@signetai/core 0.219.5 → 0.220.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/child-process.d.ts +22 -0
- package/dist/child-process.d.ts.map +1 -0
- package/dist/database.d.ts.map +1 -1
- package/dist/identity.d.ts +0 -44
- package/dist/identity.d.ts.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +232 -453
- package/dist/package-manager.d.ts.map +1 -1
- package/dist/secrets.d.ts.map +1 -1
- package/dist/sqlite-journal.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/oh-my-pi.d.ts +0 -15
- package/dist/oh-my-pi.d.ts.map +0 -1
- package/dist/pi.d.ts +0 -15
- package/dist/pi.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -11532,13 +11532,74 @@ function emptyHookRecallResponse(query, extras) {
|
|
|
11532
11532
|
}
|
|
11533
11533
|
|
|
11534
11534
|
// src/database.ts
|
|
11535
|
-
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
11536
11535
|
import { existsSync, readdirSync } from "node:fs";
|
|
11537
11536
|
import { homedir } from "node:os";
|
|
11538
11537
|
import { dirname, join } from "node:path";
|
|
11539
11538
|
import { arch, platform } from "node:process";
|
|
11540
11539
|
import { fileURLToPath } from "node:url";
|
|
11541
11540
|
|
|
11541
|
+
// src/child-process.ts
|
|
11542
|
+
import {
|
|
11543
|
+
execFile as nodeExecFile,
|
|
11544
|
+
execFileSync as nodeExecFileSync,
|
|
11545
|
+
execSync as nodeExecSync,
|
|
11546
|
+
spawn as nodeSpawn,
|
|
11547
|
+
spawnSync as nodeSpawnSync
|
|
11548
|
+
} from "node:child_process";
|
|
11549
|
+
import { promisify } from "node:util";
|
|
11550
|
+
function withWindowsHide(options) {
|
|
11551
|
+
return {
|
|
11552
|
+
...options ?? {},
|
|
11553
|
+
windowsHide: options?.windowsHide ?? true
|
|
11554
|
+
};
|
|
11555
|
+
}
|
|
11556
|
+
function isOptions(value) {
|
|
11557
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11558
|
+
}
|
|
11559
|
+
function withWindowsHideArgument(args, firstOptionIndex) {
|
|
11560
|
+
const normalized = [...args];
|
|
11561
|
+
const optionIndex = normalized.findIndex((value, index) => index >= firstOptionIndex && isOptions(value));
|
|
11562
|
+
if (optionIndex >= 0) {
|
|
11563
|
+
normalized[optionIndex] = withWindowsHide(normalized[optionIndex]);
|
|
11564
|
+
return normalized;
|
|
11565
|
+
}
|
|
11566
|
+
const placeholderIndex = normalized.findIndex((value, index) => index >= firstOptionIndex && (value === undefined || value === null));
|
|
11567
|
+
if (placeholderIndex >= 0) {
|
|
11568
|
+
normalized[placeholderIndex] = withWindowsHide(undefined);
|
|
11569
|
+
return normalized;
|
|
11570
|
+
}
|
|
11571
|
+
const callbackIndex = normalized.findIndex((value, index) => index >= firstOptionIndex && typeof value === "function");
|
|
11572
|
+
normalized.splice(callbackIndex >= 0 ? callbackIndex : normalized.length, 0, { windowsHide: true });
|
|
11573
|
+
return normalized;
|
|
11574
|
+
}
|
|
11575
|
+
function withSpawnDefaults(options) {
|
|
11576
|
+
if (options?.shell !== undefined && options.shell !== false) {
|
|
11577
|
+
throw new TypeError("spawnHidden does not allow shell execution");
|
|
11578
|
+
}
|
|
11579
|
+
return {
|
|
11580
|
+
...withWindowsHide(options),
|
|
11581
|
+
shell: false
|
|
11582
|
+
};
|
|
11583
|
+
}
|
|
11584
|
+
var spawnHidden = (command, argsOrOptions, options) => {
|
|
11585
|
+
if (Array.isArray(argsOrOptions))
|
|
11586
|
+
return nodeSpawn(command, argsOrOptions, withSpawnDefaults(options));
|
|
11587
|
+
return nodeSpawn(command, withSpawnDefaults(options ?? argsOrOptions));
|
|
11588
|
+
};
|
|
11589
|
+
var spawnSyncHidden = (command, argsOrOptions, options) => {
|
|
11590
|
+
if (Array.isArray(argsOrOptions))
|
|
11591
|
+
return nodeSpawnSync(command, argsOrOptions, withSpawnDefaults(options));
|
|
11592
|
+
return nodeSpawnSync(command, withSpawnDefaults(options ?? argsOrOptions));
|
|
11593
|
+
};
|
|
11594
|
+
var nodeExecFileAsync = promisify(nodeExecFile);
|
|
11595
|
+
var execFileHiddenImpl = (...args) => Reflect.apply(nodeExecFile, undefined, withWindowsHideArgument(args, 1));
|
|
11596
|
+
Object.defineProperty(execFileHiddenImpl, promisify.custom, {
|
|
11597
|
+
value: (...args) => Reflect.apply(nodeExecFileAsync, undefined, withWindowsHideArgument(args, 1))
|
|
11598
|
+
});
|
|
11599
|
+
var execFileHidden = execFileHiddenImpl;
|
|
11600
|
+
var execSyncHidden = (...args) => Reflect.apply(nodeExecSync, undefined, withWindowsHideArgument(args, 1));
|
|
11601
|
+
var execFileSyncHidden = (...args) => Reflect.apply(nodeExecFileSync, undefined, withWindowsHideArgument(args, 1));
|
|
11602
|
+
|
|
11542
11603
|
// src/memory-content-safety.ts
|
|
11543
11604
|
var MEMORY_CONTENT_SAFETY_POLICY_VERSION = "memory-content-safety-v1";
|
|
11544
11605
|
var MEMORY_CONTENT_WITHHELD_NOTICE = "[memory content withheld by safety policy]";
|
|
@@ -18534,7 +18595,6 @@ with the error message above and your signetai version.`);
|
|
|
18534
18595
|
}
|
|
18535
18596
|
|
|
18536
18597
|
// src/sqlite-journal.ts
|
|
18537
|
-
import { execFileSync } from "node:child_process";
|
|
18538
18598
|
import { statfsSync } from "node:fs";
|
|
18539
18599
|
var NETWORK_FILESYSTEM_TYPES = new Set(["afpfs", "nfs", "smbfs", "webdav"]);
|
|
18540
18600
|
function isNetworkFilesystem(filesystemType) {
|
|
@@ -18553,7 +18613,7 @@ function detectFilesystemType(path, opts) {
|
|
|
18553
18613
|
}
|
|
18554
18614
|
} catch {}
|
|
18555
18615
|
try {
|
|
18556
|
-
const output = opts?.statCommand?.(path) ??
|
|
18616
|
+
const output = opts?.statCommand?.(path) ?? execFileSyncHidden("/usr/bin/stat", ["-f", "%T", path], { encoding: "utf8" });
|
|
18557
18617
|
const filesystemType = output.trim();
|
|
18558
18618
|
return filesystemType.length > 0 ? filesystemType : null;
|
|
18559
18619
|
} catch {
|
|
@@ -18594,10 +18654,9 @@ function findNpmGlobalRoot() {
|
|
|
18594
18654
|
return cachedNpmGlobalRoot;
|
|
18595
18655
|
try {
|
|
18596
18656
|
const command = platform === "win32" ? "npm.cmd" : "npm";
|
|
18597
|
-
const root =
|
|
18657
|
+
const root = execFileSyncHidden(command, ["root", "-g"], {
|
|
18598
18658
|
encoding: "utf8",
|
|
18599
|
-
timeout: 3000
|
|
18600
|
-
windowsHide: true
|
|
18659
|
+
timeout: 3000
|
|
18601
18660
|
}).trim();
|
|
18602
18661
|
cachedNpmGlobalRoot = root || null;
|
|
18603
18662
|
} catch {
|
|
@@ -19276,7 +19335,6 @@ class Signet {
|
|
|
19276
19335
|
}
|
|
19277
19336
|
}
|
|
19278
19337
|
// src/secrets.ts
|
|
19279
|
-
import { execSync, spawn } from "node:child_process";
|
|
19280
19338
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
19281
19339
|
import {
|
|
19282
19340
|
chmodSync,
|
|
@@ -19297,7 +19355,6 @@ import { hostname } from "node:os";
|
|
|
19297
19355
|
import { join as join4 } from "node:path";
|
|
19298
19356
|
|
|
19299
19357
|
// src/secrets-keyring.ts
|
|
19300
|
-
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
19301
19358
|
import { createHash as createHash2 } from "node:crypto";
|
|
19302
19359
|
import { createRequire as createRequire2 } from "node:module";
|
|
19303
19360
|
var SERVICE = "ai.signet.secrets";
|
|
@@ -19383,7 +19440,7 @@ function linuxKeyringAvailable() {
|
|
|
19383
19440
|
};
|
|
19384
19441
|
}
|
|
19385
19442
|
try {
|
|
19386
|
-
|
|
19443
|
+
execFileSyncHidden("busctl", ["--user", "status", "org.freedesktop.secrets"], {
|
|
19387
19444
|
stdio: "ignore",
|
|
19388
19445
|
timeout: 1000
|
|
19389
19446
|
});
|
|
@@ -19499,7 +19556,7 @@ function resolveMachineId() {
|
|
|
19499
19556
|
} catch {}
|
|
19500
19557
|
}
|
|
19501
19558
|
try {
|
|
19502
|
-
const out =
|
|
19559
|
+
const out = execSyncHidden("ioreg -rd1 -c IOPlatformExpertDevice | grep IOPlatformUUID | awk '{print $3}'", {
|
|
19503
19560
|
timeout: 2000
|
|
19504
19561
|
}).toString().trim().replace(/"/g, "");
|
|
19505
19562
|
if (out)
|
|
@@ -19507,10 +19564,9 @@ function resolveMachineId() {
|
|
|
19507
19564
|
} catch {}
|
|
19508
19565
|
} else {
|
|
19509
19566
|
try {
|
|
19510
|
-
const out =
|
|
19567
|
+
const out = execSyncHidden('reg query "HKLM\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid', {
|
|
19511
19568
|
encoding: "utf-8",
|
|
19512
|
-
timeout: 2000
|
|
19513
|
-
windowsHide: true
|
|
19569
|
+
timeout: 2000
|
|
19514
19570
|
});
|
|
19515
19571
|
const match = out.match(/MachineGuid\s+REG_SZ\s+(\S+)/);
|
|
19516
19572
|
if (match?.[1])
|
|
@@ -20228,11 +20284,10 @@ async function execWithSecrets(command, secretRefs, options = {}) {
|
|
|
20228
20284
|
});
|
|
20229
20285
|
return new Promise((resolve2, reject) => {
|
|
20230
20286
|
const useProcessGroup = process.platform !== "win32";
|
|
20231
|
-
const proc =
|
|
20287
|
+
const proc = spawnHidden(cmd[0], cmd.slice(1), {
|
|
20232
20288
|
detached: useProcessGroup,
|
|
20233
20289
|
env: { ...process.env, ...resolved },
|
|
20234
|
-
stdio: "pipe"
|
|
20235
|
-
windowsHide: true
|
|
20290
|
+
stdio: "pipe"
|
|
20236
20291
|
});
|
|
20237
20292
|
const stdoutRedactor = createStreamingRedactor();
|
|
20238
20293
|
const stderrRedactor = createStreamingRedactor();
|
|
@@ -22336,7 +22391,6 @@ function isRecord6(value) {
|
|
|
22336
22391
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22337
22392
|
}
|
|
22338
22393
|
// src/workspace-source-repo.ts
|
|
22339
|
-
import { spawn as spawn2, spawnSync } from "node:child_process";
|
|
22340
22394
|
import { closeSync as closeSync3, existsSync as existsSync8, mkdirSync as mkdirSync5, openSync as openSync3, readdirSync as readdirSync3, rmSync as rmSync3, statSync as statSync4, writeFileSync as writeFileSync4 } from "node:fs";
|
|
22341
22395
|
import { join as join9, resolve as resolve4 } from "node:path";
|
|
22342
22396
|
var SIGNET_SOURCE_CHECKOUT_DIRNAME = "signetai";
|
|
@@ -22483,11 +22537,10 @@ async function isGitAvailableAsync(timeoutMs) {
|
|
|
22483
22537
|
return (await runGitAsync(["--version"], undefined, timeoutMs)).ok;
|
|
22484
22538
|
}
|
|
22485
22539
|
function runGit(args, cwd, timeoutMs) {
|
|
22486
|
-
const result =
|
|
22540
|
+
const result = spawnSyncHidden("git", args, {
|
|
22487
22541
|
cwd,
|
|
22488
22542
|
encoding: "utf-8",
|
|
22489
|
-
timeout: timeoutMs
|
|
22490
|
-
windowsHide: true
|
|
22543
|
+
timeout: timeoutMs
|
|
22491
22544
|
});
|
|
22492
22545
|
return {
|
|
22493
22546
|
ok: result.status === 0 && result.error === undefined,
|
|
@@ -22499,10 +22552,9 @@ function runGit(args, cwd, timeoutMs) {
|
|
|
22499
22552
|
}
|
|
22500
22553
|
async function runGitAsync(args, cwd, timeoutMs) {
|
|
22501
22554
|
return await new Promise((resolve5) => {
|
|
22502
|
-
const proc =
|
|
22555
|
+
const proc = spawnHidden("git", args, {
|
|
22503
22556
|
cwd,
|
|
22504
22557
|
stdio: ["ignore", "pipe", "pipe"],
|
|
22505
|
-
windowsHide: true,
|
|
22506
22558
|
detached: process.platform !== "win32"
|
|
22507
22559
|
});
|
|
22508
22560
|
let stdout = "";
|
|
@@ -24200,192 +24252,13 @@ function importRelations(db, relationsJsonl) {
|
|
|
24200
24252
|
return { imported, errors };
|
|
24201
24253
|
}
|
|
24202
24254
|
// src/identity.ts
|
|
24203
|
-
import {
|
|
24204
|
-
import { existsSync as existsSync13, readFileSync as readFileSync11, readdirSync as readdirSync5, realpathSync, statSync as statSync7 } from "node:fs";
|
|
24205
|
-
import { homedir as homedir9 } from "node:os";
|
|
24206
|
-
import { dirname as dirname8, join as join13 } from "node:path";
|
|
24207
|
-
|
|
24208
|
-
// src/oh-my-pi.ts
|
|
24209
|
-
import { existsSync as existsSync11, mkdirSync as mkdirSync7, readFileSync as readFileSync9, rmSync as rmSync5, writeFileSync as writeFileSync6 } from "node:fs";
|
|
24255
|
+
import { existsSync as existsSync11, readFileSync as readFileSync9, realpathSync, statSync as statSync7 } from "node:fs";
|
|
24210
24256
|
import { homedir as homedir7 } from "node:os";
|
|
24211
|
-
import { dirname as dirname6, join as join11
|
|
24212
|
-
function readTrimmed(env, name) {
|
|
24213
|
-
const raw = env[name];
|
|
24214
|
-
if (typeof raw !== "string")
|
|
24215
|
-
return null;
|
|
24216
|
-
const trimmed = raw.trim();
|
|
24217
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
24218
|
-
}
|
|
24219
|
-
function normalizePath(pathValue) {
|
|
24220
|
-
return resolve6(expandHome(pathValue.trim()));
|
|
24221
|
-
}
|
|
24222
|
-
function readConfigHome2(env) {
|
|
24223
|
-
const configured = readTrimmed(env, "XDG_CONFIG_HOME");
|
|
24224
|
-
return configured ? normalizePath(configured) : join11(homedir7(), ".config");
|
|
24225
|
-
}
|
|
24226
|
-
function getOhMyPiConfigPath(env = process.env) {
|
|
24227
|
-
return join11(readConfigHome2(env), "signet", "oh-my-pi.json");
|
|
24228
|
-
}
|
|
24229
|
-
function readConfiguredOhMyPiAgentDir(env = process.env) {
|
|
24230
|
-
const configPath = getOhMyPiConfigPath(env);
|
|
24231
|
-
if (!existsSync11(configPath))
|
|
24232
|
-
return null;
|
|
24233
|
-
try {
|
|
24234
|
-
const raw = JSON.parse(readFileSync9(configPath, "utf-8"));
|
|
24235
|
-
if (typeof raw !== "object" || raw === null)
|
|
24236
|
-
return null;
|
|
24237
|
-
const agentDir = Reflect.get(raw, "agentDir");
|
|
24238
|
-
return typeof agentDir === "string" && agentDir.trim().length > 0 ? normalizePath(agentDir) : null;
|
|
24239
|
-
} catch {
|
|
24240
|
-
return null;
|
|
24241
|
-
}
|
|
24242
|
-
}
|
|
24243
|
-
function resolveOhMyPiAgentDir(env = process.env) {
|
|
24244
|
-
const configured = readTrimmed(env, "PI_CODING_AGENT_DIR");
|
|
24245
|
-
if (configured)
|
|
24246
|
-
return normalizePath(configured);
|
|
24247
|
-
return readConfiguredOhMyPiAgentDir(env) ?? join11(homedir7(), ".omp", "agent");
|
|
24248
|
-
}
|
|
24249
|
-
function resolveOhMyPiExtensionsDir(env = process.env) {
|
|
24250
|
-
return join11(resolveOhMyPiAgentDir(env), "extensions");
|
|
24251
|
-
}
|
|
24252
|
-
function listOhMyPiAgentDirCandidates(env = process.env) {
|
|
24253
|
-
const candidates = new Set;
|
|
24254
|
-
const configured = readTrimmed(env, "PI_CODING_AGENT_DIR");
|
|
24255
|
-
if (configured)
|
|
24256
|
-
candidates.add(normalizePath(configured));
|
|
24257
|
-
const persisted = readConfiguredOhMyPiAgentDir(env);
|
|
24258
|
-
if (persisted)
|
|
24259
|
-
candidates.add(persisted);
|
|
24260
|
-
candidates.add(join11(homedir7(), ".omp", "agent"));
|
|
24261
|
-
return Array.from(candidates);
|
|
24262
|
-
}
|
|
24263
|
-
function writeConfiguredOhMyPiAgentDir(pathValue, env = process.env) {
|
|
24264
|
-
const agentDir = normalizePath(pathValue);
|
|
24265
|
-
const configPath = getOhMyPiConfigPath(env);
|
|
24266
|
-
if (readConfiguredOhMyPiAgentDir(env) === agentDir && existsSync11(configPath)) {
|
|
24267
|
-
return configPath;
|
|
24268
|
-
}
|
|
24269
|
-
mkdirSync7(dirname6(configPath), { recursive: true });
|
|
24270
|
-
const payload = {
|
|
24271
|
-
version: 1,
|
|
24272
|
-
agentDir,
|
|
24273
|
-
updatedAt: new Date().toISOString()
|
|
24274
|
-
};
|
|
24275
|
-
writeFileSync6(configPath, `${JSON.stringify(payload, null, 2)}
|
|
24276
|
-
`);
|
|
24277
|
-
return configPath;
|
|
24278
|
-
}
|
|
24279
|
-
function clearConfiguredOhMyPiAgentDir(env = process.env) {
|
|
24280
|
-
const configPath = getOhMyPiConfigPath(env);
|
|
24281
|
-
if (!existsSync11(configPath))
|
|
24282
|
-
return;
|
|
24283
|
-
try {
|
|
24284
|
-
rmSync5(configPath, { force: true });
|
|
24285
|
-
} catch {}
|
|
24286
|
-
}
|
|
24287
|
-
|
|
24288
|
-
// src/pi.ts
|
|
24289
|
-
import { existsSync as existsSync12, mkdirSync as mkdirSync8, readFileSync as readFileSync10, rmSync as rmSync6, writeFileSync as writeFileSync7 } from "node:fs";
|
|
24290
|
-
import { homedir as homedir8 } from "node:os";
|
|
24291
|
-
import { dirname as dirname7, join as join12, resolve as resolve7 } from "node:path";
|
|
24292
|
-
function readTrimmed2(env, name) {
|
|
24293
|
-
const raw = env[name];
|
|
24294
|
-
if (typeof raw !== "string")
|
|
24295
|
-
return null;
|
|
24296
|
-
const trimmed = raw.trim();
|
|
24297
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
24298
|
-
}
|
|
24299
|
-
function expandUserPath(pathValue) {
|
|
24300
|
-
const trimmed = pathValue.trim();
|
|
24301
|
-
if (trimmed === "~")
|
|
24302
|
-
return homedir8();
|
|
24303
|
-
if (trimmed.startsWith("~/"))
|
|
24304
|
-
return join12(homedir8(), trimmed.slice(2));
|
|
24305
|
-
if (trimmed.startsWith("~"))
|
|
24306
|
-
return join12(homedir8(), trimmed.slice(1));
|
|
24307
|
-
return trimmed;
|
|
24308
|
-
}
|
|
24309
|
-
function normalizePath2(pathValue) {
|
|
24310
|
-
return resolve7(expandUserPath(pathValue));
|
|
24311
|
-
}
|
|
24312
|
-
function readConfigHome3(env) {
|
|
24313
|
-
const configured = readTrimmed2(env, "XDG_CONFIG_HOME");
|
|
24314
|
-
return configured ? normalizePath2(configured) : join12(homedir8(), ".config");
|
|
24315
|
-
}
|
|
24316
|
-
function getPiConfigPath(env = process.env) {
|
|
24317
|
-
return join12(readConfigHome3(env), "signet", "pi.json");
|
|
24318
|
-
}
|
|
24319
|
-
function readConfiguredPiAgentDir(env = process.env) {
|
|
24320
|
-
const configPath = getPiConfigPath(env);
|
|
24321
|
-
if (!existsSync12(configPath))
|
|
24322
|
-
return null;
|
|
24323
|
-
try {
|
|
24324
|
-
const raw = JSON.parse(readFileSync10(configPath, "utf-8"));
|
|
24325
|
-
if (typeof raw !== "object" || raw === null)
|
|
24326
|
-
return null;
|
|
24327
|
-
const agentDir = Reflect.get(raw, "agentDir");
|
|
24328
|
-
return typeof agentDir === "string" && agentDir.trim().length > 0 ? normalizePath2(agentDir) : null;
|
|
24329
|
-
} catch {
|
|
24330
|
-
return null;
|
|
24331
|
-
}
|
|
24332
|
-
}
|
|
24333
|
-
function resolvePiAgentDir(env = process.env) {
|
|
24334
|
-
const configured = readTrimmed2(env, "PI_CODING_AGENT_DIR");
|
|
24335
|
-
if (configured)
|
|
24336
|
-
return normalizePath2(configured);
|
|
24337
|
-
return readConfiguredPiAgentDir(env) ?? join12(homedir8(), ".pi", "agent");
|
|
24338
|
-
}
|
|
24339
|
-
function resolvePiExtensionsDir(env = process.env) {
|
|
24340
|
-
return join12(resolvePiAgentDir(env), "extensions");
|
|
24341
|
-
}
|
|
24342
|
-
function listPiAgentDirCandidates(env = process.env) {
|
|
24343
|
-
const candidates = new Set;
|
|
24344
|
-
const configured = readTrimmed2(env, "PI_CODING_AGENT_DIR");
|
|
24345
|
-
if (configured)
|
|
24346
|
-
candidates.add(normalizePath2(configured));
|
|
24347
|
-
const persisted = readConfiguredPiAgentDir(env);
|
|
24348
|
-
if (persisted)
|
|
24349
|
-
candidates.add(persisted);
|
|
24350
|
-
candidates.add(join12(homedir8(), ".pi", "agent"));
|
|
24351
|
-
return Array.from(candidates);
|
|
24352
|
-
}
|
|
24353
|
-
function writeConfiguredPiAgentDir(pathValue, env = process.env) {
|
|
24354
|
-
const agentDir = normalizePath2(pathValue);
|
|
24355
|
-
const configPath = getPiConfigPath(env);
|
|
24356
|
-
if (readConfiguredPiAgentDir(env) === agentDir && existsSync12(configPath)) {
|
|
24357
|
-
return configPath;
|
|
24358
|
-
}
|
|
24359
|
-
mkdirSync8(dirname7(configPath), { recursive: true });
|
|
24360
|
-
const payload = {
|
|
24361
|
-
version: 1,
|
|
24362
|
-
agentDir,
|
|
24363
|
-
updatedAt: new Date().toISOString()
|
|
24364
|
-
};
|
|
24365
|
-
writeFileSync7(configPath, `${JSON.stringify(payload, null, 2)}
|
|
24366
|
-
`);
|
|
24367
|
-
return configPath;
|
|
24368
|
-
}
|
|
24369
|
-
function clearConfiguredPiAgentDir(env = process.env) {
|
|
24370
|
-
const configPath = getPiConfigPath(env);
|
|
24371
|
-
if (!existsSync12(configPath))
|
|
24372
|
-
return;
|
|
24373
|
-
try {
|
|
24374
|
-
rmSync6(configPath, { force: true });
|
|
24375
|
-
} catch {}
|
|
24376
|
-
}
|
|
24377
|
-
|
|
24378
|
-
// src/identity.ts
|
|
24379
|
-
var OH_MY_PI_MANAGED_EXTENSION_FILENAME = "signet-oh-my-pi.js";
|
|
24380
|
-
var OH_MY_PI_LEGACY_MANAGED_EXTENSION_FILENAME = "signet-oh-my-pi.mjs";
|
|
24381
|
-
var OH_MY_PI_MANAGED_MARKER = "SIGNET_MANAGED_OH_MY_PI_EXTENSION";
|
|
24382
|
-
var PI_MANAGED_EXTENSION_FILENAME = "signet-pi.js";
|
|
24383
|
-
var PI_LEGACY_MANAGED_EXTENSION_FILENAME = "signet-pi.mjs";
|
|
24384
|
-
var PI_MANAGED_MARKER = "SIGNET_MANAGED_PI_EXTENSION";
|
|
24257
|
+
import { dirname as dirname6, join as join11 } from "node:path";
|
|
24385
24258
|
function resolveAgentBasePath(agentName, workspaceDir) {
|
|
24386
24259
|
if (agentName === "default")
|
|
24387
24260
|
return workspaceDir;
|
|
24388
|
-
return
|
|
24261
|
+
return join11(workspaceDir, "agents", agentName);
|
|
24389
24262
|
}
|
|
24390
24263
|
var IDENTITY_MODES = ["managed", "off"];
|
|
24391
24264
|
var IDENTITY_FILES = {
|
|
@@ -24482,40 +24355,8 @@ var IDENTITY_PRESETS = {
|
|
|
24482
24355
|
};
|
|
24483
24356
|
var REQUIRED_IDENTITY_KEYS = Object.entries(IDENTITY_FILES).filter(([, spec]) => !spec.optional).map(([key]) => key);
|
|
24484
24357
|
var OPTIONAL_IDENTITY_KEYS = Object.entries(IDENTITY_FILES).filter(([, spec]) => spec.optional).map(([key]) => key);
|
|
24485
|
-
function isSignetManagedOhMyPiInstall() {
|
|
24486
|
-
for (const agentDir of listOhMyPiAgentDirCandidates()) {
|
|
24487
|
-
const extensionsDir = join13(agentDir, "extensions");
|
|
24488
|
-
for (const filename of [OH_MY_PI_MANAGED_EXTENSION_FILENAME, OH_MY_PI_LEGACY_MANAGED_EXTENSION_FILENAME]) {
|
|
24489
|
-
const extensionPath = join13(extensionsDir, filename);
|
|
24490
|
-
if (!existsSync13(extensionPath))
|
|
24491
|
-
continue;
|
|
24492
|
-
try {
|
|
24493
|
-
const content = readFileSync11(extensionPath, "utf8");
|
|
24494
|
-
if (content.includes(OH_MY_PI_MANAGED_MARKER))
|
|
24495
|
-
return true;
|
|
24496
|
-
} catch {}
|
|
24497
|
-
}
|
|
24498
|
-
}
|
|
24499
|
-
return false;
|
|
24500
|
-
}
|
|
24501
|
-
function isSignetManagedPiInstall() {
|
|
24502
|
-
for (const agentDir of listPiAgentDirCandidates()) {
|
|
24503
|
-
const extensionsDir = join13(agentDir, "extensions");
|
|
24504
|
-
for (const filename of [PI_MANAGED_EXTENSION_FILENAME, PI_LEGACY_MANAGED_EXTENSION_FILENAME]) {
|
|
24505
|
-
const extensionPath = join13(extensionsDir, filename);
|
|
24506
|
-
if (!existsSync13(extensionPath))
|
|
24507
|
-
continue;
|
|
24508
|
-
try {
|
|
24509
|
-
const content = readFileSync11(extensionPath, "utf8");
|
|
24510
|
-
if (content.includes(PI_MANAGED_MARKER))
|
|
24511
|
-
return true;
|
|
24512
|
-
} catch {}
|
|
24513
|
-
}
|
|
24514
|
-
}
|
|
24515
|
-
return false;
|
|
24516
|
-
}
|
|
24517
24358
|
function userHome() {
|
|
24518
|
-
return process.env.HOME?.trim() ||
|
|
24359
|
+
return process.env.HOME?.trim() || homedir7();
|
|
24519
24360
|
}
|
|
24520
24361
|
function resolveKimiHomePath() {
|
|
24521
24362
|
const currentOverride = process.env.KIMI_SHARE_DIR?.trim();
|
|
@@ -24524,22 +24365,18 @@ function resolveKimiHomePath() {
|
|
|
24524
24365
|
const legacyOverride = process.env.KIMI_CODE_HOME?.trim();
|
|
24525
24366
|
if (legacyOverride)
|
|
24526
24367
|
return legacyOverride;
|
|
24527
|
-
const currentHome =
|
|
24528
|
-
const legacyHome =
|
|
24529
|
-
if (
|
|
24368
|
+
const currentHome = join11(userHome(), ".kimi");
|
|
24369
|
+
const legacyHome = join11(userHome(), ".kimi-code");
|
|
24370
|
+
if (existsSync11(currentHome))
|
|
24530
24371
|
return currentHome;
|
|
24531
|
-
if (
|
|
24372
|
+
if (existsSync11(legacyHome))
|
|
24532
24373
|
return legacyHome;
|
|
24533
24374
|
return currentHome;
|
|
24534
24375
|
}
|
|
24535
|
-
function isBinaryOnPath(bin) {
|
|
24536
|
-
const separator = process.platform === "win32" ? ";" : ":";
|
|
24537
|
-
return (process.env.PATH ?? "").split(separator).some((directory) => directory.length > 0 && existsSync13(join13(directory, bin)));
|
|
24538
|
-
}
|
|
24539
24376
|
var HERMES_PROFILE_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
24540
24377
|
function resolveHermesHomePath() {
|
|
24541
24378
|
const hermesHome = process.env.HERMES_HOME?.trim();
|
|
24542
|
-
return hermesHome ||
|
|
24379
|
+
return hermesHome || join11(userHome(), ".hermes");
|
|
24543
24380
|
}
|
|
24544
24381
|
function resolveHermesTarget(profile) {
|
|
24545
24382
|
if (profile === undefined || profile === "") {
|
|
@@ -24551,7 +24388,7 @@ function resolveHermesTarget(profile) {
|
|
|
24551
24388
|
return {
|
|
24552
24389
|
kind: "profile",
|
|
24553
24390
|
profile,
|
|
24554
|
-
home:
|
|
24391
|
+
home: join11(resolveHermesHomePath(), "profiles", profile)
|
|
24555
24392
|
};
|
|
24556
24393
|
}
|
|
24557
24394
|
function hermesAgentCandidateDirs() {
|
|
@@ -24559,96 +24396,53 @@ function hermesAgentCandidateDirs() {
|
|
|
24559
24396
|
const hermesHome = resolveHermesHomePath();
|
|
24560
24397
|
return [
|
|
24561
24398
|
hermesHome,
|
|
24562
|
-
|
|
24563
|
-
|
|
24564
|
-
|
|
24565
|
-
|
|
24399
|
+
join11(hermesHome, "hermes-agent"),
|
|
24400
|
+
join11(home, "hermes-agent"),
|
|
24401
|
+
join11(home, ".local", "share", "hermes-agent"),
|
|
24402
|
+
join11(home, "src", "hermes-agent"),
|
|
24566
24403
|
"/opt/hermes-agent"
|
|
24567
24404
|
];
|
|
24568
24405
|
}
|
|
24569
24406
|
function resolveHermesRepoPath() {
|
|
24570
24407
|
const hermesRepo = process.env.HERMES_REPO?.trim();
|
|
24571
|
-
if (hermesRepo &&
|
|
24408
|
+
if (hermesRepo && existsSync11(join11(hermesRepo, "plugins", "memory"))) {
|
|
24572
24409
|
return hermesRepo;
|
|
24573
24410
|
}
|
|
24574
24411
|
for (const base of hermesAgentCandidateDirs()) {
|
|
24575
|
-
if (
|
|
24412
|
+
if (existsSync11(join11(base, "plugins", "memory")))
|
|
24576
24413
|
return base;
|
|
24577
24414
|
}
|
|
24578
24415
|
try {
|
|
24579
|
-
const hermesPath =
|
|
24416
|
+
const hermesPath = execFileSyncHidden("which", ["hermes"], {
|
|
24580
24417
|
encoding: "utf-8",
|
|
24581
24418
|
stdio: ["ignore", "pipe", "ignore"],
|
|
24582
24419
|
timeout: 3000
|
|
24583
24420
|
}).trim();
|
|
24584
24421
|
if (hermesPath) {
|
|
24585
|
-
const repoDir =
|
|
24586
|
-
if (
|
|
24422
|
+
const repoDir = dirname6(realpathSync(hermesPath));
|
|
24423
|
+
if (existsSync11(join11(repoDir, "plugins", "memory")))
|
|
24587
24424
|
return repoDir;
|
|
24588
24425
|
}
|
|
24589
24426
|
} catch {}
|
|
24590
24427
|
return null;
|
|
24591
24428
|
}
|
|
24592
24429
|
function resolveHermesRepoPluginPath() {
|
|
24593
|
-
const pluginFile =
|
|
24430
|
+
const pluginFile = join11("plugins", "memory", "signet", "__init__.py");
|
|
24594
24431
|
const hermesRepo = resolveHermesRepoPath();
|
|
24595
24432
|
if (hermesRepo !== null) {
|
|
24596
|
-
const candidate =
|
|
24597
|
-
if (
|
|
24433
|
+
const candidate = join11(hermesRepo, pluginFile);
|
|
24434
|
+
if (existsSync11(candidate))
|
|
24598
24435
|
return candidate;
|
|
24599
24436
|
}
|
|
24600
24437
|
return null;
|
|
24601
24438
|
}
|
|
24602
|
-
function detectExistingSetup(basePath) {
|
|
24603
|
-
const identityFileNames = Object.values(IDENTITY_FILES).map((spec) => spec.path);
|
|
24604
|
-
const foundFiles = [];
|
|
24605
|
-
for (const fileName of identityFileNames) {
|
|
24606
|
-
if (existsSync13(join13(basePath, fileName))) {
|
|
24607
|
-
foundFiles.push(fileName);
|
|
24608
|
-
}
|
|
24609
|
-
}
|
|
24610
|
-
const memoryDir = join13(basePath, "memory");
|
|
24611
|
-
let memoryLogCount = 0;
|
|
24612
|
-
if (existsSync13(memoryDir)) {
|
|
24613
|
-
try {
|
|
24614
|
-
const files = readdirSync5(memoryDir);
|
|
24615
|
-
memoryLogCount = files.filter((f2) => f2.endsWith(".md") && !f2.startsWith("TEMPLATE")).length;
|
|
24616
|
-
} catch {}
|
|
24617
|
-
}
|
|
24618
|
-
const home = homedir9();
|
|
24619
|
-
return {
|
|
24620
|
-
basePath,
|
|
24621
|
-
agentsDir: existsSync13(basePath),
|
|
24622
|
-
agentYaml: existsSync13(join13(basePath, "agent.yaml")),
|
|
24623
|
-
agentsMd: existsSync13(join13(basePath, "AGENTS.md")),
|
|
24624
|
-
configYaml: existsSync13(join13(basePath, "config.yaml")),
|
|
24625
|
-
memoryDb: existsSync13(join13(basePath, "memory", "memories.db")),
|
|
24626
|
-
identityFiles: foundFiles,
|
|
24627
|
-
hasMemoryDir: existsSync13(memoryDir),
|
|
24628
|
-
memoryLogCount,
|
|
24629
|
-
hasClawdhub: existsSync13(join13(basePath, ".clawdhub", "lock.json")),
|
|
24630
|
-
hasClaudeSkills: existsSync13(join13(home, ".claude", "skills")),
|
|
24631
|
-
harnesses: {
|
|
24632
|
-
claudeCode: existsSync13(join13(home, ".claude", "settings.json")),
|
|
24633
|
-
openclaw: existsSync13(join13(home, ".openclaw", "openclaw.json")) || existsSync13(join13(home, ".clawdbot", "clawdbot.json")),
|
|
24634
|
-
opencode: existsSync13(join13(home, ".config", "opencode", "config.json")),
|
|
24635
|
-
forge: existsSync13(join13(home, ".forge", ".mcp.json")) || existsSync13(join13(home, "forge", ".mcp.json")) || existsSync13(join13(home, ".forge", ".forge.toml")) || existsSync13(join13(home, "forge", ".forge.toml")),
|
|
24636
|
-
codex: existsSync13(join13(home, ".codex", "config.toml")) || existsSync13(join13(home, ".config", "signet", "bin", "codex")),
|
|
24637
|
-
kimi: existsSync13(join13(resolveKimiHomePath(), "config.toml")) || existsSync13(join13(home, ".kimi-code", "config.toml")) || isBinaryOnPath("kimi"),
|
|
24638
|
-
ohMyPi: isSignetManagedOhMyPiInstall() || existsSync13(resolveOhMyPiAgentDir()),
|
|
24639
|
-
pi: isSignetManagedPiInstall() || existsSync13(resolvePiAgentDir()),
|
|
24640
|
-
hermesAgent: resolveHermesRepoPath() !== null,
|
|
24641
|
-
gemini: existsSync13(join13(home, ".gemini", "settings.json"))
|
|
24642
|
-
}
|
|
24643
|
-
};
|
|
24644
|
-
}
|
|
24645
24439
|
async function loadIdentityFiles(basePath) {
|
|
24646
24440
|
const result = {};
|
|
24647
24441
|
for (const [key, spec] of Object.entries(IDENTITY_FILES)) {
|
|
24648
|
-
const filePath =
|
|
24649
|
-
if (
|
|
24442
|
+
const filePath = join11(basePath, spec.path);
|
|
24443
|
+
if (existsSync11(filePath)) {
|
|
24650
24444
|
try {
|
|
24651
|
-
const content =
|
|
24445
|
+
const content = readFileSync9(filePath, "utf-8");
|
|
24652
24446
|
const stats = statSync7(filePath);
|
|
24653
24447
|
result[key] = {
|
|
24654
24448
|
path: spec.path,
|
|
@@ -24670,10 +24464,10 @@ async function loadIdentityFiles(basePath) {
|
|
|
24670
24464
|
function loadIdentityFilesSync(basePath) {
|
|
24671
24465
|
const result = {};
|
|
24672
24466
|
for (const [key, spec] of Object.entries(IDENTITY_FILES)) {
|
|
24673
|
-
const filePath =
|
|
24674
|
-
if (
|
|
24467
|
+
const filePath = join11(basePath, spec.path);
|
|
24468
|
+
if (existsSync11(filePath)) {
|
|
24675
24469
|
try {
|
|
24676
|
-
const content =
|
|
24470
|
+
const content = readFileSync9(filePath, "utf-8");
|
|
24677
24471
|
const stats = statSync7(filePath);
|
|
24678
24472
|
result[key] = {
|
|
24679
24473
|
path: spec.path,
|
|
@@ -24697,7 +24491,7 @@ function hasValidIdentity(basePath) {
|
|
|
24697
24491
|
if (mode !== "managed")
|
|
24698
24492
|
return true;
|
|
24699
24493
|
for (const path of resolveRequiredIdentityPaths(basePath)) {
|
|
24700
|
-
if (!
|
|
24494
|
+
if (!existsSync11(join11(basePath, path))) {
|
|
24701
24495
|
return false;
|
|
24702
24496
|
}
|
|
24703
24497
|
}
|
|
@@ -24709,7 +24503,7 @@ function getMissingIdentityFiles(basePath) {
|
|
|
24709
24503
|
return [];
|
|
24710
24504
|
const missing = [];
|
|
24711
24505
|
for (const path of resolveRequiredIdentityPaths(basePath)) {
|
|
24712
|
-
if (!
|
|
24506
|
+
if (!existsSync11(join11(basePath, path))) {
|
|
24713
24507
|
missing.push(path);
|
|
24714
24508
|
}
|
|
24715
24509
|
}
|
|
@@ -24717,11 +24511,11 @@ function getMissingIdentityFiles(basePath) {
|
|
|
24717
24511
|
}
|
|
24718
24512
|
function resolveRequiredIdentityPaths(basePath) {
|
|
24719
24513
|
const legacyRequired = () => REQUIRED_IDENTITY_KEYS.map((key) => IDENTITY_FILES[key].path);
|
|
24720
|
-
const agentYaml =
|
|
24721
|
-
if (!
|
|
24514
|
+
const agentYaml = join11(basePath, "agent.yaml");
|
|
24515
|
+
if (!existsSync11(agentYaml))
|
|
24722
24516
|
return legacyRequired();
|
|
24723
24517
|
try {
|
|
24724
|
-
const config = parseSimpleYaml(
|
|
24518
|
+
const config = parseSimpleYaml(readFileSync9(agentYaml, "utf-8"));
|
|
24725
24519
|
const identity = readRecord(readRecord(config).identity);
|
|
24726
24520
|
const configured = readIdentityEntryList(readRecord(identity.startup).load);
|
|
24727
24521
|
if (configured.length > 0)
|
|
@@ -24778,11 +24572,11 @@ function resolveIdentityModeFromConfig(config) {
|
|
|
24778
24572
|
return "managed";
|
|
24779
24573
|
}
|
|
24780
24574
|
function loadIdentityMode(agentsDir) {
|
|
24781
|
-
const agentYaml =
|
|
24782
|
-
if (!
|
|
24575
|
+
const agentYaml = join11(agentsDir, "agent.yaml");
|
|
24576
|
+
if (!existsSync11(agentYaml))
|
|
24783
24577
|
return "managed";
|
|
24784
24578
|
try {
|
|
24785
|
-
return resolveIdentityModeFromConfig(parseSimpleYaml(
|
|
24579
|
+
return resolveIdentityModeFromConfig(parseSimpleYaml(readFileSync9(agentYaml, "utf-8")));
|
|
24786
24580
|
} catch {
|
|
24787
24581
|
return "managed";
|
|
24788
24582
|
}
|
|
@@ -24833,11 +24627,11 @@ function identityHeaderFor(path, role) {
|
|
|
24833
24627
|
return STATIC_HEADER_BY_FILE[filename] ?? role ?? filename.replace(/\.md$/i, "");
|
|
24834
24628
|
}
|
|
24835
24629
|
function resolveStartupIdentityFiles(agentsDir) {
|
|
24836
|
-
const agentYaml =
|
|
24837
|
-
if (!
|
|
24630
|
+
const agentYaml = join11(agentsDir, "agent.yaml");
|
|
24631
|
+
if (!existsSync11(agentYaml))
|
|
24838
24632
|
return STATIC_BUDGETS.map(({ file, budget }) => ({ path: file, budget }));
|
|
24839
24633
|
try {
|
|
24840
|
-
const config = parseSimpleYaml(
|
|
24634
|
+
const config = parseSimpleYaml(readFileSync9(agentYaml, "utf-8"));
|
|
24841
24635
|
if (!identityModeReadsFiles(resolveIdentityModeFromConfig(config)))
|
|
24842
24636
|
return [];
|
|
24843
24637
|
const identity = readRecord(config.identity);
|
|
@@ -24853,12 +24647,12 @@ function resolveStartupIdentityFiles(agentsDir) {
|
|
|
24853
24647
|
return STATIC_BUDGETS.map(({ file, budget }) => ({ path: file, budget }));
|
|
24854
24648
|
}
|
|
24855
24649
|
function resolveSpecialIdentityFiles(agentsDir, kind) {
|
|
24856
|
-
const agentYaml =
|
|
24857
|
-
if (!
|
|
24650
|
+
const agentYaml = join11(agentsDir, "agent.yaml");
|
|
24651
|
+
if (!existsSync11(agentYaml)) {
|
|
24858
24652
|
return IDENTITY_PRESETS.minimal.special.filter((entry) => entry.kind === kind);
|
|
24859
24653
|
}
|
|
24860
24654
|
try {
|
|
24861
|
-
const config = parseSimpleYaml(
|
|
24655
|
+
const config = parseSimpleYaml(readFileSync9(agentYaml, "utf-8"));
|
|
24862
24656
|
if (!identityModeReadsFiles(resolveIdentityModeFromConfig(config)))
|
|
24863
24657
|
return [];
|
|
24864
24658
|
const identity = readRecord(config.identity);
|
|
@@ -24895,17 +24689,17 @@ function resolvePromptSubmitTimeoutMs(raw) {
|
|
|
24895
24689
|
return ms;
|
|
24896
24690
|
}
|
|
24897
24691
|
function readStaticIdentity(agentsDir, status = STATIC_IDENTITY_OFFLINE_STATUS) {
|
|
24898
|
-
if (!
|
|
24692
|
+
if (!existsSync11(agentsDir))
|
|
24899
24693
|
return null;
|
|
24900
24694
|
if (!identityModeReadsFiles(loadIdentityMode(agentsDir)))
|
|
24901
24695
|
return null;
|
|
24902
24696
|
const parts = [];
|
|
24903
24697
|
for (const entry of resolveStartupIdentityFiles(agentsDir)) {
|
|
24904
|
-
const path =
|
|
24905
|
-
if (!
|
|
24698
|
+
const path = join11(agentsDir, entry.path);
|
|
24699
|
+
if (!existsSync11(path))
|
|
24906
24700
|
continue;
|
|
24907
24701
|
try {
|
|
24908
|
-
const raw =
|
|
24702
|
+
const raw = readFileSync9(path, "utf-8").trim();
|
|
24909
24703
|
if (!raw)
|
|
24910
24704
|
continue;
|
|
24911
24705
|
const budget = entry.budget ?? STATIC_BUDGETS.find((candidate) => candidate.file === entry.path)?.budget ?? 4000;
|
|
@@ -24940,8 +24734,8 @@ function summarizeIdentity(identity) {
|
|
|
24940
24734
|
`);
|
|
24941
24735
|
}
|
|
24942
24736
|
// src/agents.ts
|
|
24943
|
-
import { existsSync as
|
|
24944
|
-
import { join as
|
|
24737
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync7, readdirSync as readdirSync5, writeFileSync as writeFileSync6 } from "node:fs";
|
|
24738
|
+
import { join as join12 } from "node:path";
|
|
24945
24739
|
function resolveAgentMemoryPolicy(readPolicy, policyGroup) {
|
|
24946
24740
|
if (readPolicy !== "isolated" && readPolicy !== "shared" && readPolicy !== "group") {
|
|
24947
24741
|
throw new Error("memory must be one of: isolated, shared, group");
|
|
@@ -24966,37 +24760,37 @@ var IDENTITY_FILES2 = [
|
|
|
24966
24760
|
"BOOTSTRAP.md"
|
|
24967
24761
|
];
|
|
24968
24762
|
function discoverAgents(agentsDir) {
|
|
24969
|
-
const root =
|
|
24970
|
-
if (!
|
|
24763
|
+
const root = join12(agentsDir, "agents");
|
|
24764
|
+
if (!existsSync12(root))
|
|
24971
24765
|
return [];
|
|
24972
|
-
return
|
|
24766
|
+
return readdirSync5(root, { withFileTypes: true }).filter((d2) => d2.isDirectory()).map((d2) => ({ name: d2.name }));
|
|
24973
24767
|
}
|
|
24974
24768
|
function scaffoldAgent(name, agentsDir) {
|
|
24975
|
-
const dir =
|
|
24976
|
-
if (!
|
|
24977
|
-
|
|
24978
|
-
const soul =
|
|
24979
|
-
if (!
|
|
24980
|
-
|
|
24769
|
+
const dir = join12(agentsDir, "agents", name);
|
|
24770
|
+
if (!existsSync12(dir))
|
|
24771
|
+
mkdirSync7(dir, { recursive: true });
|
|
24772
|
+
const soul = join12(dir, "SOUL.md");
|
|
24773
|
+
if (!existsSync12(soul))
|
|
24774
|
+
writeFileSync6(soul, `# Soul
|
|
24981
24775
|
|
|
24982
24776
|
Add ${name}'s personality here.
|
|
24983
24777
|
`);
|
|
24984
|
-
const identity =
|
|
24985
|
-
if (!
|
|
24986
|
-
|
|
24778
|
+
const identity = join12(dir, "IDENTITY.md");
|
|
24779
|
+
if (!existsSync12(identity))
|
|
24780
|
+
writeFileSync6(identity, `# Identity
|
|
24987
24781
|
|
|
24988
24782
|
name: ${name}
|
|
24989
24783
|
`);
|
|
24990
24784
|
}
|
|
24991
24785
|
function getAgentIdentityFiles(name, agentsDir) {
|
|
24992
24786
|
const result = {};
|
|
24993
|
-
const agentDir =
|
|
24787
|
+
const agentDir = join12(agentsDir, "agents", name);
|
|
24994
24788
|
for (const file of IDENTITY_FILES2) {
|
|
24995
|
-
const specific =
|
|
24996
|
-
const fallback =
|
|
24997
|
-
if (
|
|
24789
|
+
const specific = join12(agentDir, file);
|
|
24790
|
+
const fallback = join12(agentsDir, file);
|
|
24791
|
+
if (existsSync12(specific))
|
|
24998
24792
|
result[file] = specific;
|
|
24999
|
-
else if (
|
|
24793
|
+
else if (existsSync12(fallback))
|
|
25000
24794
|
result[file] = fallback;
|
|
25001
24795
|
}
|
|
25002
24796
|
return result;
|
|
@@ -25044,13 +24838,13 @@ function resolveAgentSkills(agentDef, allSkills) {
|
|
|
25044
24838
|
return allSkills.filter((s2) => allowed.has(s2));
|
|
25045
24839
|
}
|
|
25046
24840
|
// src/skills.ts
|
|
25047
|
-
import { existsSync as
|
|
25048
|
-
import { join as
|
|
25049
|
-
import { homedir as
|
|
24841
|
+
import { existsSync as existsSync14, mkdirSync as mkdirSync9, readFileSync as readFileSync10, readdirSync as readdirSync7, statSync as statSync8, writeFileSync as writeFileSync7 } from "node:fs";
|
|
24842
|
+
import { join as join14 } from "node:path";
|
|
24843
|
+
import { homedir as homedir8 } from "node:os";
|
|
25050
24844
|
|
|
25051
24845
|
// src/symlinks.ts
|
|
25052
|
-
import { existsSync as
|
|
25053
|
-
import { join as
|
|
24846
|
+
import { existsSync as existsSync13, lstatSync, mkdirSync as mkdirSync8, readdirSync as readdirSync6, symlinkSync, unlinkSync as unlinkSync2 } from "node:fs";
|
|
24847
|
+
import { join as join13 } from "node:path";
|
|
25054
24848
|
function linkDirSync(target, path) {
|
|
25055
24849
|
const type = process.platform === "win32" ? "junction" : "dir";
|
|
25056
24850
|
symlinkSync(target, path, type);
|
|
@@ -25061,19 +24855,19 @@ function symlinkSkills(sourceDir, targetDir, options = {}) {
|
|
|
25061
24855
|
skipped: [],
|
|
25062
24856
|
errors: []
|
|
25063
24857
|
};
|
|
25064
|
-
if (!
|
|
24858
|
+
if (!existsSync13(sourceDir)) {
|
|
25065
24859
|
return result;
|
|
25066
24860
|
}
|
|
25067
|
-
const targetParent =
|
|
25068
|
-
if (!
|
|
25069
|
-
|
|
24861
|
+
const targetParent = join13(targetDir, "..");
|
|
24862
|
+
if (!existsSync13(targetParent)) {
|
|
24863
|
+
mkdirSync8(targetParent, { recursive: true });
|
|
25070
24864
|
}
|
|
25071
|
-
if (!
|
|
25072
|
-
|
|
24865
|
+
if (!existsSync13(targetDir)) {
|
|
24866
|
+
mkdirSync8(targetDir, { recursive: true });
|
|
25073
24867
|
}
|
|
25074
24868
|
let entries;
|
|
25075
24869
|
try {
|
|
25076
|
-
entries =
|
|
24870
|
+
entries = readdirSync6(sourceDir);
|
|
25077
24871
|
} catch (e) {
|
|
25078
24872
|
result.errors.push({
|
|
25079
24873
|
path: sourceDir,
|
|
@@ -25082,8 +24876,8 @@ function symlinkSkills(sourceDir, targetDir, options = {}) {
|
|
|
25082
24876
|
return result;
|
|
25083
24877
|
}
|
|
25084
24878
|
for (const entry of entries) {
|
|
25085
|
-
const srcPath =
|
|
25086
|
-
const destPath =
|
|
24879
|
+
const srcPath = join13(sourceDir, entry);
|
|
24880
|
+
const destPath = join13(targetDir, entry);
|
|
25087
24881
|
try {
|
|
25088
24882
|
const src = lstatSync(srcPath);
|
|
25089
24883
|
if (src.isSymbolicLink() || !src.isDirectory()) {
|
|
@@ -25125,10 +24919,10 @@ function symlinkSkills(sourceDir, targetDir, options = {}) {
|
|
|
25125
24919
|
return result;
|
|
25126
24920
|
}
|
|
25127
24921
|
function symlinkDir(src, dest, options = {}) {
|
|
25128
|
-
if (!
|
|
24922
|
+
if (!existsSync13(src)) {
|
|
25129
24923
|
return false;
|
|
25130
24924
|
}
|
|
25131
|
-
if (
|
|
24925
|
+
if (existsSync13(dest)) {
|
|
25132
24926
|
try {
|
|
25133
24927
|
const stat = lstatSync(dest);
|
|
25134
24928
|
if (stat.isSymbolicLink()) {
|
|
@@ -25154,34 +24948,34 @@ function symlinkDir(src, dest, options = {}) {
|
|
|
25154
24948
|
}
|
|
25155
24949
|
|
|
25156
24950
|
// src/skills.ts
|
|
25157
|
-
var home =
|
|
24951
|
+
var home = homedir8();
|
|
25158
24952
|
function loadClawdhubLock(basePath) {
|
|
25159
|
-
const lockPath =
|
|
25160
|
-
if (!
|
|
24953
|
+
const lockPath = join14(basePath, ".clawdhub", "lock.json");
|
|
24954
|
+
if (!existsSync14(lockPath)) {
|
|
25161
24955
|
return null;
|
|
25162
24956
|
}
|
|
25163
24957
|
try {
|
|
25164
|
-
const content =
|
|
24958
|
+
const content = readFileSync10(lockPath, "utf-8");
|
|
25165
24959
|
return JSON.parse(content);
|
|
25166
24960
|
} catch {
|
|
25167
24961
|
return null;
|
|
25168
24962
|
}
|
|
25169
24963
|
}
|
|
25170
24964
|
function symlinkClaudeSkills(basePath) {
|
|
25171
|
-
const claudeSkillsDir =
|
|
25172
|
-
const targetSkillsDir =
|
|
25173
|
-
if (!
|
|
24965
|
+
const claudeSkillsDir = join14(home, ".claude", "skills");
|
|
24966
|
+
const targetSkillsDir = join14(basePath, "skills");
|
|
24967
|
+
if (!existsSync14(claudeSkillsDir)) {
|
|
25174
24968
|
return { symlinked: 0, skills: [] };
|
|
25175
24969
|
}
|
|
25176
|
-
if (!
|
|
25177
|
-
|
|
24970
|
+
if (!existsSync14(targetSkillsDir)) {
|
|
24971
|
+
mkdirSync9(targetSkillsDir, { recursive: true });
|
|
25178
24972
|
}
|
|
25179
24973
|
const symlinkedSkills = [];
|
|
25180
24974
|
try {
|
|
25181
|
-
const skills =
|
|
24975
|
+
const skills = readdirSync7(claudeSkillsDir);
|
|
25182
24976
|
for (const skill of skills) {
|
|
25183
|
-
const src =
|
|
25184
|
-
const dest =
|
|
24977
|
+
const src = join14(claudeSkillsDir, skill);
|
|
24978
|
+
const dest = join14(targetSkillsDir, skill);
|
|
25185
24979
|
try {
|
|
25186
24980
|
if (!statSync8(src).isDirectory())
|
|
25187
24981
|
continue;
|
|
@@ -25196,12 +24990,12 @@ function symlinkClaudeSkills(basePath) {
|
|
|
25196
24990
|
return { symlinked: symlinkedSkills.length, skills: symlinkedSkills };
|
|
25197
24991
|
}
|
|
25198
24992
|
function writeRegistry(basePath, registry) {
|
|
25199
|
-
const skillsDir =
|
|
25200
|
-
const registryPath =
|
|
25201
|
-
if (!
|
|
25202
|
-
|
|
24993
|
+
const skillsDir = join14(basePath, "skills");
|
|
24994
|
+
const registryPath = join14(skillsDir, "registry.json");
|
|
24995
|
+
if (!existsSync14(skillsDir)) {
|
|
24996
|
+
mkdirSync9(skillsDir, { recursive: true });
|
|
25203
24997
|
}
|
|
25204
|
-
|
|
24998
|
+
writeFileSync7(registryPath, JSON.stringify(registry, null, 2), "utf-8");
|
|
25205
24999
|
}
|
|
25206
25000
|
async function unifySkills(basePath, config = {}) {
|
|
25207
25001
|
const registry = {
|
|
@@ -25215,7 +25009,7 @@ async function unifySkills(basePath, config = {}) {
|
|
|
25215
25009
|
if (clawdhubLock) {
|
|
25216
25010
|
registry.sources.push({
|
|
25217
25011
|
type: "openclaw",
|
|
25218
|
-
path:
|
|
25012
|
+
path: join14(basePath, ".clawdhub")
|
|
25219
25013
|
});
|
|
25220
25014
|
const skillsData = clawdhubLock.skills || clawdhubLock;
|
|
25221
25015
|
for (const [name, data] of Object.entries(skillsData)) {
|
|
@@ -25237,10 +25031,10 @@ async function unifySkills(basePath, config = {}) {
|
|
|
25237
25031
|
}
|
|
25238
25032
|
}
|
|
25239
25033
|
const claudeResult = symlinkClaudeSkills(basePath);
|
|
25240
|
-
if (claudeResult.symlinked > 0 ||
|
|
25034
|
+
if (claudeResult.symlinked > 0 || existsSync14(join14(home, ".claude", "skills"))) {
|
|
25241
25035
|
registry.sources.push({
|
|
25242
25036
|
type: "claude-code",
|
|
25243
|
-
path:
|
|
25037
|
+
path: join14(home, ".claude", "skills")
|
|
25244
25038
|
});
|
|
25245
25039
|
for (const skillName of claudeResult.skills) {
|
|
25246
25040
|
if (!registry.skills[skillName]) {
|
|
@@ -25248,7 +25042,7 @@ async function unifySkills(basePath, config = {}) {
|
|
|
25248
25042
|
name: skillName,
|
|
25249
25043
|
source: "claude-code",
|
|
25250
25044
|
symlinked: true,
|
|
25251
|
-
path:
|
|
25045
|
+
path: join14(basePath, "skills", skillName)
|
|
25252
25046
|
};
|
|
25253
25047
|
symlinked++;
|
|
25254
25048
|
} else {
|
|
@@ -25258,7 +25052,7 @@ async function unifySkills(basePath, config = {}) {
|
|
|
25258
25052
|
}
|
|
25259
25053
|
if (config.registries) {
|
|
25260
25054
|
for (const reg of config.registries) {
|
|
25261
|
-
if (!
|
|
25055
|
+
if (!existsSync14(reg.path)) {
|
|
25262
25056
|
continue;
|
|
25263
25057
|
}
|
|
25264
25058
|
registry.sources.push({
|
|
@@ -25266,9 +25060,9 @@ async function unifySkills(basePath, config = {}) {
|
|
|
25266
25060
|
path: reg.path
|
|
25267
25061
|
});
|
|
25268
25062
|
try {
|
|
25269
|
-
const entries =
|
|
25063
|
+
const entries = readdirSync7(reg.path);
|
|
25270
25064
|
for (const entry of entries) {
|
|
25271
|
-
const entryPath =
|
|
25065
|
+
const entryPath = join14(reg.path, entry);
|
|
25272
25066
|
try {
|
|
25273
25067
|
if (!statSync8(entryPath).isDirectory())
|
|
25274
25068
|
continue;
|
|
@@ -25280,9 +25074,9 @@ async function unifySkills(basePath, config = {}) {
|
|
|
25280
25074
|
continue;
|
|
25281
25075
|
}
|
|
25282
25076
|
if (reg.symlink) {
|
|
25283
|
-
const targetPath =
|
|
25284
|
-
if (!
|
|
25285
|
-
|
|
25077
|
+
const targetPath = join14(basePath, "skills", entry);
|
|
25078
|
+
if (!existsSync14(join14(basePath, "skills"))) {
|
|
25079
|
+
mkdirSync9(join14(basePath, "skills"), { recursive: true });
|
|
25286
25080
|
}
|
|
25287
25081
|
if (symlinkDir(entryPath, targetPath)) {
|
|
25288
25082
|
registry.skills[entry] = {
|
|
@@ -25398,8 +25192,8 @@ function parseTranscriptSkills(content) {
|
|
|
25398
25192
|
return { records, skipped };
|
|
25399
25193
|
}
|
|
25400
25194
|
// src/import.ts
|
|
25401
|
-
import { existsSync as
|
|
25402
|
-
import { join as
|
|
25195
|
+
import { existsSync as existsSync15, readFileSync as readFileSync11, readdirSync as readdirSync8 } from "node:fs";
|
|
25196
|
+
import { join as join15 } from "node:path";
|
|
25403
25197
|
var DATE_FILENAME_PATTERN = /^(\d{4}-\d{2}-\d{2})\.md$/;
|
|
25404
25198
|
function estimateTokens(text) {
|
|
25405
25199
|
return Math.ceil(text.length / 4);
|
|
@@ -25606,21 +25400,21 @@ function importMemoryLogs(basePath, db) {
|
|
|
25606
25400
|
skipped: 0,
|
|
25607
25401
|
errors: []
|
|
25608
25402
|
};
|
|
25609
|
-
const memoryDir =
|
|
25610
|
-
if (!
|
|
25403
|
+
const memoryDir = join15(basePath, "memory");
|
|
25404
|
+
if (!existsSync15(memoryDir)) {
|
|
25611
25405
|
result.errors.push(`Memory directory not found: ${memoryDir}`);
|
|
25612
25406
|
return result;
|
|
25613
25407
|
}
|
|
25614
25408
|
let files;
|
|
25615
25409
|
try {
|
|
25616
|
-
files =
|
|
25410
|
+
files = readdirSync8(memoryDir).filter((f2) => f2.endsWith(".md") && !f2.startsWith("TEMPLATE"));
|
|
25617
25411
|
} catch (err) {
|
|
25618
25412
|
const message = err instanceof Error ? err.message : String(err);
|
|
25619
25413
|
result.errors.push(`Failed to read memory directory: ${message}`);
|
|
25620
25414
|
return result;
|
|
25621
25415
|
}
|
|
25622
25416
|
for (const file of files) {
|
|
25623
|
-
const filePath =
|
|
25417
|
+
const filePath = join15(memoryDir, file);
|
|
25624
25418
|
const date = extractDateFromFilename(file);
|
|
25625
25419
|
if (!date) {
|
|
25626
25420
|
result.skipped++;
|
|
@@ -25629,7 +25423,7 @@ function importMemoryLogs(basePath, db) {
|
|
|
25629
25423
|
}
|
|
25630
25424
|
let content;
|
|
25631
25425
|
try {
|
|
25632
|
-
content =
|
|
25426
|
+
content = readFileSync11(filePath, "utf-8");
|
|
25633
25427
|
} catch (err) {
|
|
25634
25428
|
const message = err instanceof Error ? err.message : String(err);
|
|
25635
25429
|
result.errors.push(`Failed to read file ${file}: ${message}`);
|
|
@@ -26838,16 +26632,16 @@ function resolveRoutingDecision(config, request, runtimeSnapshot) {
|
|
|
26838
26632
|
});
|
|
26839
26633
|
}
|
|
26840
26634
|
// src/pipeline-pause.ts
|
|
26841
|
-
import { existsSync as
|
|
26842
|
-
import { join as
|
|
26635
|
+
import { existsSync as existsSync16, readFileSync as readFileSync12, writeFileSync as writeFileSync8 } from "node:fs";
|
|
26636
|
+
import { join as join16 } from "node:path";
|
|
26843
26637
|
var PIPELINE_CONFIG_FILES = ["agent.yaml", "AGENT.yaml", "config.yaml"];
|
|
26844
26638
|
function isRecord10(value) {
|
|
26845
26639
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26846
26640
|
}
|
|
26847
26641
|
function findPipelineConfigFile(dir) {
|
|
26848
26642
|
for (const name of PIPELINE_CONFIG_FILES) {
|
|
26849
|
-
const file =
|
|
26850
|
-
if (
|
|
26643
|
+
const file = join16(dir, name);
|
|
26644
|
+
if (existsSync16(file)) {
|
|
26851
26645
|
return file;
|
|
26852
26646
|
}
|
|
26853
26647
|
}
|
|
@@ -26858,7 +26652,7 @@ function readCfg(dir) {
|
|
|
26858
26652
|
if (file === null) {
|
|
26859
26653
|
return { file: null, cfg: null };
|
|
26860
26654
|
}
|
|
26861
|
-
const parsed = parseSimpleYaml(
|
|
26655
|
+
const parsed = parseSimpleYaml(readFileSync12(file, "utf-8"));
|
|
26862
26656
|
return { file, cfg: isRecord10(parsed) ? parsed : {} };
|
|
26863
26657
|
}
|
|
26864
26658
|
function readMem(cfg) {
|
|
@@ -26901,7 +26695,7 @@ function setPipelinePaused(dir, paused) {
|
|
|
26901
26695
|
const nextP2 = { ...pipeline ?? {}, paused };
|
|
26902
26696
|
const nextMem = { ...memory ?? {}, pipelineV2: nextP2 };
|
|
26903
26697
|
const next = { ...root, memory: nextMem };
|
|
26904
|
-
|
|
26698
|
+
writeFileSync8(file, formatYaml(next));
|
|
26905
26699
|
return {
|
|
26906
26700
|
file,
|
|
26907
26701
|
exists: true,
|
|
@@ -26910,13 +26704,12 @@ function setPipelinePaused(dir, paused) {
|
|
|
26910
26704
|
};
|
|
26911
26705
|
}
|
|
26912
26706
|
// src/package-manager.ts
|
|
26913
|
-
import {
|
|
26914
|
-
import {
|
|
26915
|
-
import {
|
|
26916
|
-
import { join as join19 } from "node:path";
|
|
26707
|
+
import { existsSync as existsSync17, readFileSync as readFileSync13 } from "node:fs";
|
|
26708
|
+
import { homedir as homedir10 } from "node:os";
|
|
26709
|
+
import { join as join17 } from "node:path";
|
|
26917
26710
|
|
|
26918
26711
|
// src/package-manager-path.ts
|
|
26919
|
-
import { homedir as
|
|
26712
|
+
import { homedir as homedir9 } from "node:os";
|
|
26920
26713
|
import { posix, win32 } from "node:path";
|
|
26921
26714
|
function normalizeExecutablePath(path, platform3) {
|
|
26922
26715
|
const normalized = (platform3 === "win32" ? win32 : posix).resolve(path).replaceAll("\\", "/");
|
|
@@ -26931,7 +26724,7 @@ function inferPackageManagerFromExecutable(executablePath, options = {}) {
|
|
|
26931
26724
|
if (!executablePath)
|
|
26932
26725
|
return null;
|
|
26933
26726
|
const env = options.env ?? process.env;
|
|
26934
|
-
const home2 = options.home ??
|
|
26727
|
+
const home2 = options.home ?? homedir9();
|
|
26935
26728
|
const platform3 = options.platform ?? process.platform;
|
|
26936
26729
|
const pathApi = platform3 === "win32" ? win32 : posix;
|
|
26937
26730
|
const candidate = normalizeExecutablePath(executablePath, platform3);
|
|
@@ -26988,7 +26781,7 @@ function parsePackageManagerUserAgent(userAgent) {
|
|
|
26988
26781
|
}
|
|
26989
26782
|
function defaultCommandExists(command) {
|
|
26990
26783
|
try {
|
|
26991
|
-
const result =
|
|
26784
|
+
const result = spawnSyncHidden(command, ["--version"], { stdio: "ignore" });
|
|
26992
26785
|
return result.status === 0;
|
|
26993
26786
|
} catch {
|
|
26994
26787
|
return false;
|
|
@@ -27012,12 +26805,12 @@ function pickFirstAvailable(available, order) {
|
|
|
27012
26805
|
function readConfiguredPackageManager(agentsDir) {
|
|
27013
26806
|
if (!agentsDir)
|
|
27014
26807
|
return null;
|
|
27015
|
-
const configPaths = [
|
|
26808
|
+
const configPaths = [join17(agentsDir, "agent.yaml"), join17(agentsDir, "AGENT.yaml"), join17(agentsDir, "config.yaml")];
|
|
27016
26809
|
for (const path of configPaths) {
|
|
27017
|
-
if (!
|
|
26810
|
+
if (!existsSync17(path))
|
|
27018
26811
|
continue;
|
|
27019
26812
|
try {
|
|
27020
|
-
const yaml = parseSimpleYaml(
|
|
26813
|
+
const yaml = parseSimpleYaml(readFileSync13(path, "utf-8"));
|
|
27021
26814
|
const install = yaml.install;
|
|
27022
26815
|
const source = install?.source;
|
|
27023
26816
|
if (source === "fallback")
|
|
@@ -27043,7 +26836,7 @@ function resolvePrimaryPackageManager(options = {}) {
|
|
|
27043
26836
|
if (!options.execPath && !inferFromPath(execPathForDetection)) {
|
|
27044
26837
|
try {
|
|
27045
26838
|
const locator = (options.platform ?? process.platform) === "win32" ? "where" : "which";
|
|
27046
|
-
const result =
|
|
26839
|
+
const result = spawnSyncHidden(locator, ["signet"], { encoding: "utf-8" });
|
|
27047
26840
|
if (result.status === 0 && result.stdout.trim()) {
|
|
27048
26841
|
execPathForDetection = result.stdout.trim();
|
|
27049
26842
|
}
|
|
@@ -27129,58 +26922,54 @@ function resolveGlobalPackagePath(family, packageName) {
|
|
|
27129
26922
|
try {
|
|
27130
26923
|
switch (family) {
|
|
27131
26924
|
case "bun": {
|
|
27132
|
-
const bunGlobal =
|
|
27133
|
-
if (
|
|
26925
|
+
const bunGlobal = join17(process.env.BUN_INSTALL ?? join17(homedir10(), ".bun"), "install", "global", "node_modules", packageName);
|
|
26926
|
+
if (existsSync17(bunGlobal))
|
|
27134
26927
|
return bunGlobal;
|
|
27135
26928
|
return;
|
|
27136
26929
|
}
|
|
27137
26930
|
case "npm": {
|
|
27138
|
-
const result =
|
|
26931
|
+
const result = spawnSyncHidden("npm", ["root", "-g"], {
|
|
27139
26932
|
encoding: "utf-8",
|
|
27140
|
-
timeout: 1e4
|
|
27141
|
-
windowsHide: true
|
|
26933
|
+
timeout: 1e4
|
|
27142
26934
|
});
|
|
27143
26935
|
if (result.status === 0 && result.stdout.trim()) {
|
|
27144
|
-
const candidate =
|
|
27145
|
-
if (
|
|
26936
|
+
const candidate = join17(result.stdout.trim(), packageName);
|
|
26937
|
+
if (existsSync17(candidate))
|
|
27146
26938
|
return candidate;
|
|
27147
26939
|
}
|
|
27148
26940
|
return;
|
|
27149
26941
|
}
|
|
27150
26942
|
case "pnpm": {
|
|
27151
|
-
const result =
|
|
26943
|
+
const result = spawnSyncHidden("pnpm", ["root", "-g"], {
|
|
27152
26944
|
encoding: "utf-8",
|
|
27153
|
-
timeout: 1e4
|
|
27154
|
-
windowsHide: true
|
|
26945
|
+
timeout: 1e4
|
|
27155
26946
|
});
|
|
27156
26947
|
if (result.status === 0 && result.stdout.trim()) {
|
|
27157
|
-
const candidate =
|
|
27158
|
-
if (
|
|
26948
|
+
const candidate = join17(result.stdout.trim(), packageName);
|
|
26949
|
+
if (existsSync17(candidate))
|
|
27159
26950
|
return candidate;
|
|
27160
26951
|
}
|
|
27161
26952
|
return;
|
|
27162
26953
|
}
|
|
27163
26954
|
case "yarn": {
|
|
27164
|
-
const versionResult =
|
|
26955
|
+
const versionResult = spawnSyncHidden("yarn", ["--version"], {
|
|
27165
26956
|
encoding: "utf-8",
|
|
27166
|
-
timeout: 5000
|
|
27167
|
-
windowsHide: true
|
|
26957
|
+
timeout: 5000
|
|
27168
26958
|
});
|
|
27169
26959
|
const isClassic = versionResult.status === 0 && /^1\./.test(versionResult.stdout.trim());
|
|
27170
26960
|
if (isClassic) {
|
|
27171
|
-
const result =
|
|
26961
|
+
const result = spawnSyncHidden("yarn", ["global", "dir"], {
|
|
27172
26962
|
encoding: "utf-8",
|
|
27173
|
-
timeout: 1e4
|
|
27174
|
-
windowsHide: true
|
|
26963
|
+
timeout: 1e4
|
|
27175
26964
|
});
|
|
27176
26965
|
if (result.status === 0 && result.stdout.trim()) {
|
|
27177
|
-
const candidate =
|
|
27178
|
-
if (
|
|
26966
|
+
const candidate = join17(result.stdout.trim(), "node_modules", packageName);
|
|
26967
|
+
if (existsSync17(candidate))
|
|
27179
26968
|
return candidate;
|
|
27180
26969
|
}
|
|
27181
26970
|
} else {
|
|
27182
|
-
const berryGlobal =
|
|
27183
|
-
if (
|
|
26971
|
+
const berryGlobal = join17(process.env.YARN_GLOBAL_FOLDER ?? join17(homedir10(), ".yarn", "berry", "global"), "node_modules", packageName);
|
|
26972
|
+
if (existsSync17(berryGlobal))
|
|
27184
26973
|
return berryGlobal;
|
|
27185
26974
|
}
|
|
27186
26975
|
return;
|
|
@@ -27203,8 +26992,8 @@ function getGlobalInstallCommand(family, packageName) {
|
|
|
27203
26992
|
}
|
|
27204
26993
|
}
|
|
27205
26994
|
// src/signet-installation.ts
|
|
27206
|
-
import { existsSync as
|
|
27207
|
-
import { homedir as
|
|
26995
|
+
import { existsSync as existsSync18, realpathSync as realpathSync2 } from "node:fs";
|
|
26996
|
+
import { homedir as homedir11 } from "node:os";
|
|
27208
26997
|
import { posix as posix2, win32 as win322 } from "node:path";
|
|
27209
26998
|
var PACKAGE_MANAGERS = ["npm", "pnpm", "bun", "yarn"];
|
|
27210
26999
|
function safeRealpath(path, platform3, realpath) {
|
|
@@ -27263,10 +27052,10 @@ function packageManagerEntryPointRemovalCommand(path, platform3) {
|
|
|
27263
27052
|
}
|
|
27264
27053
|
function detectSignetInstallations(options = {}) {
|
|
27265
27054
|
const env = options.env ?? process.env;
|
|
27266
|
-
const home2 = options.home ??
|
|
27055
|
+
const home2 = options.home ?? homedir11();
|
|
27267
27056
|
const platform3 = options.platform ?? process.platform;
|
|
27268
27057
|
const activeExecutablePath = options.execPath ?? process.execPath;
|
|
27269
|
-
const pathExists = options.exists ??
|
|
27058
|
+
const pathExists = options.exists ?? existsSync18;
|
|
27270
27059
|
const realpath = options.realpath ?? realpathSync2;
|
|
27271
27060
|
const activeRealPath = safeRealpath(activeExecutablePath, platform3, realpath);
|
|
27272
27061
|
const signetDir = env.SIGNET_DIR?.trim();
|
|
@@ -27356,8 +27145,6 @@ export {
|
|
|
27356
27145
|
writeRegistry,
|
|
27357
27146
|
writeGraphiqState,
|
|
27358
27147
|
writeConfiguredWorkspacePath,
|
|
27359
|
-
writeConfiguredPiAgentDir,
|
|
27360
|
-
writeConfiguredOhMyPiAgentDir,
|
|
27361
27148
|
wrapMemoryContext,
|
|
27362
27149
|
withHookRecallCompat,
|
|
27363
27150
|
vectorSearchWithMetadata,
|
|
@@ -27375,6 +27162,8 @@ export {
|
|
|
27375
27162
|
stripSignetBlock,
|
|
27376
27163
|
stripInternalMemoryContext,
|
|
27377
27164
|
stringifyYamlDocument,
|
|
27165
|
+
spawnSyncHidden,
|
|
27166
|
+
spawnHidden,
|
|
27378
27167
|
setSecretKeyringForTests,
|
|
27379
27168
|
setSecretKeyringAdapterForTests,
|
|
27380
27169
|
setSecretEventRecorder,
|
|
@@ -27400,10 +27189,6 @@ export {
|
|
|
27400
27189
|
resolveRoutingDecision,
|
|
27401
27190
|
resolvePromptSubmitTimeoutMs,
|
|
27402
27191
|
resolvePrimaryPackageManager,
|
|
27403
|
-
resolvePiExtensionsDir,
|
|
27404
|
-
resolvePiAgentDir,
|
|
27405
|
-
resolveOhMyPiExtensionsDir,
|
|
27406
|
-
resolveOhMyPiAgentDir,
|
|
27407
27192
|
resolveNetworkBinding,
|
|
27408
27193
|
resolveLaunchdExecutable,
|
|
27409
27194
|
resolveKimiHomePath,
|
|
@@ -27433,8 +27218,6 @@ export {
|
|
|
27433
27218
|
readMemoriesFtsIndexRowCount,
|
|
27434
27219
|
readGraphiqState,
|
|
27435
27220
|
readConfiguredWorkspacePath,
|
|
27436
|
-
readConfiguredPiAgentDir,
|
|
27437
|
-
readConfiguredOhMyPiAgentDir,
|
|
27438
27221
|
putLocalSecret,
|
|
27439
27222
|
preflightWorkspace,
|
|
27440
27223
|
partitionRecallRows,
|
|
@@ -27481,8 +27264,6 @@ export {
|
|
|
27481
27264
|
loadIdentityFiles,
|
|
27482
27265
|
loadConfiguredHarnesses,
|
|
27483
27266
|
loadClawdhubLock,
|
|
27484
|
-
listPiAgentDirCandidates,
|
|
27485
|
-
listOhMyPiAgentDirCandidates,
|
|
27486
27267
|
listLocalSecretNames,
|
|
27487
27268
|
keywordSearch,
|
|
27488
27269
|
isSynthesisProvider,
|
|
@@ -27511,8 +27292,6 @@ export {
|
|
|
27511
27292
|
getSourcesConfigPath,
|
|
27512
27293
|
getSkillsRunnerCommand,
|
|
27513
27294
|
getSecretKeyring,
|
|
27514
|
-
getPiConfigPath,
|
|
27515
|
-
getOhMyPiConfigPath,
|
|
27516
27295
|
getMissingIdentityFiles,
|
|
27517
27296
|
getLocalSecretValue,
|
|
27518
27297
|
getLocalSecretProviderHealth,
|
|
@@ -27532,6 +27311,9 @@ export {
|
|
|
27532
27311
|
extractSignetBlock,
|
|
27533
27312
|
expandHome,
|
|
27534
27313
|
execWithSecrets,
|
|
27314
|
+
execSyncHidden,
|
|
27315
|
+
execFileSyncHidden,
|
|
27316
|
+
execFileHidden,
|
|
27535
27317
|
escapeMemoryContextForFence,
|
|
27536
27318
|
ensureUnifiedSchema,
|
|
27537
27319
|
ensureMigrationsTableSchema,
|
|
@@ -27543,7 +27325,6 @@ export {
|
|
|
27543
27325
|
detectSignetInstallations,
|
|
27544
27326
|
detectSchema,
|
|
27545
27327
|
detectFilesystemType,
|
|
27546
|
-
detectExistingSetup,
|
|
27547
27328
|
detectAvailablePackageManagers,
|
|
27548
27329
|
deleteLocalSecret,
|
|
27549
27330
|
defaultPipelineModel,
|
|
@@ -27554,8 +27335,6 @@ export {
|
|
|
27554
27335
|
composeApiUserContent,
|
|
27555
27336
|
collectExportData,
|
|
27556
27337
|
clearConfiguredWorkspacePath,
|
|
27557
|
-
clearConfiguredPiAgentDir,
|
|
27558
|
-
clearConfiguredOhMyPiAgentDir,
|
|
27559
27338
|
chunkMarkdownHierarchically,
|
|
27560
27339
|
chunkContent,
|
|
27561
27340
|
buildSignetBlock,
|