open-agents-ai 0.184.9 → 0.184.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +626 -62
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5263,12 +5263,12 @@ var nexus_exports = {};
|
|
|
5263
5263
|
__export(nexus_exports, {
|
|
5264
5264
|
NexusTool: () => NexusTool
|
|
5265
5265
|
});
|
|
5266
|
-
import { readFile as readFile8, writeFile as writeFile6, mkdir as mkdir3, chmod, unlink, readdir as readdir2, open as fsOpen } from "node:fs/promises";
|
|
5266
|
+
import { readFile as readFile8, writeFile as writeFile6, mkdir as mkdir3, chmod, unlink, readdir as readdir2, open as fsOpen, copyFile as copyFile2 } from "node:fs/promises";
|
|
5267
5267
|
import { existsSync as existsSync11, readFileSync as readFileSync8, watch as fsWatchLocal } from "node:fs";
|
|
5268
5268
|
import { resolve as resolve13, join as join14 } from "node:path";
|
|
5269
5269
|
import { randomBytes as randomBytes4, createCipheriv, createDecipheriv, scryptSync, createHash } from "node:crypto";
|
|
5270
5270
|
import { execSync as execSync6, spawn as spawn2 } from "node:child_process";
|
|
5271
|
-
import { hostname, userInfo } from "node:os";
|
|
5271
|
+
import { hostname, userInfo, homedir as homedir4 } from "node:os";
|
|
5272
5272
|
function containsKeyMaterial(input) {
|
|
5273
5273
|
for (const pattern of KEY_PATTERNS) {
|
|
5274
5274
|
if (pattern.test(input))
|
|
@@ -5314,7 +5314,12 @@ mkdirSync(invocationsDir, { recursive: true });
|
|
|
5314
5314
|
// Write PID so the agent can kill us
|
|
5315
5315
|
writeFileSync(pidFile, String(process.pid));
|
|
5316
5316
|
|
|
5317
|
-
|
|
5317
|
+
// Use GLOBAL identity key so all OA instances on this machine share one peerId.
|
|
5318
|
+
// Fallback to project-scoped key if global doesn't exist.
|
|
5319
|
+
const globalKeyDir = join(require('os').homedir(), '.open-agents');
|
|
5320
|
+
const globalKeyPath = join(globalKeyDir, 'identity.key');
|
|
5321
|
+
const projectKeyPath = join(nexusDir, 'identity.key');
|
|
5322
|
+
const keyPath = existsSync(globalKeyPath) ? globalKeyPath : projectKeyPath;
|
|
5318
5323
|
var nexusOpts = {
|
|
5319
5324
|
keyStorePath: keyPath,
|
|
5320
5325
|
agentName,
|
|
@@ -8572,8 +8577,8 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
|
|
|
8572
8577
|
}
|
|
8573
8578
|
} else {
|
|
8574
8579
|
try {
|
|
8575
|
-
const
|
|
8576
|
-
const globalPkg = join14(
|
|
8580
|
+
const globalDir2 = await execAsync2("npm root -g", { timeout: 5e3 });
|
|
8581
|
+
const globalPkg = join14(globalDir2, "open-agents-nexus", "package.json");
|
|
8577
8582
|
if (existsSync11(globalPkg)) {
|
|
8578
8583
|
nexusResolved = true;
|
|
8579
8584
|
try {
|
|
@@ -8620,7 +8625,28 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
|
|
|
8620
8625
|
await this.ensureWallet();
|
|
8621
8626
|
const daemonPath = join14(this.nexusDir, "nexus-daemon.mjs");
|
|
8622
8627
|
await writeFile6(daemonPath, DAEMON_SCRIPT);
|
|
8628
|
+
const globalDir = join14(homedir4(), ".open-agents");
|
|
8629
|
+
const globalKeyPath = join14(globalDir, "identity.key");
|
|
8630
|
+
const projectKeyPath = join14(this.nexusDir, "identity.key");
|
|
8631
|
+
if (existsSync11(projectKeyPath) && !existsSync11(globalKeyPath)) {
|
|
8632
|
+
try {
|
|
8633
|
+
if (!existsSync11(globalDir))
|
|
8634
|
+
await mkdir3(globalDir, { recursive: true });
|
|
8635
|
+
await copyFile2(projectKeyPath, globalKeyPath);
|
|
8636
|
+
} catch {
|
|
8637
|
+
}
|
|
8638
|
+
}
|
|
8639
|
+
const effectiveKeyPath = existsSync11(globalKeyPath) ? globalKeyPath : projectKeyPath;
|
|
8640
|
+
const globalNamePath = join14(globalDir, "agent-name");
|
|
8623
8641
|
const agentName = args.agent_name || (() => {
|
|
8642
|
+
try {
|
|
8643
|
+
if (existsSync11(globalNamePath)) {
|
|
8644
|
+
const custom = readFileSync8(globalNamePath, "utf8").trim();
|
|
8645
|
+
if (custom)
|
|
8646
|
+
return custom;
|
|
8647
|
+
}
|
|
8648
|
+
} catch {
|
|
8649
|
+
}
|
|
8624
8650
|
const ADJ = ["swift", "bright", "calm", "deep", "bold", "keen", "warm", "clear", "soft", "sharp", "quick", "cool", "fair", "free", "kind", "pure", "sage", "true", "wild", "wise", "dark", "gold", "iron", "jade", "ruby", "silk", "void", "dawn", "dusk", "rain", "star", "moon", "wave", "fire", "snow", "leaf", "oak", "pine", "ash", "elm"];
|
|
8625
8651
|
const NOUN = ["hawk", "wolf", "bear", "deer", "hare", "lynx", "crow", "wren", "dove", "swan", "pike", "bass", "carp", "reef", "tide", "vale", "glen", "peak", "mesa", "ford", "arch", "gate", "node", "core", "link", "mesh", "flux", "grid", "cell", "hub", "bolt", "gear", "coil", "ring", "lens", "orb", "cube", "dome", "shard", "rune"];
|
|
8626
8652
|
const seed = `${hostname()}:${userInfo().username}`;
|
|
@@ -8635,8 +8661,8 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
|
|
|
8635
8661
|
const agentType = args.agent_type || "general";
|
|
8636
8662
|
const nodePaths = [nodeModulesDir];
|
|
8637
8663
|
try {
|
|
8638
|
-
const
|
|
8639
|
-
nodePaths.push(
|
|
8664
|
+
const globalDir2 = await execAsync2("npm root -g", { timeout: 5e3 });
|
|
8665
|
+
nodePaths.push(globalDir2);
|
|
8640
8666
|
} catch {
|
|
8641
8667
|
}
|
|
8642
8668
|
const { openSync: openSync2, closeSync: closeSync2 } = await import("node:fs");
|
|
@@ -10572,10 +10598,10 @@ __export(custom_tool_exports, {
|
|
|
10572
10598
|
});
|
|
10573
10599
|
import { existsSync as existsSync13, readdirSync as readdirSync4, readFileSync as readFileSync10, mkdirSync as mkdirSync5, writeFileSync as writeFileSync5 } from "node:fs";
|
|
10574
10600
|
import { join as join16 } from "node:path";
|
|
10575
|
-
import { homedir as
|
|
10601
|
+
import { homedir as homedir5 } from "node:os";
|
|
10576
10602
|
import { spawn as spawn4 } from "node:child_process";
|
|
10577
10603
|
function globalToolsDir() {
|
|
10578
|
-
return join16(
|
|
10604
|
+
return join16(homedir5(), ".open-agents", "tools");
|
|
10579
10605
|
}
|
|
10580
10606
|
function projectToolsDir(repoRoot) {
|
|
10581
10607
|
return join16(repoRoot, ".oa", "tools");
|
|
@@ -11069,10 +11095,10 @@ var init_tool_creator = __esm({
|
|
|
11069
11095
|
// packages/execution/dist/tools/skill-tools.js
|
|
11070
11096
|
import { existsSync as existsSync14, readdirSync as readdirSync5, readFileSync as readFileSync11 } from "node:fs";
|
|
11071
11097
|
import { join as join17, basename as basename3, dirname as dirname3 } from "node:path";
|
|
11072
|
-
import { homedir as
|
|
11098
|
+
import { homedir as homedir6 } from "node:os";
|
|
11073
11099
|
import { execSync as execSync9 } from "node:child_process";
|
|
11074
11100
|
function getAiwgPaths() {
|
|
11075
|
-
const dataDir = join17(
|
|
11101
|
+
const dataDir = join17(homedir6(), ".local", "share", "ai-writing-guide");
|
|
11076
11102
|
return {
|
|
11077
11103
|
frameworksDir: join17(dataDir, "agentic", "code", "frameworks"),
|
|
11078
11104
|
addonsDir: join17(dataDir, "agentic", "code", "addons"),
|
|
@@ -11098,7 +11124,7 @@ function findAiwgPackageRoot() {
|
|
|
11098
11124
|
const candidates = [
|
|
11099
11125
|
"/usr/local/lib/node_modules/aiwg",
|
|
11100
11126
|
"/usr/lib/node_modules/aiwg",
|
|
11101
|
-
join17(
|
|
11127
|
+
join17(homedir6(), ".nvm", "versions")
|
|
11102
11128
|
// nvm — need to search deeper
|
|
11103
11129
|
];
|
|
11104
11130
|
for (const c3 of candidates) {
|
|
@@ -11754,7 +11780,7 @@ ${content}`
|
|
|
11754
11780
|
// packages/execution/dist/tools/transcribe-tool.js
|
|
11755
11781
|
import { existsSync as existsSync16, mkdirSync as mkdirSync7, writeFileSync as writeFileSync7, readFileSync as readFileSync13, unlinkSync } from "node:fs";
|
|
11756
11782
|
import { join as join19, basename as basename4, extname as extname3, resolve as resolve15 } from "node:path";
|
|
11757
|
-
import { homedir as
|
|
11783
|
+
import { homedir as homedir7 } from "node:os";
|
|
11758
11784
|
import { execSync as execSync10, spawn as spawn5 } from "node:child_process";
|
|
11759
11785
|
function isTranscribable(path) {
|
|
11760
11786
|
const ext = extname3(path).toLowerCase();
|
|
@@ -11779,7 +11805,7 @@ async function loadTranscribeCli() {
|
|
|
11779
11805
|
}
|
|
11780
11806
|
} catch {
|
|
11781
11807
|
}
|
|
11782
|
-
const nvmBase = join19(
|
|
11808
|
+
const nvmBase = join19(homedir7(), ".nvm", "versions", "node");
|
|
11783
11809
|
if (existsSync16(nvmBase)) {
|
|
11784
11810
|
try {
|
|
11785
11811
|
const { readdirSync: readdirSync21 } = await import("node:fs");
|
|
@@ -16583,7 +16609,7 @@ import { existsSync as existsSync21, statSync as statSync8 } from "node:fs";
|
|
|
16583
16609
|
import { resolve as resolve21, basename as basename8, dirname as dirname8, join as join31 } from "node:path";
|
|
16584
16610
|
import { execSync as execSync15 } from "node:child_process";
|
|
16585
16611
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
16586
|
-
import { homedir as
|
|
16612
|
+
import { homedir as homedir8, tmpdir as tmpdir6 } from "node:os";
|
|
16587
16613
|
function findOcrScript() {
|
|
16588
16614
|
const thisDir = dirname8(fileURLToPath4(import.meta.url));
|
|
16589
16615
|
const devPath3 = resolve21(thisDir, "../../scripts/ocr-advanced.py");
|
|
@@ -16599,7 +16625,7 @@ function findOcrScript() {
|
|
|
16599
16625
|
}
|
|
16600
16626
|
function findPython() {
|
|
16601
16627
|
const isWin2 = process.platform === "win32";
|
|
16602
|
-
const venvPython2 = isWin2 ? join31(
|
|
16628
|
+
const venvPython2 = isWin2 ? join31(homedir8(), ".open-agents", "venv", "Scripts", "python.exe") : join31(homedir8(), ".open-agents", "venv", "bin", "python");
|
|
16603
16629
|
if (existsSync21(venvPython2)) {
|
|
16604
16630
|
try {
|
|
16605
16631
|
execSync15(`${JSON.stringify(venvPython2)} -c "import cv2, pytesseract, numpy, PIL"`, {
|
|
@@ -17672,7 +17698,7 @@ train.py reverted to last kept state. Ready for next experiment.`,
|
|
|
17672
17698
|
import { execSync as execSync18, exec as execCb } from "node:child_process";
|
|
17673
17699
|
import { readFile as readFile15, writeFile as writeFile15, mkdir as mkdir11 } from "node:fs/promises";
|
|
17674
17700
|
import { resolve as resolve23, join as join34 } from "node:path";
|
|
17675
|
-
import { homedir as
|
|
17701
|
+
import { homedir as homedir9 } from "node:os";
|
|
17676
17702
|
import { randomBytes as randomBytes6 } from "node:crypto";
|
|
17677
17703
|
function isValidCron(expr) {
|
|
17678
17704
|
const parts = expr.trim().split(/\s+/);
|
|
@@ -17803,7 +17829,7 @@ async function saveStore(workingDir, store) {
|
|
|
17803
17829
|
await writeFile15(join34(dir, "tasks.json"), JSON.stringify(store, null, 2), "utf-8");
|
|
17804
17830
|
}
|
|
17805
17831
|
function globalStoreDir() {
|
|
17806
|
-
return join34(
|
|
17832
|
+
return join34(homedir9(), ".open-agents", "scheduled");
|
|
17807
17833
|
}
|
|
17808
17834
|
async function loadGlobalStore() {
|
|
17809
17835
|
try {
|
|
@@ -19321,7 +19347,7 @@ var init_factory = __esm({
|
|
|
19321
19347
|
import { execSync as execSync21 } from "node:child_process";
|
|
19322
19348
|
import { readFile as readFile18, writeFile as writeFile18, mkdir as mkdir14 } from "node:fs/promises";
|
|
19323
19349
|
import { resolve as resolve27, join as join39 } from "node:path";
|
|
19324
|
-
import { homedir as
|
|
19350
|
+
import { homedir as homedir10 } from "node:os";
|
|
19325
19351
|
import { randomBytes as randomBytes9 } from "node:crypto";
|
|
19326
19352
|
function isValidCron2(expr) {
|
|
19327
19353
|
const parts = expr.trim().split(/\s+/);
|
|
@@ -19451,7 +19477,7 @@ async function saveStore2(workingDir, store) {
|
|
|
19451
19477
|
await writeFile18(join39(dir, "store.json"), JSON.stringify(store, null, 2), "utf-8");
|
|
19452
19478
|
}
|
|
19453
19479
|
function globalCronDir() {
|
|
19454
|
-
return join39(
|
|
19480
|
+
return join39(homedir10(), ".open-agents", "cron-agents");
|
|
19455
19481
|
}
|
|
19456
19482
|
async function loadGlobalCronStore() {
|
|
19457
19483
|
try {
|
|
@@ -29619,7 +29645,7 @@ __export(listen_exports, {
|
|
|
29619
29645
|
import { spawn as spawn16, execSync as execSync25 } from "node:child_process";
|
|
29620
29646
|
import { existsSync as existsSync32, mkdirSync as mkdirSync11, writeFileSync as writeFileSync12, readdirSync as readdirSync8 } from "node:fs";
|
|
29621
29647
|
import { join as join48, dirname as dirname14 } from "node:path";
|
|
29622
|
-
import { homedir as
|
|
29648
|
+
import { homedir as homedir11 } from "node:os";
|
|
29623
29649
|
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
29624
29650
|
import { EventEmitter } from "node:events";
|
|
29625
29651
|
import { createInterface as createInterface2 } from "node:readline";
|
|
@@ -29731,7 +29757,7 @@ function findLiveWhisperScript() {
|
|
|
29731
29757
|
}
|
|
29732
29758
|
} catch {
|
|
29733
29759
|
}
|
|
29734
|
-
const nvmBase = join48(
|
|
29760
|
+
const nvmBase = join48(homedir11(), ".nvm", "versions", "node");
|
|
29735
29761
|
if (existsSync32(nvmBase)) {
|
|
29736
29762
|
try {
|
|
29737
29763
|
for (const ver of readdirSync8(nvmBase)) {
|
|
@@ -29985,7 +30011,7 @@ var init_listen = __esm({
|
|
|
29985
30011
|
}
|
|
29986
30012
|
} catch {
|
|
29987
30013
|
}
|
|
29988
|
-
const nvmBase = join48(
|
|
30014
|
+
const nvmBase = join48(homedir11(), ".nvm", "versions", "node");
|
|
29989
30015
|
if (existsSync32(nvmBase)) {
|
|
29990
30016
|
try {
|
|
29991
30017
|
const { readdirSync: readdirSync21 } = await import("node:fs");
|
|
@@ -36017,6 +36043,21 @@ var init_expose = __esm({
|
|
|
36017
36043
|
}
|
|
36018
36044
|
url.searchParams.delete("key");
|
|
36019
36045
|
const forwardPath = url.pathname + url.search;
|
|
36046
|
+
if (this._sponsorLimits) {
|
|
36047
|
+
const p = url.pathname.toLowerCase();
|
|
36048
|
+
const m = (req.method || "GET").toUpperCase();
|
|
36049
|
+
const allowed = p === "/api/chat" && m === "POST" || p === "/api/generate" && m === "POST" || p === "/api/tags" && m === "GET" || p === "/v1/chat/completions" && m === "POST" || p === "/v1/models" && m === "GET" || p === "/v1/system/metrics" && m === "GET";
|
|
36050
|
+
if (!allowed) {
|
|
36051
|
+
this._stats.activeConnections--;
|
|
36052
|
+
user.activeRequests--;
|
|
36053
|
+
this._stats.errors++;
|
|
36054
|
+
res.writeHead(403, { "Content-Type": "application/json" });
|
|
36055
|
+
res.end(JSON.stringify({
|
|
36056
|
+
error: "Forbidden \u2014 this endpoint is not available in sponsor mode."
|
|
36057
|
+
}));
|
|
36058
|
+
return;
|
|
36059
|
+
}
|
|
36060
|
+
}
|
|
36020
36061
|
if (!this._fullAccess) {
|
|
36021
36062
|
const p = url.pathname.toLowerCase();
|
|
36022
36063
|
if (p === "/api/pull" || p === "/api/delete" || p === "/api/create" || p === "/api/copy" || p === "/api/push" || p === "/api/blobs") {
|
|
@@ -38995,7 +39036,7 @@ __export(oa_directory_exports, {
|
|
|
38995
39036
|
});
|
|
38996
39037
|
import { existsSync as existsSync36, mkdirSync as mkdirSync14, readFileSync as readFileSync27, writeFileSync as writeFileSync15, readdirSync as readdirSync10, statSync as statSync12, unlinkSync as unlinkSync7 } from "node:fs";
|
|
38997
39038
|
import { join as join53, relative as relative3, basename as basename11, extname as extname9 } from "node:path";
|
|
38998
|
-
import { homedir as
|
|
39039
|
+
import { homedir as homedir12 } from "node:os";
|
|
38999
39040
|
function initOaDirectory(repoRoot) {
|
|
39000
39041
|
const oaPath = join53(repoRoot, OA_DIR);
|
|
39001
39042
|
for (const sub of SUBDIRS) {
|
|
@@ -39035,7 +39076,7 @@ function saveProjectSettings(repoRoot, settings) {
|
|
|
39035
39076
|
writeFileSync15(join53(oaPath, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
|
|
39036
39077
|
}
|
|
39037
39078
|
function loadGlobalSettings() {
|
|
39038
|
-
const settingsPath = join53(
|
|
39079
|
+
const settingsPath = join53(homedir12(), ".open-agents", "settings.json");
|
|
39039
39080
|
try {
|
|
39040
39081
|
if (existsSync36(settingsPath)) {
|
|
39041
39082
|
return JSON.parse(readFileSync27(settingsPath, "utf-8"));
|
|
@@ -39045,7 +39086,7 @@ function loadGlobalSettings() {
|
|
|
39045
39086
|
return {};
|
|
39046
39087
|
}
|
|
39047
39088
|
function saveGlobalSettings(settings) {
|
|
39048
|
-
const dir = join53(
|
|
39089
|
+
const dir = join53(homedir12(), ".open-agents");
|
|
39049
39090
|
mkdirSync14(dir, { recursive: true });
|
|
39050
39091
|
const existing = loadGlobalSettings();
|
|
39051
39092
|
const merged = { ...existing, ...settings };
|
|
@@ -39425,13 +39466,13 @@ function recordUsage(kind, value, opts) {
|
|
|
39425
39466
|
}
|
|
39426
39467
|
saveUsageFile(filePath, data);
|
|
39427
39468
|
};
|
|
39428
|
-
update(join53(
|
|
39469
|
+
update(join53(homedir12(), ".open-agents", USAGE_HISTORY_FILE));
|
|
39429
39470
|
if (opts?.repoRoot) {
|
|
39430
39471
|
update(join53(opts.repoRoot, OA_DIR, USAGE_HISTORY_FILE));
|
|
39431
39472
|
}
|
|
39432
39473
|
}
|
|
39433
39474
|
function loadUsageHistory(kind, repoRoot) {
|
|
39434
|
-
const globalPath = join53(
|
|
39475
|
+
const globalPath = join53(homedir12(), ".open-agents", USAGE_HISTORY_FILE);
|
|
39435
39476
|
const globalData = loadUsageFile(globalPath);
|
|
39436
39477
|
const localData = repoRoot ? loadUsageFile(join53(repoRoot, OA_DIR, USAGE_HISTORY_FILE)) : { records: [] };
|
|
39437
39478
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -39464,7 +39505,7 @@ function deleteUsageRecord(kind, value, repoRoot) {
|
|
|
39464
39505
|
saveUsageFile(filePath, data);
|
|
39465
39506
|
}
|
|
39466
39507
|
};
|
|
39467
|
-
remove(join53(
|
|
39508
|
+
remove(join53(homedir12(), ".open-agents", USAGE_HISTORY_FILE));
|
|
39468
39509
|
if (repoRoot) {
|
|
39469
39510
|
remove(join53(repoRoot, OA_DIR, USAGE_HISTORY_FILE));
|
|
39470
39511
|
}
|
|
@@ -39518,7 +39559,7 @@ import { execSync as execSync27, spawn as spawn19, exec as exec2 } from "node:ch
|
|
|
39518
39559
|
import { promisify as promisify6 } from "node:util";
|
|
39519
39560
|
import { existsSync as existsSync37, writeFileSync as writeFileSync16, readFileSync as readFileSync28, appendFileSync as appendFileSync2, mkdirSync as mkdirSync15 } from "node:fs";
|
|
39520
39561
|
import { join as join54 } from "node:path";
|
|
39521
|
-
import { homedir as
|
|
39562
|
+
import { homedir as homedir13, platform as platform2 } from "node:os";
|
|
39522
39563
|
async function checkToolSupport(modelName, backendUrl = "http://localhost:11434") {
|
|
39523
39564
|
if (_toolSupportCache.has(modelName))
|
|
39524
39565
|
return _toolSupportCache.get(modelName);
|
|
@@ -40583,7 +40624,7 @@ async function doSetup(config, rl) {
|
|
|
40583
40624
|
`PARAMETER num_predict ${numPredict}`,
|
|
40584
40625
|
`PARAMETER stop "<|endoftext|>"`
|
|
40585
40626
|
].join("\n");
|
|
40586
|
-
const modelDir2 = join54(
|
|
40627
|
+
const modelDir2 = join54(homedir13(), ".open-agents", "models");
|
|
40587
40628
|
mkdirSync15(modelDir2, { recursive: true });
|
|
40588
40629
|
const modelfilePath = join54(modelDir2, `Modelfile.${customName}`);
|
|
40589
40630
|
writeFileSync16(modelfilePath, modelfileContent + "\n", "utf8");
|
|
@@ -40631,7 +40672,7 @@ async function isModelAvailable(config) {
|
|
|
40631
40672
|
}
|
|
40632
40673
|
function isFirstRun() {
|
|
40633
40674
|
try {
|
|
40634
|
-
return !existsSync37(join54(
|
|
40675
|
+
return !existsSync37(join54(homedir13(), ".open-agents", "config.json"));
|
|
40635
40676
|
} catch {
|
|
40636
40677
|
return true;
|
|
40637
40678
|
}
|
|
@@ -40668,7 +40709,7 @@ function detectPkgManager() {
|
|
|
40668
40709
|
return null;
|
|
40669
40710
|
}
|
|
40670
40711
|
function getVenvDir() {
|
|
40671
|
-
return join54(
|
|
40712
|
+
return join54(homedir13(), ".open-agents", "venv");
|
|
40672
40713
|
}
|
|
40673
40714
|
function hasVenvModule() {
|
|
40674
40715
|
try {
|
|
@@ -40695,7 +40736,7 @@ function ensureVenv(log) {
|
|
|
40695
40736
|
return null;
|
|
40696
40737
|
}
|
|
40697
40738
|
try {
|
|
40698
|
-
mkdirSync15(join54(
|
|
40739
|
+
mkdirSync15(join54(homedir13(), ".open-agents"), { recursive: true });
|
|
40699
40740
|
const pyCmd = hasCmd(pythonCmd) ? pythonCmd : "python3";
|
|
40700
40741
|
execSync27(`${pyCmd} -m venv "${venvDir}"`, { stdio: "pipe", timeout: 3e4 });
|
|
40701
40742
|
execSync27(`"${pipPath}" install --upgrade pip`, {
|
|
@@ -40962,9 +41003,9 @@ function ensureCloudflaredBackground(onInfo) {
|
|
|
40962
41003
|
const archMap = { x64: "amd64", arm64: "arm64", arm: "arm" };
|
|
40963
41004
|
const cfArch = archMap[arch2] ?? "amd64";
|
|
40964
41005
|
try {
|
|
40965
|
-
execSync27(`curl -fsSL "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-${cfArch}" -o /tmp/cloudflared && chmod +x /tmp/cloudflared && mkdir -p "${
|
|
40966
|
-
if (!process.env.PATH?.includes(`${
|
|
40967
|
-
process.env.PATH = `${
|
|
41006
|
+
execSync27(`curl -fsSL "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-${cfArch}" -o /tmp/cloudflared && chmod +x /tmp/cloudflared && mkdir -p "${homedir13()}/.local/bin" && mv /tmp/cloudflared "${homedir13()}/.local/bin/cloudflared"`, { stdio: "pipe", timeout: 6e4 });
|
|
41007
|
+
if (!process.env.PATH?.includes(`${homedir13()}/.local/bin`)) {
|
|
41008
|
+
process.env.PATH = `${homedir13()}/.local/bin:${process.env.PATH}`;
|
|
40968
41009
|
}
|
|
40969
41010
|
if (hasCmd("cloudflared")) {
|
|
40970
41011
|
log("cloudflared installed.");
|
|
@@ -41059,7 +41100,7 @@ async function createExpandedVariantAsync(baseModel, specs, sizeGB, kvBytesPerTo
|
|
|
41059
41100
|
`PARAMETER num_predict ${numPredict}`,
|
|
41060
41101
|
`PARAMETER stop "<|endoftext|>"`
|
|
41061
41102
|
].join("\n");
|
|
41062
|
-
const modelDir2 = join54(
|
|
41103
|
+
const modelDir2 = join54(homedir13(), ".open-agents", "models");
|
|
41063
41104
|
mkdirSync15(modelDir2, { recursive: true });
|
|
41064
41105
|
const modelfilePath = join54(modelDir2, `Modelfile.${customName}`);
|
|
41065
41106
|
writeFileSync16(modelfilePath, modelfileContent + "\n", "utf8");
|
|
@@ -41136,7 +41177,7 @@ async function ensureNeovim() {
|
|
|
41136
41177
|
const platform6 = process.platform;
|
|
41137
41178
|
const arch2 = process.arch;
|
|
41138
41179
|
if (platform6 === "linux") {
|
|
41139
|
-
const binDir = join54(
|
|
41180
|
+
const binDir = join54(homedir13(), ".local", "bin");
|
|
41140
41181
|
const nvimDest = join54(binDir, "nvim");
|
|
41141
41182
|
try {
|
|
41142
41183
|
mkdirSync15(binDir, { recursive: true });
|
|
@@ -41208,7 +41249,7 @@ async function ensureNeovim() {
|
|
|
41208
41249
|
}
|
|
41209
41250
|
function ensurePathInShellRc(binDir) {
|
|
41210
41251
|
const shell = process.env.SHELL ?? "";
|
|
41211
|
-
const rcFile = shell.includes("zsh") ? join54(
|
|
41252
|
+
const rcFile = shell.includes("zsh") ? join54(homedir13(), ".zshrc") : join54(homedir13(), ".bashrc");
|
|
41212
41253
|
try {
|
|
41213
41254
|
const rcContent = existsSync37(rcFile) ? readFileSync28(rcFile, "utf8") : "";
|
|
41214
41255
|
if (rcContent.includes(binDir))
|
|
@@ -42566,6 +42607,388 @@ var init_neovim_mode = __esm({
|
|
|
42566
42607
|
}
|
|
42567
42608
|
});
|
|
42568
42609
|
|
|
42610
|
+
// packages/cli/dist/tui/sponsor-anims.js
|
|
42611
|
+
var sponsor_anims_exports = {};
|
|
42612
|
+
__export(sponsor_anims_exports, {
|
|
42613
|
+
ANIM_PRESETS: () => ANIM_PRESETS,
|
|
42614
|
+
generateCustomAnim: () => generateCustomAnim,
|
|
42615
|
+
generateCustomAnimWithFallback: () => generateCustomAnimWithFallback,
|
|
42616
|
+
getPreset: () => getPreset2,
|
|
42617
|
+
presetToBannerDesign: () => presetToBannerDesign,
|
|
42618
|
+
renderPreviewToString: () => renderPreviewToString
|
|
42619
|
+
});
|
|
42620
|
+
function emptyGrid(width, fg2 = -1, bg = -1) {
|
|
42621
|
+
return Array.from({ length: ROWS }, () => Array.from({ length: width }, () => ({ char: " ", fg: fg2, bg, bold: false })));
|
|
42622
|
+
}
|
|
42623
|
+
function setChar(grid, row, col, char, fg2, bold = false, bg = -1) {
|
|
42624
|
+
if (row >= 0 && row < ROWS && col >= 0 && col < grid[0].length) {
|
|
42625
|
+
grid[row][col] = { char, fg: fg2, bg, bold };
|
|
42626
|
+
}
|
|
42627
|
+
}
|
|
42628
|
+
function generateWave(width, frameCount = 12) {
|
|
42629
|
+
const chars = "\u2591\u2592\u2593\u2588\u2593\u2592\u2591";
|
|
42630
|
+
const colors = [27, 33, 39, 45, 51, 45, 39, 33];
|
|
42631
|
+
const frames = [];
|
|
42632
|
+
for (let f = 0; f < frameCount; f++) {
|
|
42633
|
+
const grid = emptyGrid(width);
|
|
42634
|
+
for (let c3 = 0; c3 < width; c3++) {
|
|
42635
|
+
const phase = (c3 + f * 2) % (chars.length * 2);
|
|
42636
|
+
const charIdx = phase < chars.length ? phase : chars.length * 2 - phase - 1;
|
|
42637
|
+
const colorIdx = (c3 + f) % colors.length;
|
|
42638
|
+
for (let r = 0; r < ROWS; r++) {
|
|
42639
|
+
const offset = r * 3;
|
|
42640
|
+
const ci = (charIdx + offset) % chars.length;
|
|
42641
|
+
setChar(grid, r, c3, chars[ci], colors[(colorIdx + r) % colors.length], false);
|
|
42642
|
+
}
|
|
42643
|
+
}
|
|
42644
|
+
frames.push({ grid, durationMs: 120 });
|
|
42645
|
+
}
|
|
42646
|
+
return frames;
|
|
42647
|
+
}
|
|
42648
|
+
function generatePulse(width, frameCount = 10) {
|
|
42649
|
+
const frames = [];
|
|
42650
|
+
const dot = "\u25CF";
|
|
42651
|
+
const colors = [236, 238, 240, 243, 246, 249, 252, 249, 246, 243];
|
|
42652
|
+
for (let f = 0; f < frameCount; f++) {
|
|
42653
|
+
const grid = emptyGrid(width);
|
|
42654
|
+
const centerX = Math.floor(width / 2);
|
|
42655
|
+
for (let r = 0; r < ROWS; r++) {
|
|
42656
|
+
for (let c3 = 0; c3 < width; c3++) {
|
|
42657
|
+
const dist = Math.abs(c3 - centerX) + Math.abs(r - 1);
|
|
42658
|
+
const phase = (dist + f * 2) % colors.length;
|
|
42659
|
+
if (dist % 3 === 0) {
|
|
42660
|
+
setChar(grid, r, c3, dot, colors[phase]);
|
|
42661
|
+
}
|
|
42662
|
+
}
|
|
42663
|
+
}
|
|
42664
|
+
frames.push({ grid, durationMs: 150 });
|
|
42665
|
+
}
|
|
42666
|
+
return frames;
|
|
42667
|
+
}
|
|
42668
|
+
function generateMatrix(width, frameCount = 15) {
|
|
42669
|
+
const frames = [];
|
|
42670
|
+
const chars = "\uFF8A\uFF90\uFF8B\uFF70\uFF73\uFF7C\uFF85\uFF93\uFF86\uFF7B\uFF9C\uFF82\uFF75\uFF98\uFF71\uFF8E\uFF83\uFF8F\uFF79\uFF92\uFF74\uFF76\uFF77\uFF91\uFF95\uFF97\uFF7E\uFF88\uFF7D\uFF80\uFF87\uFF8D0123456789";
|
|
42671
|
+
const greens = [22, 28, 34, 40, 46, 82, 118, 154, 190];
|
|
42672
|
+
const drops = Array.from({ length: width }, () => Math.floor(Math.random() * ROWS * 2));
|
|
42673
|
+
for (let f = 0; f < frameCount; f++) {
|
|
42674
|
+
const grid = emptyGrid(width);
|
|
42675
|
+
for (let c3 = 0; c3 < width; c3++) {
|
|
42676
|
+
const dropY = drops[c3] % (ROWS + 3);
|
|
42677
|
+
for (let r = 0; r < ROWS; r++) {
|
|
42678
|
+
const dist = dropY - r;
|
|
42679
|
+
if (dist >= 0 && dist < greens.length) {
|
|
42680
|
+
const ch = chars[Math.floor(Math.random() * chars.length)];
|
|
42681
|
+
const brightness = greens[Math.min(dist, greens.length - 1)];
|
|
42682
|
+
setChar(grid, r, c3, ch, brightness, dist === 0);
|
|
42683
|
+
}
|
|
42684
|
+
}
|
|
42685
|
+
drops[c3] = (drops[c3] + 1) % (ROWS + 6);
|
|
42686
|
+
}
|
|
42687
|
+
frames.push({ grid, durationMs: 100 });
|
|
42688
|
+
}
|
|
42689
|
+
return frames;
|
|
42690
|
+
}
|
|
42691
|
+
function generateSparkle(width, frameCount = 12) {
|
|
42692
|
+
const frames = [];
|
|
42693
|
+
const sparkles = ["\u2726", "\u2727", "\xB7", "\u02D9", "\u207A", "\u2735", "\u2605"];
|
|
42694
|
+
const colors = [226, 220, 214, 208, 202, 196, 231];
|
|
42695
|
+
for (let f = 0; f < frameCount; f++) {
|
|
42696
|
+
const grid = emptyGrid(width);
|
|
42697
|
+
const seed = f * 7919;
|
|
42698
|
+
for (let i = 0; i < Math.floor(width * ROWS * 0.15); i++) {
|
|
42699
|
+
const hash = (seed + i * 1301) * 16807 % 2147483647;
|
|
42700
|
+
const c3 = hash % width;
|
|
42701
|
+
const r = Math.floor(hash / width) % ROWS;
|
|
42702
|
+
const si = hash / (width * ROWS) % sparkles.length;
|
|
42703
|
+
const ci = hash / (width * ROWS * sparkles.length) % colors.length;
|
|
42704
|
+
setChar(grid, r, c3, sparkles[Math.floor(si)], colors[Math.floor(ci)]);
|
|
42705
|
+
}
|
|
42706
|
+
frames.push({ grid, durationMs: 200 });
|
|
42707
|
+
}
|
|
42708
|
+
return frames;
|
|
42709
|
+
}
|
|
42710
|
+
function generateRadar(width, frameCount = 16) {
|
|
42711
|
+
const frames = [];
|
|
42712
|
+
const centerX = Math.floor(width / 2);
|
|
42713
|
+
const centerY = 1;
|
|
42714
|
+
for (let f = 0; f < frameCount; f++) {
|
|
42715
|
+
const grid = emptyGrid(width);
|
|
42716
|
+
const angle = f / frameCount * Math.PI * 2;
|
|
42717
|
+
for (let c3 = 0; c3 < width; c3++) {
|
|
42718
|
+
for (let r = 0; r < ROWS; r++) {
|
|
42719
|
+
const dx = (c3 - centerX) / (width / 6);
|
|
42720
|
+
const dy = (r - centerY) * 2;
|
|
42721
|
+
const cellAngle = Math.atan2(dy, dx);
|
|
42722
|
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
42723
|
+
let angleDiff = cellAngle - angle;
|
|
42724
|
+
while (angleDiff < -Math.PI)
|
|
42725
|
+
angleDiff += Math.PI * 2;
|
|
42726
|
+
while (angleDiff > Math.PI)
|
|
42727
|
+
angleDiff -= Math.PI * 2;
|
|
42728
|
+
if (Math.abs(angleDiff) < 0.4 && dist > 0.2 && dist < 3) {
|
|
42729
|
+
const brightness = Math.max(0, 1 - Math.abs(angleDiff) / 0.4);
|
|
42730
|
+
const colorIdx = Math.floor(brightness * 5);
|
|
42731
|
+
const colors = [22, 28, 34, 40, 46];
|
|
42732
|
+
setChar(grid, r, c3, "\u2588", colors[colorIdx]);
|
|
42733
|
+
} else if (dist < 0.3) {
|
|
42734
|
+
setChar(grid, r, c3, "\u25C9", 46, true);
|
|
42735
|
+
}
|
|
42736
|
+
}
|
|
42737
|
+
}
|
|
42738
|
+
frames.push({ grid, durationMs: 80 });
|
|
42739
|
+
}
|
|
42740
|
+
return frames;
|
|
42741
|
+
}
|
|
42742
|
+
function generateCircuit(width, frameCount = 10) {
|
|
42743
|
+
const frames = [];
|
|
42744
|
+
const hChars = ["\u2500", "\u2501", "\u2550"];
|
|
42745
|
+
const vChars = ["\u2502", "\u2503"];
|
|
42746
|
+
const nodes = ["\u25CF", "\u25C6", "\u25A0"];
|
|
42747
|
+
const colors = [33, 39, 45, 51, 87, 123];
|
|
42748
|
+
for (let f = 0; f < frameCount; f++) {
|
|
42749
|
+
const grid = emptyGrid(width);
|
|
42750
|
+
const activeCol = f * 5 % width;
|
|
42751
|
+
for (let r = 0; r < ROWS; r++) {
|
|
42752
|
+
for (let c3 = 0; c3 < width; c3++) {
|
|
42753
|
+
const seed = (r * 1e3 + c3) * 16807 % 2147483647;
|
|
42754
|
+
if (seed % 7 === 0) {
|
|
42755
|
+
const color = colors[(c3 + f) % colors.length];
|
|
42756
|
+
const isActive = Math.abs(c3 - activeCol) < 8;
|
|
42757
|
+
if (seed % 21 === 0) {
|
|
42758
|
+
setChar(grid, r, c3, nodes[seed % nodes.length], isActive ? 231 : color, isActive);
|
|
42759
|
+
} else {
|
|
42760
|
+
setChar(grid, r, c3, hChars[seed % hChars.length], isActive ? 231 : color);
|
|
42761
|
+
}
|
|
42762
|
+
}
|
|
42763
|
+
}
|
|
42764
|
+
}
|
|
42765
|
+
frames.push({ grid, durationMs: 130 });
|
|
42766
|
+
}
|
|
42767
|
+
return frames;
|
|
42768
|
+
}
|
|
42769
|
+
function generateFire(width, frameCount = 12) {
|
|
42770
|
+
const frames = [];
|
|
42771
|
+
const fireChars = ["\u2591", "\u2592", "\u2593", "\u2588"];
|
|
42772
|
+
const colors = [52, 88, 124, 160, 196, 202, 208, 214, 220, 226];
|
|
42773
|
+
for (let f = 0; f < frameCount; f++) {
|
|
42774
|
+
const grid = emptyGrid(width);
|
|
42775
|
+
for (let c3 = 0; c3 < width; c3++) {
|
|
42776
|
+
for (let r = 0; r < ROWS; r++) {
|
|
42777
|
+
const seed = (c3 * 7 + r * 13 + f * 31) * 16807 % 2147483647;
|
|
42778
|
+
const intensity = seed % 100 / 100;
|
|
42779
|
+
const heightFactor = 1 - r / ROWS;
|
|
42780
|
+
const combined = intensity * heightFactor;
|
|
42781
|
+
if (combined > 0.2) {
|
|
42782
|
+
const ci = Math.floor(combined * (colors.length - 1));
|
|
42783
|
+
const chi = Math.floor(combined * (fireChars.length - 1));
|
|
42784
|
+
setChar(grid, r, c3, fireChars[chi], colors[ci]);
|
|
42785
|
+
}
|
|
42786
|
+
}
|
|
42787
|
+
}
|
|
42788
|
+
frames.push({ grid, durationMs: 100 });
|
|
42789
|
+
}
|
|
42790
|
+
return frames;
|
|
42791
|
+
}
|
|
42792
|
+
function getPreset2(id) {
|
|
42793
|
+
return ANIM_PRESETS.find((p) => p.id === id);
|
|
42794
|
+
}
|
|
42795
|
+
function presetToBannerDesign(presetId, sponsorName, message) {
|
|
42796
|
+
const preset = getPreset2(presetId);
|
|
42797
|
+
const width = process.stdout.columns ?? 80;
|
|
42798
|
+
const frames = preset ? preset.generate(width) : generateWave(width);
|
|
42799
|
+
if (sponsorName) {
|
|
42800
|
+
const nameText = ` \u2726 ${sponsorName}`;
|
|
42801
|
+
for (const frame of frames) {
|
|
42802
|
+
for (let i = 0; i < nameText.length && i < width; i++) {
|
|
42803
|
+
setChar(frame.grid, 0, i, nameText[i], 231, true);
|
|
42804
|
+
}
|
|
42805
|
+
}
|
|
42806
|
+
}
|
|
42807
|
+
if (message) {
|
|
42808
|
+
const msgText = ` ${message}`;
|
|
42809
|
+
for (const frame of frames) {
|
|
42810
|
+
for (let i = 0; i < msgText.length && i < width; i++) {
|
|
42811
|
+
setChar(frame.grid, 2, i, msgText[i], 252);
|
|
42812
|
+
}
|
|
42813
|
+
}
|
|
42814
|
+
}
|
|
42815
|
+
return {
|
|
42816
|
+
id: `sponsor-${presetId}-${Date.now()}`,
|
|
42817
|
+
name: `Sponsor: ${sponsorName}`,
|
|
42818
|
+
type: "sponsor",
|
|
42819
|
+
frames,
|
|
42820
|
+
alignment: ["left", "left", "left"],
|
|
42821
|
+
flowSpeed: [0, 0, 0],
|
|
42822
|
+
author: sponsorName,
|
|
42823
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
42824
|
+
};
|
|
42825
|
+
}
|
|
42826
|
+
function renderPreviewToString(presetId, width, sponsorName, message) {
|
|
42827
|
+
const preset = getPreset2(presetId);
|
|
42828
|
+
const frames = preset ? preset.generate(width, 1) : generateWave(width, 1);
|
|
42829
|
+
const frame = frames[0];
|
|
42830
|
+
if (sponsorName) {
|
|
42831
|
+
const nameText = ` \u2726 ${sponsorName}`;
|
|
42832
|
+
for (let i = 0; i < nameText.length && i < width; i++) {
|
|
42833
|
+
setChar(frame.grid, 0, i, nameText[i], 231, true);
|
|
42834
|
+
}
|
|
42835
|
+
}
|
|
42836
|
+
if (message) {
|
|
42837
|
+
const msgText = ` ${message}`;
|
|
42838
|
+
for (let i = 0; i < msgText.length && i < width; i++) {
|
|
42839
|
+
setChar(frame.grid, 2, i, msgText[i], 252);
|
|
42840
|
+
}
|
|
42841
|
+
}
|
|
42842
|
+
const lines = [];
|
|
42843
|
+
for (let r = 0; r < ROWS; r++) {
|
|
42844
|
+
let line = "";
|
|
42845
|
+
for (let col = 0; col < width; col++) {
|
|
42846
|
+
const cell = frame.grid[r][col];
|
|
42847
|
+
let seq = "";
|
|
42848
|
+
if (cell.fg >= 0)
|
|
42849
|
+
seq += `\x1B[38;5;${cell.fg}m`;
|
|
42850
|
+
if (cell.bg >= 0)
|
|
42851
|
+
seq += `\x1B[48;5;${cell.bg}m`;
|
|
42852
|
+
if (cell.bold)
|
|
42853
|
+
seq += `\x1B[1m`;
|
|
42854
|
+
line += seq + cell.char + "\x1B[0m";
|
|
42855
|
+
}
|
|
42856
|
+
lines.push(line);
|
|
42857
|
+
}
|
|
42858
|
+
return lines.join("\n");
|
|
42859
|
+
}
|
|
42860
|
+
async function generateCustomAnim(prompt, ollamaUrl, model, width = process.stdout.columns ?? 80, frameCount = 8) {
|
|
42861
|
+
const genWidth = 40;
|
|
42862
|
+
const systemPrompt = `Generate ${frameCount} animation frames for a terminal banner. Each frame: 3 rows, each row exactly ${genWidth} characters. Use: \u2591\u2592\u2593\u2588\u25CF\u2605\u2726\u25A0\xB7 and spaces. Respond ONLY with a JSON array.
|
|
42863
|
+
|
|
42864
|
+
EXAMPLE for 2 frames of a "wave" animation:
|
|
42865
|
+
[["\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588","\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593","\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592"],["\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593","\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592","\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591"]]
|
|
42866
|
+
|
|
42867
|
+
RULES: Each row EXACTLY ${genWidth} chars. Pad with spaces. Each frame is ["row1","row2","row3"]. Output ONLY the JSON array, nothing else.`;
|
|
42868
|
+
try {
|
|
42869
|
+
const resp = await fetch(`${ollamaUrl}/api/chat`, {
|
|
42870
|
+
method: "POST",
|
|
42871
|
+
headers: { "Content-Type": "application/json" },
|
|
42872
|
+
body: JSON.stringify({
|
|
42873
|
+
model,
|
|
42874
|
+
messages: [
|
|
42875
|
+
{ role: "system", content: systemPrompt },
|
|
42876
|
+
{ role: "user", content: `Generate animation: ${prompt}` }
|
|
42877
|
+
],
|
|
42878
|
+
stream: false,
|
|
42879
|
+
think: false,
|
|
42880
|
+
options: { temperature: 0.7, num_predict: 4096 }
|
|
42881
|
+
}),
|
|
42882
|
+
signal: AbortSignal.timeout(6e4)
|
|
42883
|
+
});
|
|
42884
|
+
if (!resp.ok)
|
|
42885
|
+
return null;
|
|
42886
|
+
const data = await resp.json();
|
|
42887
|
+
const content = data.message?.content || "";
|
|
42888
|
+
let jsonStr = content;
|
|
42889
|
+
jsonStr = jsonStr.replace(/^```(?:json)?\s*\n?/, "").replace(/\n?```\s*$/, "");
|
|
42890
|
+
const jsonMatch = jsonStr.match(/\[[\s\S]*\]/);
|
|
42891
|
+
if (!jsonMatch)
|
|
42892
|
+
return null;
|
|
42893
|
+
let rawFrames;
|
|
42894
|
+
try {
|
|
42895
|
+
rawFrames = JSON.parse(jsonMatch[0]);
|
|
42896
|
+
} catch {
|
|
42897
|
+
let repaired = jsonMatch[0];
|
|
42898
|
+
const opens = (repaired.match(/\[/g) || []).length;
|
|
42899
|
+
const closes = (repaired.match(/\]/g) || []).length;
|
|
42900
|
+
for (let i = 0; i < opens - closes; i++)
|
|
42901
|
+
repaired += '"]';
|
|
42902
|
+
try {
|
|
42903
|
+
rawFrames = JSON.parse(repaired);
|
|
42904
|
+
} catch {
|
|
42905
|
+
return null;
|
|
42906
|
+
}
|
|
42907
|
+
}
|
|
42908
|
+
if (!Array.isArray(rawFrames) || rawFrames.length === 0)
|
|
42909
|
+
return null;
|
|
42910
|
+
const normalizedFrames = [];
|
|
42911
|
+
for (const item of rawFrames) {
|
|
42912
|
+
if (!Array.isArray(item))
|
|
42913
|
+
continue;
|
|
42914
|
+
if (item.length > 0 && Array.isArray(item[0])) {
|
|
42915
|
+
for (const inner of item) {
|
|
42916
|
+
if (Array.isArray(inner) && inner.every((s) => typeof s === "string")) {
|
|
42917
|
+
normalizedFrames.push(inner);
|
|
42918
|
+
}
|
|
42919
|
+
}
|
|
42920
|
+
} else if (item.every((s) => typeof s === "string")) {
|
|
42921
|
+
normalizedFrames.push(item);
|
|
42922
|
+
}
|
|
42923
|
+
}
|
|
42924
|
+
if (normalizedFrames.length === 0)
|
|
42925
|
+
return null;
|
|
42926
|
+
const frames = [];
|
|
42927
|
+
const defaultColor = 252;
|
|
42928
|
+
for (const rawFrame of normalizedFrames) {
|
|
42929
|
+
if (rawFrame.length < ROWS)
|
|
42930
|
+
continue;
|
|
42931
|
+
const grid = emptyGrid(width);
|
|
42932
|
+
for (let r = 0; r < ROWS; r++) {
|
|
42933
|
+
const srcLine = rawFrame[r] || "";
|
|
42934
|
+
for (let c3 = 0; c3 < width; c3++) {
|
|
42935
|
+
const srcIdx = c3 % Math.max(srcLine.length, 1);
|
|
42936
|
+
const ch = srcLine[srcIdx] ?? " ";
|
|
42937
|
+
if (ch !== " ") {
|
|
42938
|
+
setChar(grid, r, c3, ch, defaultColor);
|
|
42939
|
+
}
|
|
42940
|
+
}
|
|
42941
|
+
}
|
|
42942
|
+
frames.push({ grid, durationMs: 120 });
|
|
42943
|
+
}
|
|
42944
|
+
return frames.length > 0 ? frames : null;
|
|
42945
|
+
} catch {
|
|
42946
|
+
return null;
|
|
42947
|
+
}
|
|
42948
|
+
}
|
|
42949
|
+
async function generateCustomAnimWithFallback(prompt, ollamaUrl, preferredModel, width = process.stdout.columns ?? 80, frameCount = 8, onStatus) {
|
|
42950
|
+
onStatus?.(`Generating animation with ${preferredModel}...`);
|
|
42951
|
+
const result1 = await generateCustomAnim(prompt, ollamaUrl, preferredModel, width, frameCount);
|
|
42952
|
+
if (result1)
|
|
42953
|
+
return { frames: result1, source: "llm" };
|
|
42954
|
+
if (!preferredModel.includes("4b")) {
|
|
42955
|
+
onStatus?.("Retrying with smaller model for reliable output...");
|
|
42956
|
+
try {
|
|
42957
|
+
const resp = await fetch(`${ollamaUrl}/api/tags`, { signal: AbortSignal.timeout(5e3) });
|
|
42958
|
+
if (resp.ok) {
|
|
42959
|
+
const data = await resp.json();
|
|
42960
|
+
const small = (data.models || []).find((m) => m.name.includes("4b") || m.name.includes("3b"));
|
|
42961
|
+
if (small) {
|
|
42962
|
+
const result2 = await generateCustomAnim(prompt, ollamaUrl, small.name, width, frameCount);
|
|
42963
|
+
if (result2)
|
|
42964
|
+
return { frames: result2, source: "fallback-model" };
|
|
42965
|
+
}
|
|
42966
|
+
}
|
|
42967
|
+
} catch {
|
|
42968
|
+
}
|
|
42969
|
+
}
|
|
42970
|
+
onStatus?.("LLM generation failed \u2014 using sparkle preset");
|
|
42971
|
+
const preset = getPreset2("sparkle");
|
|
42972
|
+
return { frames: preset.generate(width, frameCount), source: "preset" };
|
|
42973
|
+
}
|
|
42974
|
+
var ROWS, ANIM_PRESETS;
|
|
42975
|
+
var init_sponsor_anims = __esm({
|
|
42976
|
+
"packages/cli/dist/tui/sponsor-anims.js"() {
|
|
42977
|
+
"use strict";
|
|
42978
|
+
ROWS = 3;
|
|
42979
|
+
ANIM_PRESETS = [
|
|
42980
|
+
{ id: "wave", name: "Wave", desc: "Flowing wave pattern", generate: generateWave },
|
|
42981
|
+
{ id: "pulse", name: "Pulse", desc: "Pulsing dots expanding from center", generate: generatePulse },
|
|
42982
|
+
{ id: "matrix", name: "Matrix", desc: "Falling matrix characters", generate: generateMatrix },
|
|
42983
|
+
{ id: "sparkle", name: "Sparkle", desc: "Random sparkle particles", generate: generateSparkle },
|
|
42984
|
+
{ id: "radar", name: "Radar", desc: "Rotating radar sweep", generate: generateRadar },
|
|
42985
|
+
{ id: "circuit", name: "Circuit", desc: "Circuit board traces with flow", generate: generateCircuit },
|
|
42986
|
+
{ id: "fire", name: "Fire", desc: "Animated fire effect", generate: generateFire },
|
|
42987
|
+
{ id: "none", name: "No Animation", desc: "Static banner only", generate: (w) => [{ grid: emptyGrid(w), durationMs: 0 }] }
|
|
42988
|
+
];
|
|
42989
|
+
}
|
|
42990
|
+
});
|
|
42991
|
+
|
|
42569
42992
|
// packages/cli/dist/tui/sponsor-wizard.js
|
|
42570
42993
|
var sponsor_wizard_exports = {};
|
|
42571
42994
|
__export(sponsor_wizard_exports, {
|
|
@@ -42576,6 +42999,17 @@ __export(sponsor_wizard_exports, {
|
|
|
42576
42999
|
});
|
|
42577
43000
|
import { existsSync as existsSync40, readFileSync as readFileSync29, writeFileSync as writeFileSync17, mkdirSync as mkdirSync16 } from "node:fs";
|
|
42578
43001
|
import { join as join56 } from "node:path";
|
|
43002
|
+
function colorPreview(code) {
|
|
43003
|
+
return `\x1B[38;5;${code}m\u2588\u2588\u2588\u2588\x1B[0m (${code})`;
|
|
43004
|
+
}
|
|
43005
|
+
function gradientPreview(start, end) {
|
|
43006
|
+
let s = "";
|
|
43007
|
+
for (let i = 0; i < 8; i++) {
|
|
43008
|
+
const cc = start + Math.round((end - start) * (i / 7));
|
|
43009
|
+
s += `\x1B[38;5;${cc}m\u2588\x1B[0m`;
|
|
43010
|
+
}
|
|
43011
|
+
return s;
|
|
43012
|
+
}
|
|
42579
43013
|
function sponsorDir(projectDir) {
|
|
42580
43014
|
return join56(projectDir, ".oa", "sponsor");
|
|
42581
43015
|
}
|
|
@@ -42607,7 +43041,11 @@ function defaultConfig() {
|
|
|
42607
43041
|
message: "",
|
|
42608
43042
|
linkEnabled: false,
|
|
42609
43043
|
linkUrl: "",
|
|
42610
|
-
linkText: ""
|
|
43044
|
+
linkText: "",
|
|
43045
|
+
primaryColor: 214,
|
|
43046
|
+
gradientEnabled: false,
|
|
43047
|
+
gradientStart: 196,
|
|
43048
|
+
gradientEnd: 226
|
|
42611
43049
|
},
|
|
42612
43050
|
transport: { cloudflared: true, libp2p: false },
|
|
42613
43051
|
rateLimits: {
|
|
@@ -42727,7 +43165,7 @@ async function stepBanner(config, rl, availableRows) {
|
|
|
42727
43165
|
const items = [
|
|
42728
43166
|
{ key: "hdr", label: "Select Banner Animation" }
|
|
42729
43167
|
];
|
|
42730
|
-
for (const preset of
|
|
43168
|
+
for (const preset of ANIM_PRESETS2) {
|
|
42731
43169
|
items.push({
|
|
42732
43170
|
key: preset.id,
|
|
42733
43171
|
label: `${config.banner.preset === preset.id ? "(\u25CF)" : "( )"} ${preset.name}`,
|
|
@@ -42742,11 +43180,12 @@ async function stepBanner(config, rl, availableRows) {
|
|
|
42742
43180
|
rl,
|
|
42743
43181
|
skipKeys: ["hdr", "sep"],
|
|
42744
43182
|
availableRows,
|
|
43183
|
+
customKeyHint: " p preview",
|
|
42745
43184
|
onAction: (item, action) => {
|
|
42746
|
-
if (action === "space" &&
|
|
43185
|
+
if (action === "space" && ANIM_PRESETS2.some((p) => p.id === item.key)) {
|
|
42747
43186
|
config.banner.preset = item.key;
|
|
42748
43187
|
for (const it of items) {
|
|
42749
|
-
const p =
|
|
43188
|
+
const p = ANIM_PRESETS2.find((pr) => pr.id === it.key);
|
|
42750
43189
|
if (p) {
|
|
42751
43190
|
it.label = `${config.banner.preset === p.id ? "(\u25CF)" : "( )"} ${p.name}`;
|
|
42752
43191
|
}
|
|
@@ -42754,13 +43193,25 @@ async function stepBanner(config, rl, availableRows) {
|
|
|
42754
43193
|
return true;
|
|
42755
43194
|
}
|
|
42756
43195
|
return false;
|
|
43196
|
+
},
|
|
43197
|
+
onCustomKey: (item, key, _helpers) => {
|
|
43198
|
+
if ((key === "p" || key === "P") && ANIM_PRESETS2.some((p) => p.id === item.key)) {
|
|
43199
|
+
const width = process.stdout.columns ?? 80;
|
|
43200
|
+
const preview = renderPreviewToString(item.key, width, config.header?.message || "Sponsor Preview", config.header?.linkText || void 0);
|
|
43201
|
+
process.stdout.write("\n" + preview + "\n\n");
|
|
43202
|
+
return true;
|
|
43203
|
+
}
|
|
43204
|
+
return false;
|
|
42757
43205
|
}
|
|
42758
43206
|
});
|
|
42759
43207
|
if (!result.confirmed)
|
|
42760
43208
|
return false;
|
|
43209
|
+
const previewWidth = process.stdout.columns ?? 80;
|
|
43210
|
+
const previewStr = renderPreviewToString(config.banner.preset, previewWidth, config.header?.message || "Sponsor Preview", config.header?.linkText || void 0);
|
|
43211
|
+
process.stdout.write("\n" + previewStr + "\n\n");
|
|
42761
43212
|
if (result.key === "next")
|
|
42762
43213
|
return true;
|
|
42763
|
-
if (
|
|
43214
|
+
if (ANIM_PRESETS2.some((p) => p.id === result.key)) {
|
|
42764
43215
|
config.banner.preset = result.key;
|
|
42765
43216
|
return true;
|
|
42766
43217
|
}
|
|
@@ -42785,11 +43236,22 @@ async function stepHeader(config, rl, availableRows) {
|
|
|
42785
43236
|
label: `${config.header.linkEnabled ? "[x]" : "[ ]"} Link`,
|
|
42786
43237
|
detail: linkDetail()
|
|
42787
43238
|
},
|
|
43239
|
+
{
|
|
43240
|
+
key: "color_primary",
|
|
43241
|
+
label: ` Primary color: ${colorPreview(config.header.primaryColor || 214)}`,
|
|
43242
|
+
detail: "Press 'e' to cycle through color presets"
|
|
43243
|
+
},
|
|
43244
|
+
{
|
|
43245
|
+
key: "color_gradient",
|
|
43246
|
+
label: ` Gradient: ${config.header.gradientEnabled ? "[x] " + gradientPreview(config.header.gradientStart || 196, config.header.gradientEnd || 226) : "[ ] disabled"}`
|
|
43247
|
+
},
|
|
42788
43248
|
{ key: "sep", label: "" },
|
|
42789
43249
|
{ key: "next", label: selectColors.green(" Next Step \u2192") }
|
|
42790
43250
|
];
|
|
42791
43251
|
const msgIdx = 1;
|
|
42792
43252
|
const linkIdx = 2;
|
|
43253
|
+
const colorPrimaryIdx = 3;
|
|
43254
|
+
const colorGradientIdx = 4;
|
|
42793
43255
|
const result = await tuiSelect({
|
|
42794
43256
|
items,
|
|
42795
43257
|
title: "Step 3/5 \u2014 Header Text & Links",
|
|
@@ -42808,6 +43270,11 @@ async function stepHeader(config, rl, availableRows) {
|
|
|
42808
43270
|
item.label = `${config.header.linkEnabled ? "[x]" : "[ ]"} Link`;
|
|
42809
43271
|
return true;
|
|
42810
43272
|
}
|
|
43273
|
+
if (item.key === "color_gradient") {
|
|
43274
|
+
config.header.gradientEnabled = !config.header.gradientEnabled;
|
|
43275
|
+
item.label = ` Gradient: ${config.header.gradientEnabled ? "[x] " + gradientPreview(config.header.gradientStart || 196, config.header.gradientEnd || 226) : "[ ] disabled"}`;
|
|
43276
|
+
return true;
|
|
43277
|
+
}
|
|
42811
43278
|
}
|
|
42812
43279
|
return false;
|
|
42813
43280
|
},
|
|
@@ -42829,6 +43296,30 @@ async function stepHeader(config, rl, availableRows) {
|
|
|
42829
43296
|
});
|
|
42830
43297
|
return true;
|
|
42831
43298
|
}
|
|
43299
|
+
if ((key === "e" || key === "E") && item.key === "color_primary") {
|
|
43300
|
+
const currentIdx = COLOR_PRESETS.findIndex((p) => p.code === (config.header.primaryColor || 214));
|
|
43301
|
+
const nextIdx = (currentIdx + 1) % COLOR_PRESETS.length;
|
|
43302
|
+
config.header.primaryColor = COLOR_PRESETS[nextIdx].code;
|
|
43303
|
+
helpers.updateItem(colorPrimaryIdx, {
|
|
43304
|
+
label: ` Primary color: ${colorPreview(config.header.primaryColor)}`,
|
|
43305
|
+
detail: `Press 'e' to cycle through color presets \u2014 ${COLOR_PRESETS[nextIdx].name}`
|
|
43306
|
+
});
|
|
43307
|
+
helpers.render();
|
|
43308
|
+
return true;
|
|
43309
|
+
}
|
|
43310
|
+
if ((key === "e" || key === "E") && item.key === "color_gradient") {
|
|
43311
|
+
const currentIdx = GRADIENT_PRESETS.findIndex((p) => p.start === (config.header.gradientStart || 196) && p.end === (config.header.gradientEnd || 226));
|
|
43312
|
+
const nextIdx = (currentIdx + 1) % GRADIENT_PRESETS.length;
|
|
43313
|
+
const preset = GRADIENT_PRESETS[nextIdx];
|
|
43314
|
+
config.header.gradientStart = preset.start;
|
|
43315
|
+
config.header.gradientEnd = preset.end;
|
|
43316
|
+
config.header.gradientEnabled = true;
|
|
43317
|
+
helpers.updateItem(colorGradientIdx, {
|
|
43318
|
+
label: ` Gradient: [x] ${gradientPreview(preset.start, preset.end)}`
|
|
43319
|
+
});
|
|
43320
|
+
helpers.render();
|
|
43321
|
+
return true;
|
|
43322
|
+
}
|
|
42832
43323
|
if ((key === "e" || key === "E") && item.key === "link_toggle") {
|
|
42833
43324
|
config.header.linkEnabled = true;
|
|
42834
43325
|
helpers.getInput("Link URL:", config.header.linkUrl).then((url) => {
|
|
@@ -43051,13 +43542,33 @@ async function runSponsorWizard(ctx) {
|
|
|
43051
43542
|
renderInfo("Toggle: /sponsor status | Pause: /sponsor pause | Remove: /sponsor remove");
|
|
43052
43543
|
return config;
|
|
43053
43544
|
}
|
|
43054
|
-
var
|
|
43545
|
+
var COLOR_PRESETS, GRADIENT_PRESETS, ANIM_PRESETS2;
|
|
43055
43546
|
var init_sponsor_wizard = __esm({
|
|
43056
43547
|
"packages/cli/dist/tui/sponsor-wizard.js"() {
|
|
43057
43548
|
"use strict";
|
|
43058
43549
|
init_tui_select();
|
|
43059
43550
|
init_render();
|
|
43060
|
-
|
|
43551
|
+
init_sponsor_anims();
|
|
43552
|
+
COLOR_PRESETS = [
|
|
43553
|
+
{ name: "Amber", code: 214 },
|
|
43554
|
+
{ name: "Cyan", code: 51 },
|
|
43555
|
+
{ name: "Green", code: 46 },
|
|
43556
|
+
{ name: "Red", code: 196 },
|
|
43557
|
+
{ name: "Purple", code: 135 },
|
|
43558
|
+
{ name: "Blue", code: 33 },
|
|
43559
|
+
{ name: "Pink", code: 198 },
|
|
43560
|
+
{ name: "White", code: 231 },
|
|
43561
|
+
{ name: "Gold", code: 220 }
|
|
43562
|
+
];
|
|
43563
|
+
GRADIENT_PRESETS = [
|
|
43564
|
+
{ name: "Fire", start: 196, end: 226 },
|
|
43565
|
+
{ name: "Ocean", start: 21, end: 51 },
|
|
43566
|
+
{ name: "Forest", start: 22, end: 46 },
|
|
43567
|
+
{ name: "Sunset", start: 196, end: 214 },
|
|
43568
|
+
{ name: "Neon", start: 198, end: 51 },
|
|
43569
|
+
{ name: "Ice", start: 33, end: 231 }
|
|
43570
|
+
];
|
|
43571
|
+
ANIM_PRESETS2 = [
|
|
43061
43572
|
{ id: "wave", name: "Wave", desc: "Flowing wave pattern" },
|
|
43062
43573
|
{ id: "pulse", name: "Pulse", desc: "Pulsing dots" },
|
|
43063
43574
|
{ id: "matrix", name: "Matrix", desc: "Falling characters" },
|
|
@@ -43083,7 +43594,7 @@ __export(voice_exports, {
|
|
|
43083
43594
|
});
|
|
43084
43595
|
import { existsSync as existsSync41, mkdirSync as mkdirSync17, writeFileSync as writeFileSync18, readFileSync as readFileSync30, unlinkSync as unlinkSync9, readdirSync as readdirSync11, renameSync, statSync as statSync13 } from "node:fs";
|
|
43085
43596
|
import { join as join57, dirname as dirname18 } from "node:path";
|
|
43086
|
-
import { homedir as
|
|
43597
|
+
import { homedir as homedir14, tmpdir as tmpdir9, platform as platform3 } from "node:os";
|
|
43087
43598
|
import { execSync as execSync29, spawn as nodeSpawn } from "node:child_process";
|
|
43088
43599
|
import { createRequire } from "node:module";
|
|
43089
43600
|
function sanitizeForTTS(text) {
|
|
@@ -43107,7 +43618,7 @@ function listVoiceModels() {
|
|
|
43107
43618
|
}));
|
|
43108
43619
|
}
|
|
43109
43620
|
function voiceDir() {
|
|
43110
|
-
return join57(
|
|
43621
|
+
return join57(homedir14(), ".open-agents", "voice");
|
|
43111
43622
|
}
|
|
43112
43623
|
function modelsDir() {
|
|
43113
43624
|
return join57(voiceDir(), "models");
|
|
@@ -44103,7 +44614,7 @@ var init_voice = __esm({
|
|
|
44103
44614
|
}
|
|
44104
44615
|
p = p.replace(/\\ /g, " ");
|
|
44105
44616
|
if (p.startsWith("~/") || p === "~") {
|
|
44106
|
-
p = join57(
|
|
44617
|
+
p = join57(homedir14(), p.slice(1));
|
|
44107
44618
|
}
|
|
44108
44619
|
if (!existsSync41(p)) {
|
|
44109
44620
|
return `File not found: ${p}
|
|
@@ -46143,6 +46654,29 @@ async function handleSlashCommand(input, ctx) {
|
|
|
46143
46654
|
} else {
|
|
46144
46655
|
renderInfo("No wallet configured. Ask the agent to create one via the nexus tool.");
|
|
46145
46656
|
}
|
|
46657
|
+
} else if (sub === "name") {
|
|
46658
|
+
const { homedir: homedir19 } = __require("node:os");
|
|
46659
|
+
const { existsSync: ex, readFileSync: rf, writeFileSync: wf, mkdirSync: mkd } = __require("node:fs");
|
|
46660
|
+
const namePath = __require("node:path").join(homedir19(), ".open-agents", "agent-name");
|
|
46661
|
+
if (rest2) {
|
|
46662
|
+
const customName = rest2.replace(/[^a-zA-Z0-9_\-.\s]/g, "").trim().slice(0, 40);
|
|
46663
|
+
if (!customName) {
|
|
46664
|
+
renderError("Invalid name. Use alphanumeric characters, dashes, dots, underscores.");
|
|
46665
|
+
return "handled";
|
|
46666
|
+
}
|
|
46667
|
+
mkd(__require("node:path").dirname(namePath), { recursive: true });
|
|
46668
|
+
wf(namePath, customName, "utf8");
|
|
46669
|
+
renderInfo(`Agent name set to: ${c2.bold(customName)}`);
|
|
46670
|
+
renderInfo("Restart the nexus daemon (/nexus restart) for the change to take effect.");
|
|
46671
|
+
} else {
|
|
46672
|
+
if (ex(namePath)) {
|
|
46673
|
+
const current = rf(namePath, "utf8").trim();
|
|
46674
|
+
renderInfo(`Current agent name: ${c2.bold(current)}`);
|
|
46675
|
+
} else {
|
|
46676
|
+
renderInfo("No custom name set. Using deterministic mnemonic.");
|
|
46677
|
+
}
|
|
46678
|
+
renderInfo(`Set a custom name: /nexus name <your-name>`);
|
|
46679
|
+
}
|
|
46146
46680
|
} else if (sub === "restart" || sub === "disconnect" || sub === "kill") {
|
|
46147
46681
|
const nexusDir = ctx.repoRoot ? __require("node:path").join(ctx.repoRoot, ".oa", "nexus") : null;
|
|
46148
46682
|
if (!nexusDir) {
|
|
@@ -48712,9 +49246,9 @@ async function handleVoiceMenu(ctx, save, hasLocal) {
|
|
|
48712
49246
|
}
|
|
48713
49247
|
const { basename: basename18, join: pathJoin } = await import("node:path");
|
|
48714
49248
|
const { copyFileSync: copyFileSync2, mkdirSync: mkdirSync27, existsSync: exists } = await import("node:fs");
|
|
48715
|
-
const { homedir:
|
|
49249
|
+
const { homedir: homedir19 } = await import("node:os");
|
|
48716
49250
|
const modelName = basename18(onnxDrop.path, ".onnx").replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
48717
|
-
const destDir = pathJoin(
|
|
49251
|
+
const destDir = pathJoin(homedir19(), ".open-agents", "voice", "models", modelName);
|
|
48718
49252
|
if (!exists(destDir))
|
|
48719
49253
|
mkdirSync27(destDir, { recursive: true });
|
|
48720
49254
|
copyFileSync2(onnxDrop.path, pathJoin(destDir, "model.onnx"));
|
|
@@ -49247,12 +49781,22 @@ async function handleSponsoredEndpoint(ctx, local) {
|
|
|
49247
49781
|
{ key: "hdr", label: "Available Sponsored Endpoints" }
|
|
49248
49782
|
];
|
|
49249
49783
|
for (const sp of sponsors) {
|
|
49250
|
-
const modelList = sp.models.length > 0 ? sp.models.slice(0, 3).join(", ") + (sp.models.length > 3 ? ` +${sp.models.length - 3}` : "") : "probing...";
|
|
49251
49784
|
const transport = sp.url ? "tunnel" : sp.peerId ? "p2p" : "?";
|
|
49785
|
+
let modelLine;
|
|
49786
|
+
if (sp.models.length > 0) {
|
|
49787
|
+
const shown = sp.models.slice(0, 5).join(", ");
|
|
49788
|
+
const extra = sp.models.length > 5 ? `, +${sp.models.length - 5} more` : "";
|
|
49789
|
+
modelLine = `${sp.models.length} models: ${shown}${extra}`;
|
|
49790
|
+
} else {
|
|
49791
|
+
modelLine = "probing...";
|
|
49792
|
+
}
|
|
49793
|
+
const tpdLabel = sp.limits.tpd >= 1e3 ? (sp.limits.tpd / 1e3).toFixed(0) + "K" : String(sp.limits.tpd);
|
|
49794
|
+
const limitsLine = `${sp.limits.rpm} req/min, ${tpdLabel} tokens/day`;
|
|
49252
49795
|
items.push({
|
|
49253
49796
|
key: sp.url || sp.peerId || sp.name,
|
|
49254
49797
|
label: ` ${sp.name} (${sp.source}, ${transport})`,
|
|
49255
|
-
detail: `
|
|
49798
|
+
detail: ` ${modelLine}
|
|
49799
|
+
${limitsLine}`
|
|
49256
49800
|
});
|
|
49257
49801
|
}
|
|
49258
49802
|
items.push({ key: "sep", label: "" });
|
|
@@ -49269,7 +49813,18 @@ async function handleSponsoredEndpoint(ctx, local) {
|
|
|
49269
49813
|
title: "Sponsored Endpoints",
|
|
49270
49814
|
rl: ctx.rl,
|
|
49271
49815
|
skipKeys: ["hdr", "sep"],
|
|
49272
|
-
availableRows: ctx.availableContentRows?.()
|
|
49816
|
+
availableRows: ctx.availableContentRows?.(),
|
|
49817
|
+
renderRow: (item, focused, _isActive) => {
|
|
49818
|
+
if (item.key === "hdr")
|
|
49819
|
+
return selectColors.bold(item.label);
|
|
49820
|
+
const prefix = focused ? selectColors.orange("\u276F ") : " ";
|
|
49821
|
+
if (item.detail) {
|
|
49822
|
+
const detailLines = item.detail.split("\n");
|
|
49823
|
+
return `${prefix}${item.label}
|
|
49824
|
+
` + detailLines.map((l) => ` ${selectColors.dim(l)}`).join("\n");
|
|
49825
|
+
}
|
|
49826
|
+
return `${prefix}${item.label}`;
|
|
49827
|
+
}
|
|
49273
49828
|
});
|
|
49274
49829
|
if (!result.confirmed || !result.key) {
|
|
49275
49830
|
renderInfo("Cancelled.");
|
|
@@ -49292,6 +49847,12 @@ async function handleSponsoredEndpoint(ctx, local) {
|
|
|
49292
49847
|
renderError("Sponsor has no reachable endpoint (no tunnel URL or peer ID).");
|
|
49293
49848
|
return;
|
|
49294
49849
|
}
|
|
49850
|
+
if (selected.banner?.preset && ctx.setBanner) {
|
|
49851
|
+
const { presetToBannerDesign: presetToBannerDesign2 } = await Promise.resolve().then(() => (init_sponsor_anims(), sponsor_anims_exports));
|
|
49852
|
+
const bannerDesign = presetToBannerDesign2(selected.banner.preset, selected.name, selected.banner.message);
|
|
49853
|
+
ctx.setBanner(bannerDesign);
|
|
49854
|
+
renderInfo("Banner updated with sponsor branding.");
|
|
49855
|
+
}
|
|
49295
49856
|
const saveKey = selected.url || selected.peerId || selected.name;
|
|
49296
49857
|
try {
|
|
49297
49858
|
mkdirSync18(sponsorDir2, { recursive: true });
|
|
@@ -50421,7 +50982,7 @@ var init_commands = __esm({
|
|
|
50421
50982
|
import { existsSync as existsSync43, readFileSync as readFileSync32, readdirSync as readdirSync13 } from "node:fs";
|
|
50422
50983
|
import { join as join59, basename as basename12 } from "node:path";
|
|
50423
50984
|
import { execSync as execSync30 } from "node:child_process";
|
|
50424
|
-
import { homedir as
|
|
50985
|
+
import { homedir as homedir16, platform as platform4, release } from "node:os";
|
|
50425
50986
|
function getModelTier(modelName) {
|
|
50426
50987
|
const m = modelName.toLowerCase();
|
|
50427
50988
|
const sizeMatch = m.match(/\b(\d+)b\b/);
|
|
@@ -50508,7 +51069,7 @@ function loadMemoryContext(repoRoot) {
|
|
|
50508
51069
|
if (legacyEntries)
|
|
50509
51070
|
sections.push(legacyEntries);
|
|
50510
51071
|
}
|
|
50511
|
-
const globalMemDir = join59(
|
|
51072
|
+
const globalMemDir = join59(homedir16(), ".open-agents", "memory");
|
|
50512
51073
|
const globalEntries = loadMemoryDir(globalMemDir, "global");
|
|
50513
51074
|
if (globalEntries)
|
|
50514
51075
|
sections.push(globalEntries);
|
|
@@ -60665,7 +61226,7 @@ import { fileURLToPath as fileURLToPath12 } from "node:url";
|
|
|
60665
61226
|
import { readFileSync as readFileSync39, writeFileSync as writeFileSync23, appendFileSync as appendFileSync4, rmSync as rmSync3, readdirSync as readdirSync19, mkdirSync as mkdirSync24 } from "node:fs";
|
|
60666
61227
|
import { existsSync as existsSync50 } from "node:fs";
|
|
60667
61228
|
import { execSync as execSync33 } from "node:child_process";
|
|
60668
|
-
import { homedir as
|
|
61229
|
+
import { homedir as homedir17 } from "node:os";
|
|
60669
61230
|
function formatTimeAgo(date) {
|
|
60670
61231
|
const seconds = Math.floor((Date.now() - date.getTime()) / 1e3);
|
|
60671
61232
|
if (seconds < 60)
|
|
@@ -62489,7 +63050,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
62489
63050
|
const hits = allCompletions.filter((c3) => c3.toLowerCase().startsWith(lower));
|
|
62490
63051
|
return [hits, line];
|
|
62491
63052
|
}
|
|
62492
|
-
const HISTORY_DIR = join67(
|
|
63053
|
+
const HISTORY_DIR = join67(homedir17(), ".open-agents");
|
|
62493
63054
|
const HISTORY_FILE = join67(HISTORY_DIR, "repl-history");
|
|
62494
63055
|
const MAX_HISTORY_LINES = 500;
|
|
62495
63056
|
let savedHistory = [];
|
|
@@ -63964,6 +64525,9 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
63964
64525
|
showPrompt() {
|
|
63965
64526
|
showPrompt();
|
|
63966
64527
|
},
|
|
64528
|
+
setBanner: (design) => {
|
|
64529
|
+
banner.setDesign(design);
|
|
64530
|
+
},
|
|
63967
64531
|
retireCarousel() {
|
|
63968
64532
|
if (!carouselRetired && carousel.isRunning) {
|
|
63969
64533
|
carousel.stop();
|
|
@@ -64005,7 +64569,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
64005
64569
|
} catch {
|
|
64006
64570
|
}
|
|
64007
64571
|
try {
|
|
64008
|
-
const voiceDir2 = join67(
|
|
64572
|
+
const voiceDir2 = join67(homedir17(), ".open-agents", "voice");
|
|
64009
64573
|
const voicePidFiles = ["luxtts-daemon.pid", "piper-daemon.pid"];
|
|
64010
64574
|
for (const pf of voicePidFiles) {
|
|
64011
64575
|
const pidPath = join67(voiceDir2, pf);
|
|
@@ -65857,7 +66421,7 @@ __export(config_exports, {
|
|
|
65857
66421
|
configCommand: () => configCommand
|
|
65858
66422
|
});
|
|
65859
66423
|
import { join as join70, resolve as resolve34 } from "node:path";
|
|
65860
|
-
import { homedir as
|
|
66424
|
+
import { homedir as homedir18 } from "node:os";
|
|
65861
66425
|
import { cwd as cwd3 } from "node:process";
|
|
65862
66426
|
function redactIfSensitive(key, value) {
|
|
65863
66427
|
if (SENSITIVE_KEYS.has(key) && typeof value === "string" && value.length > 0) {
|
|
@@ -65939,7 +66503,7 @@ function handleShow(opts, config) {
|
|
|
65939
66503
|
}
|
|
65940
66504
|
}
|
|
65941
66505
|
printSection("Config File");
|
|
65942
|
-
printInfo(`~/.open-agents/config.json (${join70(
|
|
66506
|
+
printInfo(`~/.open-agents/config.json (${join70(homedir18(), ".open-agents", "config.json")})`);
|
|
65943
66507
|
printSection("Priority Chain");
|
|
65944
66508
|
printInfo(" 1. CLI flags (--model, --backend-url, etc.)");
|
|
65945
66509
|
printInfo(" 2. Project .oa/settings.json (--local)");
|
package/package.json
CHANGED