kifaru 1.0.163 → 1.0.164
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/kifaru-pi.js +1097 -556
- package/package.json +2 -2
package/kifaru-pi.js
CHANGED
|
@@ -216,23 +216,23 @@ var require_auth_config = __commonJS((exports, module) => {
|
|
|
216
216
|
writeAuthConfig: () => writeAuthConfig
|
|
217
217
|
});
|
|
218
218
|
module.exports = __toCommonJS(auth_config_exports);
|
|
219
|
-
var
|
|
220
|
-
var
|
|
219
|
+
var fs2 = __toESM2(__require("fs"));
|
|
220
|
+
var path2 = __toESM2(__require("path"));
|
|
221
221
|
var import_token_util = require_token_util();
|
|
222
222
|
function getAuthConfigPath() {
|
|
223
223
|
const dataDir = (0, import_token_util.getVercelDataDir)();
|
|
224
224
|
if (!dataDir) {
|
|
225
225
|
throw new Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);
|
|
226
226
|
}
|
|
227
|
-
return
|
|
227
|
+
return path2.join(dataDir, "auth.json");
|
|
228
228
|
}
|
|
229
229
|
function readAuthConfig() {
|
|
230
230
|
try {
|
|
231
231
|
const authPath = getAuthConfigPath();
|
|
232
|
-
if (!
|
|
232
|
+
if (!fs2.existsSync(authPath)) {
|
|
233
233
|
return null;
|
|
234
234
|
}
|
|
235
|
-
const content =
|
|
235
|
+
const content = fs2.readFileSync(authPath, "utf8");
|
|
236
236
|
if (!content) {
|
|
237
237
|
return null;
|
|
238
238
|
}
|
|
@@ -243,11 +243,11 @@ var require_auth_config = __commonJS((exports, module) => {
|
|
|
243
243
|
}
|
|
244
244
|
function writeAuthConfig(config2) {
|
|
245
245
|
const authPath = getAuthConfigPath();
|
|
246
|
-
const authDir =
|
|
247
|
-
if (!
|
|
248
|
-
|
|
246
|
+
const authDir = path2.dirname(authPath);
|
|
247
|
+
if (!fs2.existsSync(authDir)) {
|
|
248
|
+
fs2.mkdirSync(authDir, { mode: 504, recursive: true });
|
|
249
249
|
}
|
|
250
|
-
|
|
250
|
+
fs2.writeFileSync(authPath, JSON.stringify(config2, null, 2), { mode: 384 });
|
|
251
251
|
}
|
|
252
252
|
function isValidAccessToken(authConfig, expirationBufferMs = 0) {
|
|
253
253
|
if (!authConfig.token)
|
|
@@ -422,8 +422,8 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
422
422
|
saveToken: () => saveToken
|
|
423
423
|
});
|
|
424
424
|
module.exports = __toCommonJS(token_util_exports);
|
|
425
|
-
var
|
|
426
|
-
var
|
|
425
|
+
var path2 = __toESM2(__require("path"));
|
|
426
|
+
var fs2 = __toESM2(__require("fs"));
|
|
427
427
|
var import_token_error = require_token_error();
|
|
428
428
|
var import_token_io = require_token_io();
|
|
429
429
|
var import_auth_config = require_auth_config();
|
|
@@ -435,7 +435,7 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
435
435
|
if (!dataDir) {
|
|
436
436
|
return null;
|
|
437
437
|
}
|
|
438
|
-
return
|
|
438
|
+
return path2.join(dataDir, vercelFolder);
|
|
439
439
|
}
|
|
440
440
|
async function getVercelToken2(options2) {
|
|
441
441
|
const authConfig = (0, import_auth_config.readAuthConfig)();
|
|
@@ -503,11 +503,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
503
503
|
if (!dir) {
|
|
504
504
|
throw new import_token_error.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");
|
|
505
505
|
}
|
|
506
|
-
const prjPath =
|
|
507
|
-
if (!
|
|
506
|
+
const prjPath = path2.join(dir, ".vercel", "project.json");
|
|
507
|
+
if (!fs2.existsSync(prjPath)) {
|
|
508
508
|
throw new import_token_error.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");
|
|
509
509
|
}
|
|
510
|
-
const prj = JSON.parse(
|
|
510
|
+
const prj = JSON.parse(fs2.readFileSync(prjPath, "utf8"));
|
|
511
511
|
if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
|
|
512
512
|
throw new TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");
|
|
513
513
|
}
|
|
@@ -518,11 +518,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
518
518
|
if (!dir) {
|
|
519
519
|
throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
|
|
520
520
|
}
|
|
521
|
-
const tokenPath =
|
|
521
|
+
const tokenPath = path2.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
522
522
|
const tokenJson = JSON.stringify(token);
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
523
|
+
fs2.mkdirSync(path2.dirname(tokenPath), { mode: 504, recursive: true });
|
|
524
|
+
fs2.writeFileSync(tokenPath, tokenJson);
|
|
525
|
+
fs2.chmodSync(tokenPath, 432);
|
|
526
526
|
return;
|
|
527
527
|
}
|
|
528
528
|
function loadToken(projectId) {
|
|
@@ -530,11 +530,11 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
530
530
|
if (!dir) {
|
|
531
531
|
throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
|
|
532
532
|
}
|
|
533
|
-
const tokenPath =
|
|
534
|
-
if (!
|
|
533
|
+
const tokenPath = path2.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
534
|
+
if (!fs2.existsSync(tokenPath)) {
|
|
535
535
|
return null;
|
|
536
536
|
}
|
|
537
|
-
const token = JSON.parse(
|
|
537
|
+
const token = JSON.parse(fs2.readFileSync(tokenPath, "utf8"));
|
|
538
538
|
assertVercelOidcTokenResponse(token);
|
|
539
539
|
return token;
|
|
540
540
|
}
|
|
@@ -2191,16 +2191,16 @@ var require_src = __commonJS((exports) => {
|
|
|
2191
2191
|
});
|
|
2192
2192
|
|
|
2193
2193
|
// ../../node_modules/.bun/xdg-basedir@5.1.0/node_modules/xdg-basedir/index.js
|
|
2194
|
-
import
|
|
2195
|
-
import
|
|
2194
|
+
import os2 from "os";
|
|
2195
|
+
import path2 from "path";
|
|
2196
2196
|
var homeDirectory, env, xdgData, xdgConfig, xdgState, xdgCache, xdgRuntime, xdgDataDirectories, xdgConfigDirectories;
|
|
2197
2197
|
var init_xdg_basedir = __esm(() => {
|
|
2198
|
-
homeDirectory =
|
|
2198
|
+
homeDirectory = os2.homedir();
|
|
2199
2199
|
({ env } = process);
|
|
2200
|
-
xdgData = env.XDG_DATA_HOME || (homeDirectory ?
|
|
2201
|
-
xdgConfig = env.XDG_CONFIG_HOME || (homeDirectory ?
|
|
2202
|
-
xdgState = env.XDG_STATE_HOME || (homeDirectory ?
|
|
2203
|
-
xdgCache = env.XDG_CACHE_HOME || (homeDirectory ?
|
|
2200
|
+
xdgData = env.XDG_DATA_HOME || (homeDirectory ? path2.join(homeDirectory, ".local", "share") : undefined);
|
|
2201
|
+
xdgConfig = env.XDG_CONFIG_HOME || (homeDirectory ? path2.join(homeDirectory, ".config") : undefined);
|
|
2202
|
+
xdgState = env.XDG_STATE_HOME || (homeDirectory ? path2.join(homeDirectory, ".local", "state") : undefined);
|
|
2203
|
+
xdgCache = env.XDG_CACHE_HOME || (homeDirectory ? path2.join(homeDirectory, ".cache") : undefined);
|
|
2204
2204
|
xdgRuntime = env.XDG_RUNTIME_DIR || undefined;
|
|
2205
2205
|
xdgDataDirectories = (env.XDG_DATA_DIRS || "/usr/local/share/:/usr/share/").split(":");
|
|
2206
2206
|
if (xdgData) {
|
|
@@ -2213,9 +2213,9 @@ var init_xdg_basedir = __esm(() => {
|
|
|
2213
2213
|
});
|
|
2214
2214
|
|
|
2215
2215
|
// ../opencode/src/global/index.ts
|
|
2216
|
-
import
|
|
2217
|
-
import
|
|
2218
|
-
import
|
|
2216
|
+
import fs2 from "fs/promises";
|
|
2217
|
+
import path3 from "path";
|
|
2218
|
+
import os3 from "os";
|
|
2219
2219
|
function sanitizePath(p) {
|
|
2220
2220
|
if (!p)
|
|
2221
2221
|
return p;
|
|
@@ -2230,31 +2230,31 @@ var isSnap, realHome, primaryApp = "kifaru", legacyApp = "opencode", isWindows,
|
|
|
2230
2230
|
var init_global = __esm(async () => {
|
|
2231
2231
|
init_xdg_basedir();
|
|
2232
2232
|
isSnap = process.env.HOME?.includes("/snap/");
|
|
2233
|
-
realHome = isSnap ? process.env.XDG_CONFIG_HOME?.replace("/.config", "") ||
|
|
2233
|
+
realHome = isSnap ? process.env.XDG_CONFIG_HOME?.replace("/.config", "") || os3.homedir() : os3.homedir();
|
|
2234
2234
|
if (isSnap) {
|
|
2235
2235
|
console.error(`[WARNING] Bun appears to be installed via Snap, which may cause file access issues.`);
|
|
2236
2236
|
console.error(`[WARNING] If you experience errors, try installing Bun natively:`);
|
|
2237
2237
|
console.error(`[WARNING] sudo snap remove bun-js && curl -fsSL https://bun.sh/install | bash`);
|
|
2238
2238
|
}
|
|
2239
|
-
isWindows =
|
|
2240
|
-
appData = sanitizePath(process.env.APPDATA) ||
|
|
2241
|
-
localAppData = sanitizePath(process.env.LOCALAPPDATA) ||
|
|
2242
|
-
xdgDataFallback = sanitizePath(xdgData) ||
|
|
2243
|
-
xdgCacheFallback = sanitizePath(xdgCache) ||
|
|
2244
|
-
xdgConfigFallback = sanitizePath(xdgConfig) ||
|
|
2245
|
-
xdgStateFallback = sanitizePath(xdgState) ||
|
|
2246
|
-
data = sanitizePath(isWindows ?
|
|
2247
|
-
cache = sanitizePath(isWindows ?
|
|
2248
|
-
config2 = sanitizePath(isWindows ?
|
|
2249
|
-
state = sanitizePath(isWindows ?
|
|
2250
|
-
legacyData = sanitizePath(isWindows ?
|
|
2251
|
-
legacyConfig = sanitizePath(isWindows ?
|
|
2239
|
+
isWindows = os3.platform() === "win32";
|
|
2240
|
+
appData = sanitizePath(process.env.APPDATA) || path3.join(os3.homedir(), "AppData", "Roaming");
|
|
2241
|
+
localAppData = sanitizePath(process.env.LOCALAPPDATA) || path3.join(os3.homedir(), "AppData", "Local");
|
|
2242
|
+
xdgDataFallback = sanitizePath(xdgData) || path3.join(realHome, ".local", "share");
|
|
2243
|
+
xdgCacheFallback = sanitizePath(xdgCache) || path3.join(realHome, ".cache");
|
|
2244
|
+
xdgConfigFallback = sanitizePath(xdgConfig) || path3.join(realHome, ".config");
|
|
2245
|
+
xdgStateFallback = sanitizePath(xdgState) || path3.join(realHome, ".local", "state");
|
|
2246
|
+
data = sanitizePath(isWindows ? path3.join(localAppData, primaryApp, "data") : path3.join(xdgDataFallback, primaryApp));
|
|
2247
|
+
cache = sanitizePath(isWindows ? path3.join(localAppData, primaryApp, "cache") : path3.join(xdgCacheFallback, primaryApp));
|
|
2248
|
+
config2 = sanitizePath(isWindows ? path3.join(appData, primaryApp, "config") : path3.join(xdgConfigFallback, primaryApp));
|
|
2249
|
+
state = sanitizePath(isWindows ? path3.join(localAppData, primaryApp, "state") : path3.join(xdgStateFallback, primaryApp));
|
|
2250
|
+
legacyData = sanitizePath(isWindows ? path3.join(localAppData, legacyApp, "data") : path3.join(xdgDataFallback, legacyApp));
|
|
2251
|
+
legacyConfig = sanitizePath(isWindows ? path3.join(appData, legacyApp, "config") : path3.join(xdgConfigFallback, legacyApp));
|
|
2252
2252
|
((Global) => {
|
|
2253
2253
|
Global.Path = {
|
|
2254
|
-
home:
|
|
2254
|
+
home: os3.homedir(),
|
|
2255
2255
|
data,
|
|
2256
|
-
bin:
|
|
2257
|
-
log:
|
|
2256
|
+
bin: path3.join(data, "bin"),
|
|
2257
|
+
log: path3.join(data, "log"),
|
|
2258
2258
|
cache,
|
|
2259
2259
|
config: config2,
|
|
2260
2260
|
state,
|
|
@@ -2274,29 +2274,29 @@ var init_global = __esm(async () => {
|
|
|
2274
2274
|
console.warn(`[WARNING] XDG environment variables contain null bytes - they have been sanitized`);
|
|
2275
2275
|
}
|
|
2276
2276
|
await Promise.all([
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2277
|
+
fs2.mkdir(Global.Path.data, { recursive: true }),
|
|
2278
|
+
fs2.mkdir(Global.Path.config, { recursive: true }),
|
|
2279
|
+
fs2.mkdir(Global.Path.state, { recursive: true }),
|
|
2280
|
+
fs2.mkdir(Global.Path.log, { recursive: true }),
|
|
2281
|
+
fs2.mkdir(Global.Path.bin, { recursive: true }),
|
|
2282
|
+
fs2.mkdir(Global.Path.cache, { recursive: true })
|
|
2283
2283
|
]).catch((err) => {
|
|
2284
2284
|
if (err.code !== "EEXIST") {
|
|
2285
2285
|
console.error(`Warning: Could not create directories: ${err.message}`);
|
|
2286
2286
|
console.error(`Try running: mkdir -p ~/.config/kifaru ~/.cache/kifaru`);
|
|
2287
2287
|
}
|
|
2288
2288
|
});
|
|
2289
|
-
version2 = await Bun.file(
|
|
2289
|
+
version2 = await Bun.file(path3.join(Global.Path.cache, "version")).text().catch(() => "0");
|
|
2290
2290
|
if (version2 !== CACHE_VERSION) {
|
|
2291
2291
|
try {
|
|
2292
|
-
const contents = await
|
|
2293
|
-
await Promise.all(contents.map((item) =>
|
|
2292
|
+
const contents = await fs2.readdir(Global.Path.cache).catch(() => []);
|
|
2293
|
+
await Promise.all(contents.map((item) => fs2.rm(path3.join(Global.Path.cache, item), {
|
|
2294
2294
|
recursive: true,
|
|
2295
2295
|
force: true
|
|
2296
2296
|
})));
|
|
2297
2297
|
} catch (e) {}
|
|
2298
|
-
await
|
|
2299
|
-
await
|
|
2298
|
+
await fs2.mkdir(Global.Path.cache, { recursive: true }).catch(() => {});
|
|
2299
|
+
await fs2.writeFile(path3.join(Global.Path.cache, "version"), CACHE_VERSION).catch((err) => {
|
|
2300
2300
|
console.warn(`Warning: Could not write cache version file: ${err.message}`);
|
|
2301
2301
|
});
|
|
2302
2302
|
}
|
|
@@ -2538,10 +2538,10 @@ function mergeDefs2(...defs) {
|
|
|
2538
2538
|
function cloneDef2(schema) {
|
|
2539
2539
|
return mergeDefs2(schema._zod.def);
|
|
2540
2540
|
}
|
|
2541
|
-
function getElementAtPath2(obj,
|
|
2542
|
-
if (!
|
|
2541
|
+
function getElementAtPath2(obj, path4) {
|
|
2542
|
+
if (!path4)
|
|
2543
2543
|
return obj;
|
|
2544
|
-
return
|
|
2544
|
+
return path4.reduce((acc, key) => acc?.[key], obj);
|
|
2545
2545
|
}
|
|
2546
2546
|
function promiseAllObject2(promisesObj) {
|
|
2547
2547
|
const keys = Object.keys(promisesObj);
|
|
@@ -2830,11 +2830,11 @@ function aborted2(x, startIndex = 0) {
|
|
|
2830
2830
|
}
|
|
2831
2831
|
return false;
|
|
2832
2832
|
}
|
|
2833
|
-
function prefixIssues2(
|
|
2833
|
+
function prefixIssues2(path4, issues) {
|
|
2834
2834
|
return issues.map((iss) => {
|
|
2835
2835
|
var _a21;
|
|
2836
2836
|
(_a21 = iss).path ?? (_a21.path = []);
|
|
2837
|
-
iss.path.unshift(
|
|
2837
|
+
iss.path.unshift(path4);
|
|
2838
2838
|
return iss;
|
|
2839
2839
|
});
|
|
2840
2840
|
}
|
|
@@ -3057,7 +3057,7 @@ function treeifyError2(error48, _mapper) {
|
|
|
3057
3057
|
return issue3.message;
|
|
3058
3058
|
};
|
|
3059
3059
|
const result = { errors: [] };
|
|
3060
|
-
const processError = (error49,
|
|
3060
|
+
const processError = (error49, path4 = []) => {
|
|
3061
3061
|
var _a21, _b16;
|
|
3062
3062
|
for (const issue3 of error49.issues) {
|
|
3063
3063
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
@@ -3067,7 +3067,7 @@ function treeifyError2(error48, _mapper) {
|
|
|
3067
3067
|
} else if (issue3.code === "invalid_element") {
|
|
3068
3068
|
processError({ issues: issue3.issues }, issue3.path);
|
|
3069
3069
|
} else {
|
|
3070
|
-
const fullpath = [...
|
|
3070
|
+
const fullpath = [...path4, ...issue3.path];
|
|
3071
3071
|
if (fullpath.length === 0) {
|
|
3072
3072
|
result.errors.push(mapper(issue3));
|
|
3073
3073
|
continue;
|
|
@@ -3099,8 +3099,8 @@ function treeifyError2(error48, _mapper) {
|
|
|
3099
3099
|
}
|
|
3100
3100
|
function toDotPath2(_path) {
|
|
3101
3101
|
const segs = [];
|
|
3102
|
-
const
|
|
3103
|
-
for (const seg of
|
|
3102
|
+
const path4 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
3103
|
+
for (const seg of path4) {
|
|
3104
3104
|
if (typeof seg === "number")
|
|
3105
3105
|
segs.push(`[${seg}]`);
|
|
3106
3106
|
else if (typeof seg === "symbol")
|
|
@@ -14952,8 +14952,8 @@ var init_zod = __esm(() => {
|
|
|
14952
14952
|
});
|
|
14953
14953
|
|
|
14954
14954
|
// ../opencode/src/auth/index.ts
|
|
14955
|
-
import
|
|
14956
|
-
import
|
|
14955
|
+
import path4 from "path";
|
|
14956
|
+
import fs3 from "fs/promises";
|
|
14957
14957
|
var Auth;
|
|
14958
14958
|
var init_auth = __esm(async () => {
|
|
14959
14959
|
init_zod();
|
|
@@ -14976,8 +14976,8 @@ var init_auth = __esm(async () => {
|
|
|
14976
14976
|
token: zod_default.string()
|
|
14977
14977
|
}).meta({ ref: "WellKnownAuth" });
|
|
14978
14978
|
Auth.Info = zod_default.discriminatedUnion("type", [Auth.Oauth, Auth.Api, Auth.WellKnown]).meta({ ref: "Auth" });
|
|
14979
|
-
const filepath =
|
|
14980
|
-
const legacyFilepath =
|
|
14979
|
+
const filepath = path4.join(Global.Path.data, "auth.json");
|
|
14980
|
+
const legacyFilepath = path4.join(Global.Path.legacyData, "auth.json");
|
|
14981
14981
|
async function getFilepath() {
|
|
14982
14982
|
const primaryExists = await Bun.file(filepath).exists();
|
|
14983
14983
|
if (primaryExists)
|
|
@@ -15005,7 +15005,7 @@ var init_auth = __esm(async () => {
|
|
|
15005
15005
|
const file3 = Bun.file(filepath);
|
|
15006
15006
|
const data2 = await all();
|
|
15007
15007
|
await Bun.write(file3, JSON.stringify({ ...data2, [key]: info }, null, 2));
|
|
15008
|
-
await
|
|
15008
|
+
await fs3.chmod(file3.name, 384);
|
|
15009
15009
|
}
|
|
15010
15010
|
Auth.set = set3;
|
|
15011
15011
|
async function remove(key) {
|
|
@@ -15021,14 +15021,14 @@ var init_auth = __esm(async () => {
|
|
|
15021
15021
|
const data2 = exists ? await file3.json().catch(() => ({})) : {};
|
|
15022
15022
|
delete data2[key];
|
|
15023
15023
|
await Bun.write(file3, JSON.stringify(data2, null, 2));
|
|
15024
|
-
await
|
|
15024
|
+
await fs3.chmod(file3.name, 384);
|
|
15025
15025
|
}
|
|
15026
15026
|
})(Auth ||= {});
|
|
15027
15027
|
});
|
|
15028
15028
|
|
|
15029
15029
|
// ../opencode/src/util/log.ts
|
|
15030
|
-
import
|
|
15031
|
-
import
|
|
15030
|
+
import path5 from "path";
|
|
15031
|
+
import fs4 from "fs/promises";
|
|
15032
15032
|
import { inspect } from "util";
|
|
15033
15033
|
var Log2;
|
|
15034
15034
|
var init_log = __esm(async () => {
|
|
@@ -15088,9 +15088,9 @@ var init_log = __esm(async () => {
|
|
|
15088
15088
|
await flushPending();
|
|
15089
15089
|
return;
|
|
15090
15090
|
}
|
|
15091
|
-
logpath =
|
|
15091
|
+
logpath = path5.join(Global.Path.log, options2.dev ? "dev.log" : new Date().toISOString().split(".")[0].replace(/:/g, "") + ".log");
|
|
15092
15092
|
const logfile = Bun.file(logpath);
|
|
15093
|
-
await
|
|
15093
|
+
await fs4.truncate(logpath).catch(() => {});
|
|
15094
15094
|
const writer = logfile.writer();
|
|
15095
15095
|
write = async (msg) => {
|
|
15096
15096
|
const num = writer.write(msg);
|
|
@@ -15109,7 +15109,7 @@ var init_log = __esm(async () => {
|
|
|
15109
15109
|
if (files.length <= 5)
|
|
15110
15110
|
return;
|
|
15111
15111
|
const filesToDelete = files.slice(0, -10);
|
|
15112
|
-
await Promise.all(filesToDelete.map((file4) =>
|
|
15112
|
+
await Promise.all(filesToDelete.map((file4) => fs4.unlink(file4).catch(() => {})));
|
|
15113
15113
|
}
|
|
15114
15114
|
function formatError3(error92, depth = 0) {
|
|
15115
15115
|
const result = error92.message;
|
|
@@ -15398,12 +15398,12 @@ var init_log = __esm(async () => {
|
|
|
15398
15398
|
});
|
|
15399
15399
|
|
|
15400
15400
|
// ../opencode/src/util/filesystem.ts
|
|
15401
|
-
import
|
|
15401
|
+
import fs5 from "fs/promises";
|
|
15402
15402
|
import { basename, dirname, isAbsolute, join, relative, resolve as resolve2 } from "path";
|
|
15403
15403
|
var Filesystem;
|
|
15404
15404
|
var init_filesystem = __esm(() => {
|
|
15405
15405
|
((Filesystem) => {
|
|
15406
|
-
const exists = (file3) =>
|
|
15406
|
+
const exists = (file3) => fs5.stat(file3).then(() => true).catch(() => false);
|
|
15407
15407
|
function overlaps(a, b) {
|
|
15408
15408
|
const relA = relative(a, b);
|
|
15409
15409
|
const relB = relative(b, a);
|
|
@@ -15421,13 +15421,13 @@ var init_filesystem = __esm(() => {
|
|
|
15421
15421
|
const suffix = [];
|
|
15422
15422
|
while (true) {
|
|
15423
15423
|
try {
|
|
15424
|
-
const real = await
|
|
15424
|
+
const real = await fs5.realpath(current);
|
|
15425
15425
|
return suffix.length > 0 ? join(real, ...suffix.reverse()) : real;
|
|
15426
15426
|
} catch {
|
|
15427
15427
|
try {
|
|
15428
|
-
const stat = await
|
|
15428
|
+
const stat = await fs5.lstat(current);
|
|
15429
15429
|
if (stat.isSymbolicLink()) {
|
|
15430
|
-
const link = await
|
|
15430
|
+
const link = await fs5.readlink(current);
|
|
15431
15431
|
const linked = resolve2(dirname(current), link);
|
|
15432
15432
|
const real = await resolveForContainment(linked);
|
|
15433
15433
|
return suffix.length > 0 ? join(real, ...suffix.reverse()) : real;
|
|
@@ -15688,8 +15688,8 @@ var init_lock = __esm(() => {
|
|
|
15688
15688
|
});
|
|
15689
15689
|
|
|
15690
15690
|
// ../opencode/src/storage/storage.ts
|
|
15691
|
-
import
|
|
15692
|
-
import
|
|
15691
|
+
import path6 from "path";
|
|
15692
|
+
import fs6 from "fs/promises";
|
|
15693
15693
|
var {$ } = globalThis.Bun;
|
|
15694
15694
|
var Storage;
|
|
15695
15695
|
var init_storage = __esm(async () => {
|
|
@@ -15702,13 +15702,13 @@ var init_storage = __esm(async () => {
|
|
|
15702
15702
|
]);
|
|
15703
15703
|
((Storage) => {
|
|
15704
15704
|
const log2 = Log2.create({ service: "storage" });
|
|
15705
|
-
const exists = (file3) =>
|
|
15705
|
+
const exists = (file3) => fs6.stat(file3).then(() => true).catch(() => false);
|
|
15706
15706
|
Storage.NotFoundError = NamedError.create("NotFoundError", zod_default.object({
|
|
15707
15707
|
message: zod_default.string()
|
|
15708
15708
|
}));
|
|
15709
15709
|
const MIGRATIONS = [
|
|
15710
15710
|
async (dir) => {
|
|
15711
|
-
const project =
|
|
15711
|
+
const project = path6.resolve(dir, "../project");
|
|
15712
15712
|
if (!await exists(project))
|
|
15713
15713
|
return;
|
|
15714
15714
|
for await (const projectDir of new Bun.Glob("*").scan({
|
|
@@ -15717,11 +15717,11 @@ var init_storage = __esm(async () => {
|
|
|
15717
15717
|
})) {
|
|
15718
15718
|
log2.info(`migrating project ${projectDir}`);
|
|
15719
15719
|
let projectID = projectDir;
|
|
15720
|
-
const fullProjectDir =
|
|
15720
|
+
const fullProjectDir = path6.join(project, projectDir);
|
|
15721
15721
|
let worktree = "/";
|
|
15722
15722
|
if (projectID !== "global") {
|
|
15723
15723
|
for await (const msgFile of new Bun.Glob("storage/session/message/*/*.json").scan({
|
|
15724
|
-
cwd:
|
|
15724
|
+
cwd: path6.join(project, projectDir),
|
|
15725
15725
|
absolute: true
|
|
15726
15726
|
})) {
|
|
15727
15727
|
const json4 = await Bun.file(msgFile).json();
|
|
@@ -15738,7 +15738,7 @@ var init_storage = __esm(async () => {
|
|
|
15738
15738
|
if (!id)
|
|
15739
15739
|
continue;
|
|
15740
15740
|
projectID = id;
|
|
15741
|
-
await Bun.write(
|
|
15741
|
+
await Bun.write(path6.join(dir, "project", projectID + ".json"), JSON.stringify({
|
|
15742
15742
|
id,
|
|
15743
15743
|
vcs: "git",
|
|
15744
15744
|
worktree,
|
|
@@ -15752,7 +15752,7 @@ var init_storage = __esm(async () => {
|
|
|
15752
15752
|
cwd: fullProjectDir,
|
|
15753
15753
|
absolute: true
|
|
15754
15754
|
})) {
|
|
15755
|
-
const dest =
|
|
15755
|
+
const dest = path6.join(dir, "session", projectID, path6.basename(sessionFile));
|
|
15756
15756
|
log2.info("copying", {
|
|
15757
15757
|
sessionFile,
|
|
15758
15758
|
dest
|
|
@@ -15764,7 +15764,7 @@ var init_storage = __esm(async () => {
|
|
|
15764
15764
|
cwd: fullProjectDir,
|
|
15765
15765
|
absolute: true
|
|
15766
15766
|
})) {
|
|
15767
|
-
const dest2 =
|
|
15767
|
+
const dest2 = path6.join(dir, "message", session.id, path6.basename(msgFile));
|
|
15768
15768
|
log2.info("copying", {
|
|
15769
15769
|
msgFile,
|
|
15770
15770
|
dest: dest2
|
|
@@ -15776,7 +15776,7 @@ var init_storage = __esm(async () => {
|
|
|
15776
15776
|
cwd: fullProjectDir,
|
|
15777
15777
|
absolute: true
|
|
15778
15778
|
})) {
|
|
15779
|
-
const dest3 =
|
|
15779
|
+
const dest3 = path6.join(dir, "part", message.id, path6.basename(partFile));
|
|
15780
15780
|
const part = await Bun.file(partFile).json();
|
|
15781
15781
|
log2.info("copying", {
|
|
15782
15782
|
partFile,
|
|
@@ -15800,8 +15800,8 @@ var init_storage = __esm(async () => {
|
|
|
15800
15800
|
if (!session.summary?.diffs)
|
|
15801
15801
|
continue;
|
|
15802
15802
|
const { diffs } = session.summary;
|
|
15803
|
-
await Bun.file(
|
|
15804
|
-
await Bun.file(
|
|
15803
|
+
await Bun.file(path6.join(dir, "session_diff", session.id + ".json")).write(JSON.stringify(diffs));
|
|
15804
|
+
await Bun.file(path6.join(dir, "session", session.projectID, session.id + ".json")).write(JSON.stringify({
|
|
15805
15805
|
...session,
|
|
15806
15806
|
summary: {
|
|
15807
15807
|
additions: diffs.reduce((sum, x) => sum + x.additions, 0),
|
|
@@ -15812,14 +15812,14 @@ var init_storage = __esm(async () => {
|
|
|
15812
15812
|
}
|
|
15813
15813
|
];
|
|
15814
15814
|
const state2 = lazy3(async () => {
|
|
15815
|
-
const dir =
|
|
15816
|
-
await
|
|
15817
|
-
const migration = await Bun.file(
|
|
15815
|
+
const dir = path6.join(Global.Path.data, "storage");
|
|
15816
|
+
await fs6.mkdir(dir, { recursive: true });
|
|
15817
|
+
const migration = await Bun.file(path6.join(dir, "migration")).json().then((x) => parseInt(x)).catch(() => 0);
|
|
15818
15818
|
for (let index = migration;index < MIGRATIONS.length; index++) {
|
|
15819
15819
|
log2.info("running migration", { index });
|
|
15820
15820
|
const migration2 = MIGRATIONS[index];
|
|
15821
15821
|
await migration2(dir).catch(() => log2.error("failed to run migration", { index }));
|
|
15822
|
-
await Bun.write(
|
|
15822
|
+
await Bun.write(path6.join(dir, "migration"), (index + 1).toString());
|
|
15823
15823
|
}
|
|
15824
15824
|
return {
|
|
15825
15825
|
dir
|
|
@@ -15827,9 +15827,9 @@ var init_storage = __esm(async () => {
|
|
|
15827
15827
|
});
|
|
15828
15828
|
async function remove(key) {
|
|
15829
15829
|
const dir = await state2().then((x) => x.dir);
|
|
15830
|
-
const target =
|
|
15830
|
+
const target = path6.join(dir, ...key) + ".json";
|
|
15831
15831
|
return withErrorHandling(async () => {
|
|
15832
|
-
await
|
|
15832
|
+
await fs6.unlink(target).catch(() => {});
|
|
15833
15833
|
});
|
|
15834
15834
|
}
|
|
15835
15835
|
Storage.remove = remove;
|
|
@@ -15839,7 +15839,7 @@ var init_storage = __esm(async () => {
|
|
|
15839
15839
|
Storage.delete_ = delete_;
|
|
15840
15840
|
async function read(key) {
|
|
15841
15841
|
const dir = await state2().then((x) => x.dir);
|
|
15842
|
-
const target =
|
|
15842
|
+
const target = path6.join(dir, ...key) + ".json";
|
|
15843
15843
|
return withErrorHandling(async () => {
|
|
15844
15844
|
using _ = await Lock.read(target);
|
|
15845
15845
|
const result = await Bun.file(target).json();
|
|
@@ -15849,9 +15849,9 @@ var init_storage = __esm(async () => {
|
|
|
15849
15849
|
Storage.read = read;
|
|
15850
15850
|
async function update(key, fn) {
|
|
15851
15851
|
const dir = await state2().then((x) => x.dir);
|
|
15852
|
-
const target =
|
|
15852
|
+
const target = path6.join(dir, ...key) + ".json";
|
|
15853
15853
|
return withErrorHandling(async () => {
|
|
15854
|
-
await
|
|
15854
|
+
await fs6.mkdir(path6.dirname(target), { recursive: true });
|
|
15855
15855
|
using _ = await Lock.write(target);
|
|
15856
15856
|
const content = await Bun.file(target).json();
|
|
15857
15857
|
fn(content);
|
|
@@ -15862,9 +15862,9 @@ var init_storage = __esm(async () => {
|
|
|
15862
15862
|
Storage.update = update;
|
|
15863
15863
|
async function write(key, content) {
|
|
15864
15864
|
const dir = await state2().then((x) => x.dir);
|
|
15865
|
-
const target =
|
|
15865
|
+
const target = path6.join(dir, ...key) + ".json";
|
|
15866
15866
|
return withErrorHandling(async () => {
|
|
15867
|
-
await
|
|
15867
|
+
await fs6.mkdir(path6.dirname(target), { recursive: true });
|
|
15868
15868
|
using _ = await Lock.write(target);
|
|
15869
15869
|
await Bun.write(target, JSON.stringify(content, null, 2));
|
|
15870
15870
|
});
|
|
@@ -15886,9 +15886,9 @@ var init_storage = __esm(async () => {
|
|
|
15886
15886
|
const dir = await state2().then((x) => x.dir);
|
|
15887
15887
|
try {
|
|
15888
15888
|
const result = await Array.fromAsync(glob.scan({
|
|
15889
|
-
cwd:
|
|
15889
|
+
cwd: path6.join(dir, ...prefix),
|
|
15890
15890
|
onlyFiles: true
|
|
15891
|
-
})).then((results) => results.map((x) => [...prefix, ...x.slice(0, -5).split(
|
|
15891
|
+
})).then((results) => results.map((x) => [...prefix, ...x.slice(0, -5).split(path6.sep)]));
|
|
15892
15892
|
result.sort();
|
|
15893
15893
|
return result;
|
|
15894
15894
|
} catch {
|
|
@@ -15936,7 +15936,7 @@ var init_flag = __esm(() => {
|
|
|
15936
15936
|
});
|
|
15937
15937
|
|
|
15938
15938
|
// ../opencode/src/project/project.ts
|
|
15939
|
-
import
|
|
15939
|
+
import path7 from "path";
|
|
15940
15940
|
var {$: $2 } = globalThis.Bun;
|
|
15941
15941
|
var Project;
|
|
15942
15942
|
var init_project = __esm(async () => {
|
|
@@ -15977,15 +15977,15 @@ var init_project = __esm(async () => {
|
|
|
15977
15977
|
await Storage.write(["project", "global"], project2);
|
|
15978
15978
|
return project2;
|
|
15979
15979
|
}
|
|
15980
|
-
let worktree =
|
|
15980
|
+
let worktree = path7.dirname(git);
|
|
15981
15981
|
const timer = log2.time("git.rev-parse");
|
|
15982
|
-
let id = await Bun.file(
|
|
15982
|
+
let id = await Bun.file(path7.join(git, "opencode")).text().then((x) => x.trim()).catch(() => {});
|
|
15983
15983
|
if (!id) {
|
|
15984
15984
|
const roots = await $2`git rev-list --max-parents=0 --all`.quiet().nothrow().cwd(worktree).text().then((x) => x.split(`
|
|
15985
15985
|
`).filter(Boolean).map((x2) => x2.trim()).toSorted());
|
|
15986
15986
|
id = roots[0];
|
|
15987
15987
|
if (id)
|
|
15988
|
-
Bun.file(
|
|
15988
|
+
Bun.file(path7.join(git, "opencode")).write(id);
|
|
15989
15989
|
}
|
|
15990
15990
|
timer.stop();
|
|
15991
15991
|
if (!id) {
|
|
@@ -16308,7 +16308,7 @@ var init_bus = __esm(async () => {
|
|
|
16308
16308
|
});
|
|
16309
16309
|
|
|
16310
16310
|
// ../opencode/src/installation/index.ts
|
|
16311
|
-
import
|
|
16311
|
+
import path8 from "path";
|
|
16312
16312
|
var {$: $3 } = globalThis.Bun;
|
|
16313
16313
|
function hasManagedInstall(output, method) {
|
|
16314
16314
|
if (method === "brew")
|
|
@@ -16361,9 +16361,9 @@ var init_installation = __esm(async () => {
|
|
|
16361
16361
|
}
|
|
16362
16362
|
Installation.isLocal = isLocal;
|
|
16363
16363
|
async function method() {
|
|
16364
|
-
if (installPaths.some((item) => process.execPath.includes(
|
|
16364
|
+
if (installPaths.some((item) => process.execPath.includes(path8.join(item, "bin"))))
|
|
16365
16365
|
return "curl";
|
|
16366
|
-
if (process.execPath.includes(
|
|
16366
|
+
if (process.execPath.includes(path8.join(".local", "bin")))
|
|
16367
16367
|
return "curl";
|
|
16368
16368
|
const exec = process.execPath.toLowerCase();
|
|
16369
16369
|
const checks5 = [
|
|
@@ -16476,7 +16476,7 @@ var init_installation = __esm(async () => {
|
|
|
16476
16476
|
});
|
|
16477
16477
|
}
|
|
16478
16478
|
Installation.upgrade = upgrade;
|
|
16479
|
-
Installation.VERSION = "1.0.
|
|
16479
|
+
Installation.VERSION = "1.0.164";
|
|
16480
16480
|
Installation.CHANNEL = typeof KIFARU_CHANNEL === "string" ? KIFARU_CHANNEL : "local";
|
|
16481
16481
|
Installation.USER_AGENT = `kifaru/${Installation.CHANNEL}/${Installation.VERSION}`;
|
|
16482
16482
|
async function latest() {
|
|
@@ -16498,7 +16498,7 @@ var init_installation = __esm(async () => {
|
|
|
16498
16498
|
});
|
|
16499
16499
|
|
|
16500
16500
|
// ../opencode/src/provider/models.ts
|
|
16501
|
-
import
|
|
16501
|
+
import path9 from "path";
|
|
16502
16502
|
var ModelsDev;
|
|
16503
16503
|
var init_models = __esm(async () => {
|
|
16504
16504
|
init_zod();
|
|
@@ -16509,7 +16509,7 @@ var init_models = __esm(async () => {
|
|
|
16509
16509
|
]);
|
|
16510
16510
|
((ModelsDev) => {
|
|
16511
16511
|
const log2 = Log2.create({ service: "models.dev" });
|
|
16512
|
-
const filepath =
|
|
16512
|
+
const filepath = path9.join(Global.Path.cache, "models.json");
|
|
16513
16513
|
let cached3;
|
|
16514
16514
|
let loading;
|
|
16515
16515
|
let timer;
|
|
@@ -16571,9 +16571,9 @@ var init_models = __esm(async () => {
|
|
|
16571
16571
|
const value = process.env.MODELS_DEV_API_JSON;
|
|
16572
16572
|
if (!value)
|
|
16573
16573
|
return;
|
|
16574
|
-
if (
|
|
16574
|
+
if (path9.isAbsolute(value))
|
|
16575
16575
|
return value;
|
|
16576
|
-
return
|
|
16576
|
+
return path9.resolve(process.cwd(), value);
|
|
16577
16577
|
}
|
|
16578
16578
|
async function readFile(file3) {
|
|
16579
16579
|
return file3.json().catch(() => {
|
|
@@ -17625,7 +17625,7 @@ var init_main = __esm(() => {
|
|
|
17625
17625
|
});
|
|
17626
17626
|
|
|
17627
17627
|
// ../opencode/src/bun/index.ts
|
|
17628
|
-
import
|
|
17628
|
+
import path10 from "path";
|
|
17629
17629
|
var {readableStreamToText } = globalThis.Bun;
|
|
17630
17630
|
import { createRequire } from "module";
|
|
17631
17631
|
var BunProc;
|
|
@@ -17679,8 +17679,8 @@ var init_bun = __esm(async () => {
|
|
|
17679
17679
|
}));
|
|
17680
17680
|
async function install(pkg, version4 = "latest") {
|
|
17681
17681
|
using _2 = await Lock.write("bun-install");
|
|
17682
|
-
const mod =
|
|
17683
|
-
const pkgjson = Bun.file(
|
|
17682
|
+
const mod = path10.join(Global.Path.cache, "node_modules", pkg);
|
|
17683
|
+
const pkgjson = Bun.file(path10.join(Global.Path.cache, "package.json"));
|
|
17684
17684
|
const parsed = await pkgjson.json().catch(async () => {
|
|
17685
17685
|
const result = { dependencies: {} };
|
|
17686
17686
|
await Bun.write(pkgjson.name, JSON.stringify(result, null, 2));
|
|
@@ -17738,20 +17738,20 @@ var init_bun = __esm(async () => {
|
|
|
17738
17738
|
const local = workspace(pkg);
|
|
17739
17739
|
if (local)
|
|
17740
17740
|
return local;
|
|
17741
|
-
const dir =
|
|
17742
|
-
const pkgjson = Bun.file(
|
|
17741
|
+
const dir = path10.join(Global.Path.cache, "node_modules", pkg);
|
|
17742
|
+
const pkgjson = Bun.file(path10.join(dir, "package.json"));
|
|
17743
17743
|
const exists = await pkgjson.exists();
|
|
17744
17744
|
if (exists)
|
|
17745
17745
|
return dir;
|
|
17746
17746
|
}
|
|
17747
17747
|
BunProc.resolve = resolve3;
|
|
17748
17748
|
function workspace(pkg) {
|
|
17749
|
-
const isBinary = !
|
|
17749
|
+
const isBinary = !path10.basename(process.execPath).startsWith("bun");
|
|
17750
17750
|
if (isBinary)
|
|
17751
17751
|
return;
|
|
17752
17752
|
try {
|
|
17753
17753
|
const target = req.resolve(`${pkg}/package.json`);
|
|
17754
|
-
return
|
|
17754
|
+
return path10.dirname(target);
|
|
17755
17755
|
} catch {
|
|
17756
17756
|
return;
|
|
17757
17757
|
}
|
|
@@ -17761,9 +17761,9 @@ var init_bun = __esm(async () => {
|
|
|
17761
17761
|
|
|
17762
17762
|
// ../opencode/src/runtime/python.ts
|
|
17763
17763
|
import { createHash } from "crypto";
|
|
17764
|
-
import
|
|
17764
|
+
import fs7 from "fs/promises";
|
|
17765
17765
|
import { accessSync, constants as fsConstants } from "fs";
|
|
17766
|
-
import
|
|
17766
|
+
import path11 from "path";
|
|
17767
17767
|
var PythonRuntime;
|
|
17768
17768
|
var init_python = __esm(async () => {
|
|
17769
17769
|
await __promiseAll([
|
|
@@ -17870,16 +17870,16 @@ var init_python = __esm(async () => {
|
|
|
17870
17870
|
return { exitCode, stdout, stderr };
|
|
17871
17871
|
},
|
|
17872
17872
|
fileExists(filepath) {
|
|
17873
|
-
return
|
|
17873
|
+
return fs7.stat(filepath).then(() => true).catch(() => false);
|
|
17874
17874
|
},
|
|
17875
17875
|
readFile(filepath) {
|
|
17876
|
-
return
|
|
17876
|
+
return fs7.readFile(filepath, "utf8");
|
|
17877
17877
|
},
|
|
17878
17878
|
writeFile(filepath, content) {
|
|
17879
|
-
return
|
|
17879
|
+
return fs7.writeFile(filepath, content);
|
|
17880
17880
|
},
|
|
17881
17881
|
mkdir(filepath) {
|
|
17882
|
-
return
|
|
17882
|
+
return fs7.mkdir(filepath, { recursive: true }).then(() => {
|
|
17883
17883
|
return;
|
|
17884
17884
|
});
|
|
17885
17885
|
},
|
|
@@ -17932,37 +17932,37 @@ var init_python = __esm(async () => {
|
|
|
17932
17932
|
}
|
|
17933
17933
|
PythonRuntime.lockHash = lockHash;
|
|
17934
17934
|
function managedRoot(dataDir = Global.Path.data) {
|
|
17935
|
-
return
|
|
17935
|
+
return path11.join(dataDir, "python");
|
|
17936
17936
|
}
|
|
17937
17937
|
PythonRuntime.managedRoot = managedRoot;
|
|
17938
17938
|
function managedVenvPath(profile, dataDir = Global.Path.data) {
|
|
17939
|
-
return
|
|
17939
|
+
return path11.join(managedRoot(dataDir), profile);
|
|
17940
17940
|
}
|
|
17941
17941
|
PythonRuntime.managedVenvPath = managedVenvPath;
|
|
17942
17942
|
function venvBinDir(venvPath, platform = process.platform) {
|
|
17943
|
-
return platform === "win32" ?
|
|
17943
|
+
return platform === "win32" ? path11.join(venvPath, "Scripts") : path11.join(venvPath, "bin");
|
|
17944
17944
|
}
|
|
17945
17945
|
PythonRuntime.venvBinDir = venvBinDir;
|
|
17946
17946
|
function venvPythonPath(venvPath, platform = process.platform) {
|
|
17947
|
-
return platform === "win32" ?
|
|
17947
|
+
return platform === "win32" ? path11.join(venvPath, "Scripts", "python.exe") : path11.join(venvPath, "bin", "python");
|
|
17948
17948
|
}
|
|
17949
17949
|
PythonRuntime.venvPythonPath = venvPythonPath;
|
|
17950
17950
|
function stampPath(profile, dataDir = Global.Path.data) {
|
|
17951
|
-
return
|
|
17951
|
+
return path11.join(managedVenvPath(profile, dataDir), ".kifaru-python.json");
|
|
17952
17952
|
}
|
|
17953
17953
|
PythonRuntime.stampPath = stampPath;
|
|
17954
17954
|
function prependPathOnce(env2, dir) {
|
|
17955
17955
|
const next = { ...env2 };
|
|
17956
|
-
const parts = (next.PATH ?? "").split(
|
|
17957
|
-
next.PATH = [dir, ...parts.filter((part) => part !== dir)].join(
|
|
17956
|
+
const parts = (next.PATH ?? "").split(path11.delimiter).filter(Boolean);
|
|
17957
|
+
next.PATH = [dir, ...parts.filter((part) => part !== dir)].join(path11.delimiter);
|
|
17958
17958
|
return next;
|
|
17959
17959
|
}
|
|
17960
17960
|
PythonRuntime.prependPathOnce = prependPathOnce;
|
|
17961
17961
|
function candidateVenvs(cwd, env2 = process.env) {
|
|
17962
17962
|
return [
|
|
17963
17963
|
{ source: "active_venv", path: env2["VIRTUAL_ENV"] },
|
|
17964
|
-
{ source: "workspace_dotvenv", path:
|
|
17965
|
-
{ source: "workspace_venv", path:
|
|
17964
|
+
{ source: "workspace_dotvenv", path: path11.join(cwd, ".venv") },
|
|
17965
|
+
{ source: "workspace_venv", path: path11.join(cwd, "venv") }
|
|
17966
17966
|
].filter((item) => Boolean(item.path));
|
|
17967
17967
|
}
|
|
17968
17968
|
PythonRuntime.candidateVenvs = candidateVenvs;
|
|
@@ -17989,11 +17989,11 @@ var init_python = __esm(async () => {
|
|
|
17989
17989
|
}
|
|
17990
17990
|
if (settings.explicitPythonBin) {
|
|
17991
17991
|
const selected = settings.explicitPythonBin;
|
|
17992
|
-
if (!
|
|
17992
|
+
if (!path11.isAbsolute(selected)) {
|
|
17993
17993
|
return {
|
|
17994
17994
|
...base,
|
|
17995
17995
|
selectedPython: selected,
|
|
17996
|
-
selectedBinDir:
|
|
17996
|
+
selectedBinDir: path11.dirname(selected),
|
|
17997
17997
|
source: "explicit",
|
|
17998
17998
|
projectVenvActive: false,
|
|
17999
17999
|
available: false,
|
|
@@ -18003,7 +18003,7 @@ var init_python = __esm(async () => {
|
|
|
18003
18003
|
return {
|
|
18004
18004
|
...base,
|
|
18005
18005
|
selectedPython: selected,
|
|
18006
|
-
selectedBinDir:
|
|
18006
|
+
selectedBinDir: path11.dirname(selected),
|
|
18007
18007
|
source: "explicit",
|
|
18008
18008
|
projectVenvActive: false,
|
|
18009
18009
|
available: await deps2.fileExists(selected)
|
|
@@ -18040,7 +18040,7 @@ var init_python = __esm(async () => {
|
|
|
18040
18040
|
return {
|
|
18041
18041
|
...base,
|
|
18042
18042
|
selectedPython: system,
|
|
18043
|
-
selectedBinDir: system ?
|
|
18043
|
+
selectedBinDir: system ? path11.dirname(system) : undefined,
|
|
18044
18044
|
source: system ? "system" : "missing",
|
|
18045
18045
|
projectVenvActive: false,
|
|
18046
18046
|
available: Boolean(system)
|
|
@@ -18060,8 +18060,8 @@ var init_python = __esm(async () => {
|
|
|
18060
18060
|
if (!dirs.includes(dir))
|
|
18061
18061
|
dirs.push(dir);
|
|
18062
18062
|
};
|
|
18063
|
-
if (settings.explicitPythonBin &&
|
|
18064
|
-
add(
|
|
18063
|
+
if (settings.explicitPythonBin && path11.isAbsolute(settings.explicitPythonBin)) {
|
|
18064
|
+
add(path11.dirname(settings.explicitPythonBin));
|
|
18065
18065
|
}
|
|
18066
18066
|
for (const candidate of candidateVenvs(input.cwd, env2)) {
|
|
18067
18067
|
if (await deps2.fileExists(venvPythonPath(candidate.path, deps2.platform))) {
|
|
@@ -18249,7 +18249,7 @@ var init_python = __esm(async () => {
|
|
|
18249
18249
|
}
|
|
18250
18250
|
const installer = uv ? "uv" : "venv-pip";
|
|
18251
18251
|
try {
|
|
18252
|
-
await deps2.mkdir(
|
|
18252
|
+
await deps2.mkdir(path11.dirname(paths.venvPath));
|
|
18253
18253
|
await deps2.writeFile(paths.lockPath, requirementsLock(settings.profile));
|
|
18254
18254
|
if (uv) {
|
|
18255
18255
|
if (needsVenv) {
|
|
@@ -18349,7 +18349,7 @@ ${result.stderr}`.trim();
|
|
|
18349
18349
|
}
|
|
18350
18350
|
}
|
|
18351
18351
|
async function writeStamp(filepath, stamp, deps2) {
|
|
18352
|
-
await deps2.mkdir(
|
|
18352
|
+
await deps2.mkdir(path11.dirname(filepath));
|
|
18353
18353
|
await deps2.writeFile(filepath, JSON.stringify(stamp, null, 2) + `
|
|
18354
18354
|
`);
|
|
18355
18355
|
}
|
|
@@ -18360,7 +18360,7 @@ ${result.stderr}`.trim();
|
|
|
18360
18360
|
binDir: venvBinDir(venvPath, platform),
|
|
18361
18361
|
pythonPath: venvPythonPath(venvPath, platform),
|
|
18362
18362
|
stampPath: stampPath(profile, dataDir),
|
|
18363
|
-
lockPath:
|
|
18363
|
+
lockPath: path11.join(managedRoot(dataDir), `${profile}.requirements.lock`)
|
|
18364
18364
|
};
|
|
18365
18365
|
}
|
|
18366
18366
|
function whichInEnvironment(name21, env2, platform) {
|
|
@@ -18369,10 +18369,10 @@ ${result.stderr}`.trim();
|
|
|
18369
18369
|
if (!pathValue)
|
|
18370
18370
|
return Bun.which(name21);
|
|
18371
18371
|
const extensions = platform === "win32" ? (env2.PATHEXT ?? ".EXE;.CMD;.BAT;.COM").split(";").filter(Boolean) : [""];
|
|
18372
|
-
const hasExtension = platform === "win32" &&
|
|
18372
|
+
const hasExtension = platform === "win32" && path11.win32.extname(name21).length > 0;
|
|
18373
18373
|
for (const dir of pathValue.split(separator).filter(Boolean)) {
|
|
18374
18374
|
for (const extension of hasExtension ? [""] : extensions) {
|
|
18375
|
-
const candidate = platform === "win32" ?
|
|
18375
|
+
const candidate = platform === "win32" ? path11.win32.join(dir, name21 + extension.toLowerCase()) : path11.join(dir, name21);
|
|
18376
18376
|
try {
|
|
18377
18377
|
accessSync(candidate, fsConstants.X_OK);
|
|
18378
18378
|
return candidate;
|
|
@@ -18402,10 +18402,10 @@ ${result.stderr}`.trim();
|
|
|
18402
18402
|
|
|
18403
18403
|
// ../opencode/src/lsp/server.ts
|
|
18404
18404
|
import { spawn } from "child_process";
|
|
18405
|
-
import
|
|
18406
|
-
import
|
|
18405
|
+
import path12 from "path";
|
|
18406
|
+
import os4 from "os";
|
|
18407
18407
|
var {$: $5 } = globalThis.Bun;
|
|
18408
|
-
import
|
|
18408
|
+
import fs8 from "fs/promises";
|
|
18409
18409
|
var LSPServer;
|
|
18410
18410
|
var init_server = __esm(async () => {
|
|
18411
18411
|
init_filesystem();
|
|
@@ -18419,13 +18419,13 @@ var init_server = __esm(async () => {
|
|
|
18419
18419
|
]);
|
|
18420
18420
|
((LSPServer) => {
|
|
18421
18421
|
const log2 = Log2.create({ service: "lsp.server" });
|
|
18422
|
-
const exists = (file3) =>
|
|
18422
|
+
const exists = (file3) => fs8.stat(file3).then(() => true).catch(() => false);
|
|
18423
18423
|
const NearestRoot = (includePatterns, excludePatterns) => {
|
|
18424
18424
|
return async (file3) => {
|
|
18425
18425
|
if (excludePatterns) {
|
|
18426
18426
|
const excludedFiles = Filesystem.up({
|
|
18427
18427
|
targets: excludePatterns,
|
|
18428
|
-
start:
|
|
18428
|
+
start: path12.dirname(file3),
|
|
18429
18429
|
stop: Instance.directory
|
|
18430
18430
|
});
|
|
18431
18431
|
const excluded = await excludedFiles.next();
|
|
@@ -18435,14 +18435,14 @@ var init_server = __esm(async () => {
|
|
|
18435
18435
|
}
|
|
18436
18436
|
const files = Filesystem.up({
|
|
18437
18437
|
targets: includePatterns,
|
|
18438
|
-
start:
|
|
18438
|
+
start: path12.dirname(file3),
|
|
18439
18439
|
stop: Instance.directory
|
|
18440
18440
|
});
|
|
18441
18441
|
const first = await files.next();
|
|
18442
18442
|
await files.return();
|
|
18443
18443
|
if (!first.value)
|
|
18444
18444
|
return Instance.directory;
|
|
18445
|
-
return
|
|
18445
|
+
return path12.dirname(first.value);
|
|
18446
18446
|
};
|
|
18447
18447
|
};
|
|
18448
18448
|
LSPServer.Deno = {
|
|
@@ -18450,14 +18450,14 @@ var init_server = __esm(async () => {
|
|
|
18450
18450
|
root: async (file3) => {
|
|
18451
18451
|
const files = Filesystem.up({
|
|
18452
18452
|
targets: ["deno.json", "deno.jsonc"],
|
|
18453
|
-
start:
|
|
18453
|
+
start: path12.dirname(file3),
|
|
18454
18454
|
stop: Instance.directory
|
|
18455
18455
|
});
|
|
18456
18456
|
const first = await files.next();
|
|
18457
18457
|
await files.return();
|
|
18458
18458
|
if (!first.value)
|
|
18459
18459
|
return;
|
|
18460
|
-
return
|
|
18460
|
+
return path12.dirname(first.value);
|
|
18461
18461
|
},
|
|
18462
18462
|
extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs"],
|
|
18463
18463
|
async spawn(root) {
|
|
@@ -18506,7 +18506,7 @@ var init_server = __esm(async () => {
|
|
|
18506
18506
|
let binary = Bun.which("vue-language-server");
|
|
18507
18507
|
const args = [];
|
|
18508
18508
|
if (!binary) {
|
|
18509
|
-
const js =
|
|
18509
|
+
const js = path12.join(Global.Path.bin, "node_modules", "@vue", "language-server", "bin", "vue-language-server.js");
|
|
18510
18510
|
if (!await Bun.file(js).exists()) {
|
|
18511
18511
|
if (Flag.KIFARU_DISABLE_LSP_DOWNLOAD)
|
|
18512
18512
|
return;
|
|
@@ -18547,7 +18547,7 @@ var init_server = __esm(async () => {
|
|
|
18547
18547
|
if (!eslint)
|
|
18548
18548
|
return;
|
|
18549
18549
|
log2.info("spawning eslint server");
|
|
18550
|
-
const serverPath =
|
|
18550
|
+
const serverPath = path12.join(Global.Path.bin, "vscode-eslint", "server", "out", "eslintServer.js");
|
|
18551
18551
|
if (!await Bun.file(serverPath).exists()) {
|
|
18552
18552
|
if (Flag.KIFARU_DISABLE_LSP_DOWNLOAD)
|
|
18553
18553
|
return;
|
|
@@ -18555,20 +18555,20 @@ var init_server = __esm(async () => {
|
|
|
18555
18555
|
const response = await fetch("https://github.com/microsoft/vscode-eslint/archive/refs/heads/main.zip");
|
|
18556
18556
|
if (!response.ok)
|
|
18557
18557
|
return;
|
|
18558
|
-
const zipPath =
|
|
18558
|
+
const zipPath = path12.join(Global.Path.bin, "vscode-eslint.zip");
|
|
18559
18559
|
await Bun.file(zipPath).write(response);
|
|
18560
18560
|
await $5`unzip -o -q ${zipPath}`.quiet().cwd(Global.Path.bin).nothrow();
|
|
18561
|
-
await
|
|
18562
|
-
const extractedPath =
|
|
18563
|
-
const finalPath =
|
|
18564
|
-
const stats = await
|
|
18561
|
+
await fs8.rm(zipPath, { force: true });
|
|
18562
|
+
const extractedPath = path12.join(Global.Path.bin, "vscode-eslint-main");
|
|
18563
|
+
const finalPath = path12.join(Global.Path.bin, "vscode-eslint");
|
|
18564
|
+
const stats = await fs8.stat(finalPath).catch(() => {
|
|
18565
18565
|
return;
|
|
18566
18566
|
});
|
|
18567
18567
|
if (stats) {
|
|
18568
18568
|
log2.info("removing old eslint installation", { path: finalPath });
|
|
18569
|
-
await
|
|
18569
|
+
await fs8.rm(finalPath, { force: true, recursive: true });
|
|
18570
18570
|
}
|
|
18571
|
-
await
|
|
18571
|
+
await fs8.rename(extractedPath, finalPath);
|
|
18572
18572
|
await $5`npm install`.cwd(finalPath).quiet();
|
|
18573
18573
|
await $5`npm run compile`.cwd(finalPath).quiet();
|
|
18574
18574
|
log2.info("installed VS Code ESLint server", { serverPath });
|
|
@@ -18616,7 +18616,7 @@ var init_server = __esm(async () => {
|
|
|
18616
18616
|
log2.error("Failed to install gopls");
|
|
18617
18617
|
return;
|
|
18618
18618
|
}
|
|
18619
|
-
bin =
|
|
18619
|
+
bin = path12.join(Global.Path.bin, "gopls" + (process.platform === "win32" ? ".exe" : ""));
|
|
18620
18620
|
log2.info(`installed gopls`, {
|
|
18621
18621
|
bin
|
|
18622
18622
|
});
|
|
@@ -18657,7 +18657,7 @@ var init_server = __esm(async () => {
|
|
|
18657
18657
|
log2.error("Failed to install rubocop");
|
|
18658
18658
|
return;
|
|
18659
18659
|
}
|
|
18660
|
-
bin =
|
|
18660
|
+
bin = path12.join(Global.Path.bin, "rubocop" + (process.platform === "win32" ? ".exe" : ""));
|
|
18661
18661
|
log2.info(`installed rubocop`, {
|
|
18662
18662
|
bin
|
|
18663
18663
|
});
|
|
@@ -18677,7 +18677,7 @@ var init_server = __esm(async () => {
|
|
|
18677
18677
|
let binary = Bun.which("pyright-langserver");
|
|
18678
18678
|
const args = [];
|
|
18679
18679
|
if (!binary) {
|
|
18680
|
-
const js =
|
|
18680
|
+
const js = path12.join(Global.Path.bin, "node_modules", "pyright", "dist", "pyright-langserver.js");
|
|
18681
18681
|
if (!await Bun.file(js).exists()) {
|
|
18682
18682
|
if (Flag.KIFARU_DISABLE_LSP_DOWNLOAD)
|
|
18683
18683
|
return;
|
|
@@ -18725,8 +18725,8 @@ var init_server = __esm(async () => {
|
|
|
18725
18725
|
async spawn(root) {
|
|
18726
18726
|
let binary = Bun.which("elixir-ls");
|
|
18727
18727
|
if (!binary) {
|
|
18728
|
-
const elixirLsPath =
|
|
18729
|
-
binary =
|
|
18728
|
+
const elixirLsPath = path12.join(Global.Path.bin, "elixir-ls");
|
|
18729
|
+
binary = path12.join(Global.Path.bin, "elixir-ls-master", "release", process.platform === "win32" ? "language_server.bar" : "language_server.sh");
|
|
18730
18730
|
if (!await Bun.file(binary).exists()) {
|
|
18731
18731
|
const elixir = Bun.which("elixir");
|
|
18732
18732
|
if (!elixir) {
|
|
@@ -18739,14 +18739,14 @@ var init_server = __esm(async () => {
|
|
|
18739
18739
|
const response = await fetch("https://github.com/elixir-lsp/elixir-ls/archive/refs/heads/master.zip");
|
|
18740
18740
|
if (!response.ok)
|
|
18741
18741
|
return;
|
|
18742
|
-
const zipPath =
|
|
18742
|
+
const zipPath = path12.join(Global.Path.bin, "elixir-ls.zip");
|
|
18743
18743
|
await Bun.file(zipPath).write(response);
|
|
18744
18744
|
await $5`unzip -o -q ${zipPath}`.quiet().cwd(Global.Path.bin).nothrow();
|
|
18745
|
-
await
|
|
18745
|
+
await fs8.rm(zipPath, {
|
|
18746
18746
|
force: true,
|
|
18747
18747
|
recursive: true
|
|
18748
18748
|
});
|
|
18749
|
-
await $5`mix deps.get && mix compile && mix elixir_ls.release2 -o release`.quiet().cwd(
|
|
18749
|
+
await $5`mix deps.get && mix compile && mix elixir_ls.release2 -o release`.quiet().cwd(path12.join(Global.Path.bin, "elixir-ls-master")).env({ MIX_ENV: "prod", ...process.env });
|
|
18750
18750
|
log2.info(`installed elixir-ls`, {
|
|
18751
18751
|
path: elixirLsPath
|
|
18752
18752
|
});
|
|
@@ -18824,15 +18824,15 @@ var init_server = __esm(async () => {
|
|
|
18824
18824
|
log2.error("Failed to download zls");
|
|
18825
18825
|
return;
|
|
18826
18826
|
}
|
|
18827
|
-
const tempPath =
|
|
18827
|
+
const tempPath = path12.join(Global.Path.bin, assetName);
|
|
18828
18828
|
await Bun.file(tempPath).write(downloadResponse);
|
|
18829
18829
|
if (ext === "zip") {
|
|
18830
18830
|
await $5`unzip -o -q ${tempPath}`.quiet().cwd(Global.Path.bin).nothrow();
|
|
18831
18831
|
} else {
|
|
18832
18832
|
await $5`tar -xf ${tempPath}`.cwd(Global.Path.bin).nothrow();
|
|
18833
18833
|
}
|
|
18834
|
-
await
|
|
18835
|
-
bin =
|
|
18834
|
+
await fs8.rm(tempPath, { force: true });
|
|
18835
|
+
bin = path12.join(Global.Path.bin, "zls" + (platform === "win32" ? ".exe" : ""));
|
|
18836
18836
|
if (!await Bun.file(bin).exists()) {
|
|
18837
18837
|
log2.error("Failed to extract zls binary");
|
|
18838
18838
|
return;
|
|
@@ -18876,7 +18876,7 @@ var init_server = __esm(async () => {
|
|
|
18876
18876
|
log2.error("Failed to install csharp-ls");
|
|
18877
18877
|
return;
|
|
18878
18878
|
}
|
|
18879
|
-
bin =
|
|
18879
|
+
bin = path12.join(Global.Path.bin, "csharp-ls" + (process.platform === "win32" ? ".exe" : ""));
|
|
18880
18880
|
log2.info(`installed csharp-ls`, { bin });
|
|
18881
18881
|
}
|
|
18882
18882
|
return {
|
|
@@ -18920,15 +18920,15 @@ var init_server = __esm(async () => {
|
|
|
18920
18920
|
return;
|
|
18921
18921
|
}
|
|
18922
18922
|
let currentDir = crateRoot;
|
|
18923
|
-
while (currentDir !==
|
|
18924
|
-
const cargoTomlPath =
|
|
18923
|
+
while (currentDir !== path12.dirname(currentDir)) {
|
|
18924
|
+
const cargoTomlPath = path12.join(currentDir, "Cargo.toml");
|
|
18925
18925
|
try {
|
|
18926
18926
|
const cargoTomlContent = await Bun.file(cargoTomlPath).text();
|
|
18927
18927
|
if (cargoTomlContent.includes("[workspace]")) {
|
|
18928
18928
|
return currentDir;
|
|
18929
18929
|
}
|
|
18930
18930
|
} catch (err) {}
|
|
18931
|
-
const parentDir =
|
|
18931
|
+
const parentDir = path12.dirname(currentDir);
|
|
18932
18932
|
if (parentDir === currentDir)
|
|
18933
18933
|
break;
|
|
18934
18934
|
currentDir = parentDir;
|
|
@@ -18966,7 +18966,7 @@ var init_server = __esm(async () => {
|
|
|
18966
18966
|
};
|
|
18967
18967
|
}
|
|
18968
18968
|
const ext = process.platform === "win32" ? ".exe" : "";
|
|
18969
|
-
const direct =
|
|
18969
|
+
const direct = path12.join(Global.Path.bin, "clangd" + ext);
|
|
18970
18970
|
if (await Bun.file(direct).exists()) {
|
|
18971
18971
|
return {
|
|
18972
18972
|
process: spawn(direct, args, {
|
|
@@ -18974,13 +18974,13 @@ var init_server = __esm(async () => {
|
|
|
18974
18974
|
})
|
|
18975
18975
|
};
|
|
18976
18976
|
}
|
|
18977
|
-
const entries = await
|
|
18977
|
+
const entries = await fs8.readdir(Global.Path.bin, { withFileTypes: true }).catch(() => []);
|
|
18978
18978
|
for (const entry of entries) {
|
|
18979
18979
|
if (!entry.isDirectory())
|
|
18980
18980
|
continue;
|
|
18981
18981
|
if (!entry.name.startsWith("clangd_"))
|
|
18982
18982
|
continue;
|
|
18983
|
-
const candidate =
|
|
18983
|
+
const candidate = path12.join(Global.Path.bin, entry.name, "bin", "clangd" + ext);
|
|
18984
18984
|
if (await Bun.file(candidate).exists()) {
|
|
18985
18985
|
return {
|
|
18986
18986
|
process: spawn(candidate, args, {
|
|
@@ -19035,7 +19035,7 @@ var init_server = __esm(async () => {
|
|
|
19035
19035
|
log2.error("Failed to download clangd");
|
|
19036
19036
|
return;
|
|
19037
19037
|
}
|
|
19038
|
-
const archive =
|
|
19038
|
+
const archive = path12.join(Global.Path.bin, name21);
|
|
19039
19039
|
const buf = await downloadResponse.arrayBuffer();
|
|
19040
19040
|
if (buf.byteLength === 0) {
|
|
19041
19041
|
log2.error("Failed to write clangd archive");
|
|
@@ -19054,8 +19054,8 @@ var init_server = __esm(async () => {
|
|
|
19054
19054
|
if (tar) {
|
|
19055
19055
|
await $5`tar -xf ${archive}`.cwd(Global.Path.bin).nothrow();
|
|
19056
19056
|
}
|
|
19057
|
-
await
|
|
19058
|
-
const bin =
|
|
19057
|
+
await fs8.rm(archive, { force: true });
|
|
19058
|
+
const bin = path12.join(Global.Path.bin, "clangd_" + tag, "bin", "clangd" + ext);
|
|
19059
19059
|
if (!await Bun.file(bin).exists()) {
|
|
19060
19060
|
log2.error("Failed to extract clangd binary");
|
|
19061
19061
|
return;
|
|
@@ -19063,8 +19063,8 @@ var init_server = __esm(async () => {
|
|
|
19063
19063
|
if (platform !== "win32") {
|
|
19064
19064
|
await $5`chmod +x ${bin}`.nothrow();
|
|
19065
19065
|
}
|
|
19066
|
-
await
|
|
19067
|
-
await
|
|
19066
|
+
await fs8.unlink(path12.join(Global.Path.bin, "clangd")).catch(() => {});
|
|
19067
|
+
await fs8.symlink(bin, path12.join(Global.Path.bin, "clangd")).catch(() => {});
|
|
19068
19068
|
log2.info(`installed clangd`, { bin });
|
|
19069
19069
|
return {
|
|
19070
19070
|
process: spawn(bin, args, {
|
|
@@ -19081,7 +19081,7 @@ var init_server = __esm(async () => {
|
|
|
19081
19081
|
let binary = Bun.which("svelteserver");
|
|
19082
19082
|
const args = [];
|
|
19083
19083
|
if (!binary) {
|
|
19084
|
-
const js =
|
|
19084
|
+
const js = path12.join(Global.Path.bin, "node_modules", "svelte-language-server", "bin", "server.js");
|
|
19085
19085
|
if (!await Bun.file(js).exists()) {
|
|
19086
19086
|
if (Flag.KIFARU_DISABLE_LSP_DOWNLOAD)
|
|
19087
19087
|
return;
|
|
@@ -19123,11 +19123,11 @@ var init_server = __esm(async () => {
|
|
|
19123
19123
|
log2.info("typescript not found, required for Astro language server");
|
|
19124
19124
|
return;
|
|
19125
19125
|
}
|
|
19126
|
-
const tsdk =
|
|
19126
|
+
const tsdk = path12.dirname(tsserver);
|
|
19127
19127
|
let binary = Bun.which("astro-ls");
|
|
19128
19128
|
const args = [];
|
|
19129
19129
|
if (!binary) {
|
|
19130
|
-
const js =
|
|
19130
|
+
const js = path12.join(Global.Path.bin, "node_modules", "@astrojs", "language-server", "bin", "nodeServer.js");
|
|
19131
19131
|
if (!await Bun.file(js).exists()) {
|
|
19132
19132
|
if (Flag.KIFARU_DISABLE_LSP_DOWNLOAD)
|
|
19133
19133
|
return;
|
|
@@ -19181,27 +19181,27 @@ var init_server = __esm(async () => {
|
|
|
19181
19181
|
log2.error("JDTLS requires at least Java 21.");
|
|
19182
19182
|
return;
|
|
19183
19183
|
}
|
|
19184
|
-
const distPath =
|
|
19185
|
-
const launcherDir =
|
|
19184
|
+
const distPath = path12.join(Global.Path.bin, "jdtls");
|
|
19185
|
+
const launcherDir = path12.join(distPath, "plugins");
|
|
19186
19186
|
const installed = await exists(launcherDir);
|
|
19187
19187
|
if (!installed) {
|
|
19188
19188
|
if (Flag.KIFARU_DISABLE_LSP_DOWNLOAD)
|
|
19189
19189
|
return;
|
|
19190
19190
|
log2.info("Downloading JDTLS LSP server.");
|
|
19191
|
-
await
|
|
19191
|
+
await fs8.mkdir(distPath, { recursive: true });
|
|
19192
19192
|
const releaseURL = "https://www.eclipse.org/downloads/download.php?file=/jdtls/snapshots/jdt-language-server-latest.tar.gz";
|
|
19193
|
-
const archivePath =
|
|
19193
|
+
const archivePath = path12.join(distPath, "release.tar.gz");
|
|
19194
19194
|
await $5`curl -L -o '${archivePath}' '${releaseURL}'`.quiet().nothrow();
|
|
19195
19195
|
await $5`tar -xzf ${archivePath}`.cwd(distPath).quiet().nothrow();
|
|
19196
|
-
await
|
|
19196
|
+
await fs8.rm(archivePath, { force: true });
|
|
19197
19197
|
}
|
|
19198
19198
|
const jarFileName = await $5`ls org.eclipse.equinox.launcher_*.jar`.cwd(launcherDir).quiet().nothrow().then(({ stdout }) => stdout.toString().trim());
|
|
19199
|
-
const launcherJar =
|
|
19199
|
+
const launcherJar = path12.join(launcherDir, jarFileName);
|
|
19200
19200
|
if (!await exists(launcherJar)) {
|
|
19201
19201
|
log2.error(`Failed to locate the JDTLS launcher module in the installed directory: ${distPath}.`);
|
|
19202
19202
|
return;
|
|
19203
19203
|
}
|
|
19204
|
-
const configFile =
|
|
19204
|
+
const configFile = path12.join(distPath, (() => {
|
|
19205
19205
|
switch (process.platform) {
|
|
19206
19206
|
case "darwin":
|
|
19207
19207
|
return "config_mac";
|
|
@@ -19213,7 +19213,7 @@ var init_server = __esm(async () => {
|
|
|
19213
19213
|
return "config_linux";
|
|
19214
19214
|
}
|
|
19215
19215
|
})());
|
|
19216
|
-
const dataDir = await
|
|
19216
|
+
const dataDir = await fs8.mkdtemp(path12.join(os4.tmpdir(), "opencode-jdtls-data"));
|
|
19217
19217
|
return {
|
|
19218
19218
|
process: spawn(java, [
|
|
19219
19219
|
"-jar",
|
|
@@ -19243,7 +19243,7 @@ var init_server = __esm(async () => {
|
|
|
19243
19243
|
let binary = Bun.which("yaml-language-server");
|
|
19244
19244
|
const args = [];
|
|
19245
19245
|
if (!binary) {
|
|
19246
|
-
const js =
|
|
19246
|
+
const js = path12.join(Global.Path.bin, "node_modules", "yaml-language-server", "out", "server", "src", "server.js");
|
|
19247
19247
|
const exists2 = await Bun.file(js).exists();
|
|
19248
19248
|
if (!exists2) {
|
|
19249
19249
|
if (Flag.KIFARU_DISABLE_LSP_DOWNLOAD)
|
|
@@ -19344,16 +19344,16 @@ var init_server = __esm(async () => {
|
|
|
19344
19344
|
log2.error("Failed to download lua-language-server");
|
|
19345
19345
|
return;
|
|
19346
19346
|
}
|
|
19347
|
-
const tempPath =
|
|
19347
|
+
const tempPath = path12.join(Global.Path.bin, assetName);
|
|
19348
19348
|
await Bun.file(tempPath).write(downloadResponse);
|
|
19349
|
-
const installDir =
|
|
19350
|
-
const stats = await
|
|
19349
|
+
const installDir = path12.join(Global.Path.bin, `lua-language-server-${lualsArch}-${lualsPlatform}`);
|
|
19350
|
+
const stats = await fs8.stat(installDir).catch(() => {
|
|
19351
19351
|
return;
|
|
19352
19352
|
});
|
|
19353
19353
|
if (stats) {
|
|
19354
|
-
await
|
|
19354
|
+
await fs8.rm(installDir, { force: true, recursive: true });
|
|
19355
19355
|
}
|
|
19356
|
-
await
|
|
19356
|
+
await fs8.mkdir(installDir, { recursive: true });
|
|
19357
19357
|
if (ext === "zip") {
|
|
19358
19358
|
const ok = await $5`unzip -o -q ${tempPath} -d ${installDir}`.quiet().catch((error92) => {
|
|
19359
19359
|
log2.error("Failed to extract lua-language-server archive", { error: error92 });
|
|
@@ -19367,8 +19367,8 @@ var init_server = __esm(async () => {
|
|
|
19367
19367
|
if (!ok)
|
|
19368
19368
|
return;
|
|
19369
19369
|
}
|
|
19370
|
-
await
|
|
19371
|
-
bin =
|
|
19370
|
+
await fs8.rm(tempPath, { force: true });
|
|
19371
|
+
bin = path12.join(installDir, "bin", "lua-language-server" + (platform === "win32" ? ".exe" : ""));
|
|
19372
19372
|
if (!await Bun.file(bin).exists()) {
|
|
19373
19373
|
log2.error("Failed to extract lua-language-server binary");
|
|
19374
19374
|
return;
|
|
@@ -19399,7 +19399,7 @@ var init_server = __esm(async () => {
|
|
|
19399
19399
|
let binary = Bun.which("intelephense");
|
|
19400
19400
|
const args = [];
|
|
19401
19401
|
if (!binary) {
|
|
19402
|
-
const js =
|
|
19402
|
+
const js = path12.join(Global.Path.bin, "node_modules", "intelephense", "lib", "intelephense.js");
|
|
19403
19403
|
if (!await Bun.file(js).exists()) {
|
|
19404
19404
|
if (Flag.KIFARU_DISABLE_LSP_DOWNLOAD)
|
|
19405
19405
|
return;
|
|
@@ -22805,7 +22805,7 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
22805
22805
|
|
|
22806
22806
|
// ../../node_modules/.bun/gray-matter@4.0.3/node_modules/gray-matter/index.js
|
|
22807
22807
|
var require_gray_matter = __commonJS((exports, module) => {
|
|
22808
|
-
var
|
|
22808
|
+
var fs9 = __require("fs");
|
|
22809
22809
|
var sections = require_section_matter();
|
|
22810
22810
|
var defaults = require_defaults();
|
|
22811
22811
|
var stringify = require_stringify();
|
|
@@ -22892,7 +22892,7 @@ var require_gray_matter = __commonJS((exports, module) => {
|
|
|
22892
22892
|
return stringify(file3, data2, options2);
|
|
22893
22893
|
};
|
|
22894
22894
|
matter.read = function(filepath, options2) {
|
|
22895
|
-
const str2 =
|
|
22895
|
+
const str2 = fs9.readFileSync(filepath, "utf8");
|
|
22896
22896
|
const file3 = matter(str2, options2);
|
|
22897
22897
|
file3.path = filepath;
|
|
22898
22898
|
return file3;
|
|
@@ -22961,9 +22961,9 @@ var exports_config = {};
|
|
|
22961
22961
|
__export(exports_config, {
|
|
22962
22962
|
Config: () => Config
|
|
22963
22963
|
});
|
|
22964
|
-
import
|
|
22965
|
-
import
|
|
22966
|
-
import
|
|
22964
|
+
import path13 from "path";
|
|
22965
|
+
import os5 from "os";
|
|
22966
|
+
import fs9 from "fs/promises";
|
|
22967
22967
|
import { pathToFileURL } from "url";
|
|
22968
22968
|
import { createHash as createHash2 } from "crypto";
|
|
22969
22969
|
var Config;
|
|
@@ -23025,8 +23025,8 @@ var init_config = __esm(async () => {
|
|
|
23025
23025
|
for (const match of line.matchAll(/\{file:([^}]+)\}/g)) {
|
|
23026
23026
|
let referenced = match[1];
|
|
23027
23027
|
if (referenced.startsWith("~/"))
|
|
23028
|
-
referenced =
|
|
23029
|
-
const resolved =
|
|
23028
|
+
referenced = path13.join(os5.homedir(), referenced.slice(2));
|
|
23029
|
+
const resolved = path13.isAbsolute(referenced) ? referenced : path13.resolve(path13.dirname(filepath), referenced);
|
|
23030
23030
|
if (discovered.has(resolved))
|
|
23031
23031
|
continue;
|
|
23032
23032
|
discovered.add(resolved);
|
|
@@ -23049,12 +23049,12 @@ var init_config = __esm(async () => {
|
|
|
23049
23049
|
const pluginIssues2 = [];
|
|
23050
23050
|
const sourceFiles = new Set;
|
|
23051
23051
|
for (const filename of CONFIG_FILENAMES) {
|
|
23052
|
-
sourceFiles.add(
|
|
23053
|
-
sourceFiles.add(
|
|
23054
|
-
sourceFiles.add(
|
|
23052
|
+
sourceFiles.add(path13.join(Global.Path.config, filename));
|
|
23053
|
+
sourceFiles.add(path13.join(Instance.directory, filename));
|
|
23054
|
+
sourceFiles.add(path13.join(Instance.worktree, filename));
|
|
23055
23055
|
}
|
|
23056
|
-
sourceFiles.add(
|
|
23057
|
-
sourceFiles.add(
|
|
23056
|
+
sourceFiles.add(path13.join(Global.Path.config, "config.json"));
|
|
23057
|
+
sourceFiles.add(path13.join(Global.Path.config, "config"));
|
|
23058
23058
|
let result = await global2();
|
|
23059
23059
|
recordPluginSources(pluginSources, result, Global.Path.config);
|
|
23060
23060
|
if (Flag.KIFARU_CONFIG) {
|
|
@@ -23115,20 +23115,20 @@ var init_config = __esm(async () => {
|
|
|
23115
23115
|
log2.debug("loading config from KIFARU_CONFIG_DIR", { path: Flag.KIFARU_CONFIG_DIR });
|
|
23116
23116
|
}
|
|
23117
23117
|
const watchedDirectories = new Set(directories2);
|
|
23118
|
-
for (let current =
|
|
23119
|
-
watchedDirectories.add(
|
|
23120
|
-
watchedDirectories.add(
|
|
23121
|
-
if (samePath(current, Instance.worktree) ||
|
|
23118
|
+
for (let current = path13.resolve(Instance.directory);; current = path13.dirname(current)) {
|
|
23119
|
+
watchedDirectories.add(path13.join(current, ".kifaru"));
|
|
23120
|
+
watchedDirectories.add(path13.join(current, ".opencode"));
|
|
23121
|
+
if (samePath(current, Instance.worktree) || path13.dirname(current) === current)
|
|
23122
23122
|
break;
|
|
23123
23123
|
}
|
|
23124
23124
|
for (const directory of watchedDirectories) {
|
|
23125
23125
|
for (const filename of CONFIG_FILENAMES)
|
|
23126
|
-
sourceFiles.add(
|
|
23126
|
+
sourceFiles.add(path13.join(directory, filename));
|
|
23127
23127
|
}
|
|
23128
23128
|
const promises = [];
|
|
23129
23129
|
for (const dir of directories2) {
|
|
23130
23130
|
for (const filename of CONFIG_FILENAMES)
|
|
23131
|
-
sourceFiles.add(
|
|
23131
|
+
sourceFiles.add(path13.join(dir, filename));
|
|
23132
23132
|
if (dir.includes("\x00")) {
|
|
23133
23133
|
log2.error(`[FATAL] Null byte detected in config directory: ${JSON.stringify(dir)}`);
|
|
23134
23134
|
continue;
|
|
@@ -23137,7 +23137,7 @@ var init_config = __esm(async () => {
|
|
|
23137
23137
|
const allowPlugins = samePath(dir, Global.Path.config) || !!Flag.KIFARU_CONFIG_DIR && samePath(dir, Flag.KIFARU_CONFIG_DIR) || Flag.allowProjectPlugins();
|
|
23138
23138
|
if (dir.endsWith(".kifaru") || dir.endsWith(".opencode") || dir === Flag.KIFARU_CONFIG_DIR) {
|
|
23139
23139
|
for (const file3 of CONFIG_FILENAMES) {
|
|
23140
|
-
const filepath =
|
|
23140
|
+
const filepath = path13.join(dir, file3);
|
|
23141
23141
|
log2.debug(`loading config from ${filepath}`);
|
|
23142
23142
|
const config4 = await loadFile(filepath, allowPlugins ? undefined : {
|
|
23143
23143
|
denyPlugins: {
|
|
@@ -23185,7 +23185,7 @@ var init_config = __esm(async () => {
|
|
|
23185
23185
|
result.permission = D(result.permission ?? {}, JSON.parse(Flag.KIFARU_PERMISSION));
|
|
23186
23186
|
}
|
|
23187
23187
|
if (!result.username)
|
|
23188
|
-
result.username =
|
|
23188
|
+
result.username = os5.userInfo().username;
|
|
23189
23189
|
if (result.autoshare === true && !result.share) {
|
|
23190
23190
|
result.share = "auto";
|
|
23191
23191
|
}
|
|
@@ -23229,7 +23229,7 @@ var init_config = __esm(async () => {
|
|
|
23229
23229
|
Config.state = Instance.state(loadState);
|
|
23230
23230
|
function samePath(left, right) {
|
|
23231
23231
|
const normalize = (value) => {
|
|
23232
|
-
const resolved =
|
|
23232
|
+
const resolved = path13.resolve(value);
|
|
23233
23233
|
return process.platform === "win32" ? resolved.toLowerCase() : resolved;
|
|
23234
23234
|
};
|
|
23235
23235
|
return normalize(left) === normalize(right);
|
|
@@ -23267,12 +23267,12 @@ var init_config = __esm(async () => {
|
|
|
23267
23267
|
return;
|
|
23268
23268
|
installedDependencyDirectories.add(cleanDir);
|
|
23269
23269
|
try {
|
|
23270
|
-
await
|
|
23271
|
-
const pkg =
|
|
23270
|
+
await fs9.mkdir(cleanDir, { recursive: true }).catch(() => {});
|
|
23271
|
+
const pkg = path13.join(cleanDir, "package.json");
|
|
23272
23272
|
if (!await Bun.file(pkg).exists()) {
|
|
23273
23273
|
await Bun.write(pkg, "{}");
|
|
23274
23274
|
}
|
|
23275
|
-
const gitignore =
|
|
23275
|
+
const gitignore = path13.join(cleanDir, ".gitignore");
|
|
23276
23276
|
const hasGitIgnore = await Bun.file(gitignore).exists();
|
|
23277
23277
|
if (!hasGitIgnore)
|
|
23278
23278
|
await Bun.write(gitignore, ["node_modules", "package.json", "bun.lock", ".gitignore"].join(`
|
|
@@ -23301,7 +23301,7 @@ var init_config = __esm(async () => {
|
|
|
23301
23301
|
const index = item.indexOf(pattern);
|
|
23302
23302
|
return item.slice(index + pattern.length, -3);
|
|
23303
23303
|
}
|
|
23304
|
-
return
|
|
23304
|
+
return path13.basename(item, ".md");
|
|
23305
23305
|
})();
|
|
23306
23306
|
const config4 = {
|
|
23307
23307
|
name: name21,
|
|
@@ -23329,7 +23329,7 @@ var init_config = __esm(async () => {
|
|
|
23329
23329
|
const md = await ConfigMarkdown.parse(item);
|
|
23330
23330
|
if (!md.data)
|
|
23331
23331
|
continue;
|
|
23332
|
-
let agentName =
|
|
23332
|
+
let agentName = path13.basename(item, ".md");
|
|
23333
23333
|
const agentFolderPath = item.includes("/.opencode/agent/") ? item.split("/.opencode/agent/")[1] : item.includes("/agent/") ? item.split("/agent/")[1] : agentName + ".md";
|
|
23334
23334
|
if (agentFolderPath.includes("/")) {
|
|
23335
23335
|
const relativePath = agentFolderPath.replace(".md", "");
|
|
@@ -23363,7 +23363,7 @@ var init_config = __esm(async () => {
|
|
|
23363
23363
|
if (!md.data)
|
|
23364
23364
|
continue;
|
|
23365
23365
|
const config4 = {
|
|
23366
|
-
name:
|
|
23366
|
+
name: path13.basename(item, ".md"),
|
|
23367
23367
|
...md.data,
|
|
23368
23368
|
prompt: md.content.trim()
|
|
23369
23369
|
};
|
|
@@ -23710,8 +23710,8 @@ var init_config = __esm(async () => {
|
|
|
23710
23710
|
}
|
|
23711
23711
|
Config.global = global2;
|
|
23712
23712
|
async function loadGlobal() {
|
|
23713
|
-
let result = C({}, D(await loadFile(
|
|
23714
|
-
await import(
|
|
23713
|
+
let result = C({}, D(await loadFile(path13.join(Global.Path.config, "config.json"))), D(await loadFile(path13.join(Global.Path.config, "opencode.json"))), D(await loadFile(path13.join(Global.Path.config, "opencode.jsonc"))));
|
|
23714
|
+
await import(path13.join(Global.Path.config, "config"), {
|
|
23715
23715
|
with: {
|
|
23716
23716
|
type: "toml"
|
|
23717
23717
|
}
|
|
@@ -23721,8 +23721,8 @@ var init_config = __esm(async () => {
|
|
|
23721
23721
|
result.model = `${provider}/${model}`;
|
|
23722
23722
|
result["$schema"] = "https://github.com/Bastsec/kifaru/raw/main/kifaru.schema.json";
|
|
23723
23723
|
result = D(result, rest);
|
|
23724
|
-
await Bun.write(
|
|
23725
|
-
await
|
|
23724
|
+
await Bun.write(path13.join(Global.Path.config, "config.json"), JSON.stringify(result, null, 2));
|
|
23725
|
+
await fs9.unlink(path13.join(Global.Path.config, "config"));
|
|
23726
23726
|
}).catch(() => {});
|
|
23727
23727
|
return result;
|
|
23728
23728
|
}
|
|
@@ -23743,7 +23743,7 @@ var init_config = __esm(async () => {
|
|
|
23743
23743
|
});
|
|
23744
23744
|
const fileMatches = text2.match(/\{file:[^}]+\}/g);
|
|
23745
23745
|
if (fileMatches) {
|
|
23746
|
-
const configDir =
|
|
23746
|
+
const configDir = path13.dirname(configFilepath);
|
|
23747
23747
|
const lines = text2.split(`
|
|
23748
23748
|
`);
|
|
23749
23749
|
for (const match of fileMatches) {
|
|
@@ -23753,9 +23753,9 @@ var init_config = __esm(async () => {
|
|
|
23753
23753
|
}
|
|
23754
23754
|
let filePath = match.replace(/^\{file:/, "").replace(/\}$/, "");
|
|
23755
23755
|
if (filePath.startsWith("~/")) {
|
|
23756
|
-
filePath =
|
|
23756
|
+
filePath = path13.join(os5.homedir(), filePath.slice(2));
|
|
23757
23757
|
}
|
|
23758
|
-
const resolvedPath =
|
|
23758
|
+
const resolvedPath = path13.isAbsolute(filePath) ? filePath : path13.resolve(configDir, filePath);
|
|
23759
23759
|
const fileContent = (await Bun.file(resolvedPath).text().catch((error92) => {
|
|
23760
23760
|
const errMsg = `bad file reference: "${match}"`;
|
|
23761
23761
|
if (error92.code === "ENOENT") {
|
|
@@ -23819,7 +23819,7 @@ ${errorDetails}
|
|
|
23819
23819
|
for (let i2 = 0;i2 < data3.plugin.length; i2++) {
|
|
23820
23820
|
const plugin = data3.plugin[i2];
|
|
23821
23821
|
try {
|
|
23822
|
-
data3.plugin[i2] = pathToFileURL(Bun.resolveSync(plugin,
|
|
23822
|
+
data3.plugin[i2] = pathToFileURL(Bun.resolveSync(plugin, path13.dirname(configFilepath))).href;
|
|
23823
23823
|
} catch {
|
|
23824
23824
|
try {
|
|
23825
23825
|
data3.plugin[i2] = import.meta.resolve(plugin, configFilepath);
|
|
@@ -23890,7 +23890,7 @@ ${errorDetails}
|
|
|
23890
23890
|
}
|
|
23891
23891
|
Config.refreshIfChanged = refreshIfChanged;
|
|
23892
23892
|
async function update(config4) {
|
|
23893
|
-
const filepath =
|
|
23893
|
+
const filepath = path13.join(Instance.directory, "config.json");
|
|
23894
23894
|
const existing = await loadFile(filepath);
|
|
23895
23895
|
await Bun.write(filepath, JSON.stringify(D(existing, config4), null, 2));
|
|
23896
23896
|
await Instance.dispose();
|
|
@@ -50280,9 +50280,9 @@ var require_getMachineId_linux = __commonJS((exports) => {
|
|
|
50280
50280
|
var api_1 = require_src();
|
|
50281
50281
|
async function getMachineId() {
|
|
50282
50282
|
const paths = ["/etc/machine-id", "/var/lib/dbus/machine-id"];
|
|
50283
|
-
for (const
|
|
50283
|
+
for (const path17 of paths) {
|
|
50284
50284
|
try {
|
|
50285
|
-
const result = await fs_1.promises.readFile(
|
|
50285
|
+
const result = await fs_1.promises.readFile(path17, { encoding: "utf8" });
|
|
50286
50286
|
return result.trim();
|
|
50287
50287
|
} catch (e2) {
|
|
50288
50288
|
api_1.diag.debug(`error reading machine id: ${e2}`);
|
|
@@ -50466,7 +50466,7 @@ var require_ProcessDetector = __commonJS((exports) => {
|
|
|
50466
50466
|
exports.processDetector = undefined;
|
|
50467
50467
|
var api_1 = require_src();
|
|
50468
50468
|
var semconv_1 = require_semconv2();
|
|
50469
|
-
var
|
|
50469
|
+
var os8 = __require("os");
|
|
50470
50470
|
|
|
50471
50471
|
class ProcessDetector {
|
|
50472
50472
|
detect(_config) {
|
|
@@ -50487,7 +50487,7 @@ var require_ProcessDetector = __commonJS((exports) => {
|
|
|
50487
50487
|
attributes[semconv_1.ATTR_PROCESS_COMMAND] = process.argv[1];
|
|
50488
50488
|
}
|
|
50489
50489
|
try {
|
|
50490
|
-
const userInfo =
|
|
50490
|
+
const userInfo = os8.userInfo();
|
|
50491
50491
|
attributes[semconv_1.ATTR_PROCESS_OWNER] = userInfo.username;
|
|
50492
50492
|
} catch (e2) {
|
|
50493
50493
|
api_1.diag.debug(`error obtaining process owner: ${e2}`);
|
|
@@ -52980,8 +52980,8 @@ var require_shared_env_configuration = __commonJS((exports) => {
|
|
|
52980
52980
|
var require_otlp_node_http_env_configuration = __commonJS((exports) => {
|
|
52981
52981
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52982
52982
|
exports.getNodeHttpConfigurationFromEnvironment = undefined;
|
|
52983
|
-
var
|
|
52984
|
-
var
|
|
52983
|
+
var fs12 = __require("fs");
|
|
52984
|
+
var path17 = __require("path");
|
|
52985
52985
|
var core_1 = require_src3();
|
|
52986
52986
|
var api_1 = require_src();
|
|
52987
52987
|
var shared_env_configuration_1 = require_shared_env_configuration();
|
|
@@ -53006,7 +53006,7 @@ var require_otlp_node_http_env_configuration = __commonJS((exports) => {
|
|
|
53006
53006
|
return;
|
|
53007
53007
|
}
|
|
53008
53008
|
}
|
|
53009
|
-
function appendResourcePathToUrl(url3,
|
|
53009
|
+
function appendResourcePathToUrl(url3, path18) {
|
|
53010
53010
|
try {
|
|
53011
53011
|
new URL(url3);
|
|
53012
53012
|
} catch {
|
|
@@ -53016,11 +53016,11 @@ var require_otlp_node_http_env_configuration = __commonJS((exports) => {
|
|
|
53016
53016
|
if (!url3.endsWith("/")) {
|
|
53017
53017
|
url3 = url3 + "/";
|
|
53018
53018
|
}
|
|
53019
|
-
url3 +=
|
|
53019
|
+
url3 += path18;
|
|
53020
53020
|
try {
|
|
53021
53021
|
new URL(url3);
|
|
53022
53022
|
} catch {
|
|
53023
|
-
api_1.diag.warn(`Configuration: Provided URL appended with '${
|
|
53023
|
+
api_1.diag.warn(`Configuration: Provided URL appended with '${path18}' is not a valid URL, using 'undefined' instead of '${url3}'`);
|
|
53024
53024
|
return;
|
|
53025
53025
|
}
|
|
53026
53026
|
return url3;
|
|
@@ -53045,7 +53045,7 @@ var require_otlp_node_http_env_configuration = __commonJS((exports) => {
|
|
|
53045
53045
|
const filePath = signalSpecificPath ?? nonSignalSpecificPath;
|
|
53046
53046
|
if (filePath != null) {
|
|
53047
53047
|
try {
|
|
53048
|
-
return
|
|
53048
|
+
return fs12.readFileSync(path17.resolve(process.cwd(), filePath));
|
|
53049
53049
|
} catch {
|
|
53050
53050
|
api_1.diag.warn(warningMessage);
|
|
53051
53051
|
return;
|
|
@@ -57595,26 +57595,26 @@ var require_module_details_from_path = __commonJS((exports, module) => {
|
|
|
57595
57595
|
basedir += segments[i2] + sep;
|
|
57596
57596
|
}
|
|
57597
57597
|
}
|
|
57598
|
-
var
|
|
57598
|
+
var path17 = "";
|
|
57599
57599
|
var lastSegmentIndex = segments.length - 1;
|
|
57600
57600
|
for (var i22 = index + offset;i22 <= lastSegmentIndex; i22++) {
|
|
57601
57601
|
if (i22 === lastSegmentIndex) {
|
|
57602
|
-
|
|
57602
|
+
path17 += segments[i22];
|
|
57603
57603
|
} else {
|
|
57604
|
-
|
|
57604
|
+
path17 += segments[i22] + sep;
|
|
57605
57605
|
}
|
|
57606
57606
|
}
|
|
57607
57607
|
return {
|
|
57608
57608
|
name: name21,
|
|
57609
57609
|
basedir,
|
|
57610
|
-
path:
|
|
57610
|
+
path: path17
|
|
57611
57611
|
};
|
|
57612
57612
|
};
|
|
57613
57613
|
});
|
|
57614
57614
|
|
|
57615
57615
|
// ../../node_modules/.bun/require-in-the-middle@8.0.1/node_modules/require-in-the-middle/index.js
|
|
57616
57616
|
var require_require_in_the_middle = __commonJS((exports, module) => {
|
|
57617
|
-
var
|
|
57617
|
+
var path17 = __require("path");
|
|
57618
57618
|
var Module = __require("module");
|
|
57619
57619
|
var debug = require_src14()("require-in-the-middle");
|
|
57620
57620
|
var moduleDetailsFromPath = require_module_details_from_path();
|
|
@@ -57761,7 +57761,7 @@ var require_require_in_the_middle = __commonJS((exports, module) => {
|
|
|
57761
57761
|
}
|
|
57762
57762
|
moduleName = filename;
|
|
57763
57763
|
} else if (hasWhitelist === true && modules.includes(filename)) {
|
|
57764
|
-
const parsedPath =
|
|
57764
|
+
const parsedPath = path17.parse(filename);
|
|
57765
57765
|
moduleName = parsedPath.name;
|
|
57766
57766
|
basedir = parsedPath.dir;
|
|
57767
57767
|
} else {
|
|
@@ -57799,7 +57799,7 @@ var require_require_in_the_middle = __commonJS((exports, module) => {
|
|
|
57799
57799
|
}
|
|
57800
57800
|
if (res !== filename) {
|
|
57801
57801
|
if (internals === true) {
|
|
57802
|
-
moduleName = moduleName +
|
|
57802
|
+
moduleName = moduleName + path17.sep + path17.relative(basedir, filename);
|
|
57803
57803
|
debug("preparing to process require of internal file: %s", moduleName);
|
|
57804
57804
|
} else {
|
|
57805
57805
|
debug("ignoring require of non-main module file: %s", res);
|
|
@@ -57835,8 +57835,8 @@ var require_require_in_the_middle = __commonJS((exports, module) => {
|
|
|
57835
57835
|
}
|
|
57836
57836
|
};
|
|
57837
57837
|
function resolveModuleName(stat) {
|
|
57838
|
-
const normalizedPath =
|
|
57839
|
-
return
|
|
57838
|
+
const normalizedPath = path17.sep !== "/" ? stat.path.split(path17.sep).join("/") : stat.path;
|
|
57839
|
+
return path17.posix.join(stat.name, normalizedPath).replace(normalize, "");
|
|
57840
57840
|
}
|
|
57841
57841
|
});
|
|
57842
57842
|
|
|
@@ -57904,7 +57904,7 @@ var require_RequireInTheMiddleSingleton = __commonJS((exports) => {
|
|
|
57904
57904
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57905
57905
|
exports.RequireInTheMiddleSingleton = undefined;
|
|
57906
57906
|
var require_in_the_middle_1 = require_require_in_the_middle();
|
|
57907
|
-
var
|
|
57907
|
+
var path17 = __require("path");
|
|
57908
57908
|
var ModuleNameTrie_1 = require_ModuleNameTrie();
|
|
57909
57909
|
var isMocha = [
|
|
57910
57910
|
"afterEach",
|
|
@@ -57949,7 +57949,7 @@ var require_RequireInTheMiddleSingleton = __commonJS((exports) => {
|
|
|
57949
57949
|
}
|
|
57950
57950
|
exports.RequireInTheMiddleSingleton = RequireInTheMiddleSingleton;
|
|
57951
57951
|
function normalizePathSeparators(moduleNameOrPath) {
|
|
57952
|
-
return
|
|
57952
|
+
return path17.sep !== ModuleNameTrie_1.ModuleNameSeparator ? moduleNameOrPath.split(path17.sep).join(ModuleNameTrie_1.ModuleNameSeparator) : moduleNameOrPath;
|
|
57953
57953
|
}
|
|
57954
57954
|
});
|
|
57955
57955
|
|
|
@@ -58127,7 +58127,7 @@ var require_register = __commonJS((exports) => {
|
|
|
58127
58127
|
|
|
58128
58128
|
// ../../node_modules/.bun/import-in-the-middle@3.5.1/node_modules/import-in-the-middle/index.js
|
|
58129
58129
|
var require_import_in_the_middle = __commonJS((exports, module) => {
|
|
58130
|
-
var
|
|
58130
|
+
var path17 = __require("path");
|
|
58131
58131
|
var moduleDetailsFromPath = require_module_details_from_path();
|
|
58132
58132
|
var { fileURLToPath } = __require("url");
|
|
58133
58133
|
var { MessageChannel } = __require("worker_threads");
|
|
@@ -58246,7 +58246,7 @@ var require_import_in_the_middle = __commonJS((exports, module) => {
|
|
|
58246
58246
|
} else if (baseDir.endsWith(specifiers.get(loadUrl)) || isTurbopackSpecifier(specifiers.get(loadUrl), baseDir)) {
|
|
58247
58247
|
callHookFn(hookFn, namespace, name21, baseDir);
|
|
58248
58248
|
} else if (internals) {
|
|
58249
|
-
const internalPath = name21 +
|
|
58249
|
+
const internalPath = name21 + path17.sep + path17.relative(baseDir, filePath);
|
|
58250
58250
|
callHookFn(hookFn, namespace, internalPath, baseDir);
|
|
58251
58251
|
}
|
|
58252
58252
|
} else if (matchArg === specifier) {
|
|
@@ -58315,7 +58315,7 @@ var require_utils11 = __commonJS((exports) => {
|
|
|
58315
58315
|
var require_instrumentation2 = __commonJS((exports) => {
|
|
58316
58316
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58317
58317
|
exports.InstrumentationBase = undefined;
|
|
58318
|
-
var
|
|
58318
|
+
var path17 = __require("path");
|
|
58319
58319
|
var util_1 = __require("util");
|
|
58320
58320
|
var semver_1 = require_semver2();
|
|
58321
58321
|
var shimmer_1 = require_shimmer();
|
|
@@ -58416,7 +58416,7 @@ var require_instrumentation2 = __commonJS((exports) => {
|
|
|
58416
58416
|
}
|
|
58417
58417
|
_extractPackageVersion(baseDir) {
|
|
58418
58418
|
try {
|
|
58419
|
-
const json4 = (0, fs_1.readFileSync)(
|
|
58419
|
+
const json4 = (0, fs_1.readFileSync)(path17.join(baseDir, "package.json"), {
|
|
58420
58420
|
encoding: "utf8"
|
|
58421
58421
|
});
|
|
58422
58422
|
const version4 = JSON.parse(json4).version;
|
|
@@ -58458,7 +58458,7 @@ var require_instrumentation2 = __commonJS((exports) => {
|
|
|
58458
58458
|
return exports2;
|
|
58459
58459
|
}
|
|
58460
58460
|
const files = module2.files ?? [];
|
|
58461
|
-
const normalizedName =
|
|
58461
|
+
const normalizedName = path17.normalize(name21);
|
|
58462
58462
|
const supportedFileInstrumentations = files.filter((f3) => f3.name === normalizedName && isSupported(f3.supportedVersions, version4, module2.includePrerelease));
|
|
58463
58463
|
return supportedFileInstrumentations.reduce((patchedExports, file3) => {
|
|
58464
58464
|
file3.moduleExports = patchedExports;
|
|
@@ -58504,8 +58504,8 @@ var require_instrumentation2 = __commonJS((exports) => {
|
|
|
58504
58504
|
this._warnOnPreloadedModules();
|
|
58505
58505
|
for (const module2 of this._modules) {
|
|
58506
58506
|
const hookFn = (exports2, name21, baseDir) => {
|
|
58507
|
-
if (!baseDir &&
|
|
58508
|
-
const parsedPath =
|
|
58507
|
+
if (!baseDir && path17.isAbsolute(name21)) {
|
|
58508
|
+
const parsedPath = path17.parse(name21);
|
|
58509
58509
|
name21 = parsedPath.name;
|
|
58510
58510
|
baseDir = parsedPath.dir;
|
|
58511
58511
|
}
|
|
@@ -58514,7 +58514,7 @@ var require_instrumentation2 = __commonJS((exports) => {
|
|
|
58514
58514
|
const onRequire = (exports2, name21, baseDir) => {
|
|
58515
58515
|
return this._onRequire(module2, exports2, name21, baseDir);
|
|
58516
58516
|
};
|
|
58517
|
-
const hook =
|
|
58517
|
+
const hook = path17.isAbsolute(module2.name) ? new require_in_the_middle_1.Hook([module2.name], { internals: true }, onRequire) : this._requireInTheMiddleSingleton.register(module2.name, onRequire);
|
|
58518
58518
|
this._hooks.push(hook);
|
|
58519
58519
|
const esmHook = new import_in_the_middle_1.Hook([module2.name], { internals: true }, hookFn);
|
|
58520
58520
|
this._hooks.push(esmHook);
|
|
@@ -59320,14 +59320,14 @@ var require_tls_helpers = __commonJS((exports) => {
|
|
|
59320
59320
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59321
59321
|
exports.CIPHER_SUITES = undefined;
|
|
59322
59322
|
exports.getDefaultRootsData = getDefaultRootsData;
|
|
59323
|
-
var
|
|
59323
|
+
var fs12 = __require("fs");
|
|
59324
59324
|
exports.CIPHER_SUITES = process.env.GRPC_SSL_CIPHER_SUITES;
|
|
59325
59325
|
var DEFAULT_ROOTS_FILE_PATH = process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH;
|
|
59326
59326
|
var defaultRootsData = null;
|
|
59327
59327
|
function getDefaultRootsData() {
|
|
59328
59328
|
if (DEFAULT_ROOTS_FILE_PATH) {
|
|
59329
59329
|
if (defaultRootsData === null) {
|
|
59330
|
-
defaultRootsData =
|
|
59330
|
+
defaultRootsData = fs12.readFileSync(DEFAULT_ROOTS_FILE_PATH);
|
|
59331
59331
|
}
|
|
59332
59332
|
return defaultRootsData;
|
|
59333
59333
|
}
|
|
@@ -59355,19 +59355,19 @@ var require_uri_parser = __commonJS((exports) => {
|
|
|
59355
59355
|
};
|
|
59356
59356
|
}
|
|
59357
59357
|
var NUMBER_REGEX = /^\d+$/;
|
|
59358
|
-
function splitHostPort(
|
|
59359
|
-
if (
|
|
59360
|
-
const hostEnd =
|
|
59358
|
+
function splitHostPort(path17) {
|
|
59359
|
+
if (path17.startsWith("[")) {
|
|
59360
|
+
const hostEnd = path17.indexOf("]");
|
|
59361
59361
|
if (hostEnd === -1) {
|
|
59362
59362
|
return null;
|
|
59363
59363
|
}
|
|
59364
|
-
const host =
|
|
59364
|
+
const host = path17.substring(1, hostEnd);
|
|
59365
59365
|
if (host.indexOf(":") === -1) {
|
|
59366
59366
|
return null;
|
|
59367
59367
|
}
|
|
59368
|
-
if (
|
|
59369
|
-
if (
|
|
59370
|
-
const portString =
|
|
59368
|
+
if (path17.length > hostEnd + 1) {
|
|
59369
|
+
if (path17[hostEnd + 1] === ":") {
|
|
59370
|
+
const portString = path17.substring(hostEnd + 2);
|
|
59371
59371
|
if (NUMBER_REGEX.test(portString)) {
|
|
59372
59372
|
return {
|
|
59373
59373
|
host,
|
|
@@ -59385,7 +59385,7 @@ var require_uri_parser = __commonJS((exports) => {
|
|
|
59385
59385
|
};
|
|
59386
59386
|
}
|
|
59387
59387
|
} else {
|
|
59388
|
-
const splitPath =
|
|
59388
|
+
const splitPath = path17.split(":");
|
|
59389
59389
|
if (splitPath.length === 2) {
|
|
59390
59390
|
if (NUMBER_REGEX.test(splitPath[1])) {
|
|
59391
59391
|
return {
|
|
@@ -59397,7 +59397,7 @@ var require_uri_parser = __commonJS((exports) => {
|
|
|
59397
59397
|
}
|
|
59398
59398
|
} else {
|
|
59399
59399
|
return {
|
|
59400
|
-
host:
|
|
59400
|
+
host: path17
|
|
59401
59401
|
};
|
|
59402
59402
|
}
|
|
59403
59403
|
}
|
|
@@ -59938,7 +59938,7 @@ var require_service_config = __commonJS((exports) => {
|
|
|
59938
59938
|
exports.validateRetryThrottling = validateRetryThrottling;
|
|
59939
59939
|
exports.validateServiceConfig = validateServiceConfig;
|
|
59940
59940
|
exports.extractAndSelectServiceConfig = extractAndSelectServiceConfig;
|
|
59941
|
-
var
|
|
59941
|
+
var os8 = __require("os");
|
|
59942
59942
|
var constants_1 = require_constants2();
|
|
59943
59943
|
var DURATION_REGEX = /^\d+(\.\d{1,9})?s$/;
|
|
59944
59944
|
var CLIENT_LANGUAGE_STRING = "node";
|
|
@@ -60237,7 +60237,7 @@ var require_service_config = __commonJS((exports) => {
|
|
|
60237
60237
|
if (Array.isArray(validatedConfig.clientHostname)) {
|
|
60238
60238
|
let hostnameMatched = false;
|
|
60239
60239
|
for (const hostname5 of validatedConfig.clientHostname) {
|
|
60240
|
-
if (hostname5 ===
|
|
60240
|
+
if (hostname5 === os8.hostname()) {
|
|
60241
60241
|
hostnameMatched = true;
|
|
60242
60242
|
}
|
|
60243
60243
|
}
|
|
@@ -62332,14 +62332,14 @@ var require_client_interceptors = __commonJS((exports) => {
|
|
|
62332
62332
|
}
|
|
62333
62333
|
}
|
|
62334
62334
|
exports.InterceptingCall = InterceptingCall;
|
|
62335
|
-
function getCall(channel,
|
|
62335
|
+
function getCall(channel, path17, options2) {
|
|
62336
62336
|
var _a24, _b16;
|
|
62337
62337
|
const deadline = (_a24 = options2.deadline) !== null && _a24 !== undefined ? _a24 : Infinity;
|
|
62338
62338
|
const host = options2.host;
|
|
62339
62339
|
const parent = (_b16 = options2.parent) !== null && _b16 !== undefined ? _b16 : null;
|
|
62340
62340
|
const propagateFlags = options2.propagate_flags;
|
|
62341
62341
|
const credentials = options2.credentials;
|
|
62342
|
-
const call = channel.createCall(
|
|
62342
|
+
const call = channel.createCall(path17, deadline, host, parent, propagateFlags);
|
|
62343
62343
|
if (credentials) {
|
|
62344
62344
|
call.setCredentials(credentials);
|
|
62345
62345
|
}
|
|
@@ -62902,9 +62902,9 @@ var require_make_client = __commonJS((exports) => {
|
|
|
62902
62902
|
ServiceClientImpl.serviceName = serviceName;
|
|
62903
62903
|
return ServiceClientImpl;
|
|
62904
62904
|
}
|
|
62905
|
-
function partial3(fn,
|
|
62905
|
+
function partial3(fn, path17, serialize, deserialize) {
|
|
62906
62906
|
return function(...args) {
|
|
62907
|
-
return fn.call(this,
|
|
62907
|
+
return fn.call(this, path17, serialize, deserialize, ...args);
|
|
62908
62908
|
};
|
|
62909
62909
|
}
|
|
62910
62910
|
function isProtobufTypeDefinition(obj) {
|
|
@@ -63384,20 +63384,20 @@ var require_codegen = __commonJS((exports, module) => {
|
|
|
63384
63384
|
|
|
63385
63385
|
// ../../node_modules/.bun/@protobufjs+fetch@1.1.1/node_modules/@protobufjs/fetch/util/fs.js
|
|
63386
63386
|
var require_fs = __commonJS((exports, module) => {
|
|
63387
|
-
var
|
|
63387
|
+
var fs12 = null;
|
|
63388
63388
|
try {
|
|
63389
|
-
|
|
63390
|
-
if (!
|
|
63391
|
-
|
|
63389
|
+
fs12 = __require("fs");
|
|
63390
|
+
if (!fs12 || !fs12.readFile || !fs12.readFileSync)
|
|
63391
|
+
fs12 = null;
|
|
63392
63392
|
} catch (e2) {}
|
|
63393
|
-
module.exports =
|
|
63393
|
+
module.exports = fs12;
|
|
63394
63394
|
});
|
|
63395
63395
|
|
|
63396
63396
|
// ../../node_modules/.bun/@protobufjs+fetch@1.1.1/node_modules/@protobufjs/fetch/index.js
|
|
63397
63397
|
var require_fetch = __commonJS((exports, module) => {
|
|
63398
63398
|
module.exports = fetch2;
|
|
63399
63399
|
var asPromise = require_aspromise();
|
|
63400
|
-
var
|
|
63400
|
+
var fs12 = require_fs();
|
|
63401
63401
|
function fetch2(filename, options2, callback) {
|
|
63402
63402
|
if (typeof options2 === "function") {
|
|
63403
63403
|
callback = options2;
|
|
@@ -63406,8 +63406,8 @@ var require_fetch = __commonJS((exports, module) => {
|
|
|
63406
63406
|
options2 = {};
|
|
63407
63407
|
if (!callback)
|
|
63408
63408
|
return asPromise(fetch2, this, filename, options2);
|
|
63409
|
-
if (!options2.xhr &&
|
|
63410
|
-
return
|
|
63409
|
+
if (!options2.xhr && fs12 && fs12.readFile)
|
|
63410
|
+
return fs12.readFile(filename, function fetchReadFileCallback(err, contents) {
|
|
63411
63411
|
return err && typeof XMLHttpRequest !== "undefined" ? fetch2.xhr(filename, options2, callback) : err ? callback(err) : callback(null, options2.binary ? contents : contents.toString("utf8"));
|
|
63412
63412
|
});
|
|
63413
63413
|
return fetch2.xhr(filename, options2, callback);
|
|
@@ -63442,13 +63442,13 @@ var require_fetch = __commonJS((exports, module) => {
|
|
|
63442
63442
|
|
|
63443
63443
|
// ../../node_modules/.bun/@protobufjs+path@1.1.2/node_modules/@protobufjs/path/index.js
|
|
63444
63444
|
var require_path = __commonJS((exports) => {
|
|
63445
|
-
var
|
|
63446
|
-
var isAbsolute2 =
|
|
63447
|
-
return /^(?:\/|\w+:)/.test(
|
|
63445
|
+
var path17 = exports;
|
|
63446
|
+
var isAbsolute2 = path17.isAbsolute = function isAbsolute3(path18) {
|
|
63447
|
+
return /^(?:\/|\w+:)/.test(path18);
|
|
63448
63448
|
};
|
|
63449
|
-
var normalize =
|
|
63450
|
-
|
|
63451
|
-
var parts =
|
|
63449
|
+
var normalize = path17.normalize = function normalize2(path18) {
|
|
63450
|
+
path18 = path18.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
|
|
63451
|
+
var parts = path18.split("/"), absolute = isAbsolute2(path18), prefix = "";
|
|
63452
63452
|
if (absolute)
|
|
63453
63453
|
prefix = parts.shift() + "/";
|
|
63454
63454
|
for (var i2 = 0;i2 < parts.length; ) {
|
|
@@ -63466,7 +63466,7 @@ var require_path = __commonJS((exports) => {
|
|
|
63466
63466
|
}
|
|
63467
63467
|
return prefix + parts.join("/");
|
|
63468
63468
|
};
|
|
63469
|
-
|
|
63469
|
+
path17.resolve = function resolve3(originPath, includePath, alreadyNormalized) {
|
|
63470
63470
|
if (!alreadyNormalized)
|
|
63471
63471
|
includePath = normalize(includePath);
|
|
63472
63472
|
if (isAbsolute2(includePath))
|
|
@@ -63487,13 +63487,13 @@ var require_patterns = __commonJS((exports) => {
|
|
|
63487
63487
|
|
|
63488
63488
|
// ../../node_modules/.bun/protobufjs@7.6.6/node_modules/protobufjs/src/util/fs.js
|
|
63489
63489
|
var require_fs2 = __commonJS((exports, module) => {
|
|
63490
|
-
var
|
|
63490
|
+
var fs12 = null;
|
|
63491
63491
|
try {
|
|
63492
|
-
|
|
63493
|
-
if (!
|
|
63494
|
-
|
|
63492
|
+
fs12 = __require("fs");
|
|
63493
|
+
if (!fs12 || !fs12.readFile || !fs12.readFileSync)
|
|
63494
|
+
fs12 = null;
|
|
63495
63495
|
} catch (e2) {}
|
|
63496
|
-
module.exports =
|
|
63496
|
+
module.exports = fs12;
|
|
63497
63497
|
});
|
|
63498
63498
|
|
|
63499
63499
|
// ../../node_modules/.bun/protobufjs@7.6.6/node_modules/protobufjs/src/namespace.js
|
|
@@ -63634,18 +63634,18 @@ var require_namespace = __commonJS((exports, module) => {
|
|
|
63634
63634
|
object4.onRemove(this);
|
|
63635
63635
|
return clearCache(this);
|
|
63636
63636
|
};
|
|
63637
|
-
Namespace.prototype.define = function define2(
|
|
63638
|
-
if (util2.isString(
|
|
63639
|
-
|
|
63640
|
-
else if (!Array.isArray(
|
|
63637
|
+
Namespace.prototype.define = function define2(path17, json4) {
|
|
63638
|
+
if (util2.isString(path17))
|
|
63639
|
+
path17 = path17.split(".");
|
|
63640
|
+
else if (!Array.isArray(path17))
|
|
63641
63641
|
throw TypeError("illegal path");
|
|
63642
|
-
if (
|
|
63642
|
+
if (path17 && path17.length && path17[0] === "")
|
|
63643
63643
|
throw Error("path must be relative");
|
|
63644
|
-
if (
|
|
63644
|
+
if (path17.length > util2.recursionLimit)
|
|
63645
63645
|
throw Error("max depth exceeded");
|
|
63646
63646
|
var ptr = this;
|
|
63647
|
-
while (
|
|
63648
|
-
var part =
|
|
63647
|
+
while (path17.length > 0) {
|
|
63648
|
+
var part = path17.shift();
|
|
63649
63649
|
if (ptr.nested && ptr.nested[part]) {
|
|
63650
63650
|
ptr = ptr.nested[part];
|
|
63651
63651
|
if (!(ptr instanceof Namespace))
|
|
@@ -63682,26 +63682,26 @@ var require_namespace = __commonJS((exports, module) => {
|
|
|
63682
63682
|
});
|
|
63683
63683
|
return this;
|
|
63684
63684
|
};
|
|
63685
|
-
Namespace.prototype.lookup = function lookup(
|
|
63685
|
+
Namespace.prototype.lookup = function lookup(path17, filterTypes, parentAlreadyChecked) {
|
|
63686
63686
|
if (typeof filterTypes === "boolean") {
|
|
63687
63687
|
parentAlreadyChecked = filterTypes;
|
|
63688
63688
|
filterTypes = undefined;
|
|
63689
63689
|
} else if (filterTypes && !Array.isArray(filterTypes))
|
|
63690
63690
|
filterTypes = [filterTypes];
|
|
63691
|
-
if (util2.isString(
|
|
63692
|
-
if (
|
|
63691
|
+
if (util2.isString(path17) && path17.length) {
|
|
63692
|
+
if (path17 === ".")
|
|
63693
63693
|
return this.root;
|
|
63694
|
-
|
|
63695
|
-
} else if (!
|
|
63694
|
+
path17 = path17.split(".");
|
|
63695
|
+
} else if (!path17.length)
|
|
63696
63696
|
return this;
|
|
63697
|
-
var flatPath =
|
|
63698
|
-
if (
|
|
63699
|
-
return this.root.lookup(
|
|
63697
|
+
var flatPath = path17.join(".");
|
|
63698
|
+
if (path17[0] === "")
|
|
63699
|
+
return this.root.lookup(path17.slice(1), filterTypes);
|
|
63700
63700
|
var found = this.root._fullyQualifiedObjects && this.root._fullyQualifiedObjects["." + flatPath];
|
|
63701
63701
|
if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
|
|
63702
63702
|
return found;
|
|
63703
63703
|
}
|
|
63704
|
-
found = this._lookupImpl(
|
|
63704
|
+
found = this._lookupImpl(path17, flatPath);
|
|
63705
63705
|
if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
|
|
63706
63706
|
return found;
|
|
63707
63707
|
}
|
|
@@ -63709,7 +63709,7 @@ var require_namespace = __commonJS((exports, module) => {
|
|
|
63709
63709
|
return null;
|
|
63710
63710
|
var current = this;
|
|
63711
63711
|
while (current.parent) {
|
|
63712
|
-
found = current.parent._lookupImpl(
|
|
63712
|
+
found = current.parent._lookupImpl(path17, flatPath);
|
|
63713
63713
|
if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
|
|
63714
63714
|
return found;
|
|
63715
63715
|
}
|
|
@@ -63717,22 +63717,22 @@ var require_namespace = __commonJS((exports, module) => {
|
|
|
63717
63717
|
}
|
|
63718
63718
|
return null;
|
|
63719
63719
|
};
|
|
63720
|
-
Namespace.prototype._lookupImpl = function lookup(
|
|
63720
|
+
Namespace.prototype._lookupImpl = function lookup(path17, flatPath) {
|
|
63721
63721
|
if (Object.prototype.hasOwnProperty.call(this._lookupCache, flatPath)) {
|
|
63722
63722
|
return this._lookupCache[flatPath];
|
|
63723
63723
|
}
|
|
63724
|
-
var found = this.get(
|
|
63724
|
+
var found = this.get(path17[0]);
|
|
63725
63725
|
var exact = null;
|
|
63726
63726
|
if (found) {
|
|
63727
|
-
if (
|
|
63727
|
+
if (path17.length === 1) {
|
|
63728
63728
|
exact = found;
|
|
63729
63729
|
} else if (found instanceof Namespace) {
|
|
63730
|
-
|
|
63731
|
-
exact = found._lookupImpl(
|
|
63730
|
+
path17 = path17.slice(1);
|
|
63731
|
+
exact = found._lookupImpl(path17, path17.join("."));
|
|
63732
63732
|
}
|
|
63733
63733
|
} else {
|
|
63734
63734
|
for (var i2 = 0;i2 < this.nestedArray.length; ++i2)
|
|
63735
|
-
if (this._nestedArray[i2] instanceof Namespace && (found = this._nestedArray[i2]._lookupImpl(
|
|
63735
|
+
if (this._nestedArray[i2] instanceof Namespace && (found = this._nestedArray[i2]._lookupImpl(path17, flatPath))) {
|
|
63736
63736
|
exact = found;
|
|
63737
63737
|
break;
|
|
63738
63738
|
}
|
|
@@ -63740,28 +63740,28 @@ var require_namespace = __commonJS((exports, module) => {
|
|
|
63740
63740
|
this._lookupCache[flatPath] = exact;
|
|
63741
63741
|
return exact;
|
|
63742
63742
|
};
|
|
63743
|
-
Namespace.prototype.lookupType = function lookupType(
|
|
63744
|
-
var found = this.lookup(
|
|
63743
|
+
Namespace.prototype.lookupType = function lookupType(path17) {
|
|
63744
|
+
var found = this.lookup(path17, [Type4]);
|
|
63745
63745
|
if (!found)
|
|
63746
|
-
throw Error("no such type: " +
|
|
63746
|
+
throw Error("no such type: " + path17);
|
|
63747
63747
|
return found;
|
|
63748
63748
|
};
|
|
63749
|
-
Namespace.prototype.lookupEnum = function lookupEnum(
|
|
63750
|
-
var found = this.lookup(
|
|
63749
|
+
Namespace.prototype.lookupEnum = function lookupEnum(path17) {
|
|
63750
|
+
var found = this.lookup(path17, [Enum]);
|
|
63751
63751
|
if (!found)
|
|
63752
|
-
throw Error("no such Enum '" +
|
|
63752
|
+
throw Error("no such Enum '" + path17 + "' in " + this);
|
|
63753
63753
|
return found;
|
|
63754
63754
|
};
|
|
63755
|
-
Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(
|
|
63756
|
-
var found = this.lookup(
|
|
63755
|
+
Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path17) {
|
|
63756
|
+
var found = this.lookup(path17, [Type4, Enum]);
|
|
63757
63757
|
if (!found)
|
|
63758
|
-
throw Error("no such Type or Enum '" +
|
|
63758
|
+
throw Error("no such Type or Enum '" + path17 + "' in " + this);
|
|
63759
63759
|
return found;
|
|
63760
63760
|
};
|
|
63761
|
-
Namespace.prototype.lookupService = function lookupService(
|
|
63762
|
-
var found = this.lookup(
|
|
63761
|
+
Namespace.prototype.lookupService = function lookupService(path17) {
|
|
63762
|
+
var found = this.lookup(path17, [Service]);
|
|
63763
63763
|
if (!found)
|
|
63764
|
-
throw Error("no such Service '" +
|
|
63764
|
+
throw Error("no such Service '" + path17 + "' in " + this);
|
|
63765
63765
|
return found;
|
|
63766
63766
|
};
|
|
63767
63767
|
Namespace._configure = function(Type_, Service_, Enum_) {
|
|
@@ -65094,13 +65094,13 @@ var require_util3 = __commonJS((exports, module) => {
|
|
|
65094
65094
|
Object.defineProperty(object4, "$type", { value: enm, enumerable: false });
|
|
65095
65095
|
return enm;
|
|
65096
65096
|
};
|
|
65097
|
-
util2.setProperty = function setProperty2(dst,
|
|
65098
|
-
function setProp(dst2,
|
|
65099
|
-
var part =
|
|
65097
|
+
util2.setProperty = function setProperty2(dst, path17, value, ifNotSet) {
|
|
65098
|
+
function setProp(dst2, path18, value2) {
|
|
65099
|
+
var part = path18.shift();
|
|
65100
65100
|
if (util2.isUnsafeProperty(part))
|
|
65101
65101
|
return dst2;
|
|
65102
|
-
if (
|
|
65103
|
-
dst2[part] = setProp(dst2[part] || {},
|
|
65102
|
+
if (path18.length > 0) {
|
|
65103
|
+
dst2[part] = setProp(dst2[part] || {}, path18, value2);
|
|
65104
65104
|
} else {
|
|
65105
65105
|
var prevValue = dst2[part];
|
|
65106
65106
|
if (prevValue && ifNotSet)
|
|
@@ -65113,12 +65113,12 @@ var require_util3 = __commonJS((exports, module) => {
|
|
|
65113
65113
|
}
|
|
65114
65114
|
if (typeof dst !== "object")
|
|
65115
65115
|
throw TypeError("dst must be an object");
|
|
65116
|
-
if (!
|
|
65116
|
+
if (!path17)
|
|
65117
65117
|
throw TypeError("path must be specified");
|
|
65118
|
-
|
|
65119
|
-
if (
|
|
65118
|
+
path17 = path17.split(".");
|
|
65119
|
+
if (path17.length > util2.recursionLimit)
|
|
65120
65120
|
throw Error("max depth exceeded");
|
|
65121
|
-
return setProp(dst,
|
|
65121
|
+
return setProp(dst, path17, value);
|
|
65122
65122
|
};
|
|
65123
65123
|
Object.defineProperty(util2, "decorateRoot", {
|
|
65124
65124
|
get: function() {
|
|
@@ -65560,12 +65560,12 @@ var require_object = __commonJS((exports, module) => {
|
|
|
65560
65560
|
},
|
|
65561
65561
|
fullName: {
|
|
65562
65562
|
get: function() {
|
|
65563
|
-
var
|
|
65563
|
+
var path17 = [this.name], ptr = this.parent;
|
|
65564
65564
|
while (ptr) {
|
|
65565
|
-
|
|
65565
|
+
path17.unshift(ptr.name);
|
|
65566
65566
|
ptr = ptr.parent;
|
|
65567
65567
|
}
|
|
65568
|
-
return
|
|
65568
|
+
return path17.join(".");
|
|
65569
65569
|
}
|
|
65570
65570
|
}
|
|
65571
65571
|
});
|
|
@@ -69388,19 +69388,19 @@ var require_type3 = __commonJS((exports, module) => {
|
|
|
69388
69388
|
var require_util4 = __commonJS((exports) => {
|
|
69389
69389
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69390
69390
|
exports.addCommonProtos = exports.loadProtosWithOptionsSync = exports.loadProtosWithOptions = undefined;
|
|
69391
|
-
var
|
|
69392
|
-
var
|
|
69391
|
+
var fs12 = __require("fs");
|
|
69392
|
+
var path17 = __require("path");
|
|
69393
69393
|
var Protobuf = require_src17();
|
|
69394
69394
|
function addIncludePathResolver(root, includePaths) {
|
|
69395
69395
|
const originalResolvePath = root.resolvePath;
|
|
69396
69396
|
root.resolvePath = (origin, target) => {
|
|
69397
|
-
if (
|
|
69397
|
+
if (path17.isAbsolute(target)) {
|
|
69398
69398
|
return target;
|
|
69399
69399
|
}
|
|
69400
69400
|
for (const directory of includePaths) {
|
|
69401
|
-
const fullPath =
|
|
69401
|
+
const fullPath = path17.join(directory, target);
|
|
69402
69402
|
try {
|
|
69403
|
-
|
|
69403
|
+
fs12.accessSync(fullPath, fs12.constants.R_OK);
|
|
69404
69404
|
return fullPath;
|
|
69405
69405
|
} catch (err) {
|
|
69406
69406
|
continue;
|
|
@@ -71718,7 +71718,7 @@ var require_subchannel_call = __commonJS((exports) => {
|
|
|
71718
71718
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
71719
71719
|
exports.Http2SubchannelCall = undefined;
|
|
71720
71720
|
var http2 = __require("http2");
|
|
71721
|
-
var
|
|
71721
|
+
var os8 = __require("os");
|
|
71722
71722
|
var constants_1 = require_constants2();
|
|
71723
71723
|
var metadata_1 = require_metadata();
|
|
71724
71724
|
var stream_decoder_1 = require_stream_decoder();
|
|
@@ -71726,7 +71726,7 @@ var require_subchannel_call = __commonJS((exports) => {
|
|
|
71726
71726
|
var constants_2 = require_constants2();
|
|
71727
71727
|
var TRACER_NAME = "subchannel_call";
|
|
71728
71728
|
function getSystemErrorName(errno) {
|
|
71729
|
-
for (const [name21, num] of Object.entries(
|
|
71729
|
+
for (const [name21, num] of Object.entries(os8.constants.errno)) {
|
|
71730
71730
|
if (num === errno) {
|
|
71731
71731
|
return name21;
|
|
71732
71732
|
}
|
|
@@ -74526,9 +74526,9 @@ var require_server_call = __commonJS((exports) => {
|
|
|
74526
74526
|
}
|
|
74527
74527
|
|
|
74528
74528
|
class ServerUnaryCallImpl extends events_1.EventEmitter {
|
|
74529
|
-
constructor(
|
|
74529
|
+
constructor(path17, call, metadata, request) {
|
|
74530
74530
|
super();
|
|
74531
|
-
this.path =
|
|
74531
|
+
this.path = path17;
|
|
74532
74532
|
this.call = call;
|
|
74533
74533
|
this.metadata = metadata;
|
|
74534
74534
|
this.request = request;
|
|
@@ -74559,9 +74559,9 @@ var require_server_call = __commonJS((exports) => {
|
|
|
74559
74559
|
exports.ServerUnaryCallImpl = ServerUnaryCallImpl;
|
|
74560
74560
|
|
|
74561
74561
|
class ServerReadableStreamImpl extends stream_1.Readable {
|
|
74562
|
-
constructor(
|
|
74562
|
+
constructor(path17, call, metadata) {
|
|
74563
74563
|
super({ objectMode: true });
|
|
74564
|
-
this.path =
|
|
74564
|
+
this.path = path17;
|
|
74565
74565
|
this.call = call;
|
|
74566
74566
|
this.metadata = metadata;
|
|
74567
74567
|
this.cancelled = false;
|
|
@@ -74594,9 +74594,9 @@ var require_server_call = __commonJS((exports) => {
|
|
|
74594
74594
|
exports.ServerReadableStreamImpl = ServerReadableStreamImpl;
|
|
74595
74595
|
|
|
74596
74596
|
class ServerWritableStreamImpl extends stream_1.Writable {
|
|
74597
|
-
constructor(
|
|
74597
|
+
constructor(path17, call, metadata, request) {
|
|
74598
74598
|
super({ objectMode: true });
|
|
74599
|
-
this.path =
|
|
74599
|
+
this.path = path17;
|
|
74600
74600
|
this.call = call;
|
|
74601
74601
|
this.metadata = metadata;
|
|
74602
74602
|
this.request = request;
|
|
@@ -74650,9 +74650,9 @@ var require_server_call = __commonJS((exports) => {
|
|
|
74650
74650
|
exports.ServerWritableStreamImpl = ServerWritableStreamImpl;
|
|
74651
74651
|
|
|
74652
74652
|
class ServerDuplexStreamImpl extends stream_1.Duplex {
|
|
74653
|
-
constructor(
|
|
74653
|
+
constructor(path17, call, metadata) {
|
|
74654
74654
|
super({ objectMode: true });
|
|
74655
|
-
this.path =
|
|
74655
|
+
this.path = path17;
|
|
74656
74656
|
this.call = call;
|
|
74657
74657
|
this.metadata = metadata;
|
|
74658
74658
|
this.pendingStatus = {
|
|
@@ -76852,11 +76852,11 @@ var require_server = __commonJS((exports) => {
|
|
|
76852
76852
|
}
|
|
76853
76853
|
return true;
|
|
76854
76854
|
}
|
|
76855
|
-
_retrieveHandler(
|
|
76856
|
-
serverCallTrace("Received call to method " +
|
|
76857
|
-
const handler = this.handlers.get(
|
|
76855
|
+
_retrieveHandler(path17) {
|
|
76856
|
+
serverCallTrace("Received call to method " + path17 + " at address " + this.serverAddressString);
|
|
76857
|
+
const handler = this.handlers.get(path17);
|
|
76858
76858
|
if (handler === undefined) {
|
|
76859
|
-
serverCallTrace("No handler registered for method " +
|
|
76859
|
+
serverCallTrace("No handler registered for method " + path17 + ". Sending UNIMPLEMENTED status.");
|
|
76860
76860
|
return null;
|
|
76861
76861
|
}
|
|
76862
76862
|
return handler;
|
|
@@ -76879,10 +76879,10 @@ var require_server = __commonJS((exports) => {
|
|
|
76879
76879
|
channelzSessionInfo === null || channelzSessionInfo === undefined || channelzSessionInfo.streamTracker.addCallFailed();
|
|
76880
76880
|
return;
|
|
76881
76881
|
}
|
|
76882
|
-
const
|
|
76883
|
-
const handler = this._retrieveHandler(
|
|
76882
|
+
const path17 = headers[HTTP2_HEADER_PATH];
|
|
76883
|
+
const handler = this._retrieveHandler(path17);
|
|
76884
76884
|
if (!handler) {
|
|
76885
|
-
this._respondWithError(getUnimplementedStatusResponse(
|
|
76885
|
+
this._respondWithError(getUnimplementedStatusResponse(path17), stream, channelzSessionInfo);
|
|
76886
76886
|
return;
|
|
76887
76887
|
}
|
|
76888
76888
|
const callEventTracker = {
|
|
@@ -76931,10 +76931,10 @@ var require_server = __commonJS((exports) => {
|
|
|
76931
76931
|
if (this._verifyContentType(stream, headers) !== true) {
|
|
76932
76932
|
return;
|
|
76933
76933
|
}
|
|
76934
|
-
const
|
|
76935
|
-
const handler = this._retrieveHandler(
|
|
76934
|
+
const path17 = headers[HTTP2_HEADER_PATH];
|
|
76935
|
+
const handler = this._retrieveHandler(path17);
|
|
76936
76936
|
if (!handler) {
|
|
76937
|
-
this._respondWithError(getUnimplementedStatusResponse(
|
|
76937
|
+
this._respondWithError(getUnimplementedStatusResponse(path17), stream, null);
|
|
76938
76938
|
return;
|
|
76939
76939
|
}
|
|
76940
76940
|
const call = (0, server_interceptors_1.getServerInterceptingCall)([...extraInterceptors, ...this.interceptors], stream, headers, null, handler, this.options);
|
|
@@ -77913,7 +77913,7 @@ var require_load_balancer_pick_first = __commonJS((exports) => {
|
|
|
77913
77913
|
var require_certificate_provider = __commonJS((exports) => {
|
|
77914
77914
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
77915
77915
|
exports.FileWatcherCertificateProvider = undefined;
|
|
77916
|
-
var
|
|
77916
|
+
var fs12 = __require("fs");
|
|
77917
77917
|
var logging = require_logging();
|
|
77918
77918
|
var constants_1 = require_constants2();
|
|
77919
77919
|
var util_1 = __require("util");
|
|
@@ -77921,7 +77921,7 @@ var require_certificate_provider = __commonJS((exports) => {
|
|
|
77921
77921
|
function trace2(text2) {
|
|
77922
77922
|
logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text2);
|
|
77923
77923
|
}
|
|
77924
|
-
var readFilePromise = (0, util_1.promisify)(
|
|
77924
|
+
var readFilePromise = (0, util_1.promisify)(fs12.readFile);
|
|
77925
77925
|
|
|
77926
77926
|
class FileWatcherCertificateProvider {
|
|
77927
77927
|
constructor(config4) {
|
|
@@ -78172,13 +78172,13 @@ var require_resolver_uds = __commonJS((exports) => {
|
|
|
78172
78172
|
this.listener = listener;
|
|
78173
78173
|
this.hasReturnedResult = false;
|
|
78174
78174
|
this.endpoints = [];
|
|
78175
|
-
let
|
|
78175
|
+
let path17;
|
|
78176
78176
|
if (target.authority === "") {
|
|
78177
|
-
|
|
78177
|
+
path17 = "/" + target.path;
|
|
78178
78178
|
} else {
|
|
78179
|
-
|
|
78179
|
+
path17 = target.path;
|
|
78180
78180
|
}
|
|
78181
|
-
this.endpoints = [{ addresses: [{ path:
|
|
78181
|
+
this.endpoints = [{ addresses: [{ path: path17 }] }];
|
|
78182
78182
|
}
|
|
78183
78183
|
updateResolution() {
|
|
78184
78184
|
if (!this.hasReturnedResult) {
|
|
@@ -78236,12 +78236,12 @@ var require_resolver_ip = __commonJS((exports) => {
|
|
|
78236
78236
|
return;
|
|
78237
78237
|
}
|
|
78238
78238
|
const pathList = target.path.split(",");
|
|
78239
|
-
for (const
|
|
78240
|
-
const hostPort = (0, uri_parser_1.splitHostPort)(
|
|
78239
|
+
for (const path17 of pathList) {
|
|
78240
|
+
const hostPort = (0, uri_parser_1.splitHostPort)(path17);
|
|
78241
78241
|
if (hostPort === null) {
|
|
78242
78242
|
this.error = {
|
|
78243
78243
|
code: constants_1.Status.UNAVAILABLE,
|
|
78244
|
-
details: `Failed to parse ${target.scheme} address ${
|
|
78244
|
+
details: `Failed to parse ${target.scheme} address ${path17}`,
|
|
78245
78245
|
metadata: new metadata_1.Metadata
|
|
78246
78246
|
};
|
|
78247
78247
|
return;
|
|
@@ -78249,7 +78249,7 @@ var require_resolver_ip = __commonJS((exports) => {
|
|
|
78249
78249
|
if (target.scheme === IPV4_SCHEME && !(0, net_1.isIPv4)(hostPort.host) || target.scheme === IPV6_SCHEME && !(0, net_1.isIPv6)(hostPort.host)) {
|
|
78250
78250
|
this.error = {
|
|
78251
78251
|
code: constants_1.Status.UNAVAILABLE,
|
|
78252
|
-
details: `Failed to parse ${target.scheme} address ${
|
|
78252
|
+
details: `Failed to parse ${target.scheme} address ${path17}`,
|
|
78253
78253
|
metadata: new metadata_1.Metadata
|
|
78254
78254
|
};
|
|
78255
78255
|
return;
|
|
@@ -79540,10 +79540,10 @@ var require_create_service_client_constructor = __commonJS((exports) => {
|
|
|
79540
79540
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
79541
79541
|
exports.createServiceClientConstructor = undefined;
|
|
79542
79542
|
var grpc = require_src19();
|
|
79543
|
-
function createServiceClientConstructor(
|
|
79543
|
+
function createServiceClientConstructor(path17, name21) {
|
|
79544
79544
|
const serviceDefinition = {
|
|
79545
79545
|
export: {
|
|
79546
|
-
path:
|
|
79546
|
+
path: path17,
|
|
79547
79547
|
requestStream: false,
|
|
79548
79548
|
responseStream: false,
|
|
79549
79549
|
requestSerialize: (arg) => {
|
|
@@ -79746,8 +79746,8 @@ var require_otlp_grpc_env_configuration = __commonJS((exports) => {
|
|
|
79746
79746
|
var core_1 = require_src3();
|
|
79747
79747
|
var grpc_exporter_transport_1 = require_grpc_exporter_transport();
|
|
79748
79748
|
var node_http_1 = require_index_node_http();
|
|
79749
|
-
var
|
|
79750
|
-
var
|
|
79749
|
+
var fs12 = __require("fs");
|
|
79750
|
+
var path17 = __require("path");
|
|
79751
79751
|
var api_1 = require_src();
|
|
79752
79752
|
function fallbackIfNullishOrBlank(signalSpecific, nonSignalSpecific) {
|
|
79753
79753
|
if (signalSpecific != null && signalSpecific !== "") {
|
|
@@ -79796,7 +79796,7 @@ var require_otlp_grpc_env_configuration = __commonJS((exports) => {
|
|
|
79796
79796
|
const filePath = fallbackIfNullishOrBlank(signalSpecificPath, nonSignalSpecificPath);
|
|
79797
79797
|
if (filePath != null) {
|
|
79798
79798
|
try {
|
|
79799
|
-
return
|
|
79799
|
+
return fs12.readFileSync(path17.resolve(process.cwd(), filePath));
|
|
79800
79800
|
} catch {
|
|
79801
79801
|
api_1.diag.warn(warningMessage);
|
|
79802
79802
|
return;
|
|
@@ -83048,17 +83048,17 @@ var require_visit = __commonJS((exports) => {
|
|
|
83048
83048
|
visit3.BREAK = BREAK;
|
|
83049
83049
|
visit3.SKIP = SKIP;
|
|
83050
83050
|
visit3.REMOVE = REMOVE;
|
|
83051
|
-
function visit_(key, node, visitor,
|
|
83052
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
83051
|
+
function visit_(key, node, visitor, path17) {
|
|
83052
|
+
const ctrl = callVisitor(key, node, visitor, path17);
|
|
83053
83053
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
83054
|
-
replaceNode(key,
|
|
83055
|
-
return visit_(key, ctrl, visitor,
|
|
83054
|
+
replaceNode(key, path17, ctrl);
|
|
83055
|
+
return visit_(key, ctrl, visitor, path17);
|
|
83056
83056
|
}
|
|
83057
83057
|
if (typeof ctrl !== "symbol") {
|
|
83058
83058
|
if (identity.isCollection(node)) {
|
|
83059
|
-
|
|
83059
|
+
path17 = Object.freeze(path17.concat(node));
|
|
83060
83060
|
for (let i2 = 0;i2 < node.items.length; ++i2) {
|
|
83061
|
-
const ci = visit_(i2, node.items[i2], visitor,
|
|
83061
|
+
const ci = visit_(i2, node.items[i2], visitor, path17);
|
|
83062
83062
|
if (typeof ci === "number")
|
|
83063
83063
|
i2 = ci - 1;
|
|
83064
83064
|
else if (ci === BREAK)
|
|
@@ -83069,13 +83069,13 @@ var require_visit = __commonJS((exports) => {
|
|
|
83069
83069
|
}
|
|
83070
83070
|
}
|
|
83071
83071
|
} else if (identity.isPair(node)) {
|
|
83072
|
-
|
|
83073
|
-
const ck = visit_("key", node.key, visitor,
|
|
83072
|
+
path17 = Object.freeze(path17.concat(node));
|
|
83073
|
+
const ck = visit_("key", node.key, visitor, path17);
|
|
83074
83074
|
if (ck === BREAK)
|
|
83075
83075
|
return BREAK;
|
|
83076
83076
|
else if (ck === REMOVE)
|
|
83077
83077
|
node.key = null;
|
|
83078
|
-
const cv = visit_("value", node.value, visitor,
|
|
83078
|
+
const cv = visit_("value", node.value, visitor, path17);
|
|
83079
83079
|
if (cv === BREAK)
|
|
83080
83080
|
return BREAK;
|
|
83081
83081
|
else if (cv === REMOVE)
|
|
@@ -83096,17 +83096,17 @@ var require_visit = __commonJS((exports) => {
|
|
|
83096
83096
|
visitAsync.BREAK = BREAK;
|
|
83097
83097
|
visitAsync.SKIP = SKIP;
|
|
83098
83098
|
visitAsync.REMOVE = REMOVE;
|
|
83099
|
-
async function visitAsync_(key, node, visitor,
|
|
83100
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
83099
|
+
async function visitAsync_(key, node, visitor, path17) {
|
|
83100
|
+
const ctrl = await callVisitor(key, node, visitor, path17);
|
|
83101
83101
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
83102
|
-
replaceNode(key,
|
|
83103
|
-
return visitAsync_(key, ctrl, visitor,
|
|
83102
|
+
replaceNode(key, path17, ctrl);
|
|
83103
|
+
return visitAsync_(key, ctrl, visitor, path17);
|
|
83104
83104
|
}
|
|
83105
83105
|
if (typeof ctrl !== "symbol") {
|
|
83106
83106
|
if (identity.isCollection(node)) {
|
|
83107
|
-
|
|
83107
|
+
path17 = Object.freeze(path17.concat(node));
|
|
83108
83108
|
for (let i2 = 0;i2 < node.items.length; ++i2) {
|
|
83109
|
-
const ci = await visitAsync_(i2, node.items[i2], visitor,
|
|
83109
|
+
const ci = await visitAsync_(i2, node.items[i2], visitor, path17);
|
|
83110
83110
|
if (typeof ci === "number")
|
|
83111
83111
|
i2 = ci - 1;
|
|
83112
83112
|
else if (ci === BREAK)
|
|
@@ -83117,13 +83117,13 @@ var require_visit = __commonJS((exports) => {
|
|
|
83117
83117
|
}
|
|
83118
83118
|
}
|
|
83119
83119
|
} else if (identity.isPair(node)) {
|
|
83120
|
-
|
|
83121
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
83120
|
+
path17 = Object.freeze(path17.concat(node));
|
|
83121
|
+
const ck = await visitAsync_("key", node.key, visitor, path17);
|
|
83122
83122
|
if (ck === BREAK)
|
|
83123
83123
|
return BREAK;
|
|
83124
83124
|
else if (ck === REMOVE)
|
|
83125
83125
|
node.key = null;
|
|
83126
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
83126
|
+
const cv = await visitAsync_("value", node.value, visitor, path17);
|
|
83127
83127
|
if (cv === BREAK)
|
|
83128
83128
|
return BREAK;
|
|
83129
83129
|
else if (cv === REMOVE)
|
|
@@ -83150,23 +83150,23 @@ var require_visit = __commonJS((exports) => {
|
|
|
83150
83150
|
}
|
|
83151
83151
|
return visitor;
|
|
83152
83152
|
}
|
|
83153
|
-
function callVisitor(key, node, visitor,
|
|
83153
|
+
function callVisitor(key, node, visitor, path17) {
|
|
83154
83154
|
if (typeof visitor === "function")
|
|
83155
|
-
return visitor(key, node,
|
|
83155
|
+
return visitor(key, node, path17);
|
|
83156
83156
|
if (identity.isMap(node))
|
|
83157
|
-
return visitor.Map?.(key, node,
|
|
83157
|
+
return visitor.Map?.(key, node, path17);
|
|
83158
83158
|
if (identity.isSeq(node))
|
|
83159
|
-
return visitor.Seq?.(key, node,
|
|
83159
|
+
return visitor.Seq?.(key, node, path17);
|
|
83160
83160
|
if (identity.isPair(node))
|
|
83161
|
-
return visitor.Pair?.(key, node,
|
|
83161
|
+
return visitor.Pair?.(key, node, path17);
|
|
83162
83162
|
if (identity.isScalar(node))
|
|
83163
|
-
return visitor.Scalar?.(key, node,
|
|
83163
|
+
return visitor.Scalar?.(key, node, path17);
|
|
83164
83164
|
if (identity.isAlias(node))
|
|
83165
|
-
return visitor.Alias?.(key, node,
|
|
83165
|
+
return visitor.Alias?.(key, node, path17);
|
|
83166
83166
|
return;
|
|
83167
83167
|
}
|
|
83168
|
-
function replaceNode(key,
|
|
83169
|
-
const parent =
|
|
83168
|
+
function replaceNode(key, path17, node) {
|
|
83169
|
+
const parent = path17[path17.length - 1];
|
|
83170
83170
|
if (identity.isCollection(parent)) {
|
|
83171
83171
|
parent.items[key] = node;
|
|
83172
83172
|
} else if (identity.isPair(parent)) {
|
|
@@ -83725,10 +83725,10 @@ var require_Collection = __commonJS((exports) => {
|
|
|
83725
83725
|
var createNode = require_createNode();
|
|
83726
83726
|
var identity = require_identity();
|
|
83727
83727
|
var Node = require_Node();
|
|
83728
|
-
function collectionFromPath(schema,
|
|
83728
|
+
function collectionFromPath(schema, path17, value) {
|
|
83729
83729
|
let v2 = value;
|
|
83730
|
-
for (let i2 =
|
|
83731
|
-
const k2 =
|
|
83730
|
+
for (let i2 = path17.length - 1;i2 >= 0; --i2) {
|
|
83731
|
+
const k2 = path17[i2];
|
|
83732
83732
|
if (typeof k2 === "number" && Number.isInteger(k2) && k2 >= 0) {
|
|
83733
83733
|
const a2 = [];
|
|
83734
83734
|
a2[k2] = v2;
|
|
@@ -83747,7 +83747,7 @@ var require_Collection = __commonJS((exports) => {
|
|
|
83747
83747
|
sourceObjects: new Map
|
|
83748
83748
|
});
|
|
83749
83749
|
}
|
|
83750
|
-
var isEmptyPath = (
|
|
83750
|
+
var isEmptyPath = (path17) => path17 == null || typeof path17 === "object" && !!path17[Symbol.iterator]().next().done;
|
|
83751
83751
|
|
|
83752
83752
|
class Collection extends Node.NodeBase {
|
|
83753
83753
|
constructor(type, schema) {
|
|
@@ -83768,11 +83768,11 @@ var require_Collection = __commonJS((exports) => {
|
|
|
83768
83768
|
copy.range = this.range.slice();
|
|
83769
83769
|
return copy;
|
|
83770
83770
|
}
|
|
83771
|
-
addIn(
|
|
83772
|
-
if (isEmptyPath(
|
|
83771
|
+
addIn(path17, value) {
|
|
83772
|
+
if (isEmptyPath(path17))
|
|
83773
83773
|
this.add(value);
|
|
83774
83774
|
else {
|
|
83775
|
-
const [key, ...rest] =
|
|
83775
|
+
const [key, ...rest] = path17;
|
|
83776
83776
|
const node = this.get(key, true);
|
|
83777
83777
|
if (identity.isCollection(node))
|
|
83778
83778
|
node.addIn(rest, value);
|
|
@@ -83782,8 +83782,8 @@ var require_Collection = __commonJS((exports) => {
|
|
|
83782
83782
|
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
83783
83783
|
}
|
|
83784
83784
|
}
|
|
83785
|
-
deleteIn(
|
|
83786
|
-
const [key, ...rest] =
|
|
83785
|
+
deleteIn(path17) {
|
|
83786
|
+
const [key, ...rest] = path17;
|
|
83787
83787
|
if (rest.length === 0)
|
|
83788
83788
|
return this.delete(key);
|
|
83789
83789
|
const node = this.get(key, true);
|
|
@@ -83792,8 +83792,8 @@ var require_Collection = __commonJS((exports) => {
|
|
|
83792
83792
|
else
|
|
83793
83793
|
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
83794
83794
|
}
|
|
83795
|
-
getIn(
|
|
83796
|
-
const [key, ...rest] =
|
|
83795
|
+
getIn(path17, keepScalar) {
|
|
83796
|
+
const [key, ...rest] = path17;
|
|
83797
83797
|
const node = this.get(key, true);
|
|
83798
83798
|
if (rest.length === 0)
|
|
83799
83799
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -83808,15 +83808,15 @@ var require_Collection = __commonJS((exports) => {
|
|
|
83808
83808
|
return n2 == null || allowScalar && identity.isScalar(n2) && n2.value == null && !n2.commentBefore && !n2.comment && !n2.tag;
|
|
83809
83809
|
});
|
|
83810
83810
|
}
|
|
83811
|
-
hasIn(
|
|
83812
|
-
const [key, ...rest] =
|
|
83811
|
+
hasIn(path17) {
|
|
83812
|
+
const [key, ...rest] = path17;
|
|
83813
83813
|
if (rest.length === 0)
|
|
83814
83814
|
return this.has(key);
|
|
83815
83815
|
const node = this.get(key, true);
|
|
83816
83816
|
return identity.isCollection(node) ? node.hasIn(rest) : false;
|
|
83817
83817
|
}
|
|
83818
|
-
setIn(
|
|
83819
|
-
const [key, ...rest] =
|
|
83818
|
+
setIn(path17, value) {
|
|
83819
|
+
const [key, ...rest] = path17;
|
|
83820
83820
|
if (rest.length === 0) {
|
|
83821
83821
|
this.set(key, value);
|
|
83822
83822
|
} else {
|
|
@@ -86209,9 +86209,9 @@ var require_Document = __commonJS((exports) => {
|
|
|
86209
86209
|
if (assertCollection(this.contents))
|
|
86210
86210
|
this.contents.add(value);
|
|
86211
86211
|
}
|
|
86212
|
-
addIn(
|
|
86212
|
+
addIn(path17, value) {
|
|
86213
86213
|
if (assertCollection(this.contents))
|
|
86214
|
-
this.contents.addIn(
|
|
86214
|
+
this.contents.addIn(path17, value);
|
|
86215
86215
|
}
|
|
86216
86216
|
createAlias(node, name21) {
|
|
86217
86217
|
if (!node.anchor) {
|
|
@@ -86260,30 +86260,30 @@ var require_Document = __commonJS((exports) => {
|
|
|
86260
86260
|
delete(key) {
|
|
86261
86261
|
return assertCollection(this.contents) ? this.contents.delete(key) : false;
|
|
86262
86262
|
}
|
|
86263
|
-
deleteIn(
|
|
86264
|
-
if (Collection.isEmptyPath(
|
|
86263
|
+
deleteIn(path17) {
|
|
86264
|
+
if (Collection.isEmptyPath(path17)) {
|
|
86265
86265
|
if (this.contents == null)
|
|
86266
86266
|
return false;
|
|
86267
86267
|
this.contents = null;
|
|
86268
86268
|
return true;
|
|
86269
86269
|
}
|
|
86270
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
86270
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path17) : false;
|
|
86271
86271
|
}
|
|
86272
86272
|
get(key, keepScalar) {
|
|
86273
86273
|
return identity.isCollection(this.contents) ? this.contents.get(key, keepScalar) : undefined;
|
|
86274
86274
|
}
|
|
86275
|
-
getIn(
|
|
86276
|
-
if (Collection.isEmptyPath(
|
|
86275
|
+
getIn(path17, keepScalar) {
|
|
86276
|
+
if (Collection.isEmptyPath(path17))
|
|
86277
86277
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
86278
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
86278
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path17, keepScalar) : undefined;
|
|
86279
86279
|
}
|
|
86280
86280
|
has(key) {
|
|
86281
86281
|
return identity.isCollection(this.contents) ? this.contents.has(key) : false;
|
|
86282
86282
|
}
|
|
86283
|
-
hasIn(
|
|
86284
|
-
if (Collection.isEmptyPath(
|
|
86283
|
+
hasIn(path17) {
|
|
86284
|
+
if (Collection.isEmptyPath(path17))
|
|
86285
86285
|
return this.contents !== undefined;
|
|
86286
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
86286
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path17) : false;
|
|
86287
86287
|
}
|
|
86288
86288
|
set(key, value) {
|
|
86289
86289
|
if (this.contents == null) {
|
|
@@ -86292,13 +86292,13 @@ var require_Document = __commonJS((exports) => {
|
|
|
86292
86292
|
this.contents.set(key, value);
|
|
86293
86293
|
}
|
|
86294
86294
|
}
|
|
86295
|
-
setIn(
|
|
86296
|
-
if (Collection.isEmptyPath(
|
|
86295
|
+
setIn(path17, value) {
|
|
86296
|
+
if (Collection.isEmptyPath(path17)) {
|
|
86297
86297
|
this.contents = value;
|
|
86298
86298
|
} else if (this.contents == null) {
|
|
86299
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
86299
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path17), value);
|
|
86300
86300
|
} else if (assertCollection(this.contents)) {
|
|
86301
|
-
this.contents.setIn(
|
|
86301
|
+
this.contents.setIn(path17, value);
|
|
86302
86302
|
}
|
|
86303
86303
|
}
|
|
86304
86304
|
setSchema(version4, options2 = {}) {
|
|
@@ -88195,9 +88195,9 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
88195
88195
|
visit3.BREAK = BREAK;
|
|
88196
88196
|
visit3.SKIP = SKIP;
|
|
88197
88197
|
visit3.REMOVE = REMOVE;
|
|
88198
|
-
visit3.itemAtPath = (cst,
|
|
88198
|
+
visit3.itemAtPath = (cst, path17) => {
|
|
88199
88199
|
let item = cst;
|
|
88200
|
-
for (const [field, index] of
|
|
88200
|
+
for (const [field, index] of path17) {
|
|
88201
88201
|
const tok = item?.[field];
|
|
88202
88202
|
if (tok && "items" in tok) {
|
|
88203
88203
|
item = tok.items[index];
|
|
@@ -88206,23 +88206,23 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
88206
88206
|
}
|
|
88207
88207
|
return item;
|
|
88208
88208
|
};
|
|
88209
|
-
visit3.parentCollection = (cst,
|
|
88210
|
-
const parent = visit3.itemAtPath(cst,
|
|
88211
|
-
const field =
|
|
88209
|
+
visit3.parentCollection = (cst, path17) => {
|
|
88210
|
+
const parent = visit3.itemAtPath(cst, path17.slice(0, -1));
|
|
88211
|
+
const field = path17[path17.length - 1][0];
|
|
88212
88212
|
const coll = parent?.[field];
|
|
88213
88213
|
if (coll && "items" in coll)
|
|
88214
88214
|
return coll;
|
|
88215
88215
|
throw new Error("Parent collection not found");
|
|
88216
88216
|
};
|
|
88217
|
-
function _visit(
|
|
88218
|
-
let ctrl = visitor(item,
|
|
88217
|
+
function _visit(path17, item, visitor) {
|
|
88218
|
+
let ctrl = visitor(item, path17);
|
|
88219
88219
|
if (typeof ctrl === "symbol")
|
|
88220
88220
|
return ctrl;
|
|
88221
88221
|
for (const field of ["key", "value"]) {
|
|
88222
88222
|
const token = item[field];
|
|
88223
88223
|
if (token && "items" in token) {
|
|
88224
88224
|
for (let i2 = 0;i2 < token.items.length; ++i2) {
|
|
88225
|
-
const ci = _visit(Object.freeze(
|
|
88225
|
+
const ci = _visit(Object.freeze(path17.concat([[field, i2]])), token.items[i2], visitor);
|
|
88226
88226
|
if (typeof ci === "number")
|
|
88227
88227
|
i2 = ci - 1;
|
|
88228
88228
|
else if (ci === BREAK)
|
|
@@ -88233,10 +88233,10 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
88233
88233
|
}
|
|
88234
88234
|
}
|
|
88235
88235
|
if (typeof ctrl === "function" && field === "key")
|
|
88236
|
-
ctrl = ctrl(item,
|
|
88236
|
+
ctrl = ctrl(item, path17);
|
|
88237
88237
|
}
|
|
88238
88238
|
}
|
|
88239
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
88239
|
+
return typeof ctrl === "function" ? ctrl(item, path17) : ctrl;
|
|
88240
88240
|
}
|
|
88241
88241
|
exports.visit = visit3;
|
|
88242
88242
|
});
|
|
@@ -89523,14 +89523,14 @@ var require_parser = __commonJS((exports) => {
|
|
|
89523
89523
|
case "scalar":
|
|
89524
89524
|
case "single-quoted-scalar":
|
|
89525
89525
|
case "double-quoted-scalar": {
|
|
89526
|
-
const
|
|
89526
|
+
const fs12 = this.flowScalar(this.type);
|
|
89527
89527
|
if (atNextItem || it.value) {
|
|
89528
|
-
map3.items.push({ start, key:
|
|
89528
|
+
map3.items.push({ start, key: fs12, sep: [] });
|
|
89529
89529
|
this.onKeyLine = true;
|
|
89530
89530
|
} else if (it.sep) {
|
|
89531
|
-
this.stack.push(
|
|
89531
|
+
this.stack.push(fs12);
|
|
89532
89532
|
} else {
|
|
89533
|
-
Object.assign(it, { key:
|
|
89533
|
+
Object.assign(it, { key: fs12, sep: [] });
|
|
89534
89534
|
this.onKeyLine = true;
|
|
89535
89535
|
}
|
|
89536
89536
|
return;
|
|
@@ -89658,13 +89658,13 @@ var require_parser = __commonJS((exports) => {
|
|
|
89658
89658
|
case "scalar":
|
|
89659
89659
|
case "single-quoted-scalar":
|
|
89660
89660
|
case "double-quoted-scalar": {
|
|
89661
|
-
const
|
|
89661
|
+
const fs12 = this.flowScalar(this.type);
|
|
89662
89662
|
if (!it || it.value)
|
|
89663
|
-
fc.items.push({ start: [], key:
|
|
89663
|
+
fc.items.push({ start: [], key: fs12, sep: [] });
|
|
89664
89664
|
else if (it.sep)
|
|
89665
|
-
this.stack.push(
|
|
89665
|
+
this.stack.push(fs12);
|
|
89666
89666
|
else
|
|
89667
|
-
Object.assign(it, { key:
|
|
89667
|
+
Object.assign(it, { key: fs12, sep: [] });
|
|
89668
89668
|
return;
|
|
89669
89669
|
}
|
|
89670
89670
|
case "flow-map-end":
|
|
@@ -89972,7 +89972,7 @@ var require_FileConfigFactory = __commonJS((exports) => {
|
|
|
89972
89972
|
exports.setLoggerProvider = exports.getSeverity = exports.setMeterProvider = exports.getTemporalityPreference = exports.setTracerProvider = exports.setPropagator = exports.setAttributeLimits = exports.setResourceAttributes = exports.parseConfigFile = exports.hasValidConfigFile = exports.FileConfigFactory = undefined;
|
|
89973
89973
|
var core_1 = require_src3();
|
|
89974
89974
|
var configModel_1 = require_configModel();
|
|
89975
|
-
var
|
|
89975
|
+
var fs12 = __require("fs");
|
|
89976
89976
|
var yaml = require_dist2();
|
|
89977
89977
|
var utils_1 = require_utils14();
|
|
89978
89978
|
var commonModel_1 = require_commonModel();
|
|
@@ -89995,7 +89995,7 @@ var require_FileConfigFactory = __commonJS((exports) => {
|
|
|
89995
89995
|
function hasValidConfigFile() {
|
|
89996
89996
|
const configFile = (0, core_1.getStringFromEnv)("OTEL_CONFIG_FILE");
|
|
89997
89997
|
if (configFile) {
|
|
89998
|
-
if (!(configFile.endsWith(".yaml") || configFile.endsWith(".yml")) || !
|
|
89998
|
+
if (!(configFile.endsWith(".yaml") || configFile.endsWith(".yml")) || !fs12.existsSync(configFile)) {
|
|
89999
89999
|
api_1.diag.warn(`Config file ${configFile} set on OTEL_CONFIG_FILE is not valid`);
|
|
90000
90000
|
return false;
|
|
90001
90001
|
}
|
|
@@ -90007,7 +90007,7 @@ var require_FileConfigFactory = __commonJS((exports) => {
|
|
|
90007
90007
|
function parseConfigFile(config4) {
|
|
90008
90008
|
const supportedFileVersions = ["1.0-rc.3"];
|
|
90009
90009
|
const configFile = (0, core_1.getStringFromEnv)("OTEL_CONFIG_FILE") || "";
|
|
90010
|
-
const file3 =
|
|
90010
|
+
const file3 = fs12.readFileSync(configFile, "utf8");
|
|
90011
90011
|
const parsedContent = yaml.parse(file3);
|
|
90012
90012
|
if (parsedContent["file_format"] && supportedFileVersions.includes(parsedContent["file_format"])) {
|
|
90013
90013
|
const disabled = (0, utils_1.getBooleanFromConfigFile)(parsedContent["disabled"]);
|
|
@@ -92866,7 +92866,7 @@ var init_client = __esm(() => {
|
|
|
92866
92866
|
});
|
|
92867
92867
|
|
|
92868
92868
|
// ../opencode/src/auth/user-session/util.ts
|
|
92869
|
-
import
|
|
92869
|
+
import os8 from "os";
|
|
92870
92870
|
function cleanURL(value) {
|
|
92871
92871
|
const input = readString(value);
|
|
92872
92872
|
if (!input)
|
|
@@ -92874,7 +92874,7 @@ function cleanURL(value) {
|
|
|
92874
92874
|
return input.replace(/\/$/, "");
|
|
92875
92875
|
}
|
|
92876
92876
|
function defaultDeviceName() {
|
|
92877
|
-
return `${
|
|
92877
|
+
return `${os8.hostname()} (${process.platform})`;
|
|
92878
92878
|
}
|
|
92879
92879
|
function endpointURL(baseURL, suffix) {
|
|
92880
92880
|
const target = new URL(baseURL);
|
|
@@ -93317,14 +93317,14 @@ var init_state2 = __esm(async () => {
|
|
|
93317
93317
|
});
|
|
93318
93318
|
|
|
93319
93319
|
// ../opencode/src/auth/user-session/storage.ts
|
|
93320
|
-
import
|
|
93321
|
-
import
|
|
93322
|
-
import
|
|
93320
|
+
import fs12 from "fs/promises";
|
|
93321
|
+
import os9 from "os";
|
|
93322
|
+
import path17 from "path";
|
|
93323
93323
|
function filePath() {
|
|
93324
|
-
return
|
|
93324
|
+
return path17.join(Global.Path.data, "auth", "session.json");
|
|
93325
93325
|
}
|
|
93326
93326
|
function displayPath() {
|
|
93327
|
-
const homedir =
|
|
93327
|
+
const homedir = os9.homedir();
|
|
93328
93328
|
const filepath = filePath();
|
|
93329
93329
|
return filepath.startsWith(homedir) ? filepath.replace(homedir, "~") : filepath;
|
|
93330
93330
|
}
|
|
@@ -93332,7 +93332,7 @@ async function load() {
|
|
|
93332
93332
|
const target = filePath();
|
|
93333
93333
|
try {
|
|
93334
93334
|
using _2 = await Lock.read(target);
|
|
93335
|
-
const raw = await
|
|
93335
|
+
const raw = await fs12.readFile(target, "utf-8");
|
|
93336
93336
|
return Stored.parse(JSON.parse(raw));
|
|
93337
93337
|
} catch (error92) {
|
|
93338
93338
|
if (isMissingError(error92))
|
|
@@ -93355,20 +93355,20 @@ async function loadStrict() {
|
|
|
93355
93355
|
async function save(input) {
|
|
93356
93356
|
const parsed = Stored.parse(input);
|
|
93357
93357
|
const target = filePath();
|
|
93358
|
-
const dir =
|
|
93358
|
+
const dir = path17.dirname(target);
|
|
93359
93359
|
const temp = `${target}.tmp`;
|
|
93360
93360
|
using _2 = await Lock.write(target);
|
|
93361
|
-
await
|
|
93362
|
-
await
|
|
93363
|
-
await
|
|
93364
|
-
await
|
|
93365
|
-
await
|
|
93361
|
+
await fs12.mkdir(dir, { recursive: true });
|
|
93362
|
+
await fs12.writeFile(temp, JSON.stringify(parsed, null, 2));
|
|
93363
|
+
await fs12.chmod(temp, 384);
|
|
93364
|
+
await fs12.rename(temp, target);
|
|
93365
|
+
await fs12.chmod(target, 384);
|
|
93366
93366
|
return parsed;
|
|
93367
93367
|
}
|
|
93368
93368
|
async function clear() {
|
|
93369
93369
|
const target = filePath();
|
|
93370
93370
|
using _2 = await Lock.write(target);
|
|
93371
|
-
await
|
|
93371
|
+
await fs12.unlink(target).catch((error92) => {
|
|
93372
93372
|
if (!isMissingError(error92))
|
|
93373
93373
|
throw error92;
|
|
93374
93374
|
});
|
|
@@ -96145,6 +96145,545 @@ class GovernedSkillTool {
|
|
|
96145
96145
|
};
|
|
96146
96146
|
}
|
|
96147
96147
|
}
|
|
96148
|
+
// ../core/src/skills/embedded-skills.ts
|
|
96149
|
+
import fs from "fs";
|
|
96150
|
+
import os from "os";
|
|
96151
|
+
import path from "path";
|
|
96152
|
+
|
|
96153
|
+
// ../core/src/skills/embedded-skills.generated.ts
|
|
96154
|
+
var EMBEDDED_KIFARU_SKILLS = [
|
|
96155
|
+
{ dir: "kifaru-claim-discipline", content: `---
|
|
96156
|
+
name: kifaru-claim-discipline
|
|
96157
|
+
description: "Use when reporting findings or writing assessment claims. Enforces bottom-up claim writing: CVE-version consistency, CVSS base vectors only, impact grounded to proven primitives, and uniform credential redaction."
|
|
96158
|
+
---
|
|
96159
|
+
|
|
96160
|
+
# Kifaru Claim Discipline
|
|
96161
|
+
|
|
96162
|
+
The report is judged by its weakest claim. This skill encodes the \`REPORT_CONTRACT\` + report-lint rules (opencode \`report-contract.ts\`) and the RQ-01..04 remediation from the pi run-quality review, so every published claim is bottom-up from proven evidence. The mechanical lint lives in the \`kifaru_report_lint\` extension; this skill is the writing discipline that makes the lint pass.
|
|
96163
|
+
|
|
96164
|
+
## Claim Rules
|
|
96165
|
+
|
|
96166
|
+
1. **Bottom-up impact.** Write "I did X, observed Y". Never "could/may/potentially lead to". If you did not prove it, do not claim it. Impact is grounded to the **last confirmed primitive** and its privilege level: \`whoami \u2192 www-data\` reads as "RCE as unprivileged web user", never "root shell".
|
|
96167
|
+
2. **Severity is a CVSS 3.1 base vector.** Bare scores ("10/10 CRITICAL") are never published. Each metric is justified by what was verified (access vector, privileges, scope, confidentiality/integrity/availability impact). Base metrics only \u2014 Temporal/Environmental adjustments belong to the client, and reflexively maxing to 9.8 is a triage red flag.
|
|
96168
|
+
3. **CVE\u2194version consistency.** A CVE claim must match the running version: banner/server/package version evidence must fall inside the CVE's affected range. Otherwise use the honest framing: \`[observed behavior: <what happened> on <version>] (CVE-\u2026 applies to <different range>; attribution unverified for this banner)\` \u2014 and drop the CVE from the title.
|
|
96169
|
+
4. **Uniform credential redaction.** Every secret shape (\`password=\`, \`sk_live_\`, \`AKIA\`, JWTs with non-masked payloads, DB_PASSWORD, JWT_SECRET, Stripe/Mailgun keys) is masked everywhere, consistently, including in "sanitized" sections. If a section says sanitized, it is sanitized.
|
|
96170
|
+
5. **Evidence-bound scope.** Every origin exercised must fall inside the attested scope set. If a dev/staging origin differs from the top-level target, say explicitly whether it is in scope \u2014 never imply it.
|
|
96171
|
+
6. **No scaffolding slop.** No OWASP/CWE boilerplate paragraphs, no "in conclusion / it is important to note / as shown above / etc.", no generic mitigations. One line of class context at most.
|
|
96172
|
+
|
|
96173
|
+
## Report Shape (per finding, in order)
|
|
96174
|
+
|
|
96175
|
+
Description \u2192 Vulnerability discovery \u2192 Proof of Concept (replayable, raw request/response or exact commands, tokens stripped) \u2192 Exploitation (atomic steps, preconditions stated) \u2192 Impact (bottom-up) \u2192 Remediation (optional) \u2192 References (optional).
|
|
96176
|
+
|
|
96177
|
+
## Prove the primitive, then STOP
|
|
96178
|
+
|
|
96179
|
+
Do not mass-exfiltrate data or run destructive post-exploitation to "demonstrate" impact. The minimal proof that confirms the boundary is the proof that ships.
|
|
96180
|
+
` },
|
|
96181
|
+
{ dir: "kifaru-coverage-method", content: `---
|
|
96182
|
+
name: kifaru-coverage-method
|
|
96183
|
+
description: Use during and after an assessment to track coverage of (Asset x Vulnerability Class) cells, record why cells are blocked instead of silently skipped, and decide when a hunt is honestly complete.
|
|
96184
|
+
---
|
|
96185
|
+
|
|
96186
|
+
# Kifaru Coverage Method
|
|
96187
|
+
|
|
96188
|
+
A hunt is not complete until **every (Asset \xD7 Vulnerability Class) cell is accounted for**. Skipping cells silently is how findings are missed; claiming coverage without evidence is how reports are rejected. This skill carries the opencode \`CoverageManager\` / \`PivotEngine\` discipline into the Pi runtime as a method (the machine-readable state lives in the \`kifaru_coverage\` extension).
|
|
96189
|
+
|
|
96190
|
+
## Cell Model
|
|
96191
|
+
|
|
96192
|
+
Track cells \`(asset, vuln_class)\`. Each must reach a **terminal state**:
|
|
96193
|
+
|
|
96194
|
+
| State | Meaning |
|
|
96195
|
+
| ------------------- | ---------------------------------------------------------------------- |
|
|
96196
|
+
| \`TESTED_SAFE\` | Actively tested, no vulnerability found \u2014 with the test that proves it |
|
|
96197
|
+
| \`VERIFIED\` | Finding confirmed with minimal proof |
|
|
96198
|
+
| \`GHOST\` | Asset unreachable (DNS dead, removed) \u2014 with the probe |
|
|
96199
|
+
| \`JUSTIFIED_BLOCKED\` | Formally justified why testing was impossible \u2014 not "I skipped it" |
|
|
96200
|
+
|
|
96201
|
+
\`PENDING\` and \`OBSTRUCTED\` are **not terminal**. They must be resolved, pivoted, or formally justified.
|
|
96202
|
+
|
|
96203
|
+
## Blocked Cells \u2192 Pivot, Don't Skip
|
|
96204
|
+
|
|
96205
|
+
When a cell is obstructed (WAF, rate limit, auth wall, challenge, 404-everything), try in order:
|
|
96206
|
+
|
|
96207
|
+
1. **Alternate route**: different endpoint/version/param/Header/Case, hidden or legacy paths, mobile or third-party client surfaces.
|
|
96208
|
+
2. **Alternate signal**: passive indicators (source, config, bundle) instead of live behavior; error-differential instead of direct access.
|
|
96209
|
+
3. **Alternate timing**: slow rate, authenticated context, off-peak, or single low-noise retry (respect limits).
|
|
96210
|
+
4. **Escalation to operator**: if a legitimately blocked cell is material to the assessment, surface it as a question \u2014 a formal \`JUSTIFIED_BLOCKED\` needs an explicit reason such as "WAF challenge on /admin; no bypass found after pivot attempts; manual testing recommended."
|
|
96211
|
+
|
|
96212
|
+
Record for every blocked cell: the attempts, the reason, and why a pivot was not possible.
|
|
96213
|
+
|
|
96214
|
+
## Honest Completion
|
|
96215
|
+
|
|
96216
|
+
Before finishing a stage, produce the coverage ledger and check:
|
|
96217
|
+
|
|
96218
|
+
- No cell left \`PENDING\`/\`OBSTRUCTED\` without an explicit reason.
|
|
96219
|
+
- Every \`TESTED_SAFE\` has its decisive test; every \`VERIFIED\` has its minimal proof.
|
|
96220
|
+
- Ghost and justified-blocked counts are proportionate to effort \u2014 many of either without evidence reads as skimming.
|
|
96221
|
+
- Completion criteria from the workflow are mapped onto covered cells; anything un-mapped is called out.
|
|
96222
|
+
|
|
96223
|
+
The ledger feeds the report's scope/honesty claims; it must survive the \`kifaru-claim-discipline\` review.
|
|
96224
|
+
` },
|
|
96225
|
+
{ dir: "kifaru-hunt-intake", content: `---
|
|
96226
|
+
name: kifaru-hunt-intake
|
|
96227
|
+
description: Use at the start of an authorized Kifaru hunt or assessment to convert scope, target material, repo context, logs, captures, or notes into a concise operating brief, select the right workflow, preserve authorization limits, and define falsifiable research theses before running tools.
|
|
96228
|
+
---
|
|
96229
|
+
|
|
96230
|
+
# Kifaru Hunt Intake
|
|
96231
|
+
|
|
96232
|
+
Use this skill first when a security task is broad, ambiguous, multi-domain, or likely to turn into a live hunt. Read-only planning skill: it provides instructions only, it does not authorize activity by itself.
|
|
96233
|
+
|
|
96234
|
+
## Operating Contract
|
|
96235
|
+
|
|
96236
|
+
Keep the platform's system, operator, and safety prompts ahead of this skill. Preserve the authorization limits recorded for this run: in-scope assets, allowed actions, constraints, and proof limits. If scope or authorization is missing, stay passive: local artifact review, threat modeling, report drafting, or questions for the operator.
|
|
96237
|
+
|
|
96238
|
+
## Intake Flow
|
|
96239
|
+
|
|
96240
|
+
1. **Normalize the target.** Extract assets, repo paths, apps, packages, APIs, domains, accounts, cloud tenants, and environment assumptions. Separate confirmed facts from claims and missing data.
|
|
96241
|
+
2. **Build the trust map.** Identify principals, roles, tenants, tokens, object ownership, control/data plane boundaries, async workers, webhooks, external integrations, and admin/support paths.
|
|
96242
|
+
3. **Choose the narrowest next skill.** Web/API/SaaS/local source \u2192 \`kifaru-web-app-review\`; APK/IPA/mobile SDK \u2192 \`kifaru-mobile-app-review\`; IAM/cloud/Kubernetes \u2192 \`kifaru-cloud-identity-review\`; dependencies/CI/CD \u2192 \`kifaru-supply-chain-review\`; AI/ML/LLM/agent systems \u2192 \`kifaru-ai-agent-review\`; confirmed finding \u2192 \`kifaru-vulnerability-report\`.
|
|
96243
|
+
4. **Convert leads into theses** (see \`kifaru-hypothesis-engineering\`):
|
|
96244
|
+
- Invariant: the security rule that must hold.
|
|
96245
|
+
- Negative-space source: the overlooked state, role, parser, lifecycle step, cache, wrapper, or trust handoff.
|
|
96246
|
+
- Reachability: the exact role, endpoint, file, input, state, version, feature gate, or integration path.
|
|
96247
|
+
- Disproof plan: the fastest safe way to kill the idea.
|
|
96248
|
+
- Minimal proof: the smallest scoped evidence that confirms impact.
|
|
96249
|
+
- Impact ceiling: the strongest defensible impact without speculation.
|
|
96250
|
+
5. **Pick the first tool path.** Prefer \`read\`, \`grep\`, \`find\`, \`ls\` for local evidence; \`bash\` for controlled, scoped probes; the platform's governed hunt/file tools when available. Use current external context (\`webfetch\`/search) only when needed and allowed.
|
|
96251
|
+
|
|
96252
|
+
## Quality Gate
|
|
96253
|
+
|
|
96254
|
+
Do not call a lead a vulnerability until it has:
|
|
96255
|
+
|
|
96256
|
+
- A real security boundary.
|
|
96257
|
+
- Reachability from an in-scope starting point.
|
|
96258
|
+
- Evidence from source, config, request/response, logs, runtime behavior, or a minimal proof.
|
|
96259
|
+
- Passed the \`kifaru-verification-discipline\` checks.
|
|
96260
|
+
- Survived \`kifaru-claim-discipline\` wording before it appears in a report.
|
|
96261
|
+
` },
|
|
96262
|
+
{ dir: "kifaru-hypothesis-engineering", content: `---
|
|
96263
|
+
name: kifaru-hypothesis-engineering
|
|
96264
|
+
description: Use before testing any input or endpoint. Converts leads into falsifiable research theses with invariants, negative-space sources, reachability, disproof plans, and minimal proof, so hunting is intent-driven instead of checklist-driven.
|
|
96265
|
+
---
|
|
96266
|
+
|
|
96267
|
+
# Kifaru Hypothesis Engineering
|
|
96268
|
+
|
|
96269
|
+
Hunting is a series of **falsifiable experiments**, not a checklist. A thesis that cannot be killed cheaply is not ready to test. This skill carries the hypothesis discipline from the opencode \`HypothesisEngine\` into the Pi runtime.
|
|
96270
|
+
|
|
96271
|
+
## Thesis Template
|
|
96272
|
+
|
|
96273
|
+
For every candidate, write one line each:
|
|
96274
|
+
|
|
96275
|
+
1. **Invariant** \u2014 the security rule that must hold if the system is safe (e.g., "a tenant can only read objects it owns", "a token from user A cannot mint user B sessions").
|
|
96276
|
+
2. **Negative-space source** \u2014 the overlooked state/role/parser/lifecycle step/cache/wrapper/trust handoff where the invariant is most likely broken (e.g., "IDOR in the CSV export path, not the JSON one").
|
|
96277
|
+
3. **Reachability** \u2014 the exact role, endpoint, file, input, state, version, feature gate, or integration path that reaches the source.
|
|
96278
|
+
4. **Disproof plan** \u2014 the fastest safe way to kill the idea (e.g., "call as tenant B, get empty list \u2192 dead").
|
|
96279
|
+
5. **Minimal proof** \u2014 the smallest scoped evidence that would confirm impact (e.g., "tenant B sees tenant A's object name in export").
|
|
96280
|
+
6. **Impact ceiling** \u2014 the strongest defensible impact without speculation (e.g., "cross-tenant read of one object", NOT "full database dump").
|
|
96281
|
+
|
|
96282
|
+
## Rules
|
|
96283
|
+
|
|
96284
|
+
- **One thesis per probe.** A request that could confirm three theses confirms none; ambiguity is how false positives get born.
|
|
96285
|
+
- **Test the cheapest kills first.** Cheap disproof beats deep exploitation. Prioritize theses by (cost to kill) \xD7 (impact ceiling).
|
|
96286
|
+
- **Record outcomes.** Every thesis ends in: confirmed, dead, or obstructed \u2014 with the evidence. Obstructed theses feeding \`kifaru-coverage-method\` justifications.
|
|
96287
|
+
- **No novelty for its own sake.** Escalate technique only when a conventional test is disproven AND the target hasn't seen that class (see \`kifaru-playbook-waf-bypass\`).
|
|
96288
|
+
- **Reuse playbooks.** For known classes, open the matching playbook (\`kifaru-playbook-idor\`, \`business-logic\`, \`race-condition\`, \`graphql\`, \`auth-flow\`, \`waf-bypass\`) and adapt its checks into theses for THIS target, not verbatim scans.
|
|
96289
|
+
|
|
96290
|
+
## Anti-Patterns
|
|
96291
|
+
|
|
96292
|
+
- Blind fuzzing without an invariant.
|
|
96293
|
+
- "Let's try every payload in the list" as a first move.
|
|
96294
|
+
- Confirming a symptom without the boundary ("we got 500s, could be anything").
|
|
96295
|
+
- Testing out of reachability scope.
|
|
96296
|
+
` },
|
|
96297
|
+
{ dir: "kifaru-playbook-auth-flow", content: `---
|
|
96298
|
+
name: kifaru-playbook-auth-flow
|
|
96299
|
+
description: "Use when testing authentication and session flows: login, password reset, account recovery, OAuth/SSO callbacks, session issuance, MFA, and token handling. Covers flow-level flaws code review often misses."
|
|
96300
|
+
---
|
|
96301
|
+
|
|
96302
|
+
# Auth-Flow Playbook
|
|
96303
|
+
|
|
96304
|
+
Carries the opencode \`auth-flow-hunter\` methodology into the Pi runtime. Auth flaws live in the _sequence_ of a flow, not in one endpoint \u2014 every check names the flow invariant first.
|
|
96305
|
+
|
|
96306
|
+
## Flow Invariants to Name
|
|
96307
|
+
|
|
96308
|
+
- Login: "only a valid credential pair issues a session for that identity".
|
|
96309
|
+
- Reset/recovery: "the recovery proof (token/code) is single-use, bound to the account, and issued to the owner's channel".
|
|
96310
|
+
- OAuth/SSO: "the callback validates state, nonce, and binds the returned identity to the session that started the flow".
|
|
96311
|
+
- MFA: "a second factor is required for the whole session, not bypassable by a different path".
|
|
96312
|
+
- Session: "a session can only act as its own identity; revocation takes effect".
|
|
96313
|
+
|
|
96314
|
+
## Thesis Sources
|
|
96315
|
+
|
|
96316
|
+
1. **Reset-flow split-brain**: the token is checked in one endpoint but the account is changed in another; IDOR on \`user_id\` in the reset/verify call; token valid for any account (bound to mailbox but not account).
|
|
96317
|
+
2. **Recovery channel mixups**: email vs SMS vs backup codes accept each other's proofs; recovery answers (security questions) replace the password without re-proof.
|
|
96318
|
+
3. **OAuth/SSO callback flaws**: missing/wrong \`state\`/\`nonce\` validation, identity claimed from token without signature/issuer validation, "login as" driven by a client-supplied identity claim, mixed OAuth providers on one callback.
|
|
96319
|
+
4. **Session issuance bypass**: login sets pre-auth cookie privileges; \`POST /login\` accepts a stale session flag; remember-me tokens not rotated after password change; parallel session limit gaps.
|
|
96320
|
+
5. **MFA bypass paths**: an API endpoint that sets the auth cookie without the second factor; MFA checked on web but not on mobile/API; MFA prompt answerable with a different factor; time-based code not tied to the session.
|
|
96321
|
+
6. **Password change/re-auth**: "change password" without current password re-proof (token-bearing path), logout not revoking tokens, orphaned OAuth-linked accounts.
|
|
96322
|
+
|
|
96323
|
+
## Method
|
|
96324
|
+
|
|
96325
|
+
- Walk the full flow happy-path once, capturing every request (this is the control and the flow map).
|
|
96326
|
+
- Attack each transition's _proof of identity_ (which evidence is tested at which step) and _binding_ (is that evidence bound to the account/session being changed?).
|
|
96327
|
+
- Control group: run the flow as the account owner; experiment: substitute another account's context at the vulnerable step.
|
|
96328
|
+
- Verify 3/3 and check contextuality (is the flow reachable in prod topology? does the token actually survive to the sensitive step?).
|
|
96329
|
+
|
|
96330
|
+
## Traps
|
|
96331
|
+
|
|
96332
|
+
- Client-side flow constraints: flip steps/params in the raw request; the UI is not the protocol.
|
|
96333
|
+
- Never actually take over a real account: prove the primitive against your own test accounts, or demonstrate the exact step (token accepted for another account, state not validated) without completing the takeover.
|
|
96334
|
+
- Tokens in logs/history: capture only what is needed; redact per \`kifaru-claim-discipline\`.
|
|
96335
|
+
|
|
96336
|
+
Evidence to keep: the flow request sequence, the vulnerable step's request/response, the control and experiment outcomes, and the precise invariant violated.
|
|
96337
|
+
` },
|
|
96338
|
+
{ dir: "kifaru-playbook-business-logic", content: `---
|
|
96339
|
+
name: kifaru-playbook-business-logic
|
|
96340
|
+
description: Use when testing workflows, state machines, and price/quantity/step logic. Covers broken workflow ordering, state confusion, duplicate/concurrent submits, quota and pricing bypasses, and voucher/coupon logic.
|
|
96341
|
+
---
|
|
96342
|
+
|
|
96343
|
+
# Business Logic Playbook
|
|
96344
|
+
|
|
96345
|
+
Carries the opencode \`business-logic-hunter\` methodology into the Pi runtime. Business logic bugs violate the invariant of a _process_, not a component \u2014 so each check starts by naming the process invariant.
|
|
96346
|
+
|
|
96347
|
+
## Process Invariants to Name
|
|
96348
|
+
|
|
96349
|
+
- Order/payment/refund: "a refund is only issued for a paid, owned order, once".
|
|
96350
|
+
- Onboarding/KYC: "identity evidence is submitted before verification, state is monotonic".
|
|
96351
|
+
- Quota/billing: "usage is decremented only on successful consumption".
|
|
96352
|
+
- Vouchers/referrals: "a code is single-use, per-eligible-account, within validity".
|
|
96353
|
+
- Transfers: "source balance is debited atomically with credit".
|
|
96354
|
+
|
|
96355
|
+
## Common Broken-Invariant Sources (theses)
|
|
96356
|
+
|
|
96357
|
+
1. **State-machine splitting**: the same workflow reachable via different entrypoints (mobile vs web vs API) whose state transitions are not shared. Submit in app A, mutate in app B.
|
|
96358
|
+
2. **Step reordering**: skip ahead (pay-without-address, ship-without-payment), go back (re-enter earlier state after a grant), replay a terminal state's callback (webhook replay).
|
|
96359
|
+
3. **Idempotency abuse**: retry a charge/transfer with the same id after partial failure; race the contention window (see \`kifaru-playbook-race-condition\` for the concurrency mechanics).
|
|
96360
|
+
4. **Integer/rounding seams**: fractional quantities, negative quantities, price overrides in client payloads that reach the server, currency conversion drift.
|
|
96361
|
+
5. **Entitlement vs usage split**: plan gates checked at purchase but enforced per-request elsewhere (or vice versa), so a downgrade leaves old permissions live.
|
|
96362
|
+
6. **Referral/voucher logic**: self-referral, reusing own code, applied to ineligible item/tenant, redeemed twice via two sessions, expiry bypass by clock tampering (if server trusts client time \u2014 flag, don't rely on it).
|
|
96363
|
+
|
|
96364
|
+
## Method
|
|
96365
|
+
|
|
96366
|
+
For each invariant: write the disproof experiment (\`kifaru-hypothesis-engineering\`), run the control group (happy path first \u2014 prove the happy path works exactly once), then the attack sequence. Business logic findings are stateful: capture the full request sequence and the differing final state as evidence.
|
|
96367
|
+
|
|
96368
|
+
## Traps
|
|
96369
|
+
|
|
96370
|
+
- "It's by design" \u2014 distinguish intended flexibility from violated invariant by naming the invariant in the report.
|
|
96371
|
+
- Server-side truth: never claim a pricing bypass from a client-side response alone; prove the state change server-side (ledger, receipt, quota counter).
|
|
96372
|
+
- Escalation guardrails: stop at minimal proof (a single successful unauthorized state change); never chain into mass fund movement or destructive cleanup (see \`kifaru-claim-discipline\` \u2014 prove the primitive, then STOP).
|
|
96373
|
+
` },
|
|
96374
|
+
{ dir: "kifaru-playbook-graphql", content: `---
|
|
96375
|
+
name: kifaru-playbook-graphql
|
|
96376
|
+
description: Use when the target exposes a GraphQL endpoint (often /graphql, /gql, /api/v2/graphql, GET-variant, or batched). Covers introspection abuse, query depth/complexity/batching abuse, field-level authorization gaps, and union/alias leaks.
|
|
96377
|
+
---
|
|
96378
|
+
|
|
96379
|
+
# GraphQL Playbook
|
|
96380
|
+
|
|
96381
|
+
Carries the opencode \`graphql-hunter\` methodology into the Pi runtime. GraphQL concentrates many authorization and DoS risks into one endpoint; the negative-space source is usually "the resolver trusts the field path, not the data owner".
|
|
96382
|
+
|
|
96383
|
+
## Discovery Theses
|
|
96384
|
+
|
|
96385
|
+
1. **Endpoint & transport variants**: \`POST /graphql\`, \`GET /graphql?query=\` (also CSRF-able), alternate paths and version prefixes, websocket subscriptions, and \`application/graphql\` content type. Test the GET variant as a CSRF vector if state-changing mutations exist.
|
|
96386
|
+
2. **Introspection**: \`{ __schema { types { name fields { name args { name type { name kind ofType { name } } } } } } }\` \u2014 enabled introspection leaks the entire data model. Record it as an observation; use it to map field-level boundaries.
|
|
96387
|
+
3. **Batching & aliasing**: multiple operations or aliased copies of one operation in a single request. This defeats per-request authz that checks the "operation", and multiplies any per-resolver issue.
|
|
96388
|
+
4. **Field-level access control**: the schema surface includes fields the top-level resource authz never checks (owner email vs notes; user vs internal fields; union member objects). Test each sensitive field against the wrong identity.
|
|
96389
|
+
5. **Depth/complexity abuse**: deeply nested fragments and duplicate fields to drive resolver cost (DoS/financial abuse). Only probe to the minimal proof that cost limits are absent; do not hammer.
|
|
96390
|
+
|
|
96391
|
+
## Method
|
|
96392
|
+
|
|
96393
|
+
- Introspect \u2192 derive the full field graph \u2192 annotate trust boundaries from the source/API docs (\`kifaru-source-analysis\`).
|
|
96394
|
+
- For each boundary: query the field as the object's owner (control) and as a foreign identity (experiment) \u2014 the IDOR method applies per _field_, not per _resource_.
|
|
96395
|
+
- Test mutations with the business-logic invariants: state transitions, voucher/transfer mutations, file-upload-like mutations (\`createUploadUrl\`), and email/account takeover chains.
|
|
96396
|
+
- Aliasing: same mutation twice under two aliases in one request to leak or double-execute.
|
|
96397
|
+
|
|
96398
|
+
## Traps
|
|
96399
|
+
|
|
96400
|
+
- Introspection on = informational, not a finding by itself; report it as hardening (disable in prod) with the evidence showing it.
|
|
96401
|
+
- Query depth/batching tests must respect the platform's rate limits and stay minimal-proof; never construct an actual resource-exhaustion attack beyond demonstrating the absence of a limit (with operator approval for that if material).
|
|
96402
|
+
- Field-level gaps need the same 5-check discipline: control group, 3/3, contextual (is the field reachable in production topology?).
|
|
96403
|
+
|
|
96404
|
+
GraphQL reports benefit from the schema diff: show the vulnerable field path, the query used, and the differing response vs. the control identity.
|
|
96405
|
+
` },
|
|
96406
|
+
{ dir: "kifaru-playbook-idor", content: `---
|
|
96407
|
+
name: kifaru-playbook-idor
|
|
96408
|
+
description: Use when testing authorization boundaries and object access. Covers IDOR and cross-tenant access across JSON/CSV/export paths, batch APIs, webhooks, and indirect references, with control-group methodology.
|
|
96409
|
+
---
|
|
96410
|
+
|
|
96411
|
+
# IDOR / Broken Object-Level Authorization Playbook
|
|
96412
|
+
|
|
96413
|
+
Carries the opencode \`idor-hunter\` methodology into the Pi runtime. **Method, not checklist**: adapt each check into theses for this target (\`kifaru-hypothesis-engineering\`).
|
|
96414
|
+
|
|
96415
|
+
## Boundary Map First
|
|
96416
|
+
|
|
96417
|
+
- Every endpoint taking an object reference: path params, query, body fields, nested resources, export/batch variants.
|
|
96418
|
+
- Which identity is the caller and which tenant/account owns the object? (From \`kifaru-recon-intelligence\` trust map.)
|
|
96419
|
+
|
|
96420
|
+
## Theses to Build (most common negative-space sources)
|
|
96421
|
+
|
|
96422
|
+
1. **The export/download path differs from the fetch path.** Object IDs validated in \`GET /api/items/:id\` are often trusted in \`GET /export?id=\` or CSV/report generators. Test every object-bearing endpoint's _other formats_.
|
|
96423
|
+
2. **Batch / bulk operations trust the caller's references.** \`POST /import\`, \`POST /batch\`, \`DELETE /items[]\`, webhook deliveries \u2014 arrays skip per-item authorization.
|
|
96424
|
+
3. **Indirect references**: hashes (predictable, reversible, or from a known sequential source), tokens, filenames, \`id\` reused across resources \u2014 enumerate and test the reference scheme itself.
|
|
96425
|
+
4. **State mutations leak reads**: \`PATCH\`, status transitions, and workflows (approve/reject) return the parent object's data on success/error, leaking fields the direct GET would hide.
|
|
96426
|
+
5. **Tenant-selection headers**: \`X-Tenant\`, \`Host\`, subdomain isolation vs header isolation \u2014 test whether the object namespace is enforced consistently across both.
|
|
96427
|
+
6. **UUID\u2192integer downgrades**: some code paths accept both; the integer path may skip ownership checks.
|
|
96428
|
+
|
|
96429
|
+
## Control-Group Method (required for VERIFIED)
|
|
96430
|
+
|
|
96431
|
+
For each thesis, the **control** is the same call as a properly-authorized identity (or the same call with your own object):
|
|
96432
|
+
|
|
96433
|
+
- Experimental: call as identity B on object owned by A \u2192 observe data A-owned.
|
|
96434
|
+
- Control: call as identity A on A's object \u2192 passes; call as B on a B object \u2192 passes.
|
|
96435
|
+
- The finding is the _difference_, verified 3/3 (\`kifaru-verification-discipline\`).
|
|
96436
|
+
|
|
96437
|
+
## Traps
|
|
96438
|
+
|
|
96439
|
+
- Client-side filtering (data returned but filtered in UI) \u2014 read raw responses.
|
|
96440
|
+
- Symmetric multi-tenancy by design (shared lists are features; document as observation).
|
|
96441
|
+
- IDs you generated yourself \u2014 find the other-tenant instance, prove cross-identity, not just cross-object-you-created.
|
|
96442
|
+
- Caching: a 200 with A's data may be a shared cache artifact \u2014 vary the object and identity to prove binding.
|
|
96443
|
+
|
|
96444
|
+
Record every cell reached as clean or verified in \`kifaru-coverage-method\`; blocked cells (auth wall on object enumeration) become pivot attempts, never silence.
|
|
96445
|
+
` },
|
|
96446
|
+
{ dir: "kifaru-playbook-race-condition", content: `---
|
|
96447
|
+
name: kifaru-playbook-race-condition
|
|
96448
|
+
description: Use when a resource or state transition is shared across requests, especially money movement, redemption, account creation, or contention-prone checks-and-actseams. Covers TOCTOU races with control-group methodology and safe concurrency.
|
|
96449
|
+
---
|
|
96450
|
+
|
|
96451
|
+
# Race Condition Playbook
|
|
96452
|
+
|
|
96453
|
+
Carries the opencode \`race-condition-hunter\` methodology into the Pi runtime. A race is a **check-then-act** seam where two interleavings produce different state. Candidates: redeem-voucher, transfer/withdraw, create-then-claim username/email, quota decrement, signup bonus, idempotency-keyed endpoints.
|
|
96454
|
+
|
|
96455
|
+
## Find the Seam First (theses)
|
|
96456
|
+
|
|
96457
|
+
1. **Check and act are separate statements** (balance \u2265 amount; then debit; redeem valid; then mark used) with no locking or unique constraint visible.
|
|
96458
|
+
2. **Idempotency key reuse**: an endpoint that claims idempotency but computes the idempotency _state_ after the side effect, or only dedupes on success.
|
|
96459
|
+
3. **Client can fan out the race**: same request body with different (or same) request IDs fired in parallel \u2014 if dedup is by request-id and the check precedes the write, parallel distinct ids pass.
|
|
96460
|
+
4. **Read-then-write on a row with no version**: profile update, counter increment, status transition from the same initial state.
|
|
96461
|
+
|
|
96462
|
+
## Method
|
|
96463
|
+
|
|
96464
|
+
1. **Baseline the happy path** once: confirm the check passes and the act commits exactly once.
|
|
96465
|
+
2. **Serial retry**: same request N times sequentially \u2014 confirms idempotency claim and gives the serial baseline.
|
|
96466
|
+
3. **Parallel fan-out** (the race): fire the same effective operation concurrently \u2014 same id and distinct ids, both in small bursts (the contention window is usually tiny; bursts of 5-20 by tiny scripted delay ranges beat naive "all at once").
|
|
96467
|
+
4. **Observe the ledger**: count redemptions/debits/creations server-side after calming down. The finding is the _difference_: parallel count > serial count for the same inputs.
|
|
96468
|
+
5. **Reproduce 3/3** with a fresh state each time (\`kifaru-verification-discipline\`).
|
|
96469
|
+
|
|
96470
|
+
## Safety & Ethics
|
|
96471
|
+
|
|
96472
|
+
- Scope strictly: only the race on the _material_ state transition, minimal proof (e.g., one extra redemption, a second username claim), then STOP.
|
|
96473
|
+
- Respect rate limits and platform rules; concurrency bursts must stay within the assessment's allowed volume. Never race for financial gain beyond the proof.
|
|
96474
|
+
- If the platform has a bug-bounty defined race policy (e.g., "single repeated logical unit"), follow it.
|
|
96475
|
+
|
|
96476
|
+
## Evidence
|
|
96477
|
+
|
|
96478
|
+
Capture: the request payload(s) used, the concurrency strategy (count \xD7 timing), the serial-baseline count, the parallel count, and the server-side state rows proving the difference. This evidence must survive the 5-check pyramid and the claim discipline (impact = "one extra redemption of a single-use code", not "unlimited fraud").
|
|
96479
|
+
` },
|
|
96480
|
+
{ dir: "kifaru-playbook-waf-bypass", content: `---
|
|
96481
|
+
name: kifaru-playbook-waf-bypass
|
|
96482
|
+
description: Use when a WAF, challenge wall, or signature-based filter blocks testing or when standard payloads are being filtered. Escalates technique only after a conventional test is disproven, with methodology for encoding, normalization, and parser differentials.
|
|
96483
|
+
---
|
|
96484
|
+
|
|
96485
|
+
# WAF / Filter Bypass Playbook
|
|
96486
|
+
|
|
96487
|
+
Carries the opencode \`waf-bypass\` / \`cloudflare-bypass\` methodology into the Pi runtime. **Bypass is an escalation, not a first move**: it applies when a specific thesis is otherwise blocked or when the filter itself is the target. Stay within the assessment's authorized actions (anti-bot evasion may itself be out of scope \u2014 check the program rules first).
|
|
96488
|
+
|
|
96489
|
+
## Read the Filter First
|
|
96490
|
+
|
|
96491
|
+
Characterize how the filter decides:
|
|
96492
|
+
|
|
96493
|
+
- Signature (regex/literal match) vs behavioral (rate/payload shape) vs challenge (JS/checkbox/CAPTCHA).
|
|
96494
|
+
- Where it inspects: path, headers, query, body, JSON keys vs values, multipart, gzip.
|
|
96495
|
+
- Double-decoding seams: the front proxy decodes once, the app decodes again (or on a different component: WAF on one field, app on another).
|
|
96496
|
+
|
|
96497
|
+
## Escalation Ladder (test each rung with the SAME thesis)
|
|
96498
|
+
|
|
96499
|
+
1. **Encoding/normalization**: URL-encode, UTF-8 overlong forms, Unicode homoglyphs, case, whitespace (tabs/newlines), parameter pollution (\`?a=1&a=payload\` \u2014 which value does the app take?). Compare filter vs app decoding.
|
|
96500
|
+
2. **Context splitting**: move the payload where inspection differs \u2014 JSON key vs value, header vs query, multipart filename vs content, cookie vs body, unparsed fragment (\`#\`-after, \`;\` params).
|
|
96501
|
+
3. **Parser differential (the big one)**: two ways to reach the same app logic with different filter-visible text. Dup-parameter behavior, nested JSON, malformed-but-accepted input (stray quotes/braces), content-type confusion, chunked/HTTP-smuggling-adjacent framing (only with explicit authorization \u2014 smuggling is high-risk; prefer framing variants that are still well-formed).
|
|
96502
|
+
4. **Challenges**: for JS/CAPTCHA challenge walls, the bypass is normally _not_ fighting the challenge (that's anti-bot evasion); instead find the same capability on an unchallenged route/API/legacy endpoint used by first-party clients. Testing that path is legitimate; bypassing the challenge itself usually is not.
|
|
96503
|
+
5. **Request-shape minification**: remove everything the filter keys on (drop headers the filter marks, use the minimal well-formed request the app accepts) \u2014 often all that's needed.
|
|
96504
|
+
|
|
96505
|
+
## Controlled Differential Method
|
|
96506
|
+
|
|
96507
|
+
For each rung: send the _filtered baseline_ (blocked response), then the variant (allowed response) **to the same endpoint**. The finding needs: the filter's decision on both, and the app's behavior on both. A variant that passes the filter but is rejected by the app is not a bypass.
|
|
96508
|
+
|
|
96509
|
+
## Traps
|
|
96510
|
+
|
|
96511
|
+
- Claiming bypass from the filter response alone \u2014 prove the app executed the payload (behavioral outcome), 3/3.
|
|
96512
|
+
- Anti-bot/challenge evasion beyond the authorized method is disallowed in most programs; when in doubt, surface it as an operator question.
|
|
96513
|
+
- Keep volume minimal: WAF tests generate lots of noise; throttle and spread requests, record the decisive pairs only.
|
|
96514
|
+
- Report the _mechanism_ (which normalization/parser seam), not just "got blocked \u2192 encoded \u2192 worked".
|
|
96515
|
+
|
|
96516
|
+
Evidence: the blocked request, the bypassing request, the app's differential outcome, and the filter component name. Straight to \`kifaru-verification-discipline\` (SKEPTICAL check: is the success actually attribute-shape mismatch, i.e., the filter never saw that endpoint?).
|
|
96517
|
+
` },
|
|
96518
|
+
{ dir: "kifaru-recon-intelligence", content: `---
|
|
96519
|
+
name: kifaru-recon-intelligence
|
|
96520
|
+
description: Use when starting reconnaissance or expanding attack surface on a target. Drives targeted recon decisions from target characteristics, detected defenses, and phase progression (passive to active) instead of running a fixed checklist of tools.
|
|
96521
|
+
---
|
|
96522
|
+
|
|
96523
|
+
# Kifaru Recon Intelligence
|
|
96524
|
+
|
|
96525
|
+
Reconnaissance must be **decision-driven, not tool-driven**. Every probe should answer a question that changes the next action. This skill converts the opencode \`ReconIntelligence\` decision system into run-time methodology for the Pi runtime.
|
|
96526
|
+
|
|
96527
|
+
## Operating Principles
|
|
96528
|
+
|
|
96529
|
+
1. **Characterize first.** Classify the target: web app, API, mobile, cloud control plane, network service, or supply chain. Extract stack, framework, version, auth model, and trust boundaries from source/artifacts before touching the network.
|
|
96530
|
+
2. **Detect defenses early.** Fingerprint WAF, rate limiting, challenge walls (Cloudflare), auth gates, and anomaly detection from response shapes and headers. Record them; they change tradecraft (see \`kifaru-playbook-waf-bypass\`).
|
|
96531
|
+
3. **Phase progression is one-way and reversible-by-justification:**
|
|
96532
|
+
- **Passive**: source review, artifact inspection, headers, certificate transparency, metadata, docs. No interaction with the live service beyond what normal browsing does.
|
|
96533
|
+
- **Active, low-noise**: non-destructive requests, fingerprinting, option scanning, error probing at low rate.
|
|
96534
|
+
- **Active, directed**: only endpoints/inputs that a passive phase implicated. Never broad fuzzing of everything.
|
|
96535
|
+
- **Exploit validation**: only after a specific, reachable hypothesis exists and the plan survives disproof (see \`kifaru-hypothesis-engineering\`).
|
|
96536
|
+
4. **Each phase must produce a decision input**: a trust map update, a defense signature, a candidate input surface, or a falsifiable thesis. If a probe cannot change a decision, don't run it.
|
|
96537
|
+
|
|
96538
|
+
## Attack-Surface Expansion
|
|
96539
|
+
|
|
96540
|
+
From the trust map (intake), enumerate laterally:
|
|
96541
|
+
|
|
96542
|
+
- Alternate entry points: admin paths, API versions, health/debug endpoints, websockets, webhooks, file/media flows, async workers, mobile deep links / IPC.
|
|
96543
|
+
- Cross-tenant seams: object ownership, tenant headers, IDs in URLs/params, shared services, account impersonation, import/export paths.
|
|
96544
|
+
- Support paths: password reset, account recovery, support impersonation, rate-limit counters, audit logs, backup/recovery endpoints.
|
|
96545
|
+
- Integration surfaces: OAuth flows, SSO callbacks, webhook receivers, outbound integrations, SDK key material.
|
|
96546
|
+
|
|
96547
|
+
## Tradecraft Profile
|
|
96548
|
+
|
|
96549
|
+
Maintain and replay a compact profile:
|
|
96550
|
+
|
|
96551
|
+
\`\`\`
|
|
96552
|
+
target_class, stack, version_evidence
|
|
96553
|
+
defenses_seen (waf: n|y + flavor, rate_limit: n|y, auth: kind, challenge: n|y)
|
|
96554
|
+
passive_findings (boundaries, secrets-in-repo, version hints)
|
|
96555
|
+
candidate_inputs (endpoint \xD7 input \xD7 state, with the negative-space source)
|
|
96556
|
+
phase (passive | active-low | active-directed | exploit-validation)
|
|
96557
|
+
open_theses (link to kifaru-hypothesis-engineering)
|
|
96558
|
+
\`\`\`
|
|
96559
|
+
|
|
96560
|
+
## Handoff
|
|
96561
|
+
|
|
96562
|
+
Finish recon by naming: (1) the expanded trust map, (2) the ranked input surface with negative-space sources, (3) defenses and the tradecraft adjustments, (4) the top falsifiable theses ready for \`kifaru-hypothesis-engineering\`. Silence is a finding too: record surfaces examined and found clean so coverage can be reported honestly (see \`kifaru-coverage-method\`).
|
|
96563
|
+
` },
|
|
96564
|
+
{ dir: "kifaru-source-analysis", content: `---
|
|
96565
|
+
name: kifaru-source-analysis
|
|
96566
|
+
description: "Use for code, configuration, and artifact review before active testing. Applies the static-first discipline of the opencode code-analyzer and heuristic-scanner: find candidate inputs, secrets, trust boundaries, and version hints from source so live testing is targeted."
|
|
96567
|
+
---
|
|
96568
|
+
|
|
96569
|
+
# Kifaru Source Analysis
|
|
96570
|
+
|
|
96571
|
+
Source and artifacts are the cheapest reconnaissance. Analyze before probing; the analysis produces the input surface and version evidence that active phases consume (\`kifaru-recon-intelligence\`).
|
|
96572
|
+
|
|
96573
|
+
## Passes
|
|
96574
|
+
|
|
96575
|
+
1. **Trust boundaries pass.** Map where untrusted input crosses into trusted code: parsers, deserializers, template renderers, SQL/query builders, file paths, shell-invoking helpers, SSRF-prone fetchers, crypto/key handling, auth checks, and tenant-scoping helpers. Name each boundary and every input reaching it.
|
|
96576
|
+
2. **Secret & key-material pass.** Search for keys, tokens, credentials, JWTs, cloud roles, signing keys in source, configs, env templates, lockfiles, CI, and history. Record the _class_ and where it leaks; never paste full secrets into notes (redact to a prefix).
|
|
96577
|
+
3. **Version & dependency pass.** Capture server/package versions from manifests (\`package.json\`, \`go.mod\`, \`Dockerfile\`, lockfiles, \`Server\` headers) and match them to known-affected versions. This is the evidence \`kifaru-claim-discipline\` needs for CVE claims.
|
|
96578
|
+
4. **Candidate input pass.** Enumerate endpoints, handlers, routes, controllers, CLI entrypoints, mobile deep links / IPC, and file-format handlers with their inputs and auth context \u2014 the reachability rows for \`kifaru-hypothesis-engineering\`.
|
|
96579
|
+
5. **Config pass.** Flag debug/admin surfaces, permissive CORS, missing security headers, weak cookie flags, post-mortem/default credentials, exposed internal URLs, and non-production features gated only by config.
|
|
96580
|
+
|
|
96581
|
+
## Heuristics (fast wins, not conclusions)
|
|
96582
|
+
|
|
96583
|
+
- Handler asymmetry: the export path differs from the fetch path; the webhook skips the auth middleware; the batch API trusts the caller's tenant.
|
|
96584
|
+
- Trusted-input copy-paste: an internal helper used with attacker-controlled data.
|
|
96585
|
+
- Version mismatch between banner and dependency manifest (a claim-discipline trap).
|
|
96586
|
+
- Dead code that still routes (hidden endpoints).
|
|
96587
|
+
- Parser split-brain: two parsers for the same content (see playbooks for dup-parser attacks).
|
|
96588
|
+
- Defaults that differ between envs (dev secret rotation off in prod).
|
|
96589
|
+
|
|
96590
|
+
## Output
|
|
96591
|
+
|
|
96592
|
+
One note per strong candidate: boundary + source line + negative-space insight + minimal proof plan. Do not finish with a list of TODOs; finish with ranked theses for active testing, and version/secret evidence for the report. Cells examined and clean go into \`kifaru-coverage-method\` as \`TESTED_SAFE\`.
|
|
96593
|
+
` },
|
|
96594
|
+
{ dir: "kifaru-verification-discipline", content: `---
|
|
96595
|
+
name: kifaru-verification-discipline
|
|
96596
|
+
description: Use before any finding is recorded or reported. Applies the 5-check verification pyramid and 3-strike reproducibility rule so every confirmed finding survives triage with zero false positives.
|
|
96597
|
+
---
|
|
96598
|
+
|
|
96599
|
+
# Kifaru Verification Discipline
|
|
96600
|
+
|
|
96601
|
+
Every finding must pass the **5-check verification pyramid** before it is recorded as confirmed. A finding that cannot pass is demoted to an observation or dropped. This skill carries the opencode \`VerificationLayer\` / \`enhanced-verifier\` discipline into the Pi runtime as a checklist the model applies to its own work (the mechanical gates live in the \`kifaru_proof_gate\` extension).
|
|
96602
|
+
|
|
96603
|
+
## The 5-Check Pyramid (ALL must pass)
|
|
96604
|
+
|
|
96605
|
+
1. **DIFFERENTIAL** \u2014 the exploit behavior differs from a clean baseline. Run the same request/action against the control (safe input, baseline object, known-good state); you must see a difference attributable to the vulnerability, not noise.
|
|
96606
|
+
2. **REPRODUCIBLE** \u2014 the primitive reproduces consistently (3/3 attempts on identical state). One lucky run is a hint, not a finding.
|
|
96607
|
+
3. **IMPACTFUL** \u2014 there is real security impact: crossing a trust boundary, accessing unauthorized data, altering state, or degrading availability. "Interesting error message" is not impact.
|
|
96608
|
+
4. **SKEPTICAL** \u2014 you actively look for alternative explanations: default behavior, intended feature, rate-limit artifact, cache, client-side-only issue, previous state leak, or a test artifact of your own tooling. If an alternative survives, the finding does not.
|
|
96609
|
+
5. **CONTEXTUAL** \u2014 the finding makes sense given target context: the component is reachable in production topology, the affected version is the running version, the feature is actually enabled, and the impact chain does not require assumptions you cannot support.
|
|
96610
|
+
|
|
96611
|
+
## 3-Strike Rule
|
|
96612
|
+
|
|
96613
|
+
For exploit-type findings: attempt reproduction three times independently (fresh state where possible). \`verified\` requires \u22653 consistent confirmations; a single failure with a plausible flake explanation is allowed only with the reason recorded. Two failures \u2192 the finding is \`inconclusive\`, not confirmed.
|
|
96614
|
+
|
|
96615
|
+
## Proof Requirements by Class (evidence you must hold)
|
|
96616
|
+
|
|
96617
|
+
- **Injection / traversal / RCE-like**: the actual content that crossed the boundary (output, file content, code exec).
|
|
96618
|
+
- **IDOR / access control**: the cross-boundary object shown to the wrong identity + the same call as a control that fails.
|
|
96619
|
+
- **CSRF / state change**: request that changed state + evidence the change happened server-side.
|
|
96620
|
+
- **Secrets / data exposure**: the secret class shown, never the full secret in the report.
|
|
96621
|
+
- **Race / logic**: sequence of requests + the differing outcome vs. serialized baseline.
|
|
96622
|
+
|
|
96623
|
+
## Reporting Handoff
|
|
96624
|
+
|
|
96625
|
+
Findings that pass move to \`kifaru-vulnerability-report\`; wording must then survive \`kifaru-claim-discipline\` (the two skills are complementary: verification proves, claims word what was proven). Findings that fail are demoted to coverage ledger entries (\`kifaru-coverage-method\`) or dropped, never carried forward as "maybe".
|
|
96626
|
+
` },
|
|
96627
|
+
{ dir: "kifaru-vulnerability-report", content: `---
|
|
96628
|
+
name: kifaru-vulnerability-report
|
|
96629
|
+
description: Use when Kifaru has verified notes, code references, HTTP captures, logs, screenshots, tests, or proof artifacts and needs a concise disclosure-ready vulnerability report with invariant, root cause, exploitability, impact, severity reasoning, remediation, and regression tests.
|
|
96630
|
+
---
|
|
96631
|
+
|
|
96632
|
+
# Kifaru Vulnerability Report
|
|
96633
|
+
|
|
96634
|
+
Turns verified hunt output into a single, replayable, disclosure-ready report. Input: the coverage ledger, the verified findings, and their minimal proofs. Output: one report document that survives triage because every claim is bottom-up.
|
|
96635
|
+
|
|
96636
|
+
## Per-Finding Structure
|
|
96637
|
+
|
|
96638
|
+
1. **Title** \u2014 primitive + affected component (no unverified CVE in the title).
|
|
96639
|
+
2. **Invariant violated** \u2014 the security rule that should have held.
|
|
96640
|
+
3. **Root cause** \u2014 the exact flaw (code path / config / design gap) with reference.
|
|
96641
|
+
4. **Proof of concept** \u2014 raw request/response or exact commands a reader can replay from scratch. Include only the necessary requests; strip session tokens; redact PII uniformly.
|
|
96642
|
+
5. **Exploitation** \u2014 atomic steps, each one observable, preconditions stated (auth state, role, interaction). No step that says "trigger the vulnerability".
|
|
96643
|
+
6. **Impact** \u2014 bottom-up from the PoC: what was actually read/changed/executed and at what privilege. No speculation.
|
|
96644
|
+
7. **Severity** \u2014 CVSS 3.1 base vector, each metric justified by the evidence.
|
|
96645
|
+
8. **Remediation** \u2014 specific fix (patch, config, design change); regression test.
|
|
96646
|
+
|
|
96647
|
+
## Discipline Before Writing
|
|
96648
|
+
|
|
96649
|
+
- Every finding has passed \`kifaru-verification-discipline\` (5-check + 3-strike).
|
|
96650
|
+
- Language follows \`kifaru-claim-discipline\` (no could/may/potentially; base metrics only; CVE\u2194version consistent; secrets masked).
|
|
96651
|
+
- Scope: every origin exercised is inside the attested set, or explicitly flagged.
|
|
96652
|
+
- Run the report through the \`kifaru_report_lint\` extension; publish nothing that fails lint without an operator override.
|
|
96653
|
+
|
|
96654
|
+
## Report-Writing Order (per finding)
|
|
96655
|
+
|
|
96656
|
+
Description \u2192 Vulnerability discovery \u2192 Proof of Concept \u2192 Exploitation \u2192 Impact \u2192 Remediation (optional) \u2192 References (optional).
|
|
96657
|
+
|
|
96658
|
+
Then: an executive summary that claims exactly what the per-finding sections prove \u2014 no more, no less. Prove the primitive, then STOP: no mass exfiltration or destructive post-exploitation to "demonstrate" impact.
|
|
96659
|
+
` }
|
|
96660
|
+
];
|
|
96661
|
+
|
|
96662
|
+
// ../core/src/skills/embedded-skills.ts
|
|
96663
|
+
function kifaruSkillsRoot() {
|
|
96664
|
+
if (process.env.KIFARU_SKILLS_DIR)
|
|
96665
|
+
return path.resolve(process.env.KIFARU_SKILLS_DIR);
|
|
96666
|
+
const xdg = process.env.XDG_DATA_HOME || path.join(os.homedir(), ".local", "share");
|
|
96667
|
+
return path.join(xdg, "kifaru", "skills");
|
|
96668
|
+
}
|
|
96669
|
+
function materializeKifaruSkills(root = kifaruSkillsRoot(), skills = EMBEDDED_KIFARU_SKILLS) {
|
|
96670
|
+
let wroteAny = false;
|
|
96671
|
+
let anyPresent = false;
|
|
96672
|
+
for (const skill of skills) {
|
|
96673
|
+
const dir = path.join(root, skill.dir);
|
|
96674
|
+
const file = path.join(dir, "SKILL.md");
|
|
96675
|
+
try {
|
|
96676
|
+
const existing = fs.existsSync(file) ? fs.readFileSync(file, "utf8") : undefined;
|
|
96677
|
+
if (existing !== skill.content) {
|
|
96678
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
96679
|
+
fs.writeFileSync(file, skill.content);
|
|
96680
|
+
wroteAny = true;
|
|
96681
|
+
}
|
|
96682
|
+
anyPresent = true;
|
|
96683
|
+
} catch {}
|
|
96684
|
+
}
|
|
96685
|
+
return anyPresent ? root : null;
|
|
96686
|
+
}
|
|
96148
96687
|
// ../core/src/sandbox/mock-sandbox.ts
|
|
96149
96688
|
class MockSandboxSession {
|
|
96150
96689
|
options;
|
|
@@ -96183,19 +96722,19 @@ class MockSandboxSession {
|
|
|
96183
96722
|
durationMs: Date.now() - started
|
|
96184
96723
|
};
|
|
96185
96724
|
}
|
|
96186
|
-
async readFile(
|
|
96725
|
+
async readFile(path2) {
|
|
96187
96726
|
if (this.isClosed)
|
|
96188
96727
|
throw new Error("Sandbox session is closed");
|
|
96189
|
-
const content = this.files.get(
|
|
96728
|
+
const content = this.files.get(path2);
|
|
96190
96729
|
if (content === undefined) {
|
|
96191
|
-
throw new Error(`File not found: ${
|
|
96730
|
+
throw new Error(`File not found: ${path2}`);
|
|
96192
96731
|
}
|
|
96193
96732
|
return content;
|
|
96194
96733
|
}
|
|
96195
|
-
async writeFile(
|
|
96734
|
+
async writeFile(path2, content) {
|
|
96196
96735
|
if (this.isClosed)
|
|
96197
96736
|
throw new Error("Sandbox session is closed");
|
|
96198
|
-
this.files.set(
|
|
96737
|
+
this.files.set(path2, content);
|
|
96199
96738
|
}
|
|
96200
96739
|
async close() {
|
|
96201
96740
|
this.isClosed = true;
|
|
@@ -97614,10 +98153,10 @@ function mergeDefs(...defs) {
|
|
|
97614
98153
|
function cloneDef(schema) {
|
|
97615
98154
|
return mergeDefs(schema._zod.def);
|
|
97616
98155
|
}
|
|
97617
|
-
function getElementAtPath(obj,
|
|
97618
|
-
if (!
|
|
98156
|
+
function getElementAtPath(obj, path2) {
|
|
98157
|
+
if (!path2)
|
|
97619
98158
|
return obj;
|
|
97620
|
-
return
|
|
98159
|
+
return path2.reduce((acc, key) => acc?.[key], obj);
|
|
97621
98160
|
}
|
|
97622
98161
|
function promiseAllObject(promisesObj) {
|
|
97623
98162
|
const keys = Object.keys(promisesObj);
|
|
@@ -97998,11 +98537,11 @@ function aborted(x, startIndex = 0) {
|
|
|
97998
98537
|
}
|
|
97999
98538
|
return false;
|
|
98000
98539
|
}
|
|
98001
|
-
function prefixIssues(
|
|
98540
|
+
function prefixIssues(path2, issues) {
|
|
98002
98541
|
return issues.map((iss) => {
|
|
98003
98542
|
var _a15;
|
|
98004
98543
|
(_a15 = iss).path ?? (_a15.path = []);
|
|
98005
|
-
iss.path.unshift(
|
|
98544
|
+
iss.path.unshift(path2);
|
|
98006
98545
|
return iss;
|
|
98007
98546
|
});
|
|
98008
98547
|
}
|
|
@@ -98185,7 +98724,7 @@ function formatError(error, mapper = (issue2) => issue2.message) {
|
|
|
98185
98724
|
}
|
|
98186
98725
|
function treeifyError(error, mapper = (issue2) => issue2.message) {
|
|
98187
98726
|
const result = { errors: [] };
|
|
98188
|
-
const processError = (error2,
|
|
98727
|
+
const processError = (error2, path2 = []) => {
|
|
98189
98728
|
var _a15, _b15;
|
|
98190
98729
|
for (const issue2 of error2.issues) {
|
|
98191
98730
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
@@ -98195,7 +98734,7 @@ function treeifyError(error, mapper = (issue2) => issue2.message) {
|
|
|
98195
98734
|
} else if (issue2.code === "invalid_element") {
|
|
98196
98735
|
processError({ issues: issue2.issues }, issue2.path);
|
|
98197
98736
|
} else {
|
|
98198
|
-
const fullpath = [...
|
|
98737
|
+
const fullpath = [...path2, ...issue2.path];
|
|
98199
98738
|
if (fullpath.length === 0) {
|
|
98200
98739
|
result.errors.push(mapper(issue2));
|
|
98201
98740
|
continue;
|
|
@@ -98227,8 +98766,8 @@ function treeifyError(error, mapper = (issue2) => issue2.message) {
|
|
|
98227
98766
|
}
|
|
98228
98767
|
function toDotPath(_path) {
|
|
98229
98768
|
const segs = [];
|
|
98230
|
-
const
|
|
98231
|
-
for (const seg of
|
|
98769
|
+
const path2 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
98770
|
+
for (const seg of path2) {
|
|
98232
98771
|
if (typeof seg === "number")
|
|
98233
98772
|
segs.push(`[${seg}]`);
|
|
98234
98773
|
else if (typeof seg === "symbol")
|
|
@@ -109975,13 +110514,13 @@ function resolveRef(ref, ctx) {
|
|
|
109975
110514
|
if (!ref.startsWith("#")) {
|
|
109976
110515
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
109977
110516
|
}
|
|
109978
|
-
const
|
|
109979
|
-
if (
|
|
110517
|
+
const path2 = ref.slice(1).split("/").filter(Boolean);
|
|
110518
|
+
if (path2.length === 0) {
|
|
109980
110519
|
return ctx.rootSchema;
|
|
109981
110520
|
}
|
|
109982
110521
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
109983
|
-
if (
|
|
109984
|
-
const key =
|
|
110522
|
+
if (path2[0] === defsKey) {
|
|
110523
|
+
const key = path2[1];
|
|
109985
110524
|
if (!key || !ctx.defs[key]) {
|
|
109986
110525
|
throw new Error(`Reference not found: ${ref}`);
|
|
109987
110526
|
}
|
|
@@ -110737,8 +111276,8 @@ function getErrorMap2() {
|
|
|
110737
111276
|
|
|
110738
111277
|
// ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v3/helpers/parseUtil.js
|
|
110739
111278
|
var makeIssue = (params) => {
|
|
110740
|
-
const { data, path, errorMaps, issueData } = params;
|
|
110741
|
-
const fullPath = [...
|
|
111279
|
+
const { data, path: path2, errorMaps, issueData } = params;
|
|
111280
|
+
const fullPath = [...path2, ...issueData.path || []];
|
|
110742
111281
|
const fullIssue = {
|
|
110743
111282
|
...issueData,
|
|
110744
111283
|
path: fullPath
|
|
@@ -110850,11 +111389,11 @@ var errorUtil;
|
|
|
110850
111389
|
|
|
110851
111390
|
// ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v3/types.js
|
|
110852
111391
|
class ParseInputLazyPath {
|
|
110853
|
-
constructor(parent, value,
|
|
111392
|
+
constructor(parent, value, path2, key) {
|
|
110854
111393
|
this._cachedPath = [];
|
|
110855
111394
|
this.parent = parent;
|
|
110856
111395
|
this.data = value;
|
|
110857
|
-
this._path =
|
|
111396
|
+
this._path = path2;
|
|
110858
111397
|
this._key = key;
|
|
110859
111398
|
}
|
|
110860
111399
|
get path() {
|
|
@@ -125296,15 +125835,15 @@ function createAgentSelectList(currentWorkflowKey, onSelect, onCancel) {
|
|
|
125296
125835
|
}
|
|
125297
125836
|
|
|
125298
125837
|
// src/agent-runtime.ts
|
|
125299
|
-
import
|
|
125838
|
+
import path19 from "path";
|
|
125300
125839
|
|
|
125301
125840
|
// ../opencode/src/runtime/child-environment.ts
|
|
125302
125841
|
await __promiseAll([
|
|
125303
125842
|
init_auth(),
|
|
125304
125843
|
init_config()
|
|
125305
125844
|
]);
|
|
125306
|
-
import
|
|
125307
|
-
import
|
|
125845
|
+
import os6 from "os";
|
|
125846
|
+
import path14 from "path";
|
|
125308
125847
|
var MODEL_PROVIDER_CREDENTIAL_ENV_VARS = [
|
|
125309
125848
|
"ANTHROPIC_API_KEY",
|
|
125310
125849
|
"ANTHROPIC_OAUTH_TOKEN",
|
|
@@ -125369,10 +125908,10 @@ var ChildEnvironment;
|
|
|
125369
125908
|
const env2 = { ...input };
|
|
125370
125909
|
if (process.platform === "win32")
|
|
125371
125910
|
return env2;
|
|
125372
|
-
const home =
|
|
125911
|
+
const home = os6.homedir();
|
|
125373
125912
|
const required3 = [
|
|
125374
|
-
|
|
125375
|
-
|
|
125913
|
+
path14.join(home, ".local/bin"),
|
|
125914
|
+
path14.join(home, ".local/share/kifaru/bin"),
|
|
125376
125915
|
"/usr/local/sbin",
|
|
125377
125916
|
"/usr/local/bin",
|
|
125378
125917
|
"/usr/sbin",
|
|
@@ -125380,7 +125919,7 @@ var ChildEnvironment;
|
|
|
125380
125919
|
"/sbin",
|
|
125381
125920
|
"/bin"
|
|
125382
125921
|
];
|
|
125383
|
-
const current = (env2.PATH ?? "").split(
|
|
125922
|
+
const current = (env2.PATH ?? "").split(path14.delimiter).filter(Boolean);
|
|
125384
125923
|
const seen = new Set(current);
|
|
125385
125924
|
for (const directory of required3) {
|
|
125386
125925
|
if (seen.has(directory))
|
|
@@ -125388,7 +125927,7 @@ var ChildEnvironment;
|
|
|
125388
125927
|
current.push(directory);
|
|
125389
125928
|
seen.add(directory);
|
|
125390
125929
|
}
|
|
125391
|
-
env2.PATH = current.join(
|
|
125930
|
+
env2.PATH = current.join(path14.delimiter);
|
|
125392
125931
|
return env2;
|
|
125393
125932
|
}
|
|
125394
125933
|
ChildEnvironment.withExecutablePath = withExecutablePath;
|
|
@@ -125398,9 +125937,9 @@ var ChildEnvironment;
|
|
|
125398
125937
|
await init_python();
|
|
125399
125938
|
|
|
125400
125939
|
// src/invoker-resolver.ts
|
|
125401
|
-
import
|
|
125402
|
-
import
|
|
125403
|
-
import
|
|
125940
|
+
import fs10 from "fs";
|
|
125941
|
+
import os7 from "os";
|
|
125942
|
+
import path15 from "path";
|
|
125404
125943
|
function resolveTuiInvoker(catalog) {
|
|
125405
125944
|
return new PiAiModelInvoker(resolveTuiModels(catalog));
|
|
125406
125945
|
}
|
|
@@ -125408,12 +125947,12 @@ var KIFARU_SESSION_PROVIDER = "kifaru-session";
|
|
|
125408
125947
|
function sessionGatewayFile() {
|
|
125409
125948
|
if (process.env.KIFARU_SESSION_FILE)
|
|
125410
125949
|
return process.env.KIFARU_SESSION_FILE;
|
|
125411
|
-
const xdg = process.env.XDG_DATA_HOME ||
|
|
125412
|
-
return
|
|
125950
|
+
const xdg = process.env.XDG_DATA_HOME || path15.join(os7.homedir(), ".local", "share");
|
|
125951
|
+
return path15.join(xdg, "kifaru", "data", "auth", "session.json");
|
|
125413
125952
|
}
|
|
125414
125953
|
function loadStoredSession() {
|
|
125415
125954
|
try {
|
|
125416
|
-
const raw =
|
|
125955
|
+
const raw = fs10.readFileSync(sessionGatewayFile(), "utf8");
|
|
125417
125956
|
const data2 = JSON.parse(raw);
|
|
125418
125957
|
if (!data2?.accessToken || !data2?.gatewayEnv?.api)
|
|
125419
125958
|
return null;
|
|
@@ -125466,8 +126005,8 @@ function resolveTuiModels(catalog) {
|
|
|
125466
126005
|
}
|
|
125467
126006
|
|
|
125468
126007
|
// src/opencode-host-tools.ts
|
|
125469
|
-
import
|
|
125470
|
-
import
|
|
126008
|
+
import fs13 from "fs/promises";
|
|
126009
|
+
import path18 from "path";
|
|
125471
126010
|
import { Type as Type4 } from "@earendil-works/pi-ai";
|
|
125472
126011
|
|
|
125473
126012
|
// ../opencode/src/tool/runtime/host.ts
|
|
@@ -125481,8 +126020,8 @@ await __promiseAll([
|
|
|
125481
126020
|
init_python()
|
|
125482
126021
|
]);
|
|
125483
126022
|
import { createHash as createHash3 } from "crypto";
|
|
125484
|
-
import
|
|
125485
|
-
import
|
|
126023
|
+
import fs11 from "fs/promises";
|
|
126024
|
+
import path16 from "path";
|
|
125486
126025
|
var PythonHelpers;
|
|
125487
126026
|
((PythonHelpers) => {
|
|
125488
126027
|
const log2 = Log2.create({ service: "runtime.python-helpers" });
|
|
@@ -125728,15 +126267,15 @@ if __name__ == "__main__":
|
|
|
125728
126267
|
PythonHelpers.HUNT_MODULE_VERSION = createHash3("sha256").update(PythonHelpers.HUNT_MODULE_SOURCE).digest("hex").slice(0, 12);
|
|
125729
126268
|
function defaultDeps() {
|
|
125730
126269
|
return {
|
|
125731
|
-
mkdir: (dir) =>
|
|
126270
|
+
mkdir: (dir) => fs11.mkdir(dir, { recursive: true }).then(() => {
|
|
125732
126271
|
return;
|
|
125733
126272
|
}),
|
|
125734
|
-
readFile: (file3) =>
|
|
125735
|
-
writeFile: (file3, content) =>
|
|
126273
|
+
readFile: (file3) => fs11.readFile(file3, "utf8"),
|
|
126274
|
+
writeFile: (file3, content) => fs11.writeFile(file3, content)
|
|
125736
126275
|
};
|
|
125737
126276
|
}
|
|
125738
126277
|
function helpersDir(dataDir = Global.Path.data) {
|
|
125739
|
-
return
|
|
126278
|
+
return path16.join(PythonRuntime.managedRoot(dataDir), "helpers");
|
|
125740
126279
|
}
|
|
125741
126280
|
PythonHelpers.helpersDir = helpersDir;
|
|
125742
126281
|
const ensureTasks = new Map;
|
|
@@ -125746,8 +126285,8 @@ if __name__ == "__main__":
|
|
|
125746
126285
|
if (cached3)
|
|
125747
126286
|
return cached3;
|
|
125748
126287
|
const task = (async () => {
|
|
125749
|
-
const target =
|
|
125750
|
-
const stamp =
|
|
126288
|
+
const target = path16.join(dir, "hunt.py");
|
|
126289
|
+
const stamp = path16.join(dir, ".hunt-version");
|
|
125751
126290
|
try {
|
|
125752
126291
|
const [onDisk, current] = await Promise.all([
|
|
125753
126292
|
deps2.readFile(target).catch(() => {
|
|
@@ -125772,8 +126311,8 @@ if __name__ == "__main__":
|
|
|
125772
126311
|
PythonHelpers.ensure = ensure;
|
|
125773
126312
|
function prependPythonPath(env2, dir) {
|
|
125774
126313
|
const next = { ...env2 };
|
|
125775
|
-
const parts = (next.PYTHONPATH ?? "").split(
|
|
125776
|
-
next.PYTHONPATH = [dir, ...parts.filter((part) => part !== dir)].join(
|
|
126314
|
+
const parts = (next.PYTHONPATH ?? "").split(path16.delimiter).filter(Boolean);
|
|
126315
|
+
next.PYTHONPATH = [dir, ...parts.filter((part) => part !== dir)].join(path16.delimiter);
|
|
125777
126316
|
return next;
|
|
125778
126317
|
}
|
|
125779
126318
|
PythonHelpers.prependPythonPath = prependPythonPath;
|
|
@@ -126272,7 +126811,7 @@ function shell() {
|
|
|
126272
126811
|
return Bun.which("bash") ?? true;
|
|
126273
126812
|
}
|
|
126274
126813
|
function resolvePath(filePath2, cwd) {
|
|
126275
|
-
return
|
|
126814
|
+
return path18.isAbsolute(filePath2) ? filePath2 : path18.resolve(cwd, filePath2);
|
|
126276
126815
|
}
|
|
126277
126816
|
function evidence(description, artifactType, data2) {
|
|
126278
126817
|
return { description, artifactType, data: data2, timestamp: Date.now() };
|
|
@@ -126350,7 +126889,7 @@ class OpenCodeHostReadTool {
|
|
|
126350
126889
|
const filePath2 = resolvePath(requested, this.cwd);
|
|
126351
126890
|
const offset = typeof params.offset === "number" ? Math.max(0, Math.trunc(params.offset)) : 0;
|
|
126352
126891
|
const limit = typeof params.limit === "number" ? Math.min(DEFAULT_READ_LIMIT, Math.max(1, Math.trunc(params.limit))) : DEFAULT_READ_LIMIT;
|
|
126353
|
-
const contents = await
|
|
126892
|
+
const contents = await fs13.readFile(filePath2, "utf8");
|
|
126354
126893
|
const lines = contents.split(`
|
|
126355
126894
|
`);
|
|
126356
126895
|
const selected = lines.slice(offset, offset + limit).map((line, index) => {
|
|
@@ -126394,8 +126933,8 @@ class OpenCodeHostWriteTool {
|
|
|
126394
126933
|
throw new Error("Missing or empty 'filePath' parameter for write.");
|
|
126395
126934
|
const content = typeof params.content === "string" ? params.content : "";
|
|
126396
126935
|
const filePath2 = resolvePath(requested, this.cwd);
|
|
126397
|
-
await
|
|
126398
|
-
await
|
|
126936
|
+
await fs13.mkdir(path18.dirname(filePath2), { recursive: true });
|
|
126937
|
+
await fs13.writeFile(filePath2, content, "utf8");
|
|
126399
126938
|
return {
|
|
126400
126939
|
output: `Wrote ${Buffer.byteLength(content)} bytes to ${filePath2}`,
|
|
126401
126940
|
evidence: evidence(`Wrote host file: ${filePath2}`, "host_file_write", {
|
|
@@ -126454,7 +126993,7 @@ function createTuiAgentRuntime(catalog, options2 = {}) {
|
|
|
126454
126993
|
}),
|
|
126455
126994
|
store: new InMemoryStageSessionStore
|
|
126456
126995
|
});
|
|
126457
|
-
const workingDirectory =
|
|
126996
|
+
const workingDirectory = path19.resolve(options2.workingDirectory ?? options2.workspaceRoot ?? process.env.KIFARU_TUI_WORKSPACE_ROOT ?? process.cwd());
|
|
126458
126997
|
const budget = options2.budget;
|
|
126459
126998
|
PythonRuntime.startupBootstrap().catch(() => {
|
|
126460
126999
|
return;
|
|
@@ -127024,7 +127563,7 @@ import {
|
|
|
127024
127563
|
|
|
127025
127564
|
// src/pi-python-runtime.ts
|
|
127026
127565
|
await init_python();
|
|
127027
|
-
import
|
|
127566
|
+
import path20 from "path";
|
|
127028
127567
|
import {
|
|
127029
127568
|
createBashToolDefinition,
|
|
127030
127569
|
createLocalBashOperations
|
|
@@ -127090,7 +127629,7 @@ async function capturePythonPrompt(cwd) {
|
|
|
127090
127629
|
const environment = await prepareHostEnvironment(process.env, cwd, false);
|
|
127091
127630
|
const expected = PythonRuntime.expectedCommands(environment.settings.profile);
|
|
127092
127631
|
const discovered = expected.filter((command) => Bun.which(command, { PATH: environment.env.PATH, cwd }) !== null);
|
|
127093
|
-
const helperAvailable = await Bun.file(
|
|
127632
|
+
const helperAvailable = await Bun.file(path20.join(PythonHelpers.helpersDir(), "hunt.py")).exists();
|
|
127094
127633
|
return pythonRuntimePrompt({
|
|
127095
127634
|
settings: environment.settings,
|
|
127096
127635
|
selection: environment.selection,
|
|
@@ -127211,6 +127750,7 @@ ${runtimePrompt(state2, cwd)}`
|
|
|
127211
127750
|
async function runKifaruPiSdkTui(options2 = {}) {
|
|
127212
127751
|
const cwd = options2.cwd ?? process.cwd();
|
|
127213
127752
|
const agentDir = getAgentDir();
|
|
127753
|
+
const kifaruSkillsPath = materializeKifaruSkills();
|
|
127214
127754
|
const catalog = options2.catalog ?? new ModelCatalogRegistry;
|
|
127215
127755
|
const initial = splitThinkingRef(options2.initialModelRef ?? "azure/FW-DeepSeek-V4-Flash-0731");
|
|
127216
127756
|
const initialResolution = catalog.resolve(initial.modelRef);
|
|
@@ -127246,7 +127786,8 @@ async function runKifaruPiSdkTui(options2 = {}) {
|
|
|
127246
127786
|
createPythonRuntimeExtension({
|
|
127247
127787
|
shellPath: settingsManager.getShellPath()
|
|
127248
127788
|
})
|
|
127249
|
-
]
|
|
127789
|
+
],
|
|
127790
|
+
...kifaruSkillsPath ? { additionalSkillPaths: [kifaruSkillsPath] } : {}
|
|
127250
127791
|
}
|
|
127251
127792
|
});
|
|
127252
127793
|
const hasExistingMessages = sessionManager.buildSessionContext().messages.length > 0;
|
|
@@ -127294,7 +127835,7 @@ async function runKifaruTui(options2) {
|
|
|
127294
127835
|
// bin/kifaru-tui.ts
|
|
127295
127836
|
var args = process.argv.slice(2);
|
|
127296
127837
|
if (args.includes("--version") || args.includes("-v")) {
|
|
127297
|
-
console.log("1.0.
|
|
127838
|
+
console.log("1.0.164");
|
|
127298
127839
|
process.exit(0);
|
|
127299
127840
|
}
|
|
127300
127841
|
if (args.includes("--help") || args.includes("-h")) {
|