@8gi-foundation/8gent-code 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli.js +1255 -597
- package/dist/skills/voice-chat-mode/SKILL.md +47 -0
- package/dist/sounds/launch.mp3 +0 -0
- package/package.json +6 -2
package/dist/cli.js
CHANGED
|
@@ -183088,6 +183088,14 @@ var init_clients = __esm(() => {
|
|
|
183088
183088
|
});
|
|
183089
183089
|
|
|
183090
183090
|
// packages/hands/index.ts
|
|
183091
|
+
var exports_hands = {};
|
|
183092
|
+
__export(exports_hands, {
|
|
183093
|
+
openPrivacyPane: () => openPrivacyPane,
|
|
183094
|
+
getDriver: () => getDriver,
|
|
183095
|
+
disposeScreenshot: () => disposeScreenshot,
|
|
183096
|
+
checkPermissions: () => checkPermissions,
|
|
183097
|
+
_resetForTests: () => _resetForTests
|
|
183098
|
+
});
|
|
183091
183099
|
import { execFileSync, spawnSync as spawnSync2 } from "child_process";
|
|
183092
183100
|
import { existsSync as existsSync14, readFileSync as readFileSync13, unlinkSync as unlinkSync2 } from "fs";
|
|
183093
183101
|
import { tmpdir as tmpdir2 } from "os";
|
|
@@ -183452,6 +183460,93 @@ function getDriver() {
|
|
|
183452
183460
|
_driver = new MacosDriver;
|
|
183453
183461
|
return _driver;
|
|
183454
183462
|
}
|
|
183463
|
+
function _resetForTests() {
|
|
183464
|
+
_driver = null;
|
|
183465
|
+
_caps = null;
|
|
183466
|
+
}
|
|
183467
|
+
function checkPermissions() {
|
|
183468
|
+
let axGranted = false;
|
|
183469
|
+
let axDetail = "";
|
|
183470
|
+
try {
|
|
183471
|
+
const r = spawnSync2("/usr/bin/osascript", ["-e", 'tell application "System Events" to return name of first process whose frontmost is true'], { encoding: "utf-8", timeout: 3000 });
|
|
183472
|
+
if (r.status === 0 && r.stdout.trim().length > 0) {
|
|
183473
|
+
axGranted = true;
|
|
183474
|
+
axDetail = `frontmost: ${r.stdout.trim()}`;
|
|
183475
|
+
} else {
|
|
183476
|
+
axDetail = (r.stderr || "").trim().slice(0, 200) || `osascript exited ${r.status}`;
|
|
183477
|
+
}
|
|
183478
|
+
} catch (err) {
|
|
183479
|
+
axDetail = err instanceof Error ? err.message : "osascript spawn failed";
|
|
183480
|
+
}
|
|
183481
|
+
let srGranted = false;
|
|
183482
|
+
let srDetail = "";
|
|
183483
|
+
const probePath = join16(tmpdir2(), `8gent-hands-probe-${process.pid}.png`);
|
|
183484
|
+
try {
|
|
183485
|
+
const r = spawnSync2("/usr/sbin/screencapture", ["-x", "-r", probePath], {
|
|
183486
|
+
encoding: "utf-8",
|
|
183487
|
+
timeout: 5000
|
|
183488
|
+
});
|
|
183489
|
+
if (r.status === 0 && existsSync14(probePath)) {
|
|
183490
|
+
const buf = readFileSync13(probePath);
|
|
183491
|
+
if (buf.length > 50000) {
|
|
183492
|
+
srGranted = true;
|
|
183493
|
+
srDetail = `${(buf.length / 1024).toFixed(0)}KB capture`;
|
|
183494
|
+
} else {
|
|
183495
|
+
srDetail = `${buf.length}B placeholder \u2014 permission likely denied`;
|
|
183496
|
+
}
|
|
183497
|
+
} else {
|
|
183498
|
+
srDetail = (r.stderr || "").trim().slice(0, 200) || `screencapture exited ${r.status}`;
|
|
183499
|
+
}
|
|
183500
|
+
} catch (err) {
|
|
183501
|
+
srDetail = err instanceof Error ? err.message : "screencapture spawn failed";
|
|
183502
|
+
} finally {
|
|
183503
|
+
try {
|
|
183504
|
+
if (existsSync14(probePath))
|
|
183505
|
+
unlinkSync2(probePath);
|
|
183506
|
+
} catch {}
|
|
183507
|
+
}
|
|
183508
|
+
let terminalApp = process.env.TERM_PROGRAM || "";
|
|
183509
|
+
if (!terminalApp) {
|
|
183510
|
+
try {
|
|
183511
|
+
const ppid = process.ppid;
|
|
183512
|
+
const r = spawnSync2("/bin/ps", ["-o", "comm=", "-p", String(ppid)], {
|
|
183513
|
+
encoding: "utf-8",
|
|
183514
|
+
timeout: 1500
|
|
183515
|
+
});
|
|
183516
|
+
terminalApp = (r.stdout || "").trim();
|
|
183517
|
+
} catch {
|
|
183518
|
+
terminalApp = "your terminal";
|
|
183519
|
+
}
|
|
183520
|
+
}
|
|
183521
|
+
if (terminalApp === "iTerm.app")
|
|
183522
|
+
terminalApp = "iTerm";
|
|
183523
|
+
if (terminalApp === "Apple_Terminal")
|
|
183524
|
+
terminalApp = "Terminal";
|
|
183525
|
+
if (terminalApp === "vscode")
|
|
183526
|
+
terminalApp = "Visual Studio Code";
|
|
183527
|
+
return {
|
|
183528
|
+
accessibility: { granted: axGranted, detail: axDetail },
|
|
183529
|
+
screenRecording: { granted: srGranted, detail: srDetail },
|
|
183530
|
+
terminalApp: terminalApp || "your terminal",
|
|
183531
|
+
allGranted: axGranted && srGranted
|
|
183532
|
+
};
|
|
183533
|
+
}
|
|
183534
|
+
function openPrivacyPane(pane) {
|
|
183535
|
+
const key = pane === "accessibility" ? "Privacy_Accessibility" : "Privacy_ScreenCapture";
|
|
183536
|
+
const url = `x-apple.systempreferences:com.apple.preference.security?${key}`;
|
|
183537
|
+
try {
|
|
183538
|
+
const r = spawnSync2("/usr/bin/open", [url], { timeout: 3000 });
|
|
183539
|
+
return r.status === 0;
|
|
183540
|
+
} catch {
|
|
183541
|
+
return false;
|
|
183542
|
+
}
|
|
183543
|
+
}
|
|
183544
|
+
function disposeScreenshot(p) {
|
|
183545
|
+
try {
|
|
183546
|
+
if (existsSync14(p))
|
|
183547
|
+
unlinkSync2(p);
|
|
183548
|
+
} catch {}
|
|
183549
|
+
}
|
|
183455
183550
|
var _caps = null, KEY_ALIASES, MODIFIERS, MOD_TO_CLICLICK, _driver = null;
|
|
183456
183551
|
var init_hands = __esm(() => {
|
|
183457
183552
|
KEY_ALIASES = {
|
|
@@ -493326,16 +493421,185 @@ class WorktreeMessaging {
|
|
|
493326
493421
|
}
|
|
493327
493422
|
var init_worktree_messaging = () => {};
|
|
493328
493423
|
|
|
493424
|
+
// packages/settings/defaults.ts
|
|
493425
|
+
var DEFAULT_SETTINGS;
|
|
493426
|
+
var init_defaults = __esm(() => {
|
|
493427
|
+
DEFAULT_SETTINGS = {
|
|
493428
|
+
version: 1,
|
|
493429
|
+
voice: {
|
|
493430
|
+
silenceThresholdMs: 2000,
|
|
493431
|
+
bargeIn: true,
|
|
493432
|
+
ttsVoice: "Ava",
|
|
493433
|
+
outputEnabled: true,
|
|
493434
|
+
perAgent: {
|
|
493435
|
+
orchestrator: "Daniel",
|
|
493436
|
+
engineer: "Karen",
|
|
493437
|
+
qa: "Moira"
|
|
493438
|
+
}
|
|
493439
|
+
},
|
|
493440
|
+
performance: {
|
|
493441
|
+
mode: "auto",
|
|
493442
|
+
introBanner: "auto"
|
|
493443
|
+
},
|
|
493444
|
+
models: {
|
|
493445
|
+
tabs: {
|
|
493446
|
+
orchestrator: { provider: "ollama", model: "qwen3.6:27b" },
|
|
493447
|
+
engineer: { provider: "lmstudio", model: "google/gemma-4-26b-a4b" },
|
|
493448
|
+
qa: { provider: "apfel", model: "apple-foundationmodel" }
|
|
493449
|
+
}
|
|
493450
|
+
},
|
|
493451
|
+
providers: {
|
|
493452
|
+
apfel: { baseURL: "http://localhost:11500/v1" },
|
|
493453
|
+
ollama: { baseURL: "http://localhost:11434/v1" },
|
|
493454
|
+
lmstudio: { baseURL: "http://localhost:1234/v1" },
|
|
493455
|
+
openrouter: { baseURL: "https://openrouter.ai/api/v1" }
|
|
493456
|
+
},
|
|
493457
|
+
ui: {
|
|
493458
|
+
theme: "amber",
|
|
493459
|
+
thinkingVisualiser: {
|
|
493460
|
+
enabled: true,
|
|
493461
|
+
operatorRotationMs: 8000,
|
|
493462
|
+
boredomThresholdMs: 30000
|
|
493463
|
+
},
|
|
493464
|
+
introSound: ""
|
|
493465
|
+
},
|
|
493466
|
+
agents: {
|
|
493467
|
+
names: {
|
|
493468
|
+
orchestrator: "Orchestrator",
|
|
493469
|
+
engineer: "Engineer",
|
|
493470
|
+
qa: "QA"
|
|
493471
|
+
}
|
|
493472
|
+
}
|
|
493473
|
+
};
|
|
493474
|
+
});
|
|
493475
|
+
|
|
493476
|
+
// packages/settings/store.ts
|
|
493477
|
+
import * as fs28 from "fs";
|
|
493478
|
+
import * as os19 from "os";
|
|
493479
|
+
import * as path29 from "path";
|
|
493480
|
+
function ensureDir3() {
|
|
493481
|
+
try {
|
|
493482
|
+
if (!fs28.existsSync(SETTINGS_DIR)) {
|
|
493483
|
+
fs28.mkdirSync(SETTINGS_DIR, { recursive: true });
|
|
493484
|
+
}
|
|
493485
|
+
} catch {}
|
|
493486
|
+
}
|
|
493487
|
+
function deepMerge(defaults, user) {
|
|
493488
|
+
if (user === null || user === undefined)
|
|
493489
|
+
return defaults;
|
|
493490
|
+
if (typeof defaults !== "object" || defaults === null) {
|
|
493491
|
+
if (typeof user === typeof defaults)
|
|
493492
|
+
return user;
|
|
493493
|
+
return defaults;
|
|
493494
|
+
}
|
|
493495
|
+
if (Array.isArray(defaults)) {
|
|
493496
|
+
return Array.isArray(user) ? user : defaults;
|
|
493497
|
+
}
|
|
493498
|
+
const out = { ...defaults };
|
|
493499
|
+
if (typeof user === "object" && user !== null && !Array.isArray(user)) {
|
|
493500
|
+
const u3 = user;
|
|
493501
|
+
for (const key of Object.keys(out)) {
|
|
493502
|
+
if (key in u3) {
|
|
493503
|
+
out[key] = deepMerge(defaults[key], u3[key]);
|
|
493504
|
+
}
|
|
493505
|
+
}
|
|
493506
|
+
}
|
|
493507
|
+
return out;
|
|
493508
|
+
}
|
|
493509
|
+
function loadSettings() {
|
|
493510
|
+
try {
|
|
493511
|
+
if (!fs28.existsSync(SETTINGS_FILE)) {
|
|
493512
|
+
return DEFAULT_SETTINGS;
|
|
493513
|
+
}
|
|
493514
|
+
const raw = fs28.readFileSync(SETTINGS_FILE, "utf-8");
|
|
493515
|
+
const parsed = JSON.parse(raw);
|
|
493516
|
+
const merged = deepMerge(DEFAULT_SETTINGS, parsed);
|
|
493517
|
+
return { ...merged, version: DEFAULT_SETTINGS.version };
|
|
493518
|
+
} catch {
|
|
493519
|
+
return DEFAULT_SETTINGS;
|
|
493520
|
+
}
|
|
493521
|
+
}
|
|
493522
|
+
function saveSettings(s3) {
|
|
493523
|
+
try {
|
|
493524
|
+
ensureDir3();
|
|
493525
|
+
fs28.writeFileSync(SETTINGS_FILE, `${JSON.stringify(s3, null, 2)}
|
|
493526
|
+
`, "utf-8");
|
|
493527
|
+
} catch {}
|
|
493528
|
+
}
|
|
493529
|
+
var SETTINGS_DIR, SETTINGS_FILE;
|
|
493530
|
+
var init_store2 = __esm(() => {
|
|
493531
|
+
init_defaults();
|
|
493532
|
+
SETTINGS_DIR = path29.join(os19.homedir(), ".8gent");
|
|
493533
|
+
SETTINGS_FILE = path29.join(SETTINGS_DIR, "settings.json");
|
|
493534
|
+
});
|
|
493535
|
+
|
|
493536
|
+
// packages/settings/voice.ts
|
|
493537
|
+
var init_voice2 = __esm(() => {
|
|
493538
|
+
init_defaults();
|
|
493539
|
+
init_store2();
|
|
493540
|
+
});
|
|
493541
|
+
|
|
493542
|
+
// packages/settings/agents.ts
|
|
493543
|
+
function isKnownRole(role) {
|
|
493544
|
+
return KNOWN_ROLES.includes(role);
|
|
493545
|
+
}
|
|
493546
|
+
function capitalize(s3) {
|
|
493547
|
+
if (!s3)
|
|
493548
|
+
return s3;
|
|
493549
|
+
return s3.charAt(0).toUpperCase() + s3.slice(1);
|
|
493550
|
+
}
|
|
493551
|
+
function resolveRoleName(role, settings) {
|
|
493552
|
+
const s3 = settings ?? loadSettings();
|
|
493553
|
+
if (isKnownRole(role)) {
|
|
493554
|
+
const chosen = s3.agents?.names?.[role];
|
|
493555
|
+
if (typeof chosen === "string" && chosen.trim().length > 0) {
|
|
493556
|
+
return chosen.trim();
|
|
493557
|
+
}
|
|
493558
|
+
return DEFAULT_SETTINGS.agents.names[role];
|
|
493559
|
+
}
|
|
493560
|
+
return capitalize(role) || "Agent";
|
|
493561
|
+
}
|
|
493562
|
+
var KNOWN_ROLES;
|
|
493563
|
+
var init_agents = __esm(() => {
|
|
493564
|
+
init_defaults();
|
|
493565
|
+
init_store2();
|
|
493566
|
+
KNOWN_ROLES = ["orchestrator", "engineer", "qa"];
|
|
493567
|
+
});
|
|
493568
|
+
|
|
493569
|
+
// packages/settings/index.ts
|
|
493570
|
+
var init_settings = __esm(() => {
|
|
493571
|
+
init_voice2();
|
|
493572
|
+
init_agents();
|
|
493573
|
+
init_defaults();
|
|
493574
|
+
init_store2();
|
|
493575
|
+
});
|
|
493576
|
+
|
|
493329
493577
|
// packages/orchestration/role-registry.ts
|
|
493578
|
+
function buildSystemPrompt(role) {
|
|
493579
|
+
const template = ROLE_PROMPT_TEMPLATES[role] ?? ROLE_PROMPT_TEMPLATES.engineer;
|
|
493580
|
+
return template.replace("{name}", resolveRoleName(role));
|
|
493581
|
+
}
|
|
493330
493582
|
function getRunnerConfig(role) {
|
|
493331
|
-
|
|
493583
|
+
const cfg = ROLE_REGISTRY[role] ?? ROLE_REGISTRY.engineer;
|
|
493584
|
+
return {
|
|
493585
|
+
...cfg,
|
|
493586
|
+
systemPrompt: cfg.systemPrompt
|
|
493587
|
+
};
|
|
493332
493588
|
}
|
|
493333
|
-
var ROLE_REGISTRY;
|
|
493589
|
+
var ROLE_PROMPT_TEMPLATES, ROLE_REGISTRY;
|
|
493334
493590
|
var init_role_registry = __esm(() => {
|
|
493591
|
+
init_settings();
|
|
493592
|
+
ROLE_PROMPT_TEMPLATES = {
|
|
493593
|
+
orchestrator: "You are {name}. Plan, delegate, and coordinate. Think before acting. No code - direct others.",
|
|
493594
|
+
engineer: "You are {name}. Write code, edit files, run commands. Implement exactly what is asked. No fluff.",
|
|
493595
|
+
qa: "You are {name}. Find bugs, review diffs, run tests. Be harsh. Reject anything that doesn't meet the spec."
|
|
493596
|
+
};
|
|
493335
493597
|
ROLE_REGISTRY = {
|
|
493336
493598
|
orchestrator: {
|
|
493337
493599
|
role: "orchestrator",
|
|
493338
|
-
systemPrompt
|
|
493600
|
+
get systemPrompt() {
|
|
493601
|
+
return buildSystemPrompt("orchestrator");
|
|
493602
|
+
},
|
|
493339
493603
|
allowedTools: ["write_notes", "gh_issue_create", "gh_pr_list", "gh_issue_list"],
|
|
493340
493604
|
retryPolicy: { maxAttempts: 2, backoffMs: 1000 },
|
|
493341
493605
|
inferenceMode: "ollama",
|
|
@@ -493343,7 +493607,9 @@ var init_role_registry = __esm(() => {
|
|
|
493343
493607
|
},
|
|
493344
493608
|
engineer: {
|
|
493345
493609
|
role: "engineer",
|
|
493346
|
-
systemPrompt
|
|
493610
|
+
get systemPrompt() {
|
|
493611
|
+
return buildSystemPrompt("engineer");
|
|
493612
|
+
},
|
|
493347
493613
|
allowedTools: [
|
|
493348
493614
|
"read_file",
|
|
493349
493615
|
"write_file",
|
|
@@ -493367,7 +493633,9 @@ var init_role_registry = __esm(() => {
|
|
|
493367
493633
|
},
|
|
493368
493634
|
qa: {
|
|
493369
493635
|
role: "qa",
|
|
493370
|
-
systemPrompt
|
|
493636
|
+
get systemPrompt() {
|
|
493637
|
+
return buildSystemPrompt("qa");
|
|
493638
|
+
},
|
|
493371
493639
|
allowedTools: [
|
|
493372
493640
|
"read_file",
|
|
493373
493641
|
"list_files",
|
|
@@ -494580,12 +494848,12 @@ function createApi(pathParts = []) {
|
|
|
494580
494848
|
const found = ["api", ...pathParts].join(".");
|
|
494581
494849
|
throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${found}\``);
|
|
494582
494850
|
}
|
|
494583
|
-
const
|
|
494851
|
+
const path30 = pathParts.slice(0, -1).join("/");
|
|
494584
494852
|
const exportName = pathParts[pathParts.length - 1];
|
|
494585
494853
|
if (exportName === "default") {
|
|
494586
|
-
return
|
|
494854
|
+
return path30;
|
|
494587
494855
|
} else {
|
|
494588
|
-
return
|
|
494856
|
+
return path30 + ":" + exportName;
|
|
494589
494857
|
}
|
|
494590
494858
|
} else if (prop2 === Symbol.toStringTag) {
|
|
494591
494859
|
return "FunctionReference";
|
|
@@ -497078,16 +497346,16 @@ var init_simple_client_node = __esm(() => {
|
|
|
497078
497346
|
});
|
|
497079
497347
|
require_node_gyp_build = __commonJS2({
|
|
497080
497348
|
"../common/temp/node_modules/.pnpm/node-gyp-build@4.8.4/node_modules/node-gyp-build/node-gyp-build.js"(exports, module) {
|
|
497081
|
-
var
|
|
497082
|
-
var
|
|
497083
|
-
var
|
|
497349
|
+
var fs29 = __require2("fs");
|
|
497350
|
+
var path30 = __require2("path");
|
|
497351
|
+
var os20 = __require2("os");
|
|
497084
497352
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require2;
|
|
497085
497353
|
var vars = process.config && process.config.variables || {};
|
|
497086
497354
|
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
497087
497355
|
var abi = process.versions.modules;
|
|
497088
497356
|
var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
|
|
497089
|
-
var arch = process.env.npm_config_arch ||
|
|
497090
|
-
var platform4 = process.env.npm_config_platform ||
|
|
497357
|
+
var arch = process.env.npm_config_arch || os20.arch();
|
|
497358
|
+
var platform4 = process.env.npm_config_platform || os20.platform();
|
|
497091
497359
|
var libc = process.env.LIBC || (isAlpine(platform4) ? "musl" : "glibc");
|
|
497092
497360
|
var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || "";
|
|
497093
497361
|
var uv = (process.versions.uv || "").split(".")[0];
|
|
@@ -497096,24 +497364,24 @@ var init_simple_client_node = __esm(() => {
|
|
|
497096
497364
|
return runtimeRequire(load2.resolve(dir));
|
|
497097
497365
|
}
|
|
497098
497366
|
load2.resolve = load2.path = function(dir) {
|
|
497099
|
-
dir =
|
|
497367
|
+
dir = path30.resolve(dir || ".");
|
|
497100
497368
|
try {
|
|
497101
|
-
var name21 = runtimeRequire(
|
|
497369
|
+
var name21 = runtimeRequire(path30.join(dir, "package.json")).name.toUpperCase().replace(/-/g, "_");
|
|
497102
497370
|
if (process.env[name21 + "_PREBUILD"])
|
|
497103
497371
|
dir = process.env[name21 + "_PREBUILD"];
|
|
497104
497372
|
} catch (err) {}
|
|
497105
497373
|
if (!prebuildsOnly) {
|
|
497106
|
-
var release3 = getFirst(
|
|
497374
|
+
var release3 = getFirst(path30.join(dir, "build/Release"), matchBuild);
|
|
497107
497375
|
if (release3)
|
|
497108
497376
|
return release3;
|
|
497109
|
-
var debug = getFirst(
|
|
497377
|
+
var debug = getFirst(path30.join(dir, "build/Debug"), matchBuild);
|
|
497110
497378
|
if (debug)
|
|
497111
497379
|
return debug;
|
|
497112
497380
|
}
|
|
497113
497381
|
var prebuild = resolve9(dir);
|
|
497114
497382
|
if (prebuild)
|
|
497115
497383
|
return prebuild;
|
|
497116
|
-
var nearby = resolve9(
|
|
497384
|
+
var nearby = resolve9(path30.dirname(process.execPath));
|
|
497117
497385
|
if (nearby)
|
|
497118
497386
|
return nearby;
|
|
497119
497387
|
var target = [
|
|
@@ -497132,28 +497400,28 @@ var init_simple_client_node = __esm(() => {
|
|
|
497132
497400
|
loaded from: ` + dir + `
|
|
497133
497401
|
`);
|
|
497134
497402
|
function resolve9(dir2) {
|
|
497135
|
-
var tuples = readdirSync7(
|
|
497403
|
+
var tuples = readdirSync7(path30.join(dir2, "prebuilds")).map(parseTuple);
|
|
497136
497404
|
var tuple2 = tuples.filter(matchTuple(platform4, arch)).sort(compareTuples)[0];
|
|
497137
497405
|
if (!tuple2)
|
|
497138
497406
|
return;
|
|
497139
|
-
var prebuilds =
|
|
497407
|
+
var prebuilds = path30.join(dir2, "prebuilds", tuple2.name);
|
|
497140
497408
|
var parsed = readdirSync7(prebuilds).map(parseTags);
|
|
497141
497409
|
var candidates = parsed.filter(matchTags(runtime, abi));
|
|
497142
497410
|
var winner = candidates.sort(compareTags(runtime))[0];
|
|
497143
497411
|
if (winner)
|
|
497144
|
-
return
|
|
497412
|
+
return path30.join(prebuilds, winner.file);
|
|
497145
497413
|
}
|
|
497146
497414
|
};
|
|
497147
497415
|
function readdirSync7(dir) {
|
|
497148
497416
|
try {
|
|
497149
|
-
return
|
|
497417
|
+
return fs29.readdirSync(dir);
|
|
497150
497418
|
} catch (err) {
|
|
497151
497419
|
return [];
|
|
497152
497420
|
}
|
|
497153
497421
|
}
|
|
497154
497422
|
function getFirst(dir, filter5) {
|
|
497155
497423
|
var files = readdirSync7(dir).filter(filter5);
|
|
497156
|
-
return files[0] &&
|
|
497424
|
+
return files[0] && path30.join(dir, files[0]);
|
|
497157
497425
|
}
|
|
497158
497426
|
function matchBuild(name21) {
|
|
497159
497427
|
return /\.node$/.test(name21);
|
|
@@ -497255,7 +497523,7 @@ var init_simple_client_node = __esm(() => {
|
|
|
497255
497523
|
return typeof window !== "undefined" && window.process && window.process.type === "renderer";
|
|
497256
497524
|
}
|
|
497257
497525
|
function isAlpine(platform22) {
|
|
497258
|
-
return platform22 === "linux" &&
|
|
497526
|
+
return platform22 === "linux" && fs29.existsSync("/etc/alpine-release");
|
|
497259
497527
|
}
|
|
497260
497528
|
load2.parseTags = parseTags;
|
|
497261
497529
|
load2.matchTags = matchTags;
|
|
@@ -501494,16 +501762,16 @@ var init_orchestration = __esm(() => {
|
|
|
501494
501762
|
});
|
|
501495
501763
|
|
|
501496
501764
|
// packages/eight/tools.ts
|
|
501497
|
-
import * as
|
|
501498
|
-
import * as
|
|
501765
|
+
import * as fs29 from "fs";
|
|
501766
|
+
import * as path30 from "path";
|
|
501499
501767
|
function safePath(userPath, workingDirectory) {
|
|
501500
|
-
const normalized2 =
|
|
501501
|
-
const absolutePath =
|
|
501502
|
-
const normalizedBase =
|
|
501503
|
-
const normalizedTarget =
|
|
501768
|
+
const normalized2 = path30.normalize(userPath);
|
|
501769
|
+
const absolutePath = path30.isAbsolute(normalized2) ? path30.resolve(normalized2) : path30.resolve(workingDirectory, normalized2);
|
|
501770
|
+
const normalizedBase = path30.resolve(workingDirectory);
|
|
501771
|
+
const normalizedTarget = path30.resolve(absolutePath);
|
|
501504
501772
|
if (normalizedTarget === normalizedBase)
|
|
501505
501773
|
return normalizedTarget;
|
|
501506
|
-
if (!normalizedTarget.startsWith(normalizedBase +
|
|
501774
|
+
if (!normalizedTarget.startsWith(normalizedBase + path30.sep)) {
|
|
501507
501775
|
throw new Error(`Path traversal blocked: "${userPath}" resolves outside working directory`);
|
|
501508
501776
|
}
|
|
501509
501777
|
return normalizedTarget;
|
|
@@ -502516,8 +502784,8 @@ var init_tools = __esm(() => {
|
|
|
502516
502784
|
}
|
|
502517
502785
|
}
|
|
502518
502786
|
async getOutline(filePath) {
|
|
502519
|
-
const absolutePath =
|
|
502520
|
-
if (!
|
|
502787
|
+
const absolutePath = path30.isAbsolute(filePath) ? filePath : path30.join(this.workingDirectory, filePath);
|
|
502788
|
+
if (!fs29.existsSync(absolutePath)) {
|
|
502521
502789
|
return `File not found: ${absolutePath}`;
|
|
502522
502790
|
}
|
|
502523
502791
|
try {
|
|
@@ -502545,8 +502813,8 @@ var init_tools = __esm(() => {
|
|
|
502545
502813
|
}
|
|
502546
502814
|
const filePath = symbolId.slice(0, separatorIndex);
|
|
502547
502815
|
const symbolName = symbolId.slice(separatorIndex + 2);
|
|
502548
|
-
const absolutePath =
|
|
502549
|
-
if (!
|
|
502816
|
+
const absolutePath = path30.isAbsolute(filePath) ? filePath : path30.join(this.workingDirectory, filePath);
|
|
502817
|
+
if (!fs29.existsSync(absolutePath)) {
|
|
502550
502818
|
return `File not found: ${absolutePath}`;
|
|
502551
502819
|
}
|
|
502552
502820
|
try {
|
|
@@ -502583,7 +502851,7 @@ ${source}`;
|
|
|
502583
502851
|
matches.push({
|
|
502584
502852
|
name: symbol21.name,
|
|
502585
502853
|
kind: symbol21.kind,
|
|
502586
|
-
file:
|
|
502854
|
+
file: path30.relative(this.workingDirectory, file2),
|
|
502587
502855
|
line: symbol21.startLine
|
|
502588
502856
|
});
|
|
502589
502857
|
}
|
|
@@ -502634,11 +502902,11 @@ ${source}`;
|
|
|
502634
502902
|
`);
|
|
502635
502903
|
}
|
|
502636
502904
|
async readFile(filePath) {
|
|
502637
|
-
const absolutePath =
|
|
502638
|
-
if (!
|
|
502905
|
+
const absolutePath = path30.isAbsolute(filePath) ? filePath : path30.join(this.workingDirectory, filePath);
|
|
502906
|
+
if (!fs29.existsSync(absolutePath)) {
|
|
502639
502907
|
return `File not found: ${absolutePath}`;
|
|
502640
502908
|
}
|
|
502641
|
-
const content =
|
|
502909
|
+
const content = fs29.readFileSync(absolutePath, "utf-8");
|
|
502642
502910
|
const lines = content.split(`
|
|
502643
502911
|
`);
|
|
502644
502912
|
const isCodeFile = /\.(ts|tsx|js|jsx)$/.test(absolutePath);
|
|
@@ -502653,7 +502921,7 @@ ${source}`;
|
|
|
502653
502921
|
} catch {}
|
|
502654
502922
|
}
|
|
502655
502923
|
if (this.astIndexReady && this.astRepoId) {
|
|
502656
|
-
const relativePath =
|
|
502924
|
+
const relativePath = path30.relative(this.workingDirectory, absolutePath);
|
|
502657
502925
|
const outline = getFileOutline(this.astRepoId, relativePath);
|
|
502658
502926
|
if (outline && outline.symbols.length > 0) {
|
|
502659
502927
|
const symbolList = outline.symbols.map((s3) => ` ${s3.kind} ${s3.name} (L${s3.startLine}-${s3.endLine})`).join(`
|
|
@@ -502694,15 +502962,15 @@ ${lines.slice(0, 200).join(`
|
|
|
502694
502962
|
return content;
|
|
502695
502963
|
}
|
|
502696
502964
|
async writeFile(filePath, content) {
|
|
502697
|
-
const absolutePath =
|
|
502965
|
+
const absolutePath = path30.isAbsolute(filePath) ? filePath : path30.join(this.workingDirectory, filePath);
|
|
502698
502966
|
const uiExtensions = [".tsx", ".jsx", ".css", ".html", ".svelte", ".vue"];
|
|
502699
|
-
const ext =
|
|
502967
|
+
const ext = path30.extname(absolutePath).toLowerCase();
|
|
502700
502968
|
let designHint = "";
|
|
502701
502969
|
if (uiExtensions.includes(ext)) {
|
|
502702
502970
|
try {
|
|
502703
|
-
const isNewFile = !
|
|
502704
|
-
if (isNewFile && needsDesignDecision(`create UI file ${
|
|
502705
|
-
const detection = await detectDesignNeed(`create UI component: ${
|
|
502971
|
+
const isNewFile = !fs29.existsSync(absolutePath);
|
|
502972
|
+
if (isNewFile && needsDesignDecision(`create UI file ${path30.basename(absolutePath)}`)) {
|
|
502973
|
+
const detection = await detectDesignNeed(`create UI component: ${path30.basename(absolutePath)}`);
|
|
502706
502974
|
if (detection.needsDesign) {
|
|
502707
502975
|
designHint = `
|
|
502708
502976
|
[Design Agent] This is a new UI file. Consider using suggest_design or query_design_system to ensure consistent design. Detected: ${detection.reason}`;
|
|
@@ -502710,11 +502978,11 @@ ${lines.slice(0, 200).join(`
|
|
|
502710
502978
|
}
|
|
502711
502979
|
} catch {}
|
|
502712
502980
|
}
|
|
502713
|
-
const dir =
|
|
502714
|
-
if (!
|
|
502715
|
-
|
|
502981
|
+
const dir = path30.dirname(absolutePath);
|
|
502982
|
+
if (!fs29.existsSync(dir)) {
|
|
502983
|
+
fs29.mkdirSync(dir, { recursive: true });
|
|
502716
502984
|
}
|
|
502717
|
-
|
|
502985
|
+
fs29.writeFileSync(absolutePath, content);
|
|
502718
502986
|
if (process.platform === "darwin") {
|
|
502719
502987
|
try {
|
|
502720
502988
|
const { spawn: spawn10 } = await import("child_process");
|
|
@@ -502727,22 +502995,22 @@ ${lines.slice(0, 200).join(`
|
|
|
502727
502995
|
return `File written and opened: ${absolutePath}${designHint}`;
|
|
502728
502996
|
}
|
|
502729
502997
|
async editFile(filePath, oldText, newText) {
|
|
502730
|
-
const absolutePath =
|
|
502731
|
-
if (!
|
|
502998
|
+
const absolutePath = path30.isAbsolute(filePath) ? filePath : path30.join(this.workingDirectory, filePath);
|
|
502999
|
+
if (!fs29.existsSync(absolutePath)) {
|
|
502732
503000
|
return `File not found: ${absolutePath}`;
|
|
502733
503001
|
}
|
|
502734
|
-
const content =
|
|
503002
|
+
const content = fs29.readFileSync(absolutePath, "utf-8");
|
|
502735
503003
|
if (!content.includes(oldText)) {
|
|
502736
503004
|
return `Error: Could not find the text to replace in ${filePath}. Make sure oldText matches exactly.`;
|
|
502737
503005
|
}
|
|
502738
503006
|
const newContent = content.replace(oldText, newText);
|
|
502739
|
-
|
|
503007
|
+
fs29.writeFileSync(absolutePath, newContent);
|
|
502740
503008
|
return `File edited: ${absolutePath}
|
|
502741
503009
|
Replaced ${oldText.length} chars with ${newText.length} chars.`;
|
|
502742
503010
|
}
|
|
502743
503011
|
async listFiles(dirPath = ".", pattern) {
|
|
502744
503012
|
const { glob } = await Promise.resolve().then(() => (init_index_min2(), exports_index_min));
|
|
502745
|
-
const absolutePath =
|
|
503013
|
+
const absolutePath = path30.isAbsolute(dirPath) ? dirPath : path30.join(this.workingDirectory, dirPath);
|
|
502746
503014
|
const files = await glob(pattern || "**/*", {
|
|
502747
503015
|
cwd: absolutePath,
|
|
502748
503016
|
ignore: ["**/node_modules/**", "**/dist/**", "**/.git/**"],
|
|
@@ -502880,7 +503148,7 @@ ${stderr}`);
|
|
|
502880
503148
|
});
|
|
502881
503149
|
}
|
|
502882
503150
|
async handleReadImage(imagePath) {
|
|
502883
|
-
const absolutePath =
|
|
503151
|
+
const absolutePath = path30.isAbsolute(imagePath) ? imagePath : path30.join(this.workingDirectory, imagePath);
|
|
502884
503152
|
try {
|
|
502885
503153
|
const imageInfo = await readImage(absolutePath);
|
|
502886
503154
|
return JSON.stringify({
|
|
@@ -502899,7 +503167,7 @@ ${stderr}`);
|
|
|
502899
503167
|
}
|
|
502900
503168
|
}
|
|
502901
503169
|
async handleDescribeImage(imagePath, prompt) {
|
|
502902
|
-
const absolutePath =
|
|
503170
|
+
const absolutePath = path30.isAbsolute(imagePath) ? imagePath : path30.join(this.workingDirectory, imagePath);
|
|
502903
503171
|
try {
|
|
502904
503172
|
const description = await describeImage(absolutePath, prompt || "Describe this image in detail.", "llava");
|
|
502905
503173
|
return JSON.stringify({
|
|
@@ -502915,7 +503183,7 @@ ${stderr}`);
|
|
|
502915
503183
|
}
|
|
502916
503184
|
}
|
|
502917
503185
|
async handleReadPdf(pdfPath) {
|
|
502918
|
-
const absolutePath =
|
|
503186
|
+
const absolutePath = path30.isAbsolute(pdfPath) ? pdfPath : path30.join(this.workingDirectory, pdfPath);
|
|
502919
503187
|
try {
|
|
502920
503188
|
const pdfInfo = await readPdf(absolutePath);
|
|
502921
503189
|
const maxTextLength = 1e4;
|
|
@@ -502934,7 +503202,7 @@ ${stderr}`);
|
|
|
502934
503202
|
}
|
|
502935
503203
|
}
|
|
502936
503204
|
async handleReadPdfPage(pdfPath, pageNum) {
|
|
502937
|
-
const absolutePath =
|
|
503205
|
+
const absolutePath = path30.isAbsolute(pdfPath) ? pdfPath : path30.join(this.workingDirectory, pdfPath);
|
|
502938
503206
|
try {
|
|
502939
503207
|
const pageContent = await readPdfPage(absolutePath, pageNum);
|
|
502940
503208
|
return JSON.stringify({
|
|
@@ -502948,7 +503216,7 @@ ${stderr}`);
|
|
|
502948
503216
|
}
|
|
502949
503217
|
}
|
|
502950
503218
|
async handleSearchPdf(pdfPath, query, caseSensitive) {
|
|
502951
|
-
const absolutePath =
|
|
503219
|
+
const absolutePath = path30.isAbsolute(pdfPath) ? pdfPath : path30.join(this.workingDirectory, pdfPath);
|
|
502952
503220
|
try {
|
|
502953
503221
|
const results = await searchPdf(absolutePath, query, caseSensitive ?? false);
|
|
502954
503222
|
return JSON.stringify({
|
|
@@ -502962,7 +503230,7 @@ ${stderr}`);
|
|
|
502962
503230
|
}
|
|
502963
503231
|
}
|
|
502964
503232
|
async handleReadNotebook(notebookPath) {
|
|
502965
|
-
const absolutePath =
|
|
503233
|
+
const absolutePath = path30.isAbsolute(notebookPath) ? notebookPath : path30.join(this.workingDirectory, notebookPath);
|
|
502966
503234
|
try {
|
|
502967
503235
|
const notebook = await readNotebook(absolutePath);
|
|
502968
503236
|
const formattedCells = notebook.cells.map((cell) => ({
|
|
@@ -502989,7 +503257,7 @@ ${stderr}`);
|
|
|
502989
503257
|
}
|
|
502990
503258
|
}
|
|
502991
503259
|
async handleNotebookEditCell(notebookPath, cellIndex, newSource) {
|
|
502992
|
-
const absolutePath =
|
|
503260
|
+
const absolutePath = path30.isAbsolute(notebookPath) ? notebookPath : path30.join(this.workingDirectory, notebookPath);
|
|
502993
503261
|
try {
|
|
502994
503262
|
const result = await editCell(absolutePath, cellIndex, newSource);
|
|
502995
503263
|
return JSON.stringify(result, null, 2);
|
|
@@ -502998,7 +503266,7 @@ ${stderr}`);
|
|
|
502998
503266
|
}
|
|
502999
503267
|
}
|
|
503000
503268
|
async handleNotebookInsertCell(notebookPath, afterIndex, cellType, source) {
|
|
503001
|
-
const absolutePath =
|
|
503269
|
+
const absolutePath = path30.isAbsolute(notebookPath) ? notebookPath : path30.join(this.workingDirectory, notebookPath);
|
|
503002
503270
|
try {
|
|
503003
503271
|
const result = await insertCell(absolutePath, afterIndex, cellType, source);
|
|
503004
503272
|
return JSON.stringify(result, null, 2);
|
|
@@ -503007,7 +503275,7 @@ ${stderr}`);
|
|
|
503007
503275
|
}
|
|
503008
503276
|
}
|
|
503009
503277
|
async handleNotebookDeleteCell(notebookPath, cellIndex) {
|
|
503010
|
-
const absolutePath =
|
|
503278
|
+
const absolutePath = path30.isAbsolute(notebookPath) ? notebookPath : path30.join(this.workingDirectory, notebookPath);
|
|
503011
503279
|
try {
|
|
503012
503280
|
const result = await deleteCell(absolutePath, cellIndex);
|
|
503013
503281
|
return JSON.stringify(result, null, 2);
|
|
@@ -503688,24 +503956,24 @@ ${list.map((a5, i4) => `${i4 + 1}. ${a5}`).join(`
|
|
|
503688
503956
|
});
|
|
503689
503957
|
|
|
503690
503958
|
// packages/reporting/runlog.ts
|
|
503691
|
-
import * as
|
|
503692
|
-
import * as
|
|
503693
|
-
import * as
|
|
503694
|
-
function
|
|
503695
|
-
const dir =
|
|
503696
|
-
if (!
|
|
503697
|
-
|
|
503959
|
+
import * as fs30 from "fs";
|
|
503960
|
+
import * as os20 from "os";
|
|
503961
|
+
import * as path31 from "path";
|
|
503962
|
+
function ensureDir4() {
|
|
503963
|
+
const dir = path31.dirname(LOG_PATH);
|
|
503964
|
+
if (!fs30.existsSync(dir)) {
|
|
503965
|
+
fs30.mkdirSync(dir, { recursive: true });
|
|
503698
503966
|
}
|
|
503699
503967
|
}
|
|
503700
503968
|
function appendRun(entry) {
|
|
503701
|
-
|
|
503702
|
-
|
|
503969
|
+
ensureDir4();
|
|
503970
|
+
fs30.appendFileSync(LOG_PATH, `${JSON.stringify(entry)}
|
|
503703
503971
|
`);
|
|
503704
503972
|
}
|
|
503705
503973
|
function readRuns(limit = 20) {
|
|
503706
|
-
if (!
|
|
503974
|
+
if (!fs30.existsSync(LOG_PATH))
|
|
503707
503975
|
return [];
|
|
503708
|
-
const lines =
|
|
503976
|
+
const lines = fs30.readFileSync(LOG_PATH, "utf-8").trim().split(`
|
|
503709
503977
|
`).filter(Boolean);
|
|
503710
503978
|
const entries = [];
|
|
503711
503979
|
for (let i4 = lines.length - 1;i4 >= 0 && entries.length < limit; i4--) {
|
|
@@ -503717,15 +503985,15 @@ function readRuns(limit = 20) {
|
|
|
503717
503985
|
}
|
|
503718
503986
|
var LOG_PATH;
|
|
503719
503987
|
var init_runlog = __esm(() => {
|
|
503720
|
-
LOG_PATH =
|
|
503988
|
+
LOG_PATH = path31.join(os20.homedir(), ".8gent", "runs.jsonl");
|
|
503721
503989
|
});
|
|
503722
503990
|
// packages/secrets/index.ts
|
|
503723
503991
|
import * as crypto5 from "crypto";
|
|
503724
|
-
import * as
|
|
503725
|
-
import * as
|
|
503726
|
-
import * as
|
|
503992
|
+
import * as fs31 from "fs";
|
|
503993
|
+
import * as os21 from "os";
|
|
503994
|
+
import * as path32 from "path";
|
|
503727
503995
|
function deriveKey() {
|
|
503728
|
-
const fingerprint = `${
|
|
503996
|
+
const fingerprint = `${os21.hostname()}:${os21.userInfo().username}`;
|
|
503729
503997
|
const salt = "8gent-vault-v1";
|
|
503730
503998
|
return crypto5.pbkdf2Sync(fingerprint, salt, 1e5, 32, "sha256");
|
|
503731
503999
|
}
|
|
@@ -503735,7 +504003,7 @@ class SecretVault {
|
|
|
503735
504003
|
key;
|
|
503736
504004
|
data;
|
|
503737
504005
|
constructor(vaultPath) {
|
|
503738
|
-
this.vaultPath = vaultPath ??
|
|
504006
|
+
this.vaultPath = vaultPath ?? path32.join(os21.homedir(), ".8gent", "vault.enc");
|
|
503739
504007
|
this.key = deriveKey();
|
|
503740
504008
|
this.data = this.load();
|
|
503741
504009
|
}
|
|
@@ -503787,10 +504055,10 @@ class SecretVault {
|
|
|
503787
504055
|
return callback(value);
|
|
503788
504056
|
}
|
|
503789
504057
|
migrateFromEnv(envPath) {
|
|
503790
|
-
if (!
|
|
504058
|
+
if (!fs31.existsSync(envPath)) {
|
|
503791
504059
|
throw new Error(`File not found: ${envPath}`);
|
|
503792
504060
|
}
|
|
503793
|
-
const content =
|
|
504061
|
+
const content = fs31.readFileSync(envPath, "utf-8");
|
|
503794
504062
|
const imported = [];
|
|
503795
504063
|
const skipped = [];
|
|
503796
504064
|
for (const line of content.split(`
|
|
@@ -503818,11 +504086,11 @@ class SecretVault {
|
|
|
503818
504086
|
return { imported, skipped };
|
|
503819
504087
|
}
|
|
503820
504088
|
load() {
|
|
503821
|
-
if (!
|
|
504089
|
+
if (!fs31.existsSync(this.vaultPath)) {
|
|
503822
504090
|
return { version: 1, entries: {} };
|
|
503823
504091
|
}
|
|
503824
504092
|
try {
|
|
503825
|
-
const raw =
|
|
504093
|
+
const raw = fs31.readFileSync(this.vaultPath, "utf-8");
|
|
503826
504094
|
const parsed = JSON.parse(raw);
|
|
503827
504095
|
if (parsed.version !== 1) {
|
|
503828
504096
|
throw new Error(`Unsupported vault version: ${parsed.version}`);
|
|
@@ -503833,11 +504101,11 @@ class SecretVault {
|
|
|
503833
504101
|
}
|
|
503834
504102
|
}
|
|
503835
504103
|
save() {
|
|
503836
|
-
const dir =
|
|
503837
|
-
if (!
|
|
503838
|
-
|
|
504104
|
+
const dir = path32.dirname(this.vaultPath);
|
|
504105
|
+
if (!fs31.existsSync(dir)) {
|
|
504106
|
+
fs31.mkdirSync(dir, { recursive: true });
|
|
503839
504107
|
}
|
|
503840
|
-
|
|
504108
|
+
fs31.writeFileSync(this.vaultPath, JSON.stringify(this.data, null, 2), { mode: 384 });
|
|
503841
504109
|
}
|
|
503842
504110
|
}
|
|
503843
504111
|
function getVault() {
|
|
@@ -503858,20 +504126,20 @@ __export(exports_telegram, {
|
|
|
503858
504126
|
getActiveTelegramBot: () => getActiveTelegramBot,
|
|
503859
504127
|
TelegramBot: () => TelegramBot
|
|
503860
504128
|
});
|
|
503861
|
-
import * as
|
|
503862
|
-
import * as
|
|
503863
|
-
import * as
|
|
504129
|
+
import * as fs32 from "fs";
|
|
504130
|
+
import * as os22 from "os";
|
|
504131
|
+
import * as path33 from "path";
|
|
503864
504132
|
function loadConfig2() {
|
|
503865
504133
|
try {
|
|
503866
|
-
if (
|
|
503867
|
-
return JSON.parse(
|
|
504134
|
+
if (fs32.existsSync(CONFIG_FILE)) {
|
|
504135
|
+
return JSON.parse(fs32.readFileSync(CONFIG_FILE, "utf-8"));
|
|
503868
504136
|
}
|
|
503869
504137
|
} catch {}
|
|
503870
504138
|
return null;
|
|
503871
504139
|
}
|
|
503872
504140
|
function saveConfig(config2) {
|
|
503873
|
-
|
|
503874
|
-
|
|
504141
|
+
fs32.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
504142
|
+
fs32.writeFileSync(CONFIG_FILE, JSON.stringify(config2, null, 2));
|
|
503875
504143
|
}
|
|
503876
504144
|
async function api3(token, method, body) {
|
|
503877
504145
|
const url2 = `${API_BASE}${token}/${method}`;
|
|
@@ -504081,9 +504349,9 @@ ${taskLines}`;
|
|
|
504081
504349
|
function buildSkillsMenu(agent) {
|
|
504082
504350
|
let skillLines = "No skills loaded.";
|
|
504083
504351
|
try {
|
|
504084
|
-
const indexPath =
|
|
504085
|
-
if (
|
|
504086
|
-
const index2 = JSON.parse(
|
|
504352
|
+
const indexPath = path33.join(os22.homedir(), ".8gent", "skills", ".index.json");
|
|
504353
|
+
if (fs32.existsSync(indexPath)) {
|
|
504354
|
+
const index2 = JSON.parse(fs32.readFileSync(indexPath, "utf-8"));
|
|
504087
504355
|
const cats = Object.entries(index2.categories || {}).sort((a5, b2) => b2[1] - a5[1]).map(([cat, count]) => ` ${cat}: ${count}`).join(`
|
|
504088
504356
|
`);
|
|
504089
504357
|
skillLines = `*${index2.skillCount}* skills loaded (${Math.round(index2.totalTokens / 1000)}k tokens)
|
|
@@ -504218,9 +504486,9 @@ class TelegramBot {
|
|
|
504218
504486
|
|
|
504219
504487
|
No benchmark data found.`;
|
|
504220
504488
|
try {
|
|
504221
|
-
const statePath =
|
|
504222
|
-
if (
|
|
504223
|
-
const state = JSON.parse(
|
|
504489
|
+
const statePath = path33.join(os22.homedir(), "iris-observatory", "benchmarks", "autoresearch", "loop-state.json");
|
|
504490
|
+
if (fs32.existsSync(statePath)) {
|
|
504491
|
+
const state = JSON.parse(fs32.readFileSync(statePath, "utf-8"));
|
|
504224
504492
|
const lastHistory = state.history?.[state.history.length - 1];
|
|
504225
504493
|
if (lastHistory) {
|
|
504226
504494
|
const scores = Object.entries(lastHistory.scores || {}).map(([id2, score]) => {
|
|
@@ -504492,8 +504760,8 @@ async function validateToken(token) {
|
|
|
504492
504760
|
}
|
|
504493
504761
|
var CONFIG_DIR, CONFIG_FILE, API_BASE = "https://api.telegram.org/bot", activeBotInstance = null;
|
|
504494
504762
|
var init_telegram = __esm(() => {
|
|
504495
|
-
CONFIG_DIR =
|
|
504496
|
-
CONFIG_FILE =
|
|
504763
|
+
CONFIG_DIR = path33.join(os22.homedir(), ".8gent");
|
|
504764
|
+
CONFIG_FILE = path33.join(CONFIG_DIR, "telegram.json");
|
|
504497
504765
|
});
|
|
504498
504766
|
|
|
504499
504767
|
// packages/self-autonomy/onboarding.ts
|
|
@@ -504501,19 +504769,39 @@ var exports_onboarding = {};
|
|
|
504501
504769
|
__export(exports_onboarding, {
|
|
504502
504770
|
runTelegramSetup: () => runTelegramSetup,
|
|
504503
504771
|
default: () => onboarding_default,
|
|
504772
|
+
PROVIDER_INSTALL_HINTS: () => PROVIDER_INSTALL_HINTS,
|
|
504504
504773
|
OnboardingManager: () => OnboardingManager
|
|
504505
504774
|
});
|
|
504506
504775
|
import { exec as exec3 } from "child_process";
|
|
504507
|
-
import * as
|
|
504508
|
-
import * as
|
|
504509
|
-
import * as
|
|
504776
|
+
import * as fs33 from "fs";
|
|
504777
|
+
import * as os23 from "os";
|
|
504778
|
+
import * as path34 from "path";
|
|
504510
504779
|
import { promisify as promisify2 } from "util";
|
|
504780
|
+
function persistAgentName(roleKey, name21) {
|
|
504781
|
+
const trimmed = (name21 ?? "").trim();
|
|
504782
|
+
if (!trimmed)
|
|
504783
|
+
return;
|
|
504784
|
+
try {
|
|
504785
|
+
const current = loadSettings();
|
|
504786
|
+
const next2 = {
|
|
504787
|
+
...current,
|
|
504788
|
+
agents: {
|
|
504789
|
+
...current.agents,
|
|
504790
|
+
names: {
|
|
504791
|
+
...current.agents.names,
|
|
504792
|
+
[roleKey]: trimmed
|
|
504793
|
+
}
|
|
504794
|
+
}
|
|
504795
|
+
};
|
|
504796
|
+
saveSettings(next2);
|
|
504797
|
+
} catch {}
|
|
504798
|
+
}
|
|
504511
504799
|
|
|
504512
504800
|
class OnboardingManager {
|
|
504513
504801
|
userConfigPath;
|
|
504514
504802
|
user;
|
|
504515
504803
|
constructor(workingDirectory = process.cwd()) {
|
|
504516
|
-
this.userConfigPath =
|
|
504804
|
+
this.userConfigPath = path34.join(process.env.HOME || os23.homedir(), ".8gent", "user.json");
|
|
504517
504805
|
this.user = this.loadUserConfig();
|
|
504518
504806
|
}
|
|
504519
504807
|
static async autoDetect() {
|
|
@@ -504580,19 +504868,19 @@ class OnboardingManager {
|
|
|
504580
504868
|
}
|
|
504581
504869
|
loadUserConfig() {
|
|
504582
504870
|
try {
|
|
504583
|
-
if (
|
|
504584
|
-
const content =
|
|
504871
|
+
if (fs33.existsSync(this.userConfigPath)) {
|
|
504872
|
+
const content = fs33.readFileSync(this.userConfigPath, "utf-8");
|
|
504585
504873
|
return JSON.parse(content);
|
|
504586
504874
|
}
|
|
504587
504875
|
} catch {}
|
|
504588
504876
|
return getDefaultUserConfig();
|
|
504589
504877
|
}
|
|
504590
504878
|
saveUserConfig() {
|
|
504591
|
-
const dir =
|
|
504592
|
-
if (!
|
|
504593
|
-
|
|
504879
|
+
const dir = path34.dirname(this.userConfigPath);
|
|
504880
|
+
if (!fs33.existsSync(dir)) {
|
|
504881
|
+
fs33.mkdirSync(dir, { recursive: true });
|
|
504594
504882
|
}
|
|
504595
|
-
|
|
504883
|
+
fs33.writeFileSync(this.userConfigPath, JSON.stringify(this.user, null, 2));
|
|
504596
504884
|
}
|
|
504597
504885
|
needsOnboarding() {
|
|
504598
504886
|
return !this.user.onboardingComplete;
|
|
@@ -504610,6 +504898,9 @@ class OnboardingManager {
|
|
|
504610
504898
|
}
|
|
504611
504899
|
return false;
|
|
504612
504900
|
}
|
|
504901
|
+
getTotalSteps() {
|
|
504902
|
+
return ONBOARDING_QUESTIONS.length;
|
|
504903
|
+
}
|
|
504613
504904
|
getNextQuestion() {
|
|
504614
504905
|
if (this.user.onboardingComplete) {
|
|
504615
504906
|
return null;
|
|
@@ -504777,6 +505068,17 @@ class OnboardingManager {
|
|
|
504777
505068
|
text4 = text4.replace("{detected_provider}", this.user.preferences.model.provider || "not detected");
|
|
504778
505069
|
text4 = text4.replace("{detected_models}", this.user.integrations.ollama.models.slice(0, 3).join(", ") || "none found");
|
|
504779
505070
|
text4 = text4.replace("{agent_name}", this.user.preferences.voice?.agentName || "Eight");
|
|
505071
|
+
try {
|
|
505072
|
+
const s3 = loadSettings();
|
|
505073
|
+
const names = s3?.agents?.names ?? DEFAULT_SETTINGS.agents.names;
|
|
505074
|
+
text4 = text4.replace("{agent_orchestrator}", names.orchestrator);
|
|
505075
|
+
text4 = text4.replace("{agent_engineer}", names.engineer);
|
|
505076
|
+
text4 = text4.replace("{agent_qa}", names.qa);
|
|
505077
|
+
} catch {
|
|
505078
|
+
text4 = text4.replace("{agent_orchestrator}", DEFAULT_SETTINGS.agents.names.orchestrator);
|
|
505079
|
+
text4 = text4.replace("{agent_engineer}", DEFAULT_SETTINGS.agents.names.engineer);
|
|
505080
|
+
text4 = text4.replace("{agent_qa}", DEFAULT_SETTINGS.agents.names.qa);
|
|
505081
|
+
}
|
|
504780
505082
|
return { ...question, question: text4 };
|
|
504781
505083
|
}
|
|
504782
505084
|
}
|
|
@@ -504920,63 +505222,123 @@ Use \x1B[36m/telegram start\x1B[0m to launch the bot, or it will auto-start next
|
|
|
504920
505222
|
`);
|
|
504921
505223
|
return true;
|
|
504922
505224
|
}
|
|
504923
|
-
var execAsync2, ONBOARDING_QUESTIONS, onboarding_default;
|
|
505225
|
+
var execAsync2, PROVIDER_INSTALL_HINTS, ONBOARDING_QUESTIONS, onboarding_default;
|
|
504924
505226
|
var init_onboarding = __esm(() => {
|
|
504925
505227
|
init_secrets();
|
|
505228
|
+
init_settings();
|
|
504926
505229
|
execAsync2 = promisify2(exec3);
|
|
505230
|
+
PROVIDER_INSTALL_HINTS = {
|
|
505231
|
+
ollama: "Install: https://ollama.ai (or `brew install ollama && ollama serve`). Then `ollama pull qwen3.6:27b`.",
|
|
505232
|
+
lmstudio: "Install: https://lmstudio.ai. Open it, load `google/gemma-4-26b-a4b`, click Start Server (port 1234).",
|
|
505233
|
+
apfel: "Install: `brew install arthur-ficial/tap/apfel`. Run: `apfel --serve --port 11500`."
|
|
505234
|
+
};
|
|
504927
505235
|
ONBOARDING_QUESTIONS = [
|
|
504928
505236
|
{
|
|
504929
|
-
step: "
|
|
505237
|
+
step: "language",
|
|
504930
505238
|
question: `Good day. I'm 8gent, The Infinite Gentleman.
|
|
504931
505239
|
|
|
504932
|
-
` + `Here's what I detected:
|
|
505240
|
+
` + `Here's what I detected from your environment:
|
|
504933
505241
|
` + ` Name: {detected_name}
|
|
504934
505242
|
` + ` Email: {detected_email}
|
|
504935
505243
|
` + ` GitHub: {detected_github}
|
|
504936
505244
|
` + ` Provider: {detected_provider}
|
|
504937
505245
|
` + ` Models: {detected_models}
|
|
504938
505246
|
|
|
504939
|
-
` + "
|
|
505247
|
+
` + "I'll walk you through a short setup so I can serve you properly.",
|
|
505248
|
+
kind: "select",
|
|
505249
|
+
choices: [{ label: "Press Enter to begin", value: "ok" }],
|
|
505250
|
+
options: ["ok", "yes", "y"],
|
|
505251
|
+
processor: (_answer, user) => ({
|
|
505252
|
+
...user,
|
|
505253
|
+
completedSteps: [...user.completedSteps, "language"]
|
|
505254
|
+
})
|
|
505255
|
+
},
|
|
505256
|
+
{
|
|
505257
|
+
step: "identity",
|
|
505258
|
+
question: "What should I call you? (default: {detected_name})",
|
|
504940
505259
|
processor: (answer, user) => {
|
|
504941
505260
|
const name21 = answer.trim() || user.identity.name;
|
|
504942
505261
|
return {
|
|
504943
505262
|
...user,
|
|
504944
505263
|
identity: { ...user.identity, name: name21 || user.identity.name },
|
|
504945
|
-
completedSteps: [
|
|
504946
|
-
|
|
504947
|
-
|
|
504948
|
-
|
|
504949
|
-
|
|
504950
|
-
|
|
504951
|
-
|
|
504952
|
-
|
|
504953
|
-
|
|
504954
|
-
|
|
504955
|
-
|
|
505264
|
+
completedSteps: [...user.completedSteps, "identity"]
|
|
505265
|
+
};
|
|
505266
|
+
}
|
|
505267
|
+
},
|
|
505268
|
+
{
|
|
505269
|
+
step: "role",
|
|
505270
|
+
question: "What best describes you?",
|
|
505271
|
+
kind: "select",
|
|
505272
|
+
choices: [
|
|
505273
|
+
{ label: "Engineer", value: "engineer", description: "Builder of software" },
|
|
505274
|
+
{ label: "Designer", value: "designer", description: "Crafter of interfaces" },
|
|
505275
|
+
{ label: "Founder", value: "founder", description: "Wearer of many hats" },
|
|
505276
|
+
{ label: "Hobbyist", value: "hobbyist", description: "Tinkerer, learner" },
|
|
505277
|
+
{ label: "Other", value: "other", description: "Something else entirely" }
|
|
505278
|
+
],
|
|
505279
|
+
options: ["engineer", "designer", "founder", "hobbyist", "other"],
|
|
505280
|
+
processor: (answer, user) => {
|
|
505281
|
+
const role = answer.trim().toLowerCase() || "engineer";
|
|
505282
|
+
return {
|
|
505283
|
+
...user,
|
|
505284
|
+
identity: { ...user.identity, role },
|
|
505285
|
+
completedSteps: [...user.completedSteps, "role"]
|
|
505286
|
+
};
|
|
505287
|
+
}
|
|
505288
|
+
},
|
|
505289
|
+
{
|
|
505290
|
+
step: "projects",
|
|
505291
|
+
question: "What are you working on? (one short line, optional - press Enter to skip)",
|
|
505292
|
+
processor: (answer, user) => {
|
|
505293
|
+
const desc = answer.trim();
|
|
505294
|
+
if (!desc) {
|
|
505295
|
+
return {
|
|
505296
|
+
...user,
|
|
505297
|
+
completedSteps: [...user.completedSteps, "projects"]
|
|
505298
|
+
};
|
|
505299
|
+
}
|
|
505300
|
+
return {
|
|
505301
|
+
...user,
|
|
505302
|
+
projects: {
|
|
505303
|
+
...user.projects,
|
|
505304
|
+
primary: desc,
|
|
505305
|
+
all: user.projects.all.includes(desc) ? user.projects.all : [...user.projects.all, desc],
|
|
505306
|
+
descriptions: { ...user.projects.descriptions, [desc]: desc }
|
|
505307
|
+
},
|
|
505308
|
+
completedSteps: [...user.completedSteps, "projects"]
|
|
504956
505309
|
};
|
|
504957
505310
|
}
|
|
504958
505311
|
},
|
|
504959
505312
|
{
|
|
504960
505313
|
step: "communication",
|
|
504961
|
-
question:
|
|
504962
|
-
|
|
504963
|
-
|
|
504964
|
-
|
|
504965
|
-
|
|
504966
|
-
|
|
504967
|
-
|
|
505314
|
+
question: "How should I communicate with you?",
|
|
505315
|
+
kind: "select",
|
|
505316
|
+
choices: [
|
|
505317
|
+
{
|
|
505318
|
+
label: "Dry-witted, sarcastic, seriously motivational",
|
|
505319
|
+
value: "1",
|
|
505320
|
+
description: "Roast me into greatness"
|
|
505321
|
+
},
|
|
505322
|
+
{ label: "Concise & direct", value: "2", description: "Just the facts" },
|
|
505323
|
+
{ label: "Detailed & explanatory", value: "3", description: "Teach me as we go" },
|
|
505324
|
+
{ label: "Casual & friendly", value: "4", description: "We're collaborators" },
|
|
505325
|
+
{ label: "Formal & precise", value: "5", description: "Professional tone" }
|
|
505326
|
+
],
|
|
505327
|
+
options: ["1", "2", "3", "4", "5", "sarcastic", "concise", "detailed", "casual", "formal"],
|
|
504968
505328
|
processor: (answer, user) => {
|
|
504969
505329
|
const styleMap = {
|
|
504970
|
-
"1": "
|
|
504971
|
-
"2": "
|
|
504972
|
-
"3": "
|
|
504973
|
-
"4": "
|
|
505330
|
+
"1": "sarcastic",
|
|
505331
|
+
"2": "concise",
|
|
505332
|
+
"3": "detailed",
|
|
505333
|
+
"4": "casual",
|
|
505334
|
+
"5": "formal",
|
|
505335
|
+
sarcastic: "sarcastic",
|
|
504974
505336
|
concise: "concise",
|
|
504975
505337
|
detailed: "detailed",
|
|
504976
505338
|
casual: "casual",
|
|
504977
505339
|
formal: "formal"
|
|
504978
505340
|
};
|
|
504979
|
-
const style = styleMap[answer.toLowerCase()] || "
|
|
505341
|
+
const style = styleMap[answer.toLowerCase()] || "sarcastic";
|
|
504980
505342
|
return {
|
|
504981
505343
|
...user,
|
|
504982
505344
|
identity: { ...user.identity, communicationStyle: style },
|
|
@@ -504984,6 +505346,110 @@ var init_onboarding = __esm(() => {
|
|
|
504984
505346
|
};
|
|
504985
505347
|
}
|
|
504986
505348
|
},
|
|
505349
|
+
{
|
|
505350
|
+
step: "provider-check-ollama",
|
|
505351
|
+
question: "Provider check: Ollama (local LLM runtime)",
|
|
505352
|
+
kind: "providerCheck",
|
|
505353
|
+
provider: "ollama",
|
|
505354
|
+
installHint: PROVIDER_INSTALL_HINTS.ollama,
|
|
505355
|
+
processor: (answer, user) => {
|
|
505356
|
+
const live = answer === "live";
|
|
505357
|
+
return {
|
|
505358
|
+
...user,
|
|
505359
|
+
integrations: {
|
|
505360
|
+
...user.integrations,
|
|
505361
|
+
ollama: {
|
|
505362
|
+
...user.integrations.ollama,
|
|
505363
|
+
available: live || user.integrations.ollama.available
|
|
505364
|
+
}
|
|
505365
|
+
},
|
|
505366
|
+
completedSteps: [...user.completedSteps, "provider-check-ollama"]
|
|
505367
|
+
};
|
|
505368
|
+
}
|
|
505369
|
+
},
|
|
505370
|
+
{
|
|
505371
|
+
step: "provider-check-lmstudio",
|
|
505372
|
+
question: "Provider check: LM Studio (local LLM runtime)",
|
|
505373
|
+
kind: "providerCheck",
|
|
505374
|
+
provider: "lmstudio",
|
|
505375
|
+
installHint: PROVIDER_INSTALL_HINTS.lmstudio,
|
|
505376
|
+
processor: (answer, user) => {
|
|
505377
|
+
const live = answer === "live";
|
|
505378
|
+
return {
|
|
505379
|
+
...user,
|
|
505380
|
+
integrations: {
|
|
505381
|
+
...user.integrations,
|
|
505382
|
+
lmstudio: {
|
|
505383
|
+
...user.integrations.lmstudio,
|
|
505384
|
+
available: live || user.integrations.lmstudio.available
|
|
505385
|
+
}
|
|
505386
|
+
},
|
|
505387
|
+
completedSteps: [...user.completedSteps, "provider-check-lmstudio"]
|
|
505388
|
+
};
|
|
505389
|
+
}
|
|
505390
|
+
},
|
|
505391
|
+
{
|
|
505392
|
+
step: "provider-check-apfel",
|
|
505393
|
+
question: "Provider check: apfel (Apple Foundation Model)",
|
|
505394
|
+
kind: "providerCheck",
|
|
505395
|
+
provider: "apfel",
|
|
505396
|
+
installHint: PROVIDER_INSTALL_HINTS.apfel,
|
|
505397
|
+
processor: (_answer, user) => ({
|
|
505398
|
+
...user,
|
|
505399
|
+
completedSteps: [...user.completedSteps, "provider-check-apfel"]
|
|
505400
|
+
})
|
|
505401
|
+
},
|
|
505402
|
+
{
|
|
505403
|
+
step: "agent-name-orchestrator",
|
|
505404
|
+
question: `Name your Orchestrator agent. (default: Orchestrator)
|
|
505405
|
+
|
|
505406
|
+
` + "Press Enter to keep, or type a custom name (e.g. Architect, Plato):",
|
|
505407
|
+
kind: "agentName",
|
|
505408
|
+
roleKey: "orchestrator",
|
|
505409
|
+
default: "Orchestrator",
|
|
505410
|
+
processor: (answer, user) => {
|
|
505411
|
+
const chosen = answer.trim() || DEFAULT_SETTINGS.agents.names.orchestrator;
|
|
505412
|
+
persistAgentName("orchestrator", chosen);
|
|
505413
|
+
return {
|
|
505414
|
+
...user,
|
|
505415
|
+
completedSteps: [...user.completedSteps, "agent-name-orchestrator"]
|
|
505416
|
+
};
|
|
505417
|
+
}
|
|
505418
|
+
},
|
|
505419
|
+
{
|
|
505420
|
+
step: "agent-name-engineer",
|
|
505421
|
+
question: `Name your Engineer agent. (default: Engineer)
|
|
505422
|
+
|
|
505423
|
+
` + "Press Enter to keep, or type a custom name (e.g. Coder, Hephaestus):",
|
|
505424
|
+
kind: "agentName",
|
|
505425
|
+
roleKey: "engineer",
|
|
505426
|
+
default: "Engineer",
|
|
505427
|
+
processor: (answer, user) => {
|
|
505428
|
+
const chosen = answer.trim() || DEFAULT_SETTINGS.agents.names.engineer;
|
|
505429
|
+
persistAgentName("engineer", chosen);
|
|
505430
|
+
return {
|
|
505431
|
+
...user,
|
|
505432
|
+
completedSteps: [...user.completedSteps, "agent-name-engineer"]
|
|
505433
|
+
};
|
|
505434
|
+
}
|
|
505435
|
+
},
|
|
505436
|
+
{
|
|
505437
|
+
step: "agent-name-qa",
|
|
505438
|
+
question: `Name your QA agent. (default: QA)
|
|
505439
|
+
|
|
505440
|
+
` + "Press Enter to keep, or type a custom name (e.g. Reviewer, Cassandra):",
|
|
505441
|
+
kind: "agentName",
|
|
505442
|
+
roleKey: "qa",
|
|
505443
|
+
default: "QA",
|
|
505444
|
+
processor: (answer, user) => {
|
|
505445
|
+
const chosen = answer.trim() || DEFAULT_SETTINGS.agents.names.qa;
|
|
505446
|
+
persistAgentName("qa", chosen);
|
|
505447
|
+
return {
|
|
505448
|
+
...user,
|
|
505449
|
+
completedSteps: [...user.completedSteps, "agent-name-qa"]
|
|
505450
|
+
};
|
|
505451
|
+
}
|
|
505452
|
+
},
|
|
504987
505453
|
{
|
|
504988
505454
|
step: "voice",
|
|
504989
505455
|
question: `What should your 8gent be called? (default: Eight)
|
|
@@ -505012,12 +505478,20 @@ var init_onboarding = __esm(() => {
|
|
|
505012
505478
|
|
|
505013
505479
|
` + `This downloads KittenTTS - a free, local neural text-to-speech engine.
|
|
505014
505480
|
` + `No API keys needed. Runs entirely on your machine.
|
|
505015
|
-
` +
|
|
505016
|
-
|
|
505017
|
-
|
|
505018
|
-
|
|
505019
|
-
|
|
505020
|
-
|
|
505481
|
+
` + "Download size: ~200MB (model + dependencies)",
|
|
505482
|
+
kind: "select",
|
|
505483
|
+
choices: [
|
|
505484
|
+
{
|
|
505485
|
+
label: "Yes, install AI voices",
|
|
505486
|
+
value: "1",
|
|
505487
|
+
description: "Recommended. Free local neural TTS via KittenTTS."
|
|
505488
|
+
},
|
|
505489
|
+
{
|
|
505490
|
+
label: "No, use system voices only",
|
|
505491
|
+
value: "2",
|
|
505492
|
+
description: "Skip the download. Use macOS built-in voices."
|
|
505493
|
+
}
|
|
505494
|
+
],
|
|
505021
505495
|
options: ["1", "2", "yes", "no", "y", "n"],
|
|
505022
505496
|
processor: (answer, user) => {
|
|
505023
505497
|
const wantsAI = ["1", "yes", "y"].includes(answer.toLowerCase());
|
|
@@ -505052,26 +505526,23 @@ var init_onboarding = __esm(() => {
|
|
|
505052
505526
|
},
|
|
505053
505527
|
{
|
|
505054
505528
|
step: "voice-picker",
|
|
505055
|
-
question:
|
|
505056
|
-
|
|
505057
|
-
|
|
505058
|
-
|
|
505059
|
-
|
|
505060
|
-
|
|
505061
|
-
|
|
505062
|
-
|
|
505063
|
-
|
|
505064
|
-
|
|
505065
|
-
|
|
505066
|
-
|
|
505067
|
-
|
|
505068
|
-
|
|
505069
|
-
|
|
505070
|
-
|
|
505071
|
-
|
|
505072
|
-
` + ` 13. Rishi (Indian)
|
|
505073
|
-
|
|
505074
|
-
` + "Choose 1-13 (default: 1 - Bruno):",
|
|
505529
|
+
question: "Pick a voice for your agent.",
|
|
505530
|
+
kind: "select",
|
|
505531
|
+
choices: [
|
|
505532
|
+
{ label: "Bruno", value: "1", description: "AI - male, warm & authoritative (recommended)" },
|
|
505533
|
+
{ label: "Bella", value: "2", description: "AI - female, warm & clear" },
|
|
505534
|
+
{ label: "Jasper", value: "3", description: "AI - male, crisp & technical" },
|
|
505535
|
+
{ label: "Luna", value: "4", description: "AI - female, soft & creative" },
|
|
505536
|
+
{ label: "Rosie", value: "5", description: "AI - female, bright & energetic" },
|
|
505537
|
+
{ label: "Hugo", value: "6", description: "AI - male, neutral & steady" },
|
|
505538
|
+
{ label: "Kiki", value: "7", description: "AI - female, light & friendly" },
|
|
505539
|
+
{ label: "Leo", value: "8", description: "AI - male, rich & expressive" },
|
|
505540
|
+
{ label: "Moira", value: "9", description: "System - Irish (macOS)" },
|
|
505541
|
+
{ label: "Daniel", value: "10", description: "System - British (macOS)" },
|
|
505542
|
+
{ label: "Samantha", value: "11", description: "System - American (macOS)" },
|
|
505543
|
+
{ label: "Karen", value: "12", description: "System - Australian (macOS)" },
|
|
505544
|
+
{ label: "Rishi", value: "13", description: "System - Indian (macOS)" }
|
|
505545
|
+
],
|
|
505075
505546
|
options: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13"],
|
|
505076
505547
|
processor: (answer, user) => {
|
|
505077
505548
|
const kittenVoices = {
|
|
@@ -505115,13 +505586,22 @@ var init_onboarding = __esm(() => {
|
|
|
505115
505586
|
question: `Excellent. All set:
|
|
505116
505587
|
|
|
505117
505588
|
` + `- Name: {name}
|
|
505589
|
+
` + `- Role: {role}
|
|
505590
|
+
` + `- Project: {project}
|
|
505118
505591
|
` + `- Style: {style}
|
|
505119
505592
|
` + `- Provider: {provider}
|
|
505120
|
-
` + `-
|
|
505593
|
+
` + `- 8gent: {agent_name}
|
|
505121
505594
|
` + `- Voice: {voice}
|
|
505595
|
+
` + `- Orchestrator: {agent_orchestrator}
|
|
505596
|
+
` + `- Engineer: {agent_engineer}
|
|
505597
|
+
` + `- QA: {agent_qa}
|
|
505122
505598
|
|
|
505123
|
-
` +
|
|
505124
|
-
|
|
505599
|
+
` + "Ready to begin?",
|
|
505600
|
+
kind: "select",
|
|
505601
|
+
choices: [
|
|
505602
|
+
{ label: "Yes, let's go", value: "yes" },
|
|
505603
|
+
{ label: "No, restart later", value: "no" }
|
|
505604
|
+
],
|
|
505125
505605
|
options: ["yes", "no", "y", "n"],
|
|
505126
505606
|
processor: (answer, user) => {
|
|
505127
505607
|
return {
|
|
@@ -505146,11 +505626,11 @@ var init_onboarding = __esm(() => {
|
|
|
505146
505626
|
});
|
|
505147
505627
|
|
|
505148
505628
|
// packages/skills/compound.ts
|
|
505149
|
-
import { homedir as
|
|
505150
|
-
import { join as
|
|
505629
|
+
import { homedir as homedir24 } from "os";
|
|
505630
|
+
import { join as join43 } from "path";
|
|
505151
505631
|
var LEARNED_SKILLS_DIR;
|
|
505152
505632
|
var init_compound = __esm(() => {
|
|
505153
|
-
LEARNED_SKILLS_DIR =
|
|
505633
|
+
LEARNED_SKILLS_DIR = join43(homedir24(), ".8gent", "learned-skills");
|
|
505154
505634
|
});
|
|
505155
505635
|
|
|
505156
505636
|
// packages/skills/matcher.ts
|
|
@@ -505159,11 +505639,11 @@ var init_matcher = __esm(() => {
|
|
|
505159
505639
|
});
|
|
505160
505640
|
|
|
505161
505641
|
// packages/skills/experiment.ts
|
|
505162
|
-
import { join as
|
|
505642
|
+
import { join as join44 } from "path";
|
|
505163
505643
|
var EXPERIMENTS_DIR;
|
|
505164
505644
|
var init_experiment = __esm(() => {
|
|
505165
505645
|
init_compound();
|
|
505166
|
-
EXPERIMENTS_DIR =
|
|
505646
|
+
EXPERIMENTS_DIR = join44(LEARNED_SKILLS_DIR, ".experiments");
|
|
505167
505647
|
});
|
|
505168
505648
|
|
|
505169
505649
|
// packages/skills/creator.ts
|
|
@@ -505217,9 +505697,9 @@ var init_creator = __esm(() => {
|
|
|
505217
505697
|
});
|
|
505218
505698
|
|
|
505219
505699
|
// packages/skills/index.ts
|
|
505220
|
-
import * as
|
|
505221
|
-
import * as
|
|
505222
|
-
import * as
|
|
505700
|
+
import * as fs34 from "fs";
|
|
505701
|
+
import * as os24 from "os";
|
|
505702
|
+
import * as path35 from "path";
|
|
505223
505703
|
import { fileURLToPath } from "url";
|
|
505224
505704
|
function parseFrontmatter(content) {
|
|
505225
505705
|
const frontmatterRegex = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/;
|
|
@@ -505260,21 +505740,21 @@ function parseFrontmatter(content) {
|
|
|
505260
505740
|
};
|
|
505261
505741
|
}
|
|
505262
505742
|
function collectNestedSkillMdPaths(skillsRoot) {
|
|
505263
|
-
if (!
|
|
505743
|
+
if (!fs34.existsSync(skillsRoot))
|
|
505264
505744
|
return [];
|
|
505265
505745
|
const out = [];
|
|
505266
|
-
for (const name21 of
|
|
505267
|
-
const skillMd =
|
|
505268
|
-
if (
|
|
505746
|
+
for (const name21 of fs34.readdirSync(skillsRoot)) {
|
|
505747
|
+
const skillMd = path35.join(skillsRoot, name21, "SKILL.md");
|
|
505748
|
+
if (fs34.existsSync(skillMd)) {
|
|
505269
505749
|
out.push(skillMd);
|
|
505270
505750
|
}
|
|
505271
505751
|
}
|
|
505272
505752
|
return out;
|
|
505273
505753
|
}
|
|
505274
505754
|
function discoverBundledSkillMdFiles() {
|
|
505275
|
-
const entryDir =
|
|
505755
|
+
const entryDir = path35.dirname(fileURLToPath(import.meta.url));
|
|
505276
505756
|
const nested = [...collectNestedSkillMdPaths(entryDir)];
|
|
505277
|
-
nested.push(...collectNestedSkillMdPaths(
|
|
505757
|
+
nested.push(...collectNestedSkillMdPaths(path35.join(entryDir, "skills")));
|
|
505278
505758
|
return nested;
|
|
505279
505759
|
}
|
|
505280
505760
|
|
|
@@ -505284,31 +505764,31 @@ class SkillManager {
|
|
|
505284
505764
|
skillsDirectory;
|
|
505285
505765
|
invocations = new Map;
|
|
505286
505766
|
constructor(skillsDirectory) {
|
|
505287
|
-
this.skillsDirectory = skillsDirectory ||
|
|
505767
|
+
this.skillsDirectory = skillsDirectory || path35.join(os24.homedir(), ".8gent", "skills");
|
|
505288
505768
|
}
|
|
505289
505769
|
async loadSkills() {
|
|
505290
505770
|
this.skills.clear();
|
|
505291
505771
|
this.aliasToCanonical.clear();
|
|
505292
|
-
if (!
|
|
505293
|
-
|
|
505772
|
+
if (!fs34.existsSync(this.skillsDirectory)) {
|
|
505773
|
+
fs34.mkdirSync(this.skillsDirectory, { recursive: true });
|
|
505294
505774
|
this.createExampleSkill();
|
|
505295
505775
|
}
|
|
505296
|
-
const files =
|
|
505776
|
+
const files = fs34.readdirSync(this.skillsDirectory);
|
|
505297
505777
|
const skillFiles = files.filter((f3) => f3.endsWith(".md"));
|
|
505298
505778
|
for (const file2 of skillFiles) {
|
|
505299
|
-
this.tryIngestSkillFile(
|
|
505779
|
+
this.tryIngestSkillFile(path35.join(this.skillsDirectory, file2), false);
|
|
505300
505780
|
}
|
|
505301
|
-
const claudeSkillsRoot =
|
|
505781
|
+
const claudeSkillsRoot = path35.join(process.cwd(), ".claude", "skills");
|
|
505302
505782
|
for (const filePath of collectNestedSkillMdPaths(claudeSkillsRoot)) {
|
|
505303
505783
|
this.tryIngestSkillFile(filePath, true);
|
|
505304
505784
|
}
|
|
505305
505785
|
for (const filePath of discoverBundledSkillMdFiles()) {
|
|
505306
505786
|
this.tryIngestSkillFile(filePath, true);
|
|
505307
505787
|
}
|
|
505308
|
-
if (
|
|
505309
|
-
const learnedFiles =
|
|
505788
|
+
if (fs34.existsSync(LEARNED_DIR)) {
|
|
505789
|
+
const learnedFiles = fs34.readdirSync(LEARNED_DIR).filter((f3) => f3.endsWith(".md"));
|
|
505310
505790
|
for (const file2 of learnedFiles) {
|
|
505311
|
-
this.tryIngestSkillFile(
|
|
505791
|
+
this.tryIngestSkillFile(path35.join(LEARNED_DIR, file2), true);
|
|
505312
505792
|
}
|
|
505313
505793
|
}
|
|
505314
505794
|
return this.getAllSkills();
|
|
@@ -505346,7 +505826,7 @@ class SkillManager {
|
|
|
505346
505826
|
}
|
|
505347
505827
|
tryIngestSkillFile(filePath, skipIfExists) {
|
|
505348
505828
|
try {
|
|
505349
|
-
const content =
|
|
505829
|
+
const content = fs34.readFileSync(filePath, "utf-8");
|
|
505350
505830
|
const { frontmatter, body } = parseFrontmatter(content);
|
|
505351
505831
|
if (skipIfExists && this.skills.has(frontmatter.name))
|
|
505352
505832
|
return;
|
|
@@ -505391,8 +505871,8 @@ examples:
|
|
|
505391
505871
|
- Don't commit node_modules, .env, or other sensitive files
|
|
505392
505872
|
- Group related changes into single commits
|
|
505393
505873
|
`;
|
|
505394
|
-
const filePath =
|
|
505395
|
-
|
|
505874
|
+
const filePath = path35.join(this.skillsDirectory, "commit.md");
|
|
505875
|
+
fs34.writeFileSync(filePath, exampleSkill);
|
|
505396
505876
|
console.log(`[skills] Created example skill: ${filePath}`);
|
|
505397
505877
|
}
|
|
505398
505878
|
getSkill(name21) {
|
|
@@ -505480,8 +505960,8 @@ ${skill.examples.map((e3) => ` - ${e3}`).join(`
|
|
|
505480
505960
|
${skill.prompt}
|
|
505481
505961
|
`;
|
|
505482
505962
|
const fileName = `${skill.name.toLowerCase().replace(/\s+/g, "-")}.md`;
|
|
505483
|
-
const filePath =
|
|
505484
|
-
|
|
505963
|
+
const filePath = path35.join(this.skillsDirectory, fileName);
|
|
505964
|
+
fs34.writeFileSync(filePath, content);
|
|
505485
505965
|
skill.filePath = filePath;
|
|
505486
505966
|
this.skills.set(skill.name, skill);
|
|
505487
505967
|
}
|
|
@@ -505547,14 +506027,14 @@ var init_skills = __esm(() => {
|
|
|
505547
506027
|
init_matcher();
|
|
505548
506028
|
init_experiment();
|
|
505549
506029
|
init_creator();
|
|
505550
|
-
LEARNED_DIR =
|
|
506030
|
+
LEARNED_DIR = path35.join(os24.homedir(), ".8gent", "learned-skills");
|
|
505551
506031
|
});
|
|
505552
506032
|
|
|
505553
506033
|
// packages/tasks/index.ts
|
|
505554
506034
|
import { EventEmitter as EventEmitter8 } from "events";
|
|
505555
|
-
import * as
|
|
505556
|
-
import * as
|
|
505557
|
-
import * as
|
|
506035
|
+
import * as fs35 from "fs";
|
|
506036
|
+
import * as os25 from "os";
|
|
506037
|
+
import * as path36 from "path";
|
|
505558
506038
|
function getTaskManager(storePath) {
|
|
505559
506039
|
if (!taskManagerInstance2) {
|
|
505560
506040
|
taskManagerInstance2 = new TaskManager(storePath);
|
|
@@ -505689,17 +506169,17 @@ var init_tasks = __esm(() => {
|
|
|
505689
506169
|
autoSave = true;
|
|
505690
506170
|
constructor(storePath) {
|
|
505691
506171
|
super();
|
|
505692
|
-
this.storePath = storePath ||
|
|
506172
|
+
this.storePath = storePath || path36.join(os25.homedir(), ".8gent", "tasks.json");
|
|
505693
506173
|
this.store = this.loadStore();
|
|
505694
506174
|
}
|
|
505695
506175
|
loadStore() {
|
|
505696
|
-
const dir =
|
|
505697
|
-
if (!
|
|
505698
|
-
|
|
506176
|
+
const dir = path36.dirname(this.storePath);
|
|
506177
|
+
if (!fs35.existsSync(dir)) {
|
|
506178
|
+
fs35.mkdirSync(dir, { recursive: true });
|
|
505699
506179
|
}
|
|
505700
|
-
if (
|
|
506180
|
+
if (fs35.existsSync(this.storePath)) {
|
|
505701
506181
|
try {
|
|
505702
|
-
const data2 =
|
|
506182
|
+
const data2 = fs35.readFileSync(this.storePath, "utf-8");
|
|
505703
506183
|
const store = JSON.parse(data2);
|
|
505704
506184
|
for (const task of [...store.tasks, ...store.archivedTasks]) {
|
|
505705
506185
|
const match = task.id.match(/^task-(\d+)/);
|
|
@@ -505724,7 +506204,7 @@ var init_tasks = __esm(() => {
|
|
|
505724
506204
|
}
|
|
505725
506205
|
saveStore() {
|
|
505726
506206
|
this.store.lastUpdated = new Date().toISOString();
|
|
505727
|
-
|
|
506207
|
+
fs35.writeFileSync(this.storePath, JSON.stringify(this.store, null, 2));
|
|
505728
506208
|
}
|
|
505729
506209
|
generateId() {
|
|
505730
506210
|
this.idCounter++;
|
|
@@ -506435,8 +506915,8 @@ class ProactivePlanner {
|
|
|
506435
506915
|
for (const cmd of commands.slice(0, 5)) {
|
|
506436
506916
|
const fileMatch = cmd.match(/(?:src|lib|packages)\/[\w/.-]+\.(ts|tsx|js|jsx)/);
|
|
506437
506917
|
if (fileMatch) {
|
|
506438
|
-
const
|
|
506439
|
-
const dir =
|
|
506918
|
+
const path37 = fileMatch[0];
|
|
506919
|
+
const dir = path37.split("/").slice(0, -1).join("/");
|
|
506440
506920
|
patterns.push({
|
|
506441
506921
|
target: `files in ${dir}`,
|
|
506442
506922
|
path: dir,
|
|
@@ -506467,15 +506947,15 @@ __export(exports_modes, {
|
|
|
506467
506947
|
ModeManager: () => ModeManager,
|
|
506468
506948
|
FAST_MODE_MODELS: () => FAST_MODE_MODELS
|
|
506469
506949
|
});
|
|
506470
|
-
import * as
|
|
506471
|
-
import * as
|
|
506472
|
-
import * as
|
|
506950
|
+
import * as fs36 from "fs";
|
|
506951
|
+
import * as os26 from "os";
|
|
506952
|
+
import * as path37 from "path";
|
|
506473
506953
|
function loadCustomModes(filePath) {
|
|
506474
506954
|
const result = {};
|
|
506475
|
-
if (!
|
|
506955
|
+
if (!fs36.existsSync(filePath))
|
|
506476
506956
|
return result;
|
|
506477
506957
|
try {
|
|
506478
|
-
const raw =
|
|
506958
|
+
const raw = fs36.readFileSync(filePath, "utf-8");
|
|
506479
506959
|
const parsed = $parse(raw);
|
|
506480
506960
|
if (!parsed?.modes || typeof parsed.modes !== "object")
|
|
506481
506961
|
return result;
|
|
@@ -506504,7 +506984,7 @@ class ModeManager {
|
|
|
506504
506984
|
_fastMode = false;
|
|
506505
506985
|
_previousModel = null;
|
|
506506
506986
|
constructor(customModesPath) {
|
|
506507
|
-
const modesPath = customModesPath ||
|
|
506987
|
+
const modesPath = customModesPath || path37.join(process.env.EIGHT_DATA_DIR || path37.join(os26.homedir(), ".8gent"), "modes.yaml");
|
|
506508
506988
|
this.modes = { ...BUILT_IN_MODES, ...loadCustomModes(modesPath) };
|
|
506509
506989
|
}
|
|
506510
506990
|
getMode(name21) {
|
|
@@ -506648,21 +507128,21 @@ __export(exports_i18n, {
|
|
|
506648
507128
|
LanguageManager: () => LanguageManager,
|
|
506649
507129
|
LANGUAGES: () => LANGUAGES
|
|
506650
507130
|
});
|
|
506651
|
-
import * as
|
|
506652
|
-
import * as
|
|
506653
|
-
import * as
|
|
507131
|
+
import * as fs37 from "fs";
|
|
507132
|
+
import * as os27 from "os";
|
|
507133
|
+
import * as path38 from "path";
|
|
506654
507134
|
|
|
506655
507135
|
class LanguageManager {
|
|
506656
507136
|
settings;
|
|
506657
507137
|
settingsPath;
|
|
506658
507138
|
constructor(settingsPath) {
|
|
506659
|
-
this.settingsPath = settingsPath ||
|
|
507139
|
+
this.settingsPath = settingsPath || path38.join(os27.homedir(), ".8gent", "language.json");
|
|
506660
507140
|
this.settings = this.loadSettings();
|
|
506661
507141
|
}
|
|
506662
507142
|
loadSettings() {
|
|
506663
507143
|
try {
|
|
506664
|
-
if (
|
|
506665
|
-
const data2 =
|
|
507144
|
+
if (fs37.existsSync(this.settingsPath)) {
|
|
507145
|
+
const data2 = fs37.readFileSync(this.settingsPath, "utf-8");
|
|
506666
507146
|
return JSON.parse(data2);
|
|
506667
507147
|
}
|
|
506668
507148
|
} catch (err) {}
|
|
@@ -506672,11 +507152,11 @@ class LanguageManager {
|
|
|
506672
507152
|
};
|
|
506673
507153
|
}
|
|
506674
507154
|
saveSettings() {
|
|
506675
|
-
const dir =
|
|
506676
|
-
if (!
|
|
506677
|
-
|
|
507155
|
+
const dir = path38.dirname(this.settingsPath);
|
|
507156
|
+
if (!fs37.existsSync(dir)) {
|
|
507157
|
+
fs37.mkdirSync(dir, { recursive: true });
|
|
506678
507158
|
}
|
|
506679
|
-
|
|
507159
|
+
fs37.writeFileSync(this.settingsPath, JSON.stringify(this.settings, null, 2));
|
|
506680
507160
|
}
|
|
506681
507161
|
getActiveLanguage() {
|
|
506682
507162
|
return LANGUAGES[this.settings.activeLanguage] || LANGUAGES.en;
|
|
@@ -506921,15 +507401,15 @@ var init_i18n = __esm(() => {
|
|
|
506921
507401
|
});
|
|
506922
507402
|
|
|
506923
507403
|
// packages/eight/repl.ts
|
|
506924
|
-
import * as
|
|
506925
|
-
import * as
|
|
506926
|
-
import * as
|
|
507404
|
+
import * as fs38 from "fs";
|
|
507405
|
+
import * as os28 from "os";
|
|
507406
|
+
import * as path39 from "path";
|
|
506927
507407
|
import * as readline2 from "readline";
|
|
506928
507408
|
async function startREPL(config2) {
|
|
506929
|
-
const configPath =
|
|
507409
|
+
const configPath = path39.join(os28.homedir(), ".8gent", "config.json");
|
|
506930
507410
|
let savedConfig = {};
|
|
506931
|
-
if (
|
|
506932
|
-
savedConfig = JSON.parse(
|
|
507411
|
+
if (fs38.existsSync(configPath)) {
|
|
507412
|
+
savedConfig = JSON.parse(fs38.readFileSync(configPath, "utf-8"));
|
|
506933
507413
|
}
|
|
506934
507414
|
const finalConfig = {
|
|
506935
507415
|
model: config2?.model || savedConfig.model || "glm-4.7-flash:latest",
|
|
@@ -507461,13 +507941,13 @@ Output format: PLAN: 1) ... 2) ... 3) ...`;
|
|
|
507461
507941
|
return true;
|
|
507462
507942
|
}
|
|
507463
507943
|
if (trimmed === "/nightly") {
|
|
507464
|
-
const nightlyLog =
|
|
507465
|
-
const dreamsLog =
|
|
507944
|
+
const nightlyLog = path39.join(os28.homedir(), ".8gent", "nightly.log");
|
|
507945
|
+
const dreamsLog = path39.join(os28.homedir(), ".8gent", "dreams.log");
|
|
507466
507946
|
console.log(`
|
|
507467
507947
|
\x1B[36m8gent Nightly Training Status:\x1B[0m
|
|
507468
507948
|
`);
|
|
507469
|
-
if (
|
|
507470
|
-
const content =
|
|
507949
|
+
if (fs38.existsSync(nightlyLog)) {
|
|
507950
|
+
const content = fs38.readFileSync(nightlyLog, "utf-8");
|
|
507471
507951
|
const lines = content.trim().split(`
|
|
507472
507952
|
`);
|
|
507473
507953
|
const tail = lines.slice(-25);
|
|
@@ -507487,8 +507967,8 @@ Output format: PLAN: 1) ... 2) ... 3) ...`;
|
|
|
507487
507967
|
console.log(" \x1B[33mNo nightly training log found.\x1B[0m");
|
|
507488
507968
|
console.log(" Nightly training runs at 2:00 AM PST via cron.");
|
|
507489
507969
|
}
|
|
507490
|
-
if (
|
|
507491
|
-
const content =
|
|
507970
|
+
if (fs38.existsSync(dreamsLog)) {
|
|
507971
|
+
const content = fs38.readFileSync(dreamsLog, "utf-8");
|
|
507492
507972
|
const lines = content.trim().split(`
|
|
507493
507973
|
`);
|
|
507494
507974
|
const tail = lines.slice(-10);
|
|
@@ -507697,9 +508177,9 @@ async function handleVoiceCommands(trimmed) {
|
|
|
507697
508177
|
}
|
|
507698
508178
|
function handlePersonalCommands(trimmed) {
|
|
507699
508179
|
if (trimmed === "/personal" || trimmed === "/personal status") {
|
|
507700
|
-
const loraDir =
|
|
507701
|
-
const metaPath =
|
|
507702
|
-
if (!
|
|
508180
|
+
const loraDir = path39.join(os28.homedir(), ".8gent", "personal-lora");
|
|
508181
|
+
const metaPath = path39.join(loraDir, "meta.json");
|
|
508182
|
+
if (!fs38.existsSync(loraDir) || !fs38.existsSync(metaPath)) {
|
|
507703
508183
|
console.log(`
|
|
507704
508184
|
\x1B[33mPersonal LoRA:\x1B[0m Not configured`);
|
|
507705
508185
|
console.log(` No personal LoRA found at ${loraDir}`);
|
|
@@ -507708,7 +508188,7 @@ function handlePersonalCommands(trimmed) {
|
|
|
507708
508188
|
return true;
|
|
507709
508189
|
}
|
|
507710
508190
|
try {
|
|
507711
|
-
const meta3 = JSON.parse(
|
|
508191
|
+
const meta3 = JSON.parse(fs38.readFileSync(metaPath, "utf-8"));
|
|
507712
508192
|
console.log(`
|
|
507713
508193
|
\x1B[36mPersonal LoRA Status:\x1B[0m`);
|
|
507714
508194
|
console.log(` Path: ${loraDir}`);
|
|
@@ -507731,9 +508211,9 @@ function handlePersonalCommands(trimmed) {
|
|
|
507731
508211
|
return true;
|
|
507732
508212
|
}
|
|
507733
508213
|
if (trimmed === "/personal reset") {
|
|
507734
|
-
const loraDir =
|
|
507735
|
-
if (
|
|
507736
|
-
|
|
508214
|
+
const loraDir = path39.join(os28.homedir(), ".8gent", "personal-lora");
|
|
508215
|
+
if (fs38.existsSync(loraDir)) {
|
|
508216
|
+
fs38.rmSync(loraDir, { recursive: true, force: true });
|
|
507737
508217
|
console.log("\x1B[32mPersonal LoRA reset. Reverted to base Eight.\x1B[0m");
|
|
507738
508218
|
} else {
|
|
507739
508219
|
console.log("No personal LoRA to reset.");
|
|
@@ -508412,8 +508892,8 @@ var init_repl = __esm(() => {
|
|
|
508412
508892
|
|
|
508413
508893
|
// packages/eight/harness/session.ts
|
|
508414
508894
|
import * as crypto6 from "crypto";
|
|
508415
|
-
import * as
|
|
508416
|
-
import * as
|
|
508895
|
+
import * as fs39 from "fs";
|
|
508896
|
+
import * as path40 from "path";
|
|
508417
508897
|
function computeHash(id, timestamp, type, payload, prevHash) {
|
|
508418
508898
|
const data2 = JSON.stringify({ id, timestamp, type, payload, prevHash });
|
|
508419
508899
|
return crypto6.createHash("sha256").update(data2).digest("hex");
|
|
@@ -508427,8 +508907,8 @@ function parseLine(line) {
|
|
|
508427
508907
|
}
|
|
508428
508908
|
function createSession(sessionId) {
|
|
508429
508909
|
const id = sessionId || crypto6.randomUUID().slice(0, 12);
|
|
508430
|
-
const filePath =
|
|
508431
|
-
|
|
508910
|
+
const filePath = path40.join(SESSIONS_DIR, `${id}.jsonl`);
|
|
508911
|
+
fs39.mkdirSync(SESSIONS_DIR, { recursive: true, mode: 448 });
|
|
508432
508912
|
let cachedLastHash = null;
|
|
508433
508913
|
async function getLastHash() {
|
|
508434
508914
|
if (cachedLastHash !== null)
|
|
@@ -508438,9 +508918,9 @@ function createSession(sessionId) {
|
|
|
508438
508918
|
return cachedLastHash;
|
|
508439
508919
|
}
|
|
508440
508920
|
async function readAllEntries() {
|
|
508441
|
-
if (!
|
|
508921
|
+
if (!fs39.existsSync(filePath))
|
|
508442
508922
|
return [];
|
|
508443
|
-
const content =
|
|
508923
|
+
const content = fs39.readFileSync(filePath, "utf-8").trim();
|
|
508444
508924
|
if (!content)
|
|
508445
508925
|
return [];
|
|
508446
508926
|
return content.split(`
|
|
@@ -508464,7 +508944,7 @@ function createSession(sessionId) {
|
|
|
508464
508944
|
};
|
|
508465
508945
|
const line = `${JSON.stringify(entry)}
|
|
508466
508946
|
`;
|
|
508467
|
-
|
|
508947
|
+
fs39.appendFileSync(filePath, line, { encoding: "utf-8", mode: 384 });
|
|
508468
508948
|
cachedLastHash = hash2;
|
|
508469
508949
|
return hash2;
|
|
508470
508950
|
},
|
|
@@ -508492,23 +508972,23 @@ function createSession(sessionId) {
|
|
|
508492
508972
|
return session;
|
|
508493
508973
|
}
|
|
508494
508974
|
function openSession(sessionId) {
|
|
508495
|
-
const filePath =
|
|
508496
|
-
if (!
|
|
508975
|
+
const filePath = path40.join(SESSIONS_DIR, `${sessionId}.jsonl`);
|
|
508976
|
+
if (!fs39.existsSync(filePath)) {
|
|
508497
508977
|
throw new Error(`Session not found: ${sessionId}`);
|
|
508498
508978
|
}
|
|
508499
508979
|
return createSession(sessionId);
|
|
508500
508980
|
}
|
|
508501
508981
|
function listSessions() {
|
|
508502
|
-
if (!
|
|
508982
|
+
if (!fs39.existsSync(SESSIONS_DIR))
|
|
508503
508983
|
return [];
|
|
508504
|
-
return
|
|
508984
|
+
return fs39.readdirSync(SESSIONS_DIR).filter((f3) => f3.endsWith(".jsonl")).map((f3) => f3.replace(".jsonl", "")).sort();
|
|
508505
508985
|
}
|
|
508506
508986
|
function getSessionsDir() {
|
|
508507
508987
|
return SESSIONS_DIR;
|
|
508508
508988
|
}
|
|
508509
508989
|
var SESSIONS_DIR;
|
|
508510
508990
|
var init_session = __esm(() => {
|
|
508511
|
-
SESSIONS_DIR =
|
|
508991
|
+
SESSIONS_DIR = path40.join(process.env.HOME || "~", ".8gent", "audit");
|
|
508512
508992
|
});
|
|
508513
508993
|
|
|
508514
508994
|
// packages/eight/harness/harness.ts
|
|
@@ -508643,12 +509123,12 @@ function createSandbox(vault) {
|
|
|
508643
509123
|
}
|
|
508644
509124
|
|
|
508645
509125
|
// packages/eight/harness/vault.ts
|
|
508646
|
-
import * as
|
|
509126
|
+
import * as fs40 from "fs";
|
|
508647
509127
|
function parseDotenv(filePath) {
|
|
508648
|
-
if (!
|
|
509128
|
+
if (!fs40.existsSync(filePath))
|
|
508649
509129
|
return {};
|
|
508650
509130
|
const result = {};
|
|
508651
|
-
const lines =
|
|
509131
|
+
const lines = fs40.readFileSync(filePath, "utf-8").split(`
|
|
508652
509132
|
`);
|
|
508653
509133
|
for (const line of lines) {
|
|
508654
509134
|
const trimmed = line.trim();
|
|
@@ -509446,19 +509926,19 @@ What alternative approach will you try now?`;
|
|
|
509446
509926
|
});
|
|
509447
509927
|
|
|
509448
509928
|
// benchmarks/autoresearch/model-router.ts
|
|
509449
|
-
import { existsSync as
|
|
509450
|
-
import { join as
|
|
509929
|
+
import { existsSync as existsSync45, readFileSync as readFileSync38, writeFileSync as writeFileSync23 } from "fs";
|
|
509930
|
+
import { join as join51 } from "path";
|
|
509451
509931
|
function loadExperience() {
|
|
509452
509932
|
try {
|
|
509453
|
-
if (
|
|
509454
|
-
return JSON.parse(
|
|
509933
|
+
if (existsSync45(EXPERIENCE_FILE)) {
|
|
509934
|
+
return JSON.parse(readFileSync38(EXPERIENCE_FILE, "utf-8"));
|
|
509455
509935
|
}
|
|
509456
509936
|
} catch {}
|
|
509457
509937
|
return { byDomain: {}, byBenchmark: {}, runCounts: {}, updatedAt: "" };
|
|
509458
509938
|
}
|
|
509459
509939
|
function saveExperience(db2) {
|
|
509460
509940
|
db2.updatedAt = new Date().toISOString();
|
|
509461
|
-
|
|
509941
|
+
writeFileSync23(EXPERIENCE_FILE, JSON.stringify(db2, null, 2));
|
|
509462
509942
|
}
|
|
509463
509943
|
function recordResult(model, domain2, benchmarkId, score) {
|
|
509464
509944
|
const db2 = loadExperience();
|
|
@@ -509485,12 +509965,12 @@ function recordResult(model, domain2, benchmarkId, score) {
|
|
|
509485
509965
|
}
|
|
509486
509966
|
var ROOT, EXPERIENCE_FILE;
|
|
509487
509967
|
var init_model_router = __esm(() => {
|
|
509488
|
-
ROOT =
|
|
509489
|
-
EXPERIENCE_FILE =
|
|
509968
|
+
ROOT = join51(import.meta.dir, "..");
|
|
509969
|
+
EXPERIENCE_FILE = join51(ROOT, "autoresearch", "model-experience.json");
|
|
509490
509970
|
});
|
|
509491
509971
|
|
|
509492
509972
|
// packages/kernel/judge.ts
|
|
509493
|
-
import { existsSync as
|
|
509973
|
+
import { existsSync as existsSync46, mkdirSync as mkdirSync31, readFileSync as readFileSync39, writeFileSync as writeFileSync24 } from "fs";
|
|
509494
509974
|
import { dirname as dirname18 } from "path";
|
|
509495
509975
|
|
|
509496
509976
|
class JudgeScorer {
|
|
@@ -509601,8 +510081,8 @@ Score this response:`;
|
|
|
509601
510081
|
}
|
|
509602
510082
|
loadHistory() {
|
|
509603
510083
|
try {
|
|
509604
|
-
if (
|
|
509605
|
-
return JSON.parse(
|
|
510084
|
+
if (existsSync46(this.config.historyPath)) {
|
|
510085
|
+
return JSON.parse(readFileSync39(this.config.historyPath, "utf-8"));
|
|
509606
510086
|
}
|
|
509607
510087
|
} catch {}
|
|
509608
510088
|
return {
|
|
@@ -509635,9 +510115,9 @@ Score this response:`;
|
|
|
509635
510115
|
}
|
|
509636
510116
|
history.updatedAt = new Date().toISOString();
|
|
509637
510117
|
const dir = dirname18(this.config.historyPath);
|
|
509638
|
-
if (!
|
|
509639
|
-
|
|
509640
|
-
|
|
510118
|
+
if (!existsSync46(dir))
|
|
510119
|
+
mkdirSync31(dir, { recursive: true });
|
|
510120
|
+
writeFileSync24(this.config.historyPath, JSON.stringify(history, null, 2));
|
|
509641
510121
|
}
|
|
509642
510122
|
}
|
|
509643
510123
|
function clamp2(v4) {
|
|
@@ -509669,7 +510149,7 @@ var init_judge = __esm(() => {
|
|
|
509669
510149
|
});
|
|
509670
510150
|
|
|
509671
510151
|
// packages/kernel/proxy.ts
|
|
509672
|
-
import { existsSync as
|
|
510152
|
+
import { existsSync as existsSync47 } from "fs";
|
|
509673
510153
|
import { resolve as resolve10 } from "path";
|
|
509674
510154
|
var {spawn: spawn10 } = globalThis.Bun;
|
|
509675
510155
|
|
|
@@ -509693,7 +510173,7 @@ class TrainingProxy {
|
|
|
509693
510173
|
throw new Error(`Ollama not reachable at ${this.config.ollamaUrl}`);
|
|
509694
510174
|
}
|
|
509695
510175
|
const configPath = resolve10(this.config.configPath);
|
|
509696
|
-
if (!
|
|
510176
|
+
if (!existsSync47(configPath)) {
|
|
509697
510177
|
throw new Error(`Training proxy config not found at ${configPath}`);
|
|
509698
510178
|
}
|
|
509699
510179
|
this.process = spawn10({
|
|
@@ -509825,8 +510305,8 @@ var init_proxy = __esm(() => {
|
|
|
509825
510305
|
});
|
|
509826
510306
|
|
|
509827
510307
|
// packages/kernel/training.ts
|
|
509828
|
-
import { existsSync as
|
|
509829
|
-
import { dirname as dirname19, join as
|
|
510308
|
+
import { existsSync as existsSync48, mkdirSync as mkdirSync32, readFileSync as readFileSync41, writeFileSync as writeFileSync25 } from "fs";
|
|
510309
|
+
import { dirname as dirname19, join as join53 } from "path";
|
|
509830
510310
|
var {spawn: spawn11 } = globalThis.Bun;
|
|
509831
510311
|
|
|
509832
510312
|
class TrainingOrchestrator {
|
|
@@ -509885,8 +510365,8 @@ class TrainingOrchestrator {
|
|
|
509885
510365
|
batchId,
|
|
509886
510366
|
createdAt: new Date().toISOString()
|
|
509887
510367
|
};
|
|
509888
|
-
const batchPath =
|
|
509889
|
-
|
|
510368
|
+
const batchPath = join53(this.config.dataDir, "batches", `${batchId}.json`);
|
|
510369
|
+
writeFileSync25(batchPath, JSON.stringify(batch, null, 2));
|
|
509890
510370
|
this.state.currentBatch = [];
|
|
509891
510371
|
this.state.totalTrainingRuns += 1;
|
|
509892
510372
|
this.saveState();
|
|
@@ -509970,9 +510450,9 @@ class TrainingOrchestrator {
|
|
|
509970
510450
|
const exitCode = await proc.exited;
|
|
509971
510451
|
const stdout = await new Response(proc.stdout).text();
|
|
509972
510452
|
try {
|
|
509973
|
-
const resultsPath =
|
|
509974
|
-
if (
|
|
509975
|
-
const results = JSON.parse(
|
|
510453
|
+
const resultsPath = join53(dirname19(this.config.validateCommand.split(" ").pop()), "checkpoint-results.json");
|
|
510454
|
+
if (existsSync48(resultsPath)) {
|
|
510455
|
+
const results = JSON.parse(readFileSync41(resultsPath, "utf-8"));
|
|
509976
510456
|
return results.avgScore ?? 0;
|
|
509977
510457
|
}
|
|
509978
510458
|
} catch {}
|
|
@@ -509990,10 +510470,10 @@ class TrainingOrchestrator {
|
|
|
509990
510470
|
} catch {}
|
|
509991
510471
|
}
|
|
509992
510472
|
loadState() {
|
|
509993
|
-
const statePath =
|
|
510473
|
+
const statePath = join53(this.config.dataDir, "state.json");
|
|
509994
510474
|
try {
|
|
509995
|
-
if (
|
|
509996
|
-
return JSON.parse(
|
|
510475
|
+
if (existsSync48(statePath)) {
|
|
510476
|
+
return JSON.parse(readFileSync41(statePath, "utf-8"));
|
|
509997
510477
|
}
|
|
509998
510478
|
} catch {}
|
|
509999
510479
|
return {
|
|
@@ -510007,15 +510487,15 @@ class TrainingOrchestrator {
|
|
|
510007
510487
|
};
|
|
510008
510488
|
}
|
|
510009
510489
|
saveState() {
|
|
510010
|
-
const statePath =
|
|
510490
|
+
const statePath = join53(this.config.dataDir, "state.json");
|
|
510011
510491
|
this.state.updatedAt = new Date().toISOString();
|
|
510012
|
-
|
|
510492
|
+
writeFileSync25(statePath, JSON.stringify(this.state, null, 2));
|
|
510013
510493
|
}
|
|
510014
510494
|
ensureDirs() {
|
|
510015
510495
|
for (const sub of ["batches", "checkpoints"]) {
|
|
510016
|
-
const dir =
|
|
510017
|
-
if (!
|
|
510018
|
-
|
|
510496
|
+
const dir = join53(this.config.dataDir, sub);
|
|
510497
|
+
if (!existsSync48(dir))
|
|
510498
|
+
mkdirSync32(dir, { recursive: true });
|
|
510019
510499
|
}
|
|
510020
510500
|
}
|
|
510021
510501
|
}
|
|
@@ -510222,8 +510702,8 @@ var init_loop = __esm(() => {
|
|
|
510222
510702
|
});
|
|
510223
510703
|
|
|
510224
510704
|
// packages/kernel/personal-collector.ts
|
|
510225
|
-
import { appendFileSync as appendFileSync9, existsSync as
|
|
510226
|
-
import { join as
|
|
510705
|
+
import { appendFileSync as appendFileSync9, existsSync as existsSync49, mkdirSync as mkdirSync33, readFileSync as readFileSync42, writeFileSync as writeFileSync26 } from "fs";
|
|
510706
|
+
import { join as join54, resolve as resolve11 } from "path";
|
|
510227
510707
|
|
|
510228
510708
|
class PersonalCollector {
|
|
510229
510709
|
trainingDir;
|
|
@@ -510233,8 +510713,8 @@ class PersonalCollector {
|
|
|
510233
510713
|
stats;
|
|
510234
510714
|
constructor(projectRoot = process.cwd(), minScore = 0.7) {
|
|
510235
510715
|
this.trainingDir = resolve11(projectRoot, ".8gent", "kernel", "training");
|
|
510236
|
-
this.pairsPath =
|
|
510237
|
-
this.statsPath =
|
|
510716
|
+
this.pairsPath = join54(this.trainingDir, "pairs.jsonl");
|
|
510717
|
+
this.statsPath = join54(this.trainingDir, "stats.json");
|
|
510238
510718
|
this.minScore = minScore;
|
|
510239
510719
|
this.stats = this.loadStats();
|
|
510240
510720
|
}
|
|
@@ -510273,9 +510753,9 @@ class PersonalCollector {
|
|
|
510273
510753
|
return true;
|
|
510274
510754
|
}
|
|
510275
510755
|
getPairs(userId) {
|
|
510276
|
-
if (!
|
|
510756
|
+
if (!existsSync49(this.pairsPath))
|
|
510277
510757
|
return [];
|
|
510278
|
-
const lines =
|
|
510758
|
+
const lines = readFileSync42(this.pairsPath, "utf-8").split(`
|
|
510279
510759
|
`).filter(Boolean);
|
|
510280
510760
|
const pairs = lines.map((line) => {
|
|
510281
510761
|
try {
|
|
@@ -510296,14 +510776,14 @@ class PersonalCollector {
|
|
|
510296
510776
|
return this.getPairs(userId).length;
|
|
510297
510777
|
}
|
|
510298
510778
|
ensureDir() {
|
|
510299
|
-
if (!
|
|
510300
|
-
|
|
510779
|
+
if (!existsSync49(this.trainingDir)) {
|
|
510780
|
+
mkdirSync33(this.trainingDir, { recursive: true });
|
|
510301
510781
|
}
|
|
510302
510782
|
}
|
|
510303
510783
|
loadStats() {
|
|
510304
510784
|
try {
|
|
510305
|
-
if (
|
|
510306
|
-
return JSON.parse(
|
|
510785
|
+
if (existsSync49(this.statsPath)) {
|
|
510786
|
+
return JSON.parse(readFileSync42(this.statsPath, "utf-8"));
|
|
510307
510787
|
}
|
|
510308
510788
|
} catch {}
|
|
510309
510789
|
return {
|
|
@@ -510315,7 +510795,7 @@ class PersonalCollector {
|
|
|
510315
510795
|
}
|
|
510316
510796
|
saveStats() {
|
|
510317
510797
|
this.ensureDir();
|
|
510318
|
-
|
|
510798
|
+
writeFileSync26(this.statsPath, JSON.stringify(this.stats, null, 2));
|
|
510319
510799
|
}
|
|
510320
510800
|
}
|
|
510321
510801
|
var init_personal_collector = () => {};
|
|
@@ -510325,7 +510805,7 @@ var exports_manager = {};
|
|
|
510325
510805
|
__export(exports_manager, {
|
|
510326
510806
|
KernelManager: () => KernelManager
|
|
510327
510807
|
});
|
|
510328
|
-
import { existsSync as
|
|
510808
|
+
import { existsSync as existsSync50, readFileSync as readFileSync43 } from "fs";
|
|
510329
510809
|
import { resolve as resolve12 } from "path";
|
|
510330
510810
|
|
|
510331
510811
|
class KernelManager {
|
|
@@ -510339,11 +510819,11 @@ class KernelManager {
|
|
|
510339
510819
|
}
|
|
510340
510820
|
static fromProjectConfig(projectRoot = process.cwd()) {
|
|
510341
510821
|
const configPath = resolve12(projectRoot, ".8gent/config.json");
|
|
510342
|
-
if (!
|
|
510822
|
+
if (!existsSync50(configPath)) {
|
|
510343
510823
|
return new KernelManager;
|
|
510344
510824
|
}
|
|
510345
510825
|
try {
|
|
510346
|
-
const config2 = JSON.parse(
|
|
510826
|
+
const config2 = JSON.parse(readFileSync43(configPath, "utf-8"));
|
|
510347
510827
|
const mc = config2.training_proxy ?? {};
|
|
510348
510828
|
return new KernelManager({
|
|
510349
510829
|
enabled: mc.enabled ?? false,
|
|
@@ -510480,15 +510960,15 @@ var init_reporting = __esm(() => {
|
|
|
510480
510960
|
|
|
510481
510961
|
// packages/self-autonomy/evolution-db.ts
|
|
510482
510962
|
import { Database as Database4 } from "bun:sqlite";
|
|
510483
|
-
import * as
|
|
510484
|
-
import * as
|
|
510485
|
-
import * as
|
|
510963
|
+
import * as fs41 from "fs";
|
|
510964
|
+
import * as os29 from "os";
|
|
510965
|
+
import * as path41 from "path";
|
|
510486
510966
|
function getDbPath() {
|
|
510487
|
-
const base2 = process.env.EIGHT_DATA_DIR ||
|
|
510488
|
-
const dir =
|
|
510489
|
-
if (!
|
|
510490
|
-
|
|
510491
|
-
return
|
|
510967
|
+
const base2 = process.env.EIGHT_DATA_DIR || path41.join(os29.homedir(), ".8gent");
|
|
510968
|
+
const dir = path41.join(base2, "evolution");
|
|
510969
|
+
if (!fs41.existsSync(dir))
|
|
510970
|
+
fs41.mkdirSync(dir, { recursive: true });
|
|
510971
|
+
return path41.join(dir, "evolution.db");
|
|
510492
510972
|
}
|
|
510493
510973
|
function getDb() {
|
|
510494
510974
|
if (_db)
|
|
@@ -510703,8 +511183,8 @@ var init_learned_skills = __esm(() => {
|
|
|
510703
511183
|
|
|
510704
511184
|
// packages/self-autonomy/index.ts
|
|
510705
511185
|
import { execSync as execSync3 } from "child_process";
|
|
510706
|
-
import * as
|
|
510707
|
-
import * as
|
|
511186
|
+
import * as fs42 from "fs";
|
|
511187
|
+
import * as path42 from "path";
|
|
510708
511188
|
|
|
510709
511189
|
class AutoGit {
|
|
510710
511190
|
cwd;
|
|
@@ -510830,7 +511310,7 @@ class SelfHeal {
|
|
|
510830
511310
|
constructor(workingDirectory, verbose = false) {
|
|
510831
511311
|
this.cwd = workingDirectory;
|
|
510832
511312
|
this.verbose = verbose;
|
|
510833
|
-
this.memoryPath =
|
|
511313
|
+
this.memoryPath = path42.join(workingDirectory, ".8gent", "context", "healing.json");
|
|
510834
511314
|
this.memory = this.loadMemory();
|
|
510835
511315
|
}
|
|
510836
511316
|
log(message) {
|
|
@@ -510840,18 +511320,18 @@ class SelfHeal {
|
|
|
510840
511320
|
}
|
|
510841
511321
|
loadMemory() {
|
|
510842
511322
|
try {
|
|
510843
|
-
if (
|
|
510844
|
-
return JSON.parse(
|
|
511323
|
+
if (fs42.existsSync(this.memoryPath)) {
|
|
511324
|
+
return JSON.parse(fs42.readFileSync(this.memoryPath, "utf-8"));
|
|
510845
511325
|
}
|
|
510846
511326
|
} catch {}
|
|
510847
511327
|
return { patterns: {} };
|
|
510848
511328
|
}
|
|
510849
511329
|
saveMemory() {
|
|
510850
|
-
const dir =
|
|
510851
|
-
if (!
|
|
510852
|
-
|
|
511330
|
+
const dir = path42.dirname(this.memoryPath);
|
|
511331
|
+
if (!fs42.existsSync(dir)) {
|
|
511332
|
+
fs42.mkdirSync(dir, { recursive: true });
|
|
510853
511333
|
}
|
|
510854
|
-
|
|
511334
|
+
fs42.writeFileSync(this.memoryPath, JSON.stringify(this.memory, null, 2));
|
|
510855
511335
|
}
|
|
510856
511336
|
getKnownSolution(errorPattern) {
|
|
510857
511337
|
const pattern = this.memory.patterns[errorPattern];
|
|
@@ -510930,7 +511410,7 @@ class SessionMemory {
|
|
|
510930
511410
|
verbose;
|
|
510931
511411
|
constructor(workingDirectory, verbose = false) {
|
|
510932
511412
|
this.cwd = workingDirectory;
|
|
510933
|
-
this.contextPath =
|
|
511413
|
+
this.contextPath = path42.join(workingDirectory, ".8gent", "context");
|
|
510934
511414
|
this.verbose = verbose;
|
|
510935
511415
|
}
|
|
510936
511416
|
log(message) {
|
|
@@ -510939,15 +511419,15 @@ class SessionMemory {
|
|
|
510939
511419
|
}
|
|
510940
511420
|
}
|
|
510941
511421
|
ensureDirectories() {
|
|
510942
|
-
if (!
|
|
510943
|
-
|
|
511422
|
+
if (!fs42.existsSync(this.contextPath)) {
|
|
511423
|
+
fs42.mkdirSync(this.contextPath, { recursive: true });
|
|
510944
511424
|
}
|
|
510945
511425
|
}
|
|
510946
511426
|
getWorkingContext() {
|
|
510947
|
-
const contextFile =
|
|
511427
|
+
const contextFile = path42.join(this.contextPath, "working.json");
|
|
510948
511428
|
try {
|
|
510949
|
-
if (
|
|
510950
|
-
const context3 = JSON.parse(
|
|
511429
|
+
if (fs42.existsSync(contextFile)) {
|
|
511430
|
+
const context3 = JSON.parse(fs42.readFileSync(contextFile, "utf-8"));
|
|
510951
511431
|
const started = new Date(context3.started);
|
|
510952
511432
|
const now2 = new Date;
|
|
510953
511433
|
const hoursDiff = (now2.getTime() - started.getTime()) / (1000 * 60 * 60);
|
|
@@ -510961,12 +511441,12 @@ class SessionMemory {
|
|
|
510961
511441
|
}
|
|
510962
511442
|
saveWorkingContext(context3) {
|
|
510963
511443
|
this.ensureDirectories();
|
|
510964
|
-
const contextFile =
|
|
510965
|
-
|
|
511444
|
+
const contextFile = path42.join(this.contextPath, "working.json");
|
|
511445
|
+
fs42.writeFileSync(contextFile, JSON.stringify(context3, null, 2));
|
|
510966
511446
|
this.log("Saved working context");
|
|
510967
511447
|
}
|
|
510968
511448
|
logEvolution(entry) {
|
|
510969
|
-
const logFile =
|
|
511449
|
+
const logFile = path42.join(this.cwd, ".8gent", "evolution.log");
|
|
510970
511450
|
const line = `[${entry.timestamp}] ${entry.action} ${entry.file}
|
|
510971
511451
|
` + ` REASON: ${entry.reason}
|
|
510972
511452
|
` + ` RESULT: ${entry.result}
|
|
@@ -510974,7 +511454,7 @@ class SessionMemory {
|
|
|
510974
511454
|
` + ` MERGED: ${entry.merged}
|
|
510975
511455
|
|
|
510976
511456
|
`;
|
|
510977
|
-
|
|
511457
|
+
fs42.appendFileSync(logFile, line);
|
|
510978
511458
|
this.log(`Evolution: ${entry.action} ${entry.file} \u2192 ${entry.result}`);
|
|
510979
511459
|
}
|
|
510980
511460
|
}
|
|
@@ -511007,7 +511487,7 @@ class SelfAutonomy {
|
|
|
511007
511487
|
this.memory.saveWorkingContext({
|
|
511008
511488
|
session: `sess_${Date.now()}`,
|
|
511009
511489
|
started: new Date().toISOString(),
|
|
511010
|
-
project:
|
|
511490
|
+
project: path42.basename(this.config.workingDirectory),
|
|
511011
511491
|
branch: this.currentBranch,
|
|
511012
511492
|
activeFiles: [],
|
|
511013
511493
|
currentTask: taskDescription,
|
|
@@ -511464,9 +511944,9 @@ var init_heartbeat = __esm(() => {
|
|
|
511464
511944
|
});
|
|
511465
511945
|
|
|
511466
511946
|
// packages/specifications/session/writer.ts
|
|
511467
|
-
import * as
|
|
511468
|
-
import * as
|
|
511469
|
-
import * as
|
|
511947
|
+
import * as fs43 from "fs";
|
|
511948
|
+
import * as os30 from "os";
|
|
511949
|
+
import * as path43 from "path";
|
|
511470
511950
|
|
|
511471
511951
|
class SessionWriter {
|
|
511472
511952
|
filePath;
|
|
@@ -511489,16 +511969,16 @@ class SessionWriter {
|
|
|
511489
511969
|
this.sessionId = sessionId;
|
|
511490
511970
|
this.startTime = Date.now();
|
|
511491
511971
|
const dir = sessionsDir || SESSIONS_DIR2;
|
|
511492
|
-
if (!
|
|
511493
|
-
|
|
511972
|
+
if (!fs43.existsSync(dir)) {
|
|
511973
|
+
fs43.mkdirSync(dir, { recursive: true });
|
|
511494
511974
|
}
|
|
511495
|
-
this.filePath =
|
|
511496
|
-
this.fd =
|
|
511975
|
+
this.filePath = path43.join(dir, `${sessionId}.jsonl`);
|
|
511976
|
+
this.fd = fs43.openSync(this.filePath, "a");
|
|
511497
511977
|
}
|
|
511498
511978
|
write(entry) {
|
|
511499
511979
|
const line = `${JSON.stringify(entry)}
|
|
511500
511980
|
`;
|
|
511501
|
-
|
|
511981
|
+
fs43.writeSync(this.fd, line);
|
|
511502
511982
|
}
|
|
511503
511983
|
nextSeq() {
|
|
511504
511984
|
return this.seq++;
|
|
@@ -511689,7 +512169,7 @@ class SessionWriter {
|
|
|
511689
512169
|
reportId: reportId ?? null
|
|
511690
512170
|
}
|
|
511691
512171
|
});
|
|
511692
|
-
|
|
512172
|
+
fs43.closeSync(this.fd);
|
|
511693
512173
|
}
|
|
511694
512174
|
getFilePath() {
|
|
511695
512175
|
return this.filePath;
|
|
@@ -511728,18 +512208,18 @@ class SessionWriter {
|
|
|
511728
512208
|
}
|
|
511729
512209
|
var SESSIONS_DIR2;
|
|
511730
512210
|
var init_writer = __esm(() => {
|
|
511731
|
-
SESSIONS_DIR2 =
|
|
512211
|
+
SESSIONS_DIR2 = path43.join(os30.homedir(), ".8gent", "sessions");
|
|
511732
512212
|
});
|
|
511733
512213
|
|
|
511734
512214
|
// packages/eight/compaction.ts
|
|
511735
512215
|
class FileTracker {
|
|
511736
512216
|
read = new Set;
|
|
511737
512217
|
modified = new Set;
|
|
511738
|
-
trackRead(
|
|
511739
|
-
this.read.add(
|
|
512218
|
+
trackRead(path44) {
|
|
512219
|
+
this.read.add(path44);
|
|
511740
512220
|
}
|
|
511741
|
-
trackModified(
|
|
511742
|
-
this.modified.add(
|
|
512221
|
+
trackModified(path44) {
|
|
512222
|
+
this.modified.add(path44);
|
|
511743
512223
|
}
|
|
511744
512224
|
merge(other) {
|
|
511745
512225
|
Array.from(other.read).forEach((p) => this.read.add(p));
|
|
@@ -512123,7 +512603,7 @@ __export(exports_mapper, {
|
|
|
512123
512603
|
RepoMapper: () => RepoMapper
|
|
512124
512604
|
});
|
|
512125
512605
|
import { readFile, readdir, stat } from "fs/promises";
|
|
512126
|
-
import { basename as basename9, extname as extname8, join as
|
|
512606
|
+
import { basename as basename9, extname as extname8, join as join58, relative as relative3 } from "path";
|
|
512127
512607
|
|
|
512128
512608
|
class RepoMapper {
|
|
512129
512609
|
files = new Map;
|
|
@@ -512142,7 +512622,7 @@ class RepoMapper {
|
|
|
512142
512622
|
return;
|
|
512143
512623
|
}
|
|
512144
512624
|
for (const e3 of entries) {
|
|
512145
|
-
const full =
|
|
512625
|
+
const full = join58(dir, e3.name);
|
|
512146
512626
|
if (SKIP.test(e3.name))
|
|
512147
512627
|
continue;
|
|
512148
512628
|
if (e3.isDirectory()) {
|
|
@@ -512198,8 +512678,8 @@ class RepoMapper {
|
|
|
512198
512678
|
if (score > 0.05)
|
|
512199
512679
|
scored.push({ path: rel, score });
|
|
512200
512680
|
}
|
|
512201
|
-
return scored.sort((a5, b2) => b2.score - a5.score).slice(0, 20).map(({ path:
|
|
512202
|
-
path:
|
|
512681
|
+
return scored.sort((a5, b2) => b2.score - a5.score).slice(0, 20).map(({ path: path44, score }) => ({
|
|
512682
|
+
path: path44,
|
|
512203
512683
|
score,
|
|
512204
512684
|
content: "",
|
|
512205
512685
|
mode: "full"
|
|
@@ -512225,7 +512705,7 @@ class RepoMapper {
|
|
|
512225
512705
|
continue;
|
|
512226
512706
|
let content;
|
|
512227
512707
|
try {
|
|
512228
|
-
content = await readFile(
|
|
512708
|
+
content = await readFile(join58(this.root, file2.path), "utf-8");
|
|
512229
512709
|
} catch {
|
|
512230
512710
|
continue;
|
|
512231
512711
|
}
|
|
@@ -512276,15 +512756,15 @@ var init_repo_context = __esm(() => {
|
|
|
512276
512756
|
});
|
|
512277
512757
|
|
|
512278
512758
|
// packages/eight/instruction-loader.ts
|
|
512279
|
-
import { existsSync as
|
|
512280
|
-
import { homedir as
|
|
512281
|
-
import { dirname as dirname21, join as
|
|
512759
|
+
import { existsSync as existsSync54, readFileSync as readFileSync45 } from "fs";
|
|
512760
|
+
import { homedir as homedir32 } from "os";
|
|
512761
|
+
import { dirname as dirname21, join as join59, resolve as resolve13 } from "path";
|
|
512282
512762
|
function findInstructionFile(dir) {
|
|
512283
512763
|
for (const filename of INSTRUCTION_FILES) {
|
|
512284
|
-
const filePath =
|
|
512285
|
-
if (
|
|
512764
|
+
const filePath = join59(dir, filename);
|
|
512765
|
+
if (existsSync54(filePath)) {
|
|
512286
512766
|
try {
|
|
512287
|
-
return
|
|
512767
|
+
return readFileSync45(filePath, "utf-8");
|
|
512288
512768
|
} catch {}
|
|
512289
512769
|
}
|
|
512290
512770
|
}
|
|
@@ -512308,7 +512788,7 @@ function walkUp(startDir) {
|
|
|
512308
512788
|
}
|
|
512309
512789
|
function loadInstructions(cwd) {
|
|
512310
512790
|
const parts = [];
|
|
512311
|
-
const globalDir =
|
|
512791
|
+
const globalDir = join59(homedir32(), ".8gent");
|
|
512312
512792
|
const globalContent = findInstructionFile(globalDir);
|
|
512313
512793
|
if (globalContent) {
|
|
512314
512794
|
parts.push(globalContent.trim());
|
|
@@ -512802,9 +513282,9 @@ var require_windowsPtyAgent = __commonJS((exports) => {
|
|
|
512802
513282
|
var __dirname = "/Users/jamesspalding/8gent-code/node_modules/node-pty/lib";
|
|
512803
513283
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
512804
513284
|
exports.argsToCommandLine = exports.WindowsPtyAgent = undefined;
|
|
512805
|
-
var
|
|
512806
|
-
var
|
|
512807
|
-
var
|
|
513285
|
+
var fs44 = __require("fs");
|
|
513286
|
+
var os31 = __require("os");
|
|
513287
|
+
var path44 = __require("path");
|
|
512808
513288
|
var child_process_1 = __require("child_process");
|
|
512809
513289
|
var net_1 = __require("net");
|
|
512810
513290
|
var windowsConoutConnection_1 = require_windowsConoutConnection();
|
|
@@ -512838,7 +513318,7 @@ var require_windowsPtyAgent = __commonJS((exports) => {
|
|
|
512838
513318
|
}
|
|
512839
513319
|
}
|
|
512840
513320
|
this._ptyNative = this._useConpty ? conptyNative : winptyNative;
|
|
512841
|
-
cwd =
|
|
513321
|
+
cwd = path44.resolve(cwd);
|
|
512842
513322
|
var commandLine = argsToCommandLine(file2, args);
|
|
512843
513323
|
var term;
|
|
512844
513324
|
if (this._useConpty) {
|
|
@@ -512859,7 +513339,7 @@ var require_windowsPtyAgent = __commonJS((exports) => {
|
|
|
512859
513339
|
this._outSocket.on("connect", function() {
|
|
512860
513340
|
_this._outSocket.emit("ready_datapipe");
|
|
512861
513341
|
});
|
|
512862
|
-
var inSocketFD =
|
|
513342
|
+
var inSocketFD = fs44.openSync(term.conin, "w");
|
|
512863
513343
|
this._inSocket = new net_1.Socket({
|
|
512864
513344
|
fd: inSocketFD,
|
|
512865
513345
|
readable: false,
|
|
@@ -512958,7 +513438,7 @@ var require_windowsPtyAgent = __commonJS((exports) => {
|
|
|
512958
513438
|
WindowsPtyAgent2.prototype._getConsoleProcessList = function() {
|
|
512959
513439
|
var _this = this;
|
|
512960
513440
|
return new Promise(function(resolve14) {
|
|
512961
|
-
var agent = child_process_1.fork(
|
|
513441
|
+
var agent = child_process_1.fork(path44.join(__dirname, "conpty_console_list_agent"), [_this._innerPid.toString()]);
|
|
512962
513442
|
agent.on("message", function(message) {
|
|
512963
513443
|
clearTimeout(timeout);
|
|
512964
513444
|
resolve14(message.consoleProcessList);
|
|
@@ -512981,7 +513461,7 @@ var require_windowsPtyAgent = __commonJS((exports) => {
|
|
|
512981
513461
|
configurable: true
|
|
512982
513462
|
});
|
|
512983
513463
|
WindowsPtyAgent2.prototype._getWindowsBuildNumber = function() {
|
|
512984
|
-
var osVersion = /(\d+)\.(\d+)\.(\d+)/g.exec(
|
|
513464
|
+
var osVersion = /(\d+)\.(\d+)\.(\d+)/g.exec(os31.release());
|
|
512985
513465
|
var buildNumber = 0;
|
|
512986
513466
|
if (osVersion && osVersion.length === 4) {
|
|
512987
513467
|
buildNumber = parseInt(osVersion[3]);
|
|
@@ -513286,15 +513766,15 @@ var require_unixTerminal = __commonJS((exports) => {
|
|
|
513286
513766
|
}();
|
|
513287
513767
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
513288
513768
|
exports.UnixTerminal = undefined;
|
|
513289
|
-
var
|
|
513290
|
-
var
|
|
513769
|
+
var fs44 = __require("fs");
|
|
513770
|
+
var path44 = __require("path");
|
|
513291
513771
|
var tty = __require("tty");
|
|
513292
513772
|
var terminal_1 = require_terminal();
|
|
513293
513773
|
var utils_1 = require_utils11();
|
|
513294
513774
|
var native = utils_1.loadNativeModule("pty");
|
|
513295
513775
|
var pty = native.module;
|
|
513296
513776
|
var helperPath = native.dir + "/spawn-helper";
|
|
513297
|
-
helperPath =
|
|
513777
|
+
helperPath = path44.resolve(__dirname, helperPath);
|
|
513298
513778
|
helperPath = helperPath.replace("app.asar", "app.asar.unpacked");
|
|
513299
513779
|
helperPath = helperPath.replace("node_modules.asar", "node_modules.asar.unpacked");
|
|
513300
513780
|
var DEFAULT_FILE = "sh";
|
|
@@ -513538,7 +514018,7 @@ var require_unixTerminal = __commonJS((exports) => {
|
|
|
513538
514018
|
return;
|
|
513539
514019
|
}
|
|
513540
514020
|
var task = this._writeQueue[0];
|
|
513541
|
-
|
|
514021
|
+
fs44.write(this._fd, task.buffer, task.offset, function(err, written) {
|
|
513542
514022
|
if (err) {
|
|
513543
514023
|
if ("code" in err && err.code === "EAGAIN") {
|
|
513544
514024
|
_this._writeImmediate = setImmediate(function() {
|
|
@@ -514549,12 +515029,12 @@ var exports_skill_creator = {};
|
|
|
514549
515029
|
__export(exports_skill_creator, {
|
|
514550
515030
|
getSessionCreationCount: () => getSessionCreationCount,
|
|
514551
515031
|
createAutoSkill: () => createAutoSkill,
|
|
514552
|
-
_resetForTests: () =>
|
|
515032
|
+
_resetForTests: () => _resetForTests2,
|
|
514553
515033
|
MAX_AUTO_SKILLS_PER_SESSION: () => MAX_AUTO_SKILLS_PER_SESSION
|
|
514554
515034
|
});
|
|
514555
|
-
import * as
|
|
514556
|
-
import { homedir as
|
|
514557
|
-
import * as
|
|
515035
|
+
import * as fs44 from "fs";
|
|
515036
|
+
import { homedir as homedir33 } from "os";
|
|
515037
|
+
import * as path44 from "path";
|
|
514558
515038
|
function createAutoSkill(spec, context3) {
|
|
514559
515039
|
if (createdThisSession >= MAX_AUTO_SKILLS_PER_SESSION) {
|
|
514560
515040
|
return {
|
|
@@ -514572,11 +515052,11 @@ function createAutoSkill(spec, context3) {
|
|
|
514572
515052
|
if (!spec.body || spec.body.trim().length < 30) {
|
|
514573
515053
|
return { ok: false, reason: "body-too-short" };
|
|
514574
515054
|
}
|
|
514575
|
-
const targetDir =
|
|
514576
|
-
if (!targetDir.startsWith(SKILLS_DIR +
|
|
515055
|
+
const targetDir = path44.join(SKILLS_DIR, safeName);
|
|
515056
|
+
if (!targetDir.startsWith(SKILLS_DIR + path44.sep) && targetDir !== SKILLS_DIR) {
|
|
514577
515057
|
return { ok: false, reason: "path-traversal-blocked" };
|
|
514578
515058
|
}
|
|
514579
|
-
if (
|
|
515059
|
+
if (fs44.existsSync(targetDir)) {
|
|
514580
515060
|
return { ok: false, reason: "name-collision" };
|
|
514581
515061
|
}
|
|
514582
515062
|
const frontmatter = [
|
|
@@ -514592,8 +515072,8 @@ function createAutoSkill(spec, context3) {
|
|
|
514592
515072
|
const content = `${frontmatter}${spec.body.trim()}
|
|
514593
515073
|
`;
|
|
514594
515074
|
try {
|
|
514595
|
-
|
|
514596
|
-
|
|
515075
|
+
fs44.mkdirSync(targetDir, { recursive: true });
|
|
515076
|
+
fs44.writeFileSync(path44.join(targetDir, "SKILL.md"), content, "utf-8");
|
|
514597
515077
|
} catch (err) {
|
|
514598
515078
|
return { ok: false, reason: `write-failed: ${err.message}` };
|
|
514599
515079
|
}
|
|
@@ -514602,7 +515082,7 @@ function createAutoSkill(spec, context3) {
|
|
|
514602
515082
|
timestamp: new Date().toISOString(),
|
|
514603
515083
|
sessionId: context3.sessionId,
|
|
514604
515084
|
name: safeName,
|
|
514605
|
-
path:
|
|
515085
|
+
path: path44.join(targetDir, "SKILL.md"),
|
|
514606
515086
|
description: spec.description,
|
|
514607
515087
|
rationale: spec.rationale ?? null,
|
|
514608
515088
|
revert
|
|
@@ -514621,7 +515101,7 @@ function createAutoSkill(spec, context3) {
|
|
|
514621
515101
|
function getSessionCreationCount() {
|
|
514622
515102
|
return createdThisSession;
|
|
514623
515103
|
}
|
|
514624
|
-
function
|
|
515104
|
+
function _resetForTests2() {
|
|
514625
515105
|
createdThisSession = 0;
|
|
514626
515106
|
}
|
|
514627
515107
|
function sanitizeName(raw) {
|
|
@@ -514638,21 +515118,21 @@ function escapeYamlScalar(s3) {
|
|
|
514638
515118
|
}
|
|
514639
515119
|
function appendLog(entry) {
|
|
514640
515120
|
try {
|
|
514641
|
-
|
|
514642
|
-
|
|
515121
|
+
fs44.mkdirSync(path44.dirname(LOG_FILE), { recursive: true });
|
|
515122
|
+
fs44.appendFileSync(LOG_FILE, `${JSON.stringify(entry)}
|
|
514643
515123
|
`, "utf-8");
|
|
514644
515124
|
} catch {}
|
|
514645
515125
|
}
|
|
514646
515126
|
var MAX_AUTO_SKILLS_PER_SESSION = 3, REPO_ROOT, SKILLS_DIR, LOG_FILE, createdThisSession = 0;
|
|
514647
515127
|
var init_skill_creator = __esm(() => {
|
|
514648
|
-
REPO_ROOT =
|
|
514649
|
-
SKILLS_DIR =
|
|
514650
|
-
LOG_FILE =
|
|
515128
|
+
REPO_ROOT = path44.resolve(import.meta.dir, "..", "..");
|
|
515129
|
+
SKILLS_DIR = path44.join(REPO_ROOT, "packages", "skills");
|
|
515130
|
+
LOG_FILE = path44.join(homedir33(), ".8gent", "auto-created-skills.jsonl");
|
|
514651
515131
|
});
|
|
514652
515132
|
|
|
514653
515133
|
// packages/ai/tools.ts
|
|
514654
|
-
import * as
|
|
514655
|
-
import * as
|
|
515134
|
+
import * as fs45 from "fs";
|
|
515135
|
+
import * as path45 from "path";
|
|
514656
515136
|
function setToolContext(ctx) {
|
|
514657
515137
|
_ctx = ctx;
|
|
514658
515138
|
}
|
|
@@ -514663,7 +515143,7 @@ function getRuntimeParams() {
|
|
|
514663
515143
|
return _runtime;
|
|
514664
515144
|
}
|
|
514665
515145
|
function resolvePath(p) {
|
|
514666
|
-
return
|
|
515146
|
+
return path45.isAbsolute(p) ? p : path45.join(_ctx.workingDirectory, p);
|
|
514667
515147
|
}
|
|
514668
515148
|
async function runShellCommand(command) {
|
|
514669
515149
|
const { getPermissionManager: getPermissionManager3, isCommandDangerous: isCommandDangerous2 } = await Promise.resolve().then(() => (init_permissions(), exports_permissions));
|
|
@@ -514831,7 +515311,8 @@ var init_tools2 = __esm(() => {
|
|
|
514831
515311
|
systemPromptLength: 0,
|
|
514832
515312
|
messageHistoryLength: 0,
|
|
514833
515313
|
stepCount: 0,
|
|
514834
|
-
appendedContext: []
|
|
515314
|
+
appendedContext: [],
|
|
515315
|
+
voiceChatActive: false
|
|
514835
515316
|
};
|
|
514836
515317
|
_runtime = { ...DEFAULT_RUNTIME };
|
|
514837
515318
|
getOutline = tool({
|
|
@@ -514842,7 +515323,7 @@ var init_tools2 = __esm(() => {
|
|
|
514842
515323
|
execute: async ({ filePath }) => {
|
|
514843
515324
|
const { parseTypeScriptFile: parseTypeScriptFile2 } = await Promise.resolve().then(() => (init_typescript_parser(), exports_typescript_parser));
|
|
514844
515325
|
const absolutePath = resolvePath(filePath);
|
|
514845
|
-
if (!
|
|
515326
|
+
if (!fs45.existsSync(absolutePath))
|
|
514846
515327
|
return `File not found: ${absolutePath}`;
|
|
514847
515328
|
try {
|
|
514848
515329
|
const outline = parseTypeScriptFile2(absolutePath);
|
|
@@ -514876,7 +515357,7 @@ var init_tools2 = __esm(() => {
|
|
|
514876
515357
|
const filePath = symbolId.slice(0, separatorIndex);
|
|
514877
515358
|
const symbolName = symbolId.slice(separatorIndex + 2);
|
|
514878
515359
|
const absolutePath = resolvePath(filePath);
|
|
514879
|
-
if (!
|
|
515360
|
+
if (!fs45.existsSync(absolutePath))
|
|
514880
515361
|
return `File not found: ${absolutePath}`;
|
|
514881
515362
|
try {
|
|
514882
515363
|
const outline = parseTypeScriptFile2(absolutePath);
|
|
@@ -514919,7 +515400,7 @@ ${source}`;
|
|
|
514919
515400
|
matches.push({
|
|
514920
515401
|
name: symbol21.name,
|
|
514921
515402
|
kind: symbol21.kind,
|
|
514922
|
-
file:
|
|
515403
|
+
file: path45.relative(_ctx.workingDirectory, file2),
|
|
514923
515404
|
line: symbol21.startLine
|
|
514924
515405
|
});
|
|
514925
515406
|
}
|
|
@@ -514940,9 +515421,9 @@ ${source}`;
|
|
|
514940
515421
|
}),
|
|
514941
515422
|
execute: async ({ path: filePath }) => {
|
|
514942
515423
|
const absolutePath = resolvePath(filePath);
|
|
514943
|
-
if (!
|
|
515424
|
+
if (!fs45.existsSync(absolutePath))
|
|
514944
515425
|
return `File not found: ${absolutePath}`;
|
|
514945
|
-
const content =
|
|
515426
|
+
const content = fs45.readFileSync(absolutePath, "utf-8");
|
|
514946
515427
|
const lines = content.split(`
|
|
514947
515428
|
`);
|
|
514948
515429
|
if (lines.length > 200) {
|
|
@@ -514964,10 +515445,10 @@ ${lines.slice(0, 200).join(`
|
|
|
514964
515445
|
}),
|
|
514965
515446
|
execute: async ({ path: filePath, content }) => {
|
|
514966
515447
|
const absolutePath = resolvePath(filePath);
|
|
514967
|
-
const dir =
|
|
514968
|
-
if (!
|
|
514969
|
-
|
|
514970
|
-
|
|
515448
|
+
const dir = path45.dirname(absolutePath);
|
|
515449
|
+
if (!fs45.existsSync(dir))
|
|
515450
|
+
fs45.mkdirSync(dir, { recursive: true });
|
|
515451
|
+
fs45.writeFileSync(absolutePath, content);
|
|
514971
515452
|
return `File written: ${absolutePath}`;
|
|
514972
515453
|
}
|
|
514973
515454
|
});
|
|
@@ -514980,12 +515461,12 @@ ${lines.slice(0, 200).join(`
|
|
|
514980
515461
|
}),
|
|
514981
515462
|
execute: async ({ path: filePath, oldText, newText }) => {
|
|
514982
515463
|
const absolutePath = resolvePath(filePath);
|
|
514983
|
-
if (!
|
|
515464
|
+
if (!fs45.existsSync(absolutePath))
|
|
514984
515465
|
return `File not found: ${absolutePath}`;
|
|
514985
|
-
const content =
|
|
515466
|
+
const content = fs45.readFileSync(absolutePath, "utf-8");
|
|
514986
515467
|
if (!content.includes(oldText))
|
|
514987
515468
|
return `Error: Could not find the text to replace in ${filePath}. Make sure oldText matches exactly.`;
|
|
514988
|
-
|
|
515469
|
+
fs45.writeFileSync(absolutePath, content.replace(oldText, newText));
|
|
514989
515470
|
return `File edited: ${absolutePath}
|
|
514990
515471
|
Replaced ${oldText.length} chars with ${newText.length} chars.`;
|
|
514991
515472
|
}
|
|
@@ -515007,7 +515488,7 @@ Replaced ${oldText.length} chars with ${newText.length} chars.`;
|
|
|
515007
515488
|
const results = [];
|
|
515008
515489
|
for (const f3 of files.slice(0, 100)) {
|
|
515009
515490
|
try {
|
|
515010
|
-
const s3 = await fsStat(
|
|
515491
|
+
const s3 = await fsStat(path45.join(absolutePath, f3));
|
|
515011
515492
|
results.push(s3.isDirectory() ? `${f3}/` : f3);
|
|
515012
515493
|
} catch {
|
|
515013
515494
|
results.push(f3);
|
|
@@ -515746,16 +516227,16 @@ ${changes.slice(0, 1000)}`;
|
|
|
515746
516227
|
append: exports_external.boolean().optional().describe("If true, appends to existing note with same title instead of creating new")
|
|
515747
516228
|
}),
|
|
515748
516229
|
execute: async ({ title, content, append: append3 }) => {
|
|
515749
|
-
const { existsSync:
|
|
515750
|
-
const { join:
|
|
515751
|
-
const dataDir =
|
|
515752
|
-
const filepath =
|
|
515753
|
-
if (!
|
|
515754
|
-
|
|
516230
|
+
const { existsSync: existsSync57, mkdirSync: mkdirSync39, readFileSync: readFileSync47, writeFileSync: writeFileSync30 } = await import("fs");
|
|
516231
|
+
const { join: join62 } = await import("path");
|
|
516232
|
+
const dataDir = join62(process.env.HOME || "~", ".8gent", "tabs");
|
|
516233
|
+
const filepath = join62(dataDir, "notes.json");
|
|
516234
|
+
if (!existsSync57(dataDir))
|
|
516235
|
+
mkdirSync39(dataDir, { recursive: true });
|
|
515755
516236
|
let notes = [];
|
|
515756
516237
|
try {
|
|
515757
|
-
if (
|
|
515758
|
-
const raw = JSON.parse(
|
|
516238
|
+
if (existsSync57(filepath)) {
|
|
516239
|
+
const raw = JSON.parse(readFileSync47(filepath, "utf-8"));
|
|
515759
516240
|
notes = raw.notes || [];
|
|
515760
516241
|
}
|
|
515761
516242
|
} catch {}
|
|
@@ -515785,7 +516266,7 @@ ${content}`;
|
|
|
515785
516266
|
updatedAt: now2
|
|
515786
516267
|
});
|
|
515787
516268
|
}
|
|
515788
|
-
|
|
516269
|
+
writeFileSync30(filepath, JSON.stringify({ notes }, null, 2));
|
|
515789
516270
|
return { ok: true, noteCount: notes.length, title };
|
|
515790
516271
|
}
|
|
515791
516272
|
});
|
|
@@ -517580,6 +518061,43 @@ var init_vision_interpreter = __esm(() => {
|
|
|
517580
518061
|
init_vision_router();
|
|
517581
518062
|
});
|
|
517582
518063
|
|
|
518064
|
+
// packages/eight/auto-tune.ts
|
|
518065
|
+
function computeAutoTune(settings) {
|
|
518066
|
+
return {
|
|
518067
|
+
liteMode: resolveLiteMode(settings.performance.mode),
|
|
518068
|
+
showIntro: resolveIntroBanner(settings.performance.introBanner),
|
|
518069
|
+
voiceSilenceMs: settings.voice.silenceThresholdMs
|
|
518070
|
+
};
|
|
518071
|
+
}
|
|
518072
|
+
function resolveLiteMode(mode) {
|
|
518073
|
+
if (mode === "lite")
|
|
518074
|
+
return true;
|
|
518075
|
+
if (mode === "full")
|
|
518076
|
+
return false;
|
|
518077
|
+
if (process.env.CI === "true")
|
|
518078
|
+
return true;
|
|
518079
|
+
if (!process.stdout.isTTY)
|
|
518080
|
+
return true;
|
|
518081
|
+
if (process.env["8GENT_LITE"] === "1")
|
|
518082
|
+
return true;
|
|
518083
|
+
if (process.env["8GENT_FULL"] === "1")
|
|
518084
|
+
return false;
|
|
518085
|
+
return false;
|
|
518086
|
+
}
|
|
518087
|
+
function resolveIntroBanner(introBanner) {
|
|
518088
|
+
if (introBanner === "on")
|
|
518089
|
+
return true;
|
|
518090
|
+
if (introBanner === "off")
|
|
518091
|
+
return false;
|
|
518092
|
+
if (!process.stdout.isTTY)
|
|
518093
|
+
return false;
|
|
518094
|
+
if (process.env["8GENT_NO_INTRO"] === "1")
|
|
518095
|
+
return false;
|
|
518096
|
+
if (process.env["8GENT_LITE"] === "1")
|
|
518097
|
+
return false;
|
|
518098
|
+
return true;
|
|
518099
|
+
}
|
|
518100
|
+
|
|
517583
518101
|
// packages/proactive/opportunity-scanner.ts
|
|
517584
518102
|
var init_opportunity_scanner = () => {};
|
|
517585
518103
|
|
|
@@ -517587,19 +518105,19 @@ var init_opportunity_scanner = () => {};
|
|
|
517587
518105
|
var init_capability_matcher = () => {};
|
|
517588
518106
|
|
|
517589
518107
|
// packages/proactive/work-tracker.ts
|
|
517590
|
-
import { join as
|
|
518108
|
+
import { join as join62 } from "path";
|
|
517591
518109
|
var DATA_DIR2, STORE_PATH;
|
|
517592
518110
|
var init_work_tracker = __esm(() => {
|
|
517593
|
-
DATA_DIR2 =
|
|
517594
|
-
STORE_PATH =
|
|
518111
|
+
DATA_DIR2 = join62(process.env.HOME || "~", ".8gent");
|
|
518112
|
+
STORE_PATH = join62(DATA_DIR2, "opportunities.json");
|
|
517595
518113
|
});
|
|
517596
518114
|
|
|
517597
518115
|
// packages/proactive/revenue-engine.ts
|
|
517598
|
-
import { join as
|
|
518116
|
+
import { join as join63 } from "path";
|
|
517599
518117
|
var DATA_DIR3, STORE_PATH2;
|
|
517600
518118
|
var init_revenue_engine = __esm(() => {
|
|
517601
|
-
DATA_DIR3 =
|
|
517602
|
-
STORE_PATH2 =
|
|
518119
|
+
DATA_DIR3 = join63(process.env.HOME || "~", ".8gent");
|
|
518120
|
+
STORE_PATH2 = join63(DATA_DIR3, "revenue.json");
|
|
517603
518121
|
});
|
|
517604
518122
|
|
|
517605
518123
|
// packages/proactive/deliverable-generator.ts
|
|
@@ -517612,11 +518130,11 @@ var init_client_outreach = () => {};
|
|
|
517612
518130
|
var init_content_packaging = () => {};
|
|
517613
518131
|
|
|
517614
518132
|
// packages/tools/browser/cache.ts
|
|
517615
|
-
import { homedir as
|
|
517616
|
-
import { join as
|
|
518133
|
+
import { homedir as homedir34 } from "os";
|
|
518134
|
+
import { join as join64 } from "path";
|
|
517617
518135
|
var CACHE_DIR, TTL_MS, MAX_CACHE_BYTES;
|
|
517618
518136
|
var init_cache2 = __esm(() => {
|
|
517619
|
-
CACHE_DIR =
|
|
518137
|
+
CACHE_DIR = join64(process.env.EIGHT_DATA_DIR || join64(homedir34(), ".8gent"), "browser-cache");
|
|
517620
518138
|
TTL_MS = 60 * 60 * 1000;
|
|
517621
518139
|
MAX_CACHE_BYTES = 100 * 1024 * 1024;
|
|
517622
518140
|
});
|
|
@@ -518266,7 +518784,7 @@ class Voice {
|
|
|
518266
518784
|
}
|
|
518267
518785
|
}
|
|
518268
518786
|
var PERSONALITY, GREETINGS, COMPLETION_PHRASES, ERROR_PHRASES, IDLE_QUIPS, THINKING_PHRASES, PROGRESS_PHRASES, voice;
|
|
518269
|
-
var
|
|
518787
|
+
var init_voice3 = __esm(() => {
|
|
518270
518788
|
PERSONALITY = {
|
|
518271
518789
|
name: "8gent",
|
|
518272
518790
|
tagline: "The Infinite Gentleman",
|
|
@@ -519236,8 +519754,8 @@ function createOpenAICompatible(options) {
|
|
|
519236
519754
|
const getHeaders = () => withUserAgentSuffix(headers, `ai-sdk/openai-compatible/${VERSION4}`);
|
|
519237
519755
|
const getCommonModelConfig = (modelType) => ({
|
|
519238
519756
|
provider: `${providerName}.${modelType}`,
|
|
519239
|
-
url: ({ path:
|
|
519240
|
-
const url2 = new URL(`${baseURL}${
|
|
519757
|
+
url: ({ path: path46 }) => {
|
|
519758
|
+
const url2 = new URL(`${baseURL}${path46}`);
|
|
519241
519759
|
if (options.queryParams) {
|
|
519242
519760
|
url2.search = new URLSearchParams(options.queryParams).toString();
|
|
519243
519761
|
}
|
|
@@ -520496,14 +521014,14 @@ var init_agent = __esm(() => {
|
|
|
520496
521014
|
});
|
|
520497
521015
|
|
|
520498
521016
|
// packages/ai/task-router.ts
|
|
520499
|
-
import { join as
|
|
521017
|
+
import { join as join65 } from "path";
|
|
520500
521018
|
var CONFIG_DIR2, ROUTER_CONFIG_PATH, ROUTER_STATS_PATH, ClassificationSchema;
|
|
520501
521019
|
var init_task_router = __esm(() => {
|
|
520502
521020
|
init_zod();
|
|
520503
521021
|
init_providers2();
|
|
520504
|
-
CONFIG_DIR2 =
|
|
520505
|
-
ROUTER_CONFIG_PATH =
|
|
520506
|
-
ROUTER_STATS_PATH =
|
|
521022
|
+
CONFIG_DIR2 = join65(process.env.HOME || "~", ".8gent");
|
|
521023
|
+
ROUTER_CONFIG_PATH = join65(CONFIG_DIR2, "router.json");
|
|
521024
|
+
ROUTER_STATS_PATH = join65(CONFIG_DIR2, "router-stats.json");
|
|
520507
521025
|
ClassificationSchema = exports_external.object({
|
|
520508
521026
|
category: exports_external.enum(["code", "reasoning", "simple", "creative"]).describe("Task category: code (write/edit/debug code, fix errors, implement features), " + "reasoning (complex logic, planning, architecture, multi-step analysis), " + "simple (quick answers, explanations, short chat, factual questions), " + "creative (writing, naming, brainstorming, design ideas)"),
|
|
520509
521027
|
confidence: exports_external.number().min(0).max(1).describe("How confident you are in this classification (0-1)"),
|
|
@@ -520517,11 +521035,11 @@ var init_toolshed_bridge = __esm(() => {
|
|
|
520517
521035
|
});
|
|
520518
521036
|
|
|
520519
521037
|
// packages/ai/embedding-cache.ts
|
|
520520
|
-
import { join as
|
|
521038
|
+
import { join as join66 } from "path";
|
|
520521
521039
|
var CACHE_DIR2, CACHE_PATH;
|
|
520522
521040
|
var init_embedding_cache = __esm(() => {
|
|
520523
|
-
CACHE_DIR2 =
|
|
520524
|
-
CACHE_PATH =
|
|
521041
|
+
CACHE_DIR2 = join66(process.env.HOME || "~", ".8gent");
|
|
521042
|
+
CACHE_PATH = join66(CACHE_DIR2, "embedding-cache.json");
|
|
520525
521043
|
});
|
|
520526
521044
|
|
|
520527
521045
|
// packages/ai/edge-inference.ts
|
|
@@ -520543,12 +521061,40 @@ var init_ai = __esm(() => {
|
|
|
520543
521061
|
init_embedding_cache();
|
|
520544
521062
|
});
|
|
520545
521063
|
|
|
521064
|
+
// packages/eight/visualiser-bridge.ts
|
|
521065
|
+
var exports_visualiser_bridge = {};
|
|
521066
|
+
__export(exports_visualiser_bridge, {
|
|
521067
|
+
setVisualiserTokenSink: () => setVisualiserTokenSink,
|
|
521068
|
+
notifyVisualiserToken: () => notifyVisualiserToken,
|
|
521069
|
+
_hasSink: () => _hasSink
|
|
521070
|
+
});
|
|
521071
|
+
function setVisualiserTokenSink(next2) {
|
|
521072
|
+
sink = next2;
|
|
521073
|
+
}
|
|
521074
|
+
function notifyVisualiserToken(text4) {
|
|
521075
|
+
if (!sink || !text4)
|
|
521076
|
+
return;
|
|
521077
|
+
const parts = text4.split(/\s+/).filter(Boolean).slice(0, 24);
|
|
521078
|
+
for (const part of parts) {
|
|
521079
|
+
try {
|
|
521080
|
+
sink(part);
|
|
521081
|
+
} catch {}
|
|
521082
|
+
}
|
|
521083
|
+
}
|
|
521084
|
+
function _hasSink() {
|
|
521085
|
+
return sink !== null;
|
|
521086
|
+
}
|
|
521087
|
+
var sink = null;
|
|
521088
|
+
|
|
520546
521089
|
// packages/eight/agent.ts
|
|
520547
521090
|
var exports_agent = {};
|
|
520548
521091
|
__export(exports_agent, {
|
|
520549
521092
|
Agent: () => Agent
|
|
520550
521093
|
});
|
|
520551
521094
|
import * as crypto8 from "crypto";
|
|
521095
|
+
import * as fs46 from "fs";
|
|
521096
|
+
import * as os31 from "os";
|
|
521097
|
+
import * as path46 from "path";
|
|
520552
521098
|
|
|
520553
521099
|
class Agent {
|
|
520554
521100
|
executor;
|
|
@@ -520588,7 +521134,8 @@ class Agent {
|
|
|
520588
521134
|
this.hookManager = getHookManager();
|
|
520589
521135
|
this.sessionId = `session_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
520590
521136
|
this.sessionStartTime = Date.now();
|
|
520591
|
-
const
|
|
521137
|
+
const autoTuneSettings = readSettingsFileSync();
|
|
521138
|
+
const LITE = autoTuneSettings !== null ? computeAutoTune(autoTuneSettings).liteMode : process.env["8GENT_LITE"] === "0" || process.env["8GENT_FULL"] === "1" ? false : true;
|
|
520592
521139
|
this.hookManager.setWorkingDirectory(config2.workingDirectory || process.cwd());
|
|
520593
521140
|
setToolContext({
|
|
520594
521141
|
workingDirectory: config2.workingDirectory || process.cwd()
|
|
@@ -520598,7 +521145,9 @@ class Agent {
|
|
|
520598
521145
|
const cwd = config2.workingDirectory || process.cwd();
|
|
520599
521146
|
if (!LITE) {
|
|
520600
521147
|
indexFolder(cwd).then((index2) => {
|
|
520601
|
-
|
|
521148
|
+
if (process.env.DEBUG === "1") {
|
|
521149
|
+
console.log(`[AST] Indexed ${index2.fileCount} files, ${index2.symbolCount} symbols`);
|
|
521150
|
+
}
|
|
520602
521151
|
}).catch(() => {});
|
|
520603
521152
|
}
|
|
520604
521153
|
this.planner = getProactivePlanner();
|
|
@@ -520608,7 +521157,9 @@ class Agent {
|
|
|
520608
521157
|
this.onboarding = new OnboardingManager(config2.workingDirectory || process.cwd());
|
|
520609
521158
|
if (this.onboarding.needsOnboarding()) {
|
|
520610
521159
|
this.onboarding.detectIntegrations().catch(() => {});
|
|
520611
|
-
|
|
521160
|
+
if (process.env.DEBUG === "1") {
|
|
521161
|
+
console.log("[8gent] First run detected - onboarding available. The agent can ask setup questions.");
|
|
521162
|
+
}
|
|
520612
521163
|
}
|
|
520613
521164
|
const basePrompt = config2.systemPrompt || DEFAULT_SYSTEM_PROMPT;
|
|
520614
521165
|
const languageInstruction = this.getLanguageInstruction();
|
|
@@ -520723,7 +521274,9 @@ ${buildToolCatalogSegment({ concise: true })}`;
|
|
|
520723
521274
|
startTelegramBot(telegramToken, this, {
|
|
520724
521275
|
allowedUsers: chatId ? [Number.parseInt(chatId, 10)] : undefined
|
|
520725
521276
|
}).catch((err) => {
|
|
520726
|
-
|
|
521277
|
+
if (process.env.DEBUG === "1") {
|
|
521278
|
+
console.log(`[8gent] Telegram auto-start failed: ${err.message}`);
|
|
521279
|
+
}
|
|
520727
521280
|
});
|
|
520728
521281
|
}
|
|
520729
521282
|
}
|
|
@@ -520735,10 +521288,14 @@ ${buildToolCatalogSegment({ concise: true })}`;
|
|
|
520735
521288
|
for (const [name21, fn] of Object.entries(extTools)) {
|
|
520736
521289
|
this.toolRegistry.registerExternalTool(name21, fn);
|
|
520737
521290
|
}
|
|
520738
|
-
|
|
521291
|
+
if (process.env.DEBUG === "1") {
|
|
521292
|
+
console.log(`[ext] ${loaded.length} extension(s), ${Object.keys(extTools).length} tool(s) registered`);
|
|
521293
|
+
}
|
|
520739
521294
|
}
|
|
520740
521295
|
}).catch((err) => {
|
|
520741
|
-
|
|
521296
|
+
if (process.env.DEBUG === "1") {
|
|
521297
|
+
console.log(`[ext] Extension loading failed: ${err}`);
|
|
521298
|
+
}
|
|
520742
521299
|
});
|
|
520743
521300
|
}
|
|
520744
521301
|
async chat(userMessage, imageBase64, imageMimeType) {
|
|
@@ -520873,6 +521430,12 @@ Ask the user naturally \u2014 don't mention this system instruction. After they
|
|
|
520873
521430
|
## Agent Self-Appended Context
|
|
520874
521431
|
${tunedParams.appendedContext.map((c3, i4) => `[${i4 + 1}] ${c3}`).join(`
|
|
520875
521432
|
`)}`;
|
|
521433
|
+
}
|
|
521434
|
+
if (tunedParams.voiceChatActive) {
|
|
521435
|
+
effectiveInstructions += `
|
|
521436
|
+
|
|
521437
|
+
## Voice Chat Mode (active)
|
|
521438
|
+
You are in a real-time voice conversation. The user is speaking to you; their words arrive as transcribed text (STT). Your written replies are spoken back to them via text-to-speech (TTS). You are NOT a text-only interface \u2014 you can hear them and they can hear you. Speak conversationally as if on a phone call. Do not apologise for being text-only or claim you cannot hear them \u2014 you can. Keep replies concise and natural since they will be spoken aloud. Avoid heavy markdown, code blocks, or long URLs \u2014 they don't read well in TTS.`;
|
|
520876
521439
|
}
|
|
520877
521440
|
let agentConfig = {
|
|
520878
521441
|
provider: providerConfig,
|
|
@@ -521054,6 +521617,10 @@ Do NOT repeat the same fix again.`
|
|
|
521054
521617
|
stepCount,
|
|
521055
521618
|
messageHistoryLength: this.messageHistory.length
|
|
521056
521619
|
});
|
|
521620
|
+
try {
|
|
521621
|
+
const { notifyVisualiserToken: notifyVisualiserToken2 } = await Promise.resolve().then(() => exports_visualiser_bridge);
|
|
521622
|
+
notifyVisualiserToken2(event.text);
|
|
521623
|
+
} catch {}
|
|
521057
521624
|
this.events.onStepFinish?.({
|
|
521058
521625
|
stepNumber: event.stepNumber,
|
|
521059
521626
|
finishReason: event.finishReason,
|
|
@@ -521475,11 +522042,11 @@ ${summary || " (no provider errors recorded)"}`);
|
|
|
521475
522042
|
}
|
|
521476
522043
|
_readSyncToConvex() {
|
|
521477
522044
|
try {
|
|
521478
|
-
const
|
|
521479
|
-
const
|
|
522045
|
+
const fs47 = __require("fs");
|
|
522046
|
+
const path47 = __require("path");
|
|
521480
522047
|
const cwd = this.config.workingDirectory || process.cwd();
|
|
521481
|
-
const configPath =
|
|
521482
|
-
const raw =
|
|
522048
|
+
const configPath = path47.join(cwd, ".8gent", "config.json");
|
|
522049
|
+
const raw = fs47.readFileSync(configPath, "utf-8");
|
|
521483
522050
|
const config2 = JSON.parse(raw);
|
|
521484
522051
|
if (typeof config2.syncToConvex === "boolean")
|
|
521485
522052
|
return config2.syncToConvex;
|
|
@@ -521529,6 +522096,21 @@ ${summary || " (no provider errors recorded)"}`);
|
|
|
521529
522096
|
await manager.stopAll();
|
|
521530
522097
|
}
|
|
521531
522098
|
}
|
|
522099
|
+
function readSettingsFileSync() {
|
|
522100
|
+
try {
|
|
522101
|
+
const file2 = path46.join(os31.homedir(), ".8gent", "settings.json");
|
|
522102
|
+
if (!fs46.existsSync(file2))
|
|
522103
|
+
return null;
|
|
522104
|
+
const raw = fs46.readFileSync(file2, "utf8");
|
|
522105
|
+
const parsed = JSON.parse(raw);
|
|
522106
|
+
if (parsed && typeof parsed === "object" && parsed.performance && typeof parsed.performance.mode === "string" && typeof parsed.performance.introBanner === "string" && parsed.voice && typeof parsed.voice.silenceThresholdMs === "number") {
|
|
522107
|
+
return parsed;
|
|
522108
|
+
}
|
|
522109
|
+
return null;
|
|
522110
|
+
} catch {
|
|
522111
|
+
return null;
|
|
522112
|
+
}
|
|
522113
|
+
}
|
|
521532
522114
|
var init_agent2 = __esm(() => {
|
|
521533
522115
|
init_ast_index();
|
|
521534
522116
|
init_extensions();
|
|
@@ -521556,7 +522138,7 @@ var init_agent2 = __esm(() => {
|
|
|
521556
522138
|
init_vision_interpreter();
|
|
521557
522139
|
init_proactive();
|
|
521558
522140
|
init_brand();
|
|
521559
|
-
|
|
522141
|
+
init_voice3();
|
|
521560
522142
|
init_workflow();
|
|
521561
522143
|
init_ai();
|
|
521562
522144
|
});
|
|
@@ -521732,8 +522314,8 @@ __export(exports_cli, {
|
|
|
521732
522314
|
runCLI: () => runCLI,
|
|
521733
522315
|
parseCLIArgs: () => parseCLIArgs
|
|
521734
522316
|
});
|
|
521735
|
-
import * as
|
|
521736
|
-
import * as
|
|
522317
|
+
import * as fs47 from "fs";
|
|
522318
|
+
import * as path47 from "path";
|
|
521737
522319
|
function parseCLIArgs(args) {
|
|
521738
522320
|
if (!args.includes("--cli"))
|
|
521739
522321
|
return null;
|
|
@@ -521788,11 +522370,11 @@ function extractCode(text4) {
|
|
|
521788
522370
|
return null;
|
|
521789
522371
|
}
|
|
521790
522372
|
function writeOutput(filePath, content) {
|
|
521791
|
-
const existed =
|
|
521792
|
-
const dir =
|
|
521793
|
-
if (!
|
|
521794
|
-
|
|
521795
|
-
|
|
522373
|
+
const existed = fs47.existsSync(filePath);
|
|
522374
|
+
const dir = path47.dirname(filePath);
|
|
522375
|
+
if (!fs47.existsSync(dir))
|
|
522376
|
+
fs47.mkdirSync(dir, { recursive: true });
|
|
522377
|
+
fs47.writeFileSync(filePath, content, "utf-8");
|
|
521796
522378
|
if (existed) {
|
|
521797
522379
|
filesModified.push(filePath);
|
|
521798
522380
|
} else {
|
|
@@ -521879,14 +522461,14 @@ __export(exports_session_manager, {
|
|
|
521879
522461
|
SessionManager: () => SessionManager
|
|
521880
522462
|
});
|
|
521881
522463
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
521882
|
-
import * as
|
|
521883
|
-
import * as
|
|
522464
|
+
import * as fs48 from "fs";
|
|
522465
|
+
import * as path48 from "path";
|
|
521884
522466
|
|
|
521885
522467
|
class SessionManager {
|
|
521886
522468
|
dir;
|
|
521887
522469
|
constructor(dataDir) {
|
|
521888
|
-
this.dir = dataDir ||
|
|
521889
|
-
|
|
522470
|
+
this.dir = dataDir || path48.join(process.env.HOME || "~", ".8gent", "sessions");
|
|
522471
|
+
fs48.mkdirSync(this.dir, { recursive: true });
|
|
521890
522472
|
}
|
|
521891
522473
|
create(opts) {
|
|
521892
522474
|
const now2 = new Date().toISOString();
|
|
@@ -521946,14 +522528,14 @@ class SessionManager {
|
|
|
521946
522528
|
this.write(id, file2);
|
|
521947
522529
|
}
|
|
521948
522530
|
filePath(id) {
|
|
521949
|
-
return
|
|
522531
|
+
return path48.join(this.dir, `${id}.json`);
|
|
521950
522532
|
}
|
|
521951
522533
|
write(id, data2) {
|
|
521952
|
-
|
|
522534
|
+
fs48.writeFileSync(this.filePath(id), JSON.stringify(data2, null, 2));
|
|
521953
522535
|
}
|
|
521954
522536
|
readFile(id) {
|
|
521955
522537
|
try {
|
|
521956
|
-
const raw =
|
|
522538
|
+
const raw = fs48.readFileSync(this.filePath(id), "utf-8");
|
|
521957
522539
|
return JSON.parse(raw);
|
|
521958
522540
|
} catch {
|
|
521959
522541
|
return null;
|
|
@@ -521961,11 +522543,11 @@ class SessionManager {
|
|
|
521961
522543
|
}
|
|
521962
522544
|
listAll() {
|
|
521963
522545
|
try {
|
|
521964
|
-
const files =
|
|
522546
|
+
const files = fs48.readdirSync(this.dir).filter((f3) => f3.endsWith(".json"));
|
|
521965
522547
|
const sessions2 = [];
|
|
521966
522548
|
for (const f3 of files) {
|
|
521967
522549
|
try {
|
|
521968
|
-
const raw =
|
|
522550
|
+
const raw = fs48.readFileSync(path48.join(this.dir, f3), "utf-8");
|
|
521969
522551
|
const parsed = JSON.parse(raw);
|
|
521970
522552
|
const { messages: _4, ...info3 } = parsed;
|
|
521971
522553
|
sessions2.push(info3);
|
|
@@ -522268,8 +522850,8 @@ __export(exports_companion, {
|
|
|
522268
522850
|
formatDeckSummary: () => formatDeckSummary,
|
|
522269
522851
|
endSession: () => endSession
|
|
522270
522852
|
});
|
|
522271
|
-
import { existsSync as
|
|
522272
|
-
import { join as
|
|
522853
|
+
import { existsSync as existsSync59, mkdirSync as mkdirSync41, readFileSync as readFileSync49, writeFileSync as writeFileSync32 } from "fs";
|
|
522854
|
+
import { join as join69 } from "path";
|
|
522273
522855
|
function seedRng(seed) {
|
|
522274
522856
|
let h2 = 0;
|
|
522275
522857
|
for (let i4 = 0;i4 < seed.length; i4++) {
|
|
@@ -522407,13 +522989,13 @@ function generateCompanion(sessionId) {
|
|
|
522407
522989
|
}
|
|
522408
522990
|
function getDeckPath() {
|
|
522409
522991
|
const home = process.env.HOME || process.env.USERPROFILE || "~";
|
|
522410
|
-
return
|
|
522992
|
+
return join69(home, ".8gent", "companion-deck.json");
|
|
522411
522993
|
}
|
|
522412
522994
|
function loadDeck() {
|
|
522413
522995
|
const deckPath = getDeckPath();
|
|
522414
522996
|
try {
|
|
522415
|
-
if (
|
|
522416
|
-
return JSON.parse(
|
|
522997
|
+
if (existsSync59(deckPath)) {
|
|
522998
|
+
return JSON.parse(readFileSync49(deckPath, "utf-8"));
|
|
522417
522999
|
}
|
|
522418
523000
|
} catch {}
|
|
522419
523001
|
return {
|
|
@@ -522430,9 +523012,9 @@ function loadDeck() {
|
|
|
522430
523012
|
}
|
|
522431
523013
|
function saveDeck(deck) {
|
|
522432
523014
|
const deckPath = getDeckPath();
|
|
522433
|
-
const dir =
|
|
522434
|
-
|
|
522435
|
-
|
|
523015
|
+
const dir = join69(process.env.HOME || "~", ".8gent");
|
|
523016
|
+
mkdirSync41(dir, { recursive: true });
|
|
523017
|
+
writeFileSync32(deckPath, JSON.stringify(deck, null, 2));
|
|
522436
523018
|
}
|
|
522437
523019
|
function registerCompanion(sessionId, companion, model) {
|
|
522438
523020
|
const deck = loadDeck();
|
|
@@ -524716,9 +525298,9 @@ function formatDeviceFlowStatus(state) {
|
|
|
524716
525298
|
|
|
524717
525299
|
// packages/auth/github.ts
|
|
524718
525300
|
import * as crypto9 from "crypto";
|
|
524719
|
-
import * as
|
|
524720
|
-
import * as
|
|
524721
|
-
import * as
|
|
525301
|
+
import * as fs49 from "fs";
|
|
525302
|
+
import * as os32 from "os";
|
|
525303
|
+
import * as path49 from "path";
|
|
524722
525304
|
async function persistToken(token) {
|
|
524723
525305
|
cachedToken = token;
|
|
524724
525306
|
if (process.platform === "darwin") {
|
|
@@ -524814,10 +525396,10 @@ async function runSecurity(args) {
|
|
|
524814
525396
|
}
|
|
524815
525397
|
}
|
|
524816
525398
|
function getFilePath() {
|
|
524817
|
-
return
|
|
525399
|
+
return path49.join(os32.homedir(), ".8gent", GITHUB_TOKEN_FILE);
|
|
524818
525400
|
}
|
|
524819
525401
|
function deriveKey2() {
|
|
524820
|
-
const fingerprint = `${
|
|
525402
|
+
const fingerprint = `${os32.hostname()}:${os32.userInfo().username}`;
|
|
524821
525403
|
return crypto9.pbkdf2Sync(fingerprint, GITHUB_KEY_SALT, 1e5, 32, "sha256");
|
|
524822
525404
|
}
|
|
524823
525405
|
function fileStore(token) {
|
|
@@ -524834,17 +525416,17 @@ function fileStore(token) {
|
|
|
524834
525416
|
ciphertext
|
|
524835
525417
|
};
|
|
524836
525418
|
const filePath = getFilePath();
|
|
524837
|
-
const dir =
|
|
524838
|
-
if (!
|
|
524839
|
-
|
|
524840
|
-
|
|
525419
|
+
const dir = path49.dirname(filePath);
|
|
525420
|
+
if (!fs49.existsSync(dir))
|
|
525421
|
+
fs49.mkdirSync(dir, { recursive: true });
|
|
525422
|
+
fs49.writeFileSync(filePath, JSON.stringify(envelope), { mode: 384 });
|
|
524841
525423
|
}
|
|
524842
525424
|
function fileRetrieve() {
|
|
524843
525425
|
const filePath = getFilePath();
|
|
524844
|
-
if (!
|
|
525426
|
+
if (!fs49.existsSync(filePath))
|
|
524845
525427
|
return null;
|
|
524846
525428
|
try {
|
|
524847
|
-
const raw =
|
|
525429
|
+
const raw = fs49.readFileSync(filePath, "utf-8");
|
|
524848
525430
|
const envelope = JSON.parse(raw);
|
|
524849
525431
|
if (envelope.version !== 1)
|
|
524850
525432
|
return null;
|
|
@@ -524861,8 +525443,8 @@ function fileRetrieve() {
|
|
|
524861
525443
|
}
|
|
524862
525444
|
function fileClear() {
|
|
524863
525445
|
const filePath = getFilePath();
|
|
524864
|
-
if (
|
|
524865
|
-
|
|
525446
|
+
if (fs49.existsSync(filePath))
|
|
525447
|
+
fs49.unlinkSync(filePath);
|
|
524866
525448
|
}
|
|
524867
525449
|
async function fetchGitHubUser(token) {
|
|
524868
525450
|
try {
|
|
@@ -524969,9 +525551,9 @@ var init_github = __esm(() => {
|
|
|
524969
525551
|
|
|
524970
525552
|
// packages/auth/token-store.ts
|
|
524971
525553
|
import * as crypto10 from "crypto";
|
|
524972
|
-
import * as
|
|
524973
|
-
import * as
|
|
524974
|
-
import * as
|
|
525554
|
+
import * as fs50 from "fs";
|
|
525555
|
+
import * as os33 from "os";
|
|
525556
|
+
import * as path50 from "path";
|
|
524975
525557
|
function getTokenStore() {
|
|
524976
525558
|
if (process.platform === "darwin") {
|
|
524977
525559
|
return new KeychainTokenStore;
|
|
@@ -525071,7 +525653,7 @@ class EncryptedFileTokenStore {
|
|
|
525071
525653
|
filePath;
|
|
525072
525654
|
key;
|
|
525073
525655
|
constructor(filePath) {
|
|
525074
|
-
this.filePath = filePath ??
|
|
525656
|
+
this.filePath = filePath ?? path50.join(os33.homedir(), ".8gent", TOKEN_FILE_NAME);
|
|
525075
525657
|
this.key = this.deriveKey();
|
|
525076
525658
|
}
|
|
525077
525659
|
async store(token) {
|
|
@@ -525087,19 +525669,19 @@ class EncryptedFileTokenStore {
|
|
|
525087
525669
|
tag: tag2.toString("hex"),
|
|
525088
525670
|
ciphertext
|
|
525089
525671
|
};
|
|
525090
|
-
const dir =
|
|
525091
|
-
if (!
|
|
525092
|
-
|
|
525672
|
+
const dir = path50.dirname(this.filePath);
|
|
525673
|
+
if (!fs50.existsSync(dir)) {
|
|
525674
|
+
fs50.mkdirSync(dir, { recursive: true });
|
|
525093
525675
|
}
|
|
525094
|
-
|
|
525676
|
+
fs50.writeFileSync(this.filePath, JSON.stringify(envelope), {
|
|
525095
525677
|
mode: 384
|
|
525096
525678
|
});
|
|
525097
525679
|
}
|
|
525098
525680
|
async retrieve() {
|
|
525099
|
-
if (!
|
|
525681
|
+
if (!fs50.existsSync(this.filePath))
|
|
525100
525682
|
return null;
|
|
525101
525683
|
try {
|
|
525102
|
-
const raw =
|
|
525684
|
+
const raw = fs50.readFileSync(this.filePath, "utf-8");
|
|
525103
525685
|
const envelope = JSON.parse(raw);
|
|
525104
525686
|
if (envelope.version !== 1)
|
|
525105
525687
|
return null;
|
|
@@ -525114,15 +525696,15 @@ class EncryptedFileTokenStore {
|
|
|
525114
525696
|
}
|
|
525115
525697
|
}
|
|
525116
525698
|
async clear() {
|
|
525117
|
-
if (
|
|
525118
|
-
|
|
525699
|
+
if (fs50.existsSync(this.filePath)) {
|
|
525700
|
+
fs50.unlinkSync(this.filePath);
|
|
525119
525701
|
}
|
|
525120
525702
|
}
|
|
525121
525703
|
async exists() {
|
|
525122
|
-
return
|
|
525704
|
+
return fs50.existsSync(this.filePath);
|
|
525123
525705
|
}
|
|
525124
525706
|
deriveKey() {
|
|
525125
|
-
const fingerprint = `${
|
|
525707
|
+
const fingerprint = `${os33.hostname()}:${os33.userInfo().username}`;
|
|
525126
525708
|
return crypto10.pbkdf2Sync(fingerprint, KEY_DERIVATION_SALT, 1e5, 32, "sha256");
|
|
525127
525709
|
}
|
|
525128
525710
|
}
|
|
@@ -525300,8 +525882,8 @@ async function runCLIAuthFlow(webBaseUrl = "https://8gent.app", callbacks, timeo
|
|
|
525300
525882
|
var init_cli_auth_server = () => {};
|
|
525301
525883
|
|
|
525302
525884
|
// packages/auth/github-tools.ts
|
|
525303
|
-
import * as
|
|
525304
|
-
import * as
|
|
525885
|
+
import * as fs51 from "fs";
|
|
525886
|
+
import * as path51 from "path";
|
|
525305
525887
|
function githubHeaders(token) {
|
|
525306
525888
|
return {
|
|
525307
525889
|
Authorization: `Bearer ${token}`,
|
|
@@ -525325,11 +525907,11 @@ async function listRepos(token, opts) {
|
|
|
525325
525907
|
}
|
|
525326
525908
|
async function getCurrentRepoInfo(cwd) {
|
|
525327
525909
|
const dir = cwd ?? process.cwd();
|
|
525328
|
-
const gitConfigPath =
|
|
525329
|
-
if (!
|
|
525910
|
+
const gitConfigPath = path51.join(dir, ".git", "config");
|
|
525911
|
+
if (!fs51.existsSync(gitConfigPath))
|
|
525330
525912
|
return null;
|
|
525331
525913
|
try {
|
|
525332
|
-
const config2 =
|
|
525914
|
+
const config2 = fs51.readFileSync(gitConfigPath, "utf-8");
|
|
525333
525915
|
const remoteMatch = config2.match(/\[remote "origin"\][^[]*url\s*=\s*(.+)/m);
|
|
525334
525916
|
if (!remoteMatch)
|
|
525335
525917
|
return null;
|
|
@@ -525454,13 +526036,13 @@ var init_github_tools = () => {};
|
|
|
525454
526036
|
|
|
525455
526037
|
// packages/auth/proxy-provider.ts
|
|
525456
526038
|
import * as crypto11 from "crypto";
|
|
525457
|
-
import * as
|
|
525458
|
-
import * as
|
|
525459
|
-
import * as
|
|
526039
|
+
import * as fs52 from "fs";
|
|
526040
|
+
import * as os34 from "os";
|
|
526041
|
+
import * as path52 from "path";
|
|
525460
526042
|
function ensureDataDir() {
|
|
525461
|
-
const dir =
|
|
525462
|
-
if (!
|
|
525463
|
-
|
|
526043
|
+
const dir = path52.join(os34.homedir(), ".8gent");
|
|
526044
|
+
if (!fs52.existsSync(dir)) {
|
|
526045
|
+
fs52.mkdirSync(dir, { recursive: true });
|
|
525464
526046
|
}
|
|
525465
526047
|
}
|
|
525466
526048
|
function generateVesselId() {
|
|
@@ -525468,8 +526050,8 @@ function generateVesselId() {
|
|
|
525468
526050
|
}
|
|
525469
526051
|
function loadProxyConfig() {
|
|
525470
526052
|
try {
|
|
525471
|
-
if (
|
|
525472
|
-
const data2 = JSON.parse(
|
|
526053
|
+
if (fs52.existsSync(AUTH_CONFIG_PATH)) {
|
|
526054
|
+
const data2 = JSON.parse(fs52.readFileSync(AUTH_CONFIG_PATH, "utf-8"));
|
|
525473
526055
|
return {
|
|
525474
526056
|
proxyUrl: data2.proxyUrl || DEFAULT_PROXY_URL,
|
|
525475
526057
|
vesselId: data2.vesselId || generateVesselId()
|
|
@@ -525485,7 +526067,7 @@ function loadProxyConfig() {
|
|
|
525485
526067
|
}
|
|
525486
526068
|
function saveProxyConfig(config2) {
|
|
525487
526069
|
ensureDataDir();
|
|
525488
|
-
|
|
526070
|
+
fs52.writeFileSync(AUTH_CONFIG_PATH, JSON.stringify(config2, null, 2), {
|
|
525489
526071
|
mode: 384
|
|
525490
526072
|
});
|
|
525491
526073
|
}
|
|
@@ -525510,7 +526092,7 @@ function getProxyUrl() {
|
|
|
525510
526092
|
}
|
|
525511
526093
|
var DEFAULT_PROXY_URL = "https://8gi-model-proxy.fly.dev", AUTH_CONFIG_PATH;
|
|
525512
526094
|
var init_proxy_provider = __esm(() => {
|
|
525513
|
-
AUTH_CONFIG_PATH =
|
|
526095
|
+
AUTH_CONFIG_PATH = path52.join(os34.homedir(), ".8gent", "auth-proxy.json");
|
|
525514
526096
|
});
|
|
525515
526097
|
|
|
525516
526098
|
// packages/auth/index.ts
|
|
@@ -525839,8 +526421,8 @@ __export(exports_cron, {
|
|
|
525839
526421
|
CronManager: () => CronManager
|
|
525840
526422
|
});
|
|
525841
526423
|
import * as crypto12 from "crypto";
|
|
525842
|
-
import * as
|
|
525843
|
-
import * as
|
|
526424
|
+
import * as fs53 from "fs";
|
|
526425
|
+
import * as path53 from "path";
|
|
525844
526426
|
function matchField(field, value, max2) {
|
|
525845
526427
|
if (field === "*")
|
|
525846
526428
|
return true;
|
|
@@ -525870,22 +526452,22 @@ class CronManager {
|
|
|
525870
526452
|
jobs;
|
|
525871
526453
|
constructor(dataPath) {
|
|
525872
526454
|
const home = process.env.HOME || process.env.USERPROFILE || "~";
|
|
525873
|
-
this.filePath = dataPath ||
|
|
526455
|
+
this.filePath = dataPath || path53.join(home, ".8gent", "cron.json");
|
|
525874
526456
|
this.jobs = this.load();
|
|
525875
526457
|
}
|
|
525876
526458
|
load() {
|
|
525877
526459
|
try {
|
|
525878
|
-
if (
|
|
525879
|
-
return JSON.parse(
|
|
526460
|
+
if (fs53.existsSync(this.filePath)) {
|
|
526461
|
+
return JSON.parse(fs53.readFileSync(this.filePath, "utf-8"));
|
|
525880
526462
|
}
|
|
525881
526463
|
} catch {}
|
|
525882
526464
|
return [];
|
|
525883
526465
|
}
|
|
525884
526466
|
save() {
|
|
525885
|
-
const dir =
|
|
525886
|
-
if (!
|
|
525887
|
-
|
|
525888
|
-
|
|
526467
|
+
const dir = path53.dirname(this.filePath);
|
|
526468
|
+
if (!fs53.existsSync(dir))
|
|
526469
|
+
fs53.mkdirSync(dir, { recursive: true });
|
|
526470
|
+
fs53.writeFileSync(this.filePath, JSON.stringify(this.jobs, null, 2));
|
|
525889
526471
|
}
|
|
525890
526472
|
add(job) {
|
|
525891
526473
|
const entry = { ...job, id: crypto12.randomUUID().slice(0, 8) };
|
|
@@ -525946,8 +526528,8 @@ __export(exports_session_export, {
|
|
|
525946
526528
|
saveSessionExport: () => saveSessionExport,
|
|
525947
526529
|
exportSession: () => exportSession
|
|
525948
526530
|
});
|
|
525949
|
-
import * as
|
|
525950
|
-
import * as
|
|
526531
|
+
import * as fs54 from "fs";
|
|
526532
|
+
import * as path54 from "path";
|
|
525951
526533
|
function escapeHtml(str) {
|
|
525952
526534
|
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
525953
526535
|
}
|
|
@@ -526031,10 +526613,10 @@ ${messageHtml}
|
|
|
526031
526613
|
}
|
|
526032
526614
|
async function saveSessionExport(messages, metadata) {
|
|
526033
526615
|
const html3 = await exportSession(messages, metadata);
|
|
526034
|
-
const dir =
|
|
526035
|
-
|
|
526036
|
-
const filePath =
|
|
526037
|
-
|
|
526616
|
+
const dir = path54.join(process.env.HOME || process.env.USERPROFILE || ".", ".8gent", "exports");
|
|
526617
|
+
fs54.mkdirSync(dir, { recursive: true });
|
|
526618
|
+
const filePath = path54.join(dir, `${metadata.sessionId}.html`);
|
|
526619
|
+
fs54.writeFileSync(filePath, html3, "utf-8");
|
|
526038
526620
|
return filePath;
|
|
526039
526621
|
}
|
|
526040
526622
|
var init_session_export = () => {};
|
|
@@ -526044,8 +526626,8 @@ var exports_preferences_sync = {};
|
|
|
526044
526626
|
__export(exports_preferences_sync, {
|
|
526045
526627
|
PreferencesSyncManager: () => PreferencesSyncManager
|
|
526046
526628
|
});
|
|
526047
|
-
import * as
|
|
526048
|
-
import * as
|
|
526629
|
+
import * as fs55 from "fs";
|
|
526630
|
+
import * as path55 from "path";
|
|
526049
526631
|
|
|
526050
526632
|
class PreferencesSyncManager {
|
|
526051
526633
|
workingDirectory;
|
|
@@ -526055,7 +526637,7 @@ class PreferencesSyncManager {
|
|
|
526055
526637
|
_resolved = false;
|
|
526056
526638
|
constructor(workingDirectory = process.cwd()) {
|
|
526057
526639
|
this.workingDirectory = workingDirectory;
|
|
526058
|
-
this.userConfigPath =
|
|
526640
|
+
this.userConfigPath = path55.join(workingDirectory, ".8gent", "user.json");
|
|
526059
526641
|
}
|
|
526060
526642
|
async resolveConvex() {
|
|
526061
526643
|
if (this._resolved)
|
|
@@ -526130,18 +526712,18 @@ class PreferencesSyncManager {
|
|
|
526130
526712
|
}
|
|
526131
526713
|
loadLocalConfig() {
|
|
526132
526714
|
try {
|
|
526133
|
-
if (
|
|
526134
|
-
return JSON.parse(
|
|
526715
|
+
if (fs55.existsSync(this.userConfigPath)) {
|
|
526716
|
+
return JSON.parse(fs55.readFileSync(this.userConfigPath, "utf-8"));
|
|
526135
526717
|
}
|
|
526136
526718
|
} catch {}
|
|
526137
526719
|
return null;
|
|
526138
526720
|
}
|
|
526139
526721
|
saveLocalConfig(config2) {
|
|
526140
|
-
const dir =
|
|
526141
|
-
if (!
|
|
526142
|
-
|
|
526722
|
+
const dir = path55.dirname(this.userConfigPath);
|
|
526723
|
+
if (!fs55.existsSync(dir)) {
|
|
526724
|
+
fs55.mkdirSync(dir, { recursive: true });
|
|
526143
526725
|
}
|
|
526144
|
-
|
|
526726
|
+
fs55.writeFileSync(this.userConfigPath, JSON.stringify(config2, null, 2));
|
|
526145
526727
|
}
|
|
526146
526728
|
}
|
|
526147
526729
|
var init_preferences_sync = () => {};
|
|
@@ -526220,10 +526802,10 @@ Output a flat list. Each item: [ERROR|WARNING|INFO] file:line - description
|
|
|
526220
526802
|
If no issues, say "No issues found." No preamble.`;
|
|
526221
526803
|
|
|
526222
526804
|
// bin/8gent.ts
|
|
526223
|
-
import * as
|
|
526224
|
-
import * as
|
|
526805
|
+
import * as fs56 from "fs";
|
|
526806
|
+
import * as path56 from "path";
|
|
526225
526807
|
var __dirname = "/Users/jamesspalding/8gent-code/bin";
|
|
526226
|
-
var VERSION5 = "0.12.
|
|
526808
|
+
var VERSION5 = "0.12.1";
|
|
526227
526809
|
var BANNER = `
|
|
526228
526810
|
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
526229
526811
|
\u2551 \u2551
|
|
@@ -526249,6 +526831,9 @@ COMMANDS:
|
|
|
526249
526831
|
tui [--name=<n>] [--resume=<n>] Launch TUI (--name to name session, --resume to restore)
|
|
526250
526832
|
run <prompt> One-shot agent run. Pairs with --output-format stream-json for Orchestra/cmux/etc.
|
|
526251
526833
|
doctor Check system health (Ollama, models, tools, config)
|
|
526834
|
+
update Update 8gent to the latest version on npm (uses --force to fix EEXIST)
|
|
526835
|
+
permissions Diagnose macOS Accessibility + Screen Recording grants for your terminal
|
|
526836
|
+
Use --open to auto-launch System Settings panes for missing grants
|
|
526252
526837
|
pet Launch Lil Eight dock companion only
|
|
526253
526838
|
chat <message> Send a message (non-interactive, pipe-friendly)
|
|
526254
526839
|
agent <sub> Multi-agent orchestration
|
|
@@ -526536,21 +527121,94 @@ async function main() {
|
|
|
526536
527121
|
case "doctor":
|
|
526537
527122
|
await doctorCommand();
|
|
526538
527123
|
break;
|
|
527124
|
+
case "update":
|
|
527125
|
+
case "upgrade":
|
|
527126
|
+
await updateCommand();
|
|
527127
|
+
break;
|
|
527128
|
+
case "permissions":
|
|
527129
|
+
case "perms":
|
|
527130
|
+
await permissionsCommand(restArgs);
|
|
527131
|
+
break;
|
|
526539
527132
|
default:
|
|
526540
527133
|
console.error(`Unknown command: ${command}`);
|
|
526541
527134
|
console.log(`Run '8 --help' for usage information.`);
|
|
526542
527135
|
process.exit(1);
|
|
526543
527136
|
}
|
|
526544
527137
|
}
|
|
527138
|
+
async function updateCommand() {
|
|
527139
|
+
const { spawn: spawn14 } = await import("child_process");
|
|
527140
|
+
console.log(`Current: v${VERSION5}`);
|
|
527141
|
+
console.log(`Updating @8gi-foundation/8gent-code to latest from npm...`);
|
|
527142
|
+
console.log(`(uses --force to overwrite stale bin symlinks)
|
|
527143
|
+
`);
|
|
527144
|
+
const proc = spawn14("npm", ["install", "-g", "@8gi-foundation/8gent-code@latest", "--force"], { stdio: "inherit" });
|
|
527145
|
+
await new Promise((resolve16) => {
|
|
527146
|
+
proc.on("exit", (code2) => {
|
|
527147
|
+
if (code2 === 0) {
|
|
527148
|
+
console.log(`
|
|
527149
|
+
Done. Restart your terminal session, then run \`8gent\` to use the new version.`);
|
|
527150
|
+
} else {
|
|
527151
|
+
console.error(`
|
|
527152
|
+
Update failed (exit ${code2}). Try manually:`);
|
|
527153
|
+
console.error(` npm install -g @8gi-foundation/8gent-code@latest --force`);
|
|
527154
|
+
}
|
|
527155
|
+
resolve16();
|
|
527156
|
+
});
|
|
527157
|
+
proc.on("error", (err) => {
|
|
527158
|
+
console.error(`
|
|
527159
|
+
Couldn't run npm: ${err.message}`);
|
|
527160
|
+
resolve16();
|
|
527161
|
+
});
|
|
527162
|
+
});
|
|
527163
|
+
}
|
|
527164
|
+
async function permissionsCommand(args) {
|
|
527165
|
+
const { checkPermissions: checkPermissions2, openPrivacyPane: openPrivacyPane2 } = await Promise.resolve().then(() => (init_hands(), exports_hands));
|
|
527166
|
+
const shouldOpen = args.includes("--open") || args.includes("-o");
|
|
527167
|
+
const report = checkPermissions2();
|
|
527168
|
+
const tick = (ok) => ok ? "\u2713" : "\u2717";
|
|
527169
|
+
console.log(`
|
|
527170
|
+
8gent permissions check (terminal: ${report.terminalApp})
|
|
527171
|
+
`);
|
|
527172
|
+
console.log(` ${tick(report.accessibility.granted)} Accessibility ${report.accessibility.detail}`);
|
|
527173
|
+
console.log(` ${tick(report.screenRecording.granted)} Screen Recording ${report.screenRecording.detail}`);
|
|
527174
|
+
console.log("");
|
|
527175
|
+
if (report.allGranted) {
|
|
527176
|
+
console.log(`All permissions granted. The hands tools should work.
|
|
527177
|
+
`);
|
|
527178
|
+
return;
|
|
527179
|
+
}
|
|
527180
|
+
console.log(`To fix, grant ${report.terminalApp} the missing permission(s) in:`);
|
|
527181
|
+
console.log(` System Settings \u2192 Privacy & Security \u2192 ...`);
|
|
527182
|
+
console.log("");
|
|
527183
|
+
if (!report.accessibility.granted) {
|
|
527184
|
+
console.log(` Accessibility (lets cliclick/osascript drive the cursor + keyboard)`);
|
|
527185
|
+
}
|
|
527186
|
+
if (!report.screenRecording.granted) {
|
|
527187
|
+
console.log(` Screen Recording (lets screencapture see the desktop)`);
|
|
527188
|
+
}
|
|
527189
|
+
console.log("");
|
|
527190
|
+
console.log(`Then **fully quit and relaunch ${report.terminalApp}** \u2014 macOS only re-checks permissions on relaunch.
|
|
527191
|
+
`);
|
|
527192
|
+
if (shouldOpen) {
|
|
527193
|
+
console.log(`Opening System Settings panes...`);
|
|
527194
|
+
if (!report.accessibility.granted)
|
|
527195
|
+
openPrivacyPane2("accessibility");
|
|
527196
|
+
if (!report.screenRecording.granted)
|
|
527197
|
+
openPrivacyPane2("screen-recording");
|
|
527198
|
+
} else {
|
|
527199
|
+
console.log(`Re-run with \`8gent permissions --open\` to auto-launch the right System Settings panes.
|
|
527200
|
+
`);
|
|
527201
|
+
}
|
|
527202
|
+
}
|
|
526545
527203
|
async function initCommand(args) {
|
|
526546
527204
|
console.log(BANNER);
|
|
526547
527205
|
console.log(`Initializing 8gent Code...
|
|
526548
527206
|
`);
|
|
526549
|
-
const configPath =
|
|
526550
|
-
const indexPath =
|
|
526551
|
-
if (!
|
|
526552
|
-
|
|
526553
|
-
|
|
527207
|
+
const configPath = path56.join(process.cwd(), ".8gent");
|
|
527208
|
+
const indexPath = path56.join(configPath, "index");
|
|
527209
|
+
if (!fs56.existsSync(configPath)) {
|
|
527210
|
+
fs56.mkdirSync(configPath, { recursive: true });
|
|
527211
|
+
fs56.mkdirSync(indexPath, { recursive: true });
|
|
526554
527212
|
const config2 = {
|
|
526555
527213
|
version: VERSION5,
|
|
526556
527214
|
initialized: new Date().toISOString(),
|
|
@@ -526561,7 +527219,7 @@ async function initCommand(args) {
|
|
|
526561
527219
|
ignorePatterns: ["**/node_modules/**", "**/dist/**"]
|
|
526562
527220
|
}
|
|
526563
527221
|
};
|
|
526564
|
-
|
|
527222
|
+
fs56.writeFileSync(path56.join(configPath, "config.json"), JSON.stringify(config2, null, 2));
|
|
526565
527223
|
console.log("\u2705 Created .8gent directory");
|
|
526566
527224
|
console.log("\u2705 Created config.json");
|
|
526567
527225
|
console.log(`
|
|
@@ -526582,7 +527240,7 @@ async function outlineCommand(args) {
|
|
|
526582
527240
|
const start = performance.now();
|
|
526583
527241
|
const outline = parseTypeScriptFile2(filePath);
|
|
526584
527242
|
const time3 = performance.now() - start;
|
|
526585
|
-
const fileSize =
|
|
527243
|
+
const fileSize = fs56.statSync(filePath).size;
|
|
526586
527244
|
const fullTokens = Math.ceil(fileSize / 4);
|
|
526587
527245
|
const outlineJson = JSON.stringify(outline.symbols);
|
|
526588
527246
|
const outlineTokens = Math.ceil(outlineJson.length / 4);
|
|
@@ -526608,7 +527266,7 @@ async function outlineCommand(args) {
|
|
|
526608
527266
|
}, null, 2));
|
|
526609
527267
|
} else {
|
|
526610
527268
|
console.log(`
|
|
526611
|
-
\uD83D\uDCC4 ${
|
|
527269
|
+
\uD83D\uDCC4 ${path56.basename(filePath)} (${outline.language})`);
|
|
526612
527270
|
console.log(` ${outline.symbols.length} symbols \u2022 ${time3.toFixed(1)}ms \u2022 ${percent}% token savings
|
|
526613
527271
|
`);
|
|
526614
527272
|
for (const symbol21 of outline.symbols) {
|
|
@@ -526649,14 +527307,14 @@ Available symbols:`);
|
|
|
526649
527307
|
process.exit(1);
|
|
526650
527308
|
}
|
|
526651
527309
|
const source = getSymbolSource2(filePath, symbol21.startLine, symbol21.endLine, contextLines);
|
|
526652
|
-
const fileSize =
|
|
527310
|
+
const fileSize = fs56.statSync(filePath).size;
|
|
526653
527311
|
const fullTokens = Math.ceil(fileSize / 4);
|
|
526654
527312
|
const symbolTokens = Math.ceil(source.length / 4);
|
|
526655
527313
|
const saved = fullTokens - symbolTokens;
|
|
526656
527314
|
const percent = (saved / fullTokens * 100).toFixed(1);
|
|
526657
527315
|
console.log(`
|
|
526658
527316
|
${getSymbolIcon(symbol21.kind)} ${symbol21.name} (${symbol21.kind})`);
|
|
526659
|
-
console.log(` Lines ${symbol21.startLine}-${symbol21.endLine} in ${
|
|
527317
|
+
console.log(` Lines ${symbol21.startLine}-${symbol21.endLine} in ${path56.basename(filePath)}`);
|
|
526660
527318
|
if (symbol21.signature) {
|
|
526661
527319
|
console.log(` ${symbol21.signature}`);
|
|
526662
527320
|
}
|
|
@@ -526712,27 +527370,27 @@ async function searchCommand(args) {
|
|
|
526712
527370
|
} else {
|
|
526713
527371
|
for (const { symbol: symbol21, file: file2 } of matches) {
|
|
526714
527372
|
const icon = getSymbolIcon(symbol21.kind);
|
|
526715
|
-
console.log(` ${icon} ${symbol21.name.padEnd(30)} ${symbol21.kind.padEnd(10)} ${
|
|
527373
|
+
console.log(` ${icon} ${symbol21.name.padEnd(30)} ${symbol21.kind.padEnd(10)} ${path56.relative(process.cwd(), file2)}`);
|
|
526716
527374
|
}
|
|
526717
527375
|
console.log(`
|
|
526718
527376
|
Found ${matches.length} match${matches.length === 1 ? "" : "es"}`);
|
|
526719
527377
|
}
|
|
526720
527378
|
}
|
|
526721
527379
|
async function benchmarkCommand(args) {
|
|
526722
|
-
const benchmarkPath =
|
|
527380
|
+
const benchmarkPath = path56.join(__dirname, "../scripts/benchmark.ts");
|
|
526723
527381
|
const { spawn: spawn14 } = await import("child_process");
|
|
526724
527382
|
const proc = spawn14("bun", ["run", benchmarkPath, ...args], {
|
|
526725
527383
|
stdio: "inherit",
|
|
526726
|
-
cwd:
|
|
527384
|
+
cwd: path56.join(__dirname, "..")
|
|
526727
527385
|
});
|
|
526728
527386
|
proc.on("exit", (code2) => process.exit(code2 || 0));
|
|
526729
527387
|
}
|
|
526730
527388
|
async function demoCommand(args) {
|
|
526731
|
-
const demoPath =
|
|
527389
|
+
const demoPath = path56.join(__dirname, "../scripts/demo-savings.ts");
|
|
526732
527390
|
const { spawn: spawn14 } = await import("child_process");
|
|
526733
527391
|
const proc = spawn14("bun", ["run", demoPath, ...args], {
|
|
526734
527392
|
stdio: "inherit",
|
|
526735
|
-
cwd:
|
|
527393
|
+
cwd: path56.join(__dirname, "..")
|
|
526736
527394
|
});
|
|
526737
527395
|
proc.on("exit", (code2) => process.exit(code2 || 0));
|
|
526738
527396
|
}
|
|
@@ -526742,8 +527400,8 @@ async function spawnPet(sessionId) {
|
|
|
526742
527400
|
if (platform4 !== "darwin") {
|
|
526743
527401
|
console.log("\x1B[36m[pet] Lil Eight terminal mode (cross-platform)\x1B[0m");
|
|
526744
527402
|
try {
|
|
526745
|
-
const petPath =
|
|
526746
|
-
if (
|
|
527403
|
+
const petPath = path56.join(__dirname, "../packages/pet/terminal-pet.ts");
|
|
527404
|
+
if (fs56.existsSync(petPath)) {
|
|
526747
527405
|
const { TerminalPet } = await import(petPath);
|
|
526748
527406
|
const pet = new TerminalPet({ label: sessionId || "eight" });
|
|
526749
527407
|
const rows = process.stdout.rows || 24;
|
|
@@ -526764,12 +527422,12 @@ async function spawnPet(sessionId) {
|
|
|
526764
527422
|
} catch (e3) {}
|
|
526765
527423
|
try {
|
|
526766
527424
|
const home = process.env.HOME || process.env.USERPROFILE || "~";
|
|
526767
|
-
const meshDir =
|
|
526768
|
-
|
|
526769
|
-
const registryPath =
|
|
527425
|
+
const meshDir = path56.join(home, ".8gent", "mesh");
|
|
527426
|
+
fs56.mkdirSync(meshDir, { recursive: true });
|
|
527427
|
+
const registryPath = path56.join(meshDir, "registry.json");
|
|
526770
527428
|
let registry2 = {};
|
|
526771
527429
|
try {
|
|
526772
|
-
registry2 = JSON.parse(
|
|
527430
|
+
registry2 = JSON.parse(fs56.readFileSync(registryPath, "utf-8"));
|
|
526773
527431
|
} catch {}
|
|
526774
527432
|
const agentId = sessionId || `eight-tui-${process.pid}`;
|
|
526775
527433
|
registry2[agentId] = {
|
|
@@ -526783,7 +527441,7 @@ async function spawnPet(sessionId) {
|
|
|
526783
527441
|
lastHeartbeat: Date.now(),
|
|
526784
527442
|
channel: "terminal"
|
|
526785
527443
|
};
|
|
526786
|
-
|
|
527444
|
+
fs56.writeFileSync(registryPath, JSON.stringify(registry2, null, 2));
|
|
526787
527445
|
} catch {}
|
|
526788
527446
|
return;
|
|
526789
527447
|
}
|
|
@@ -526791,8 +527449,8 @@ async function spawnPet(sessionId) {
|
|
|
526791
527449
|
const { generateCompanion: generateCompanion2 } = await Promise.resolve().then(() => (init_companion(), exports_companion));
|
|
526792
527450
|
const companion = generateCompanion2(sessionId || `session-${Date.now()}`);
|
|
526793
527451
|
const home = process.env.HOME || "~";
|
|
526794
|
-
|
|
526795
|
-
|
|
527452
|
+
fs56.mkdirSync(path56.join(home, ".8gent"), { recursive: true });
|
|
527453
|
+
fs56.writeFileSync(path56.join(home, ".8gent", "active-companion.json"), JSON.stringify({
|
|
526796
527454
|
fullName: companion.fullName,
|
|
526797
527455
|
species: companion.species,
|
|
526798
527456
|
element: companion.element,
|
|
@@ -526804,11 +527462,11 @@ async function spawnPet(sessionId) {
|
|
|
526804
527462
|
stats: companion.stats
|
|
526805
527463
|
}, null, 2));
|
|
526806
527464
|
} catch {}
|
|
526807
|
-
const lilEightScript =
|
|
527465
|
+
const lilEightScript = path56.join(__dirname, "lil-eight.sh");
|
|
526808
527466
|
try {
|
|
526809
527467
|
execSync4("pkill -f LilEight 2>/dev/null", { stdio: "pipe" });
|
|
526810
527468
|
} catch {}
|
|
526811
|
-
if (
|
|
527469
|
+
if (fs56.existsSync(lilEightScript)) {
|
|
526812
527470
|
const pet = spawnProc("bash", [lilEightScript, "start"], {
|
|
526813
527471
|
detached: true,
|
|
526814
527472
|
stdio: "ignore"
|
|
@@ -526816,8 +527474,8 @@ async function spawnPet(sessionId) {
|
|
|
526816
527474
|
pet.unref();
|
|
526817
527475
|
console.log("\x1B[36m[pet] Lil Eight spawned on Dock\x1B[0m");
|
|
526818
527476
|
} else {
|
|
526819
|
-
const buildScript =
|
|
526820
|
-
if (
|
|
527477
|
+
const buildScript = path56.join(__dirname, "../apps/lil-eight/build.sh");
|
|
527478
|
+
if (fs56.existsSync(buildScript)) {
|
|
526821
527479
|
console.log("\x1B[36m[pet] Building Lil Eight...\x1B[0m");
|
|
526822
527480
|
try {
|
|
526823
527481
|
execSync4(`bash "${buildScript}"`, { stdio: "pipe" });
|
|
@@ -526833,13 +527491,13 @@ async function spawnPet(sessionId) {
|
|
|
526833
527491
|
}
|
|
526834
527492
|
}
|
|
526835
527493
|
try {
|
|
526836
|
-
const meshDir =
|
|
526837
|
-
const registryPath =
|
|
526838
|
-
|
|
527494
|
+
const meshDir = path56.join(process.env.HOME || "~", ".8gent", "mesh");
|
|
527495
|
+
const registryPath = path56.join(meshDir, "registry.json");
|
|
527496
|
+
fs56.mkdirSync(meshDir, { recursive: true });
|
|
526839
527497
|
const agentId = sessionId || `eight-tui-${process.pid}`;
|
|
526840
527498
|
let registry2 = {};
|
|
526841
527499
|
try {
|
|
526842
|
-
registry2 = JSON.parse(
|
|
527500
|
+
registry2 = JSON.parse(fs56.readFileSync(registryPath, "utf-8"));
|
|
526843
527501
|
} catch {}
|
|
526844
527502
|
registry2[agentId] = {
|
|
526845
527503
|
id: agentId,
|
|
@@ -526852,12 +527510,12 @@ async function spawnPet(sessionId) {
|
|
|
526852
527510
|
lastHeartbeat: Date.now(),
|
|
526853
527511
|
channel: "terminal"
|
|
526854
527512
|
};
|
|
526855
|
-
|
|
527513
|
+
fs56.writeFileSync(registryPath, JSON.stringify(registry2, null, 2));
|
|
526856
527514
|
const cleanup = () => {
|
|
526857
527515
|
try {
|
|
526858
|
-
const reg = JSON.parse(
|
|
527516
|
+
const reg = JSON.parse(fs56.readFileSync(registryPath, "utf-8"));
|
|
526859
527517
|
delete reg[agentId];
|
|
526860
|
-
|
|
527518
|
+
fs56.writeFileSync(registryPath, JSON.stringify(reg, null, 2));
|
|
526861
527519
|
} catch {}
|
|
526862
527520
|
};
|
|
526863
527521
|
process.on("exit", cleanup);
|
|
@@ -526881,10 +527539,10 @@ async function tuiCommand(args) {
|
|
|
526881
527539
|
console.log(`Launching TUI...
|
|
526882
527540
|
`);
|
|
526883
527541
|
const { spawn: spawn14 } = await import("child_process");
|
|
526884
|
-
const tuiPath =
|
|
527542
|
+
const tuiPath = path56.join(__dirname, "../apps/tui/src/index.tsx");
|
|
526885
527543
|
const proc = spawn14("bun", ["run", tuiPath, ...filteredArgs], {
|
|
526886
527544
|
stdio: "inherit",
|
|
526887
|
-
cwd:
|
|
527545
|
+
cwd: path56.join(__dirname, "..")
|
|
526888
527546
|
});
|
|
526889
527547
|
proc.on("exit", (code2) => process.exit(code2 || 0));
|
|
526890
527548
|
}
|
|
@@ -526902,8 +527560,8 @@ async function airdropCommand(args) {
|
|
|
526902
527560
|
}
|
|
526903
527561
|
const target = args.join(" ");
|
|
526904
527562
|
const { execSync: execSync4 } = await import("child_process");
|
|
526905
|
-
if (
|
|
526906
|
-
const resolved =
|
|
527563
|
+
if (fs56.existsSync(target) || fs56.existsSync(path56.resolve(target))) {
|
|
527564
|
+
const resolved = path56.resolve(target);
|
|
526907
527565
|
console.log(`AirDropping: ${resolved}`);
|
|
526908
527566
|
const script = `
|
|
526909
527567
|
tell application "Finder"
|
|
@@ -526933,7 +527591,7 @@ async function airdropCommand(args) {
|
|
|
526933
527591
|
}
|
|
526934
527592
|
`;
|
|
526935
527593
|
const tmpSwift = "/tmp/eight-airdrop.swift";
|
|
526936
|
-
|
|
527594
|
+
fs56.writeFileSync(tmpSwift, swiftHelper);
|
|
526937
527595
|
try {
|
|
526938
527596
|
execSync4(`swiftc -o /tmp/eight-airdrop -framework Cocoa "${tmpSwift}" && /tmp/eight-airdrop`, {
|
|
526939
527597
|
stdio: "inherit",
|
|
@@ -526944,7 +527602,7 @@ async function airdropCommand(args) {
|
|
|
526944
527602
|
}
|
|
526945
527603
|
} else {
|
|
526946
527604
|
const tmpFile = `/tmp/eight-note-${Date.now()}.txt`;
|
|
526947
|
-
|
|
527605
|
+
fs56.writeFileSync(tmpFile, target);
|
|
526948
527606
|
console.log(`AirDropping note: "${target.slice(0, 50)}..."`);
|
|
526949
527607
|
await airdropCommand([tmpFile]);
|
|
526950
527608
|
}
|
|
@@ -526952,10 +527610,10 @@ async function airdropCommand(args) {
|
|
|
526952
527610
|
async function petCommand(args) {
|
|
526953
527611
|
const subCmd = args[0] || "start";
|
|
526954
527612
|
const { execSync: execSync4 } = await import("child_process");
|
|
526955
|
-
const lilEightScript =
|
|
526956
|
-
if (!
|
|
527613
|
+
const lilEightScript = path56.join(__dirname, "lil-eight.sh");
|
|
527614
|
+
if (!fs56.existsSync(lilEightScript)) {
|
|
526957
527615
|
console.log("Building Lil Eight first...");
|
|
526958
|
-
const buildScript =
|
|
527616
|
+
const buildScript = path56.join(__dirname, "../apps/lil-eight/build.sh");
|
|
526959
527617
|
execSync4(`bash "${buildScript}"`, { stdio: "inherit" });
|
|
526960
527618
|
}
|
|
526961
527619
|
switch (subCmd) {
|
|
@@ -526979,14 +527637,14 @@ async function petCommand(args) {
|
|
|
526979
527637
|
setTimeout(() => spawnPet(), 1000);
|
|
526980
527638
|
break;
|
|
526981
527639
|
case "build":
|
|
526982
|
-
execSync4(`bash "${
|
|
527640
|
+
execSync4(`bash "${path56.join(__dirname, "../apps/lil-eight/build.sh")}"`, {
|
|
526983
527641
|
stdio: "inherit"
|
|
526984
527642
|
});
|
|
526985
527643
|
break;
|
|
526986
527644
|
case "log":
|
|
526987
527645
|
case "logs": {
|
|
526988
527646
|
const { spawn: sp } = await import("child_process");
|
|
526989
|
-
const logPath =
|
|
527647
|
+
const logPath = path56.join(process.env.HOME || "~", ".8gent", "lil-eight.log");
|
|
526990
527648
|
sp("tail", ["-f", logPath], { stdio: "inherit" });
|
|
526991
527649
|
break;
|
|
526992
527650
|
}
|
|
@@ -526994,9 +527652,9 @@ async function petCommand(args) {
|
|
|
526994
527652
|
try {
|
|
526995
527653
|
execSync4("pgrep -f LilEight", { stdio: "pipe" });
|
|
526996
527654
|
console.log("Lil Eight is running");
|
|
526997
|
-
const logP =
|
|
526998
|
-
if (
|
|
526999
|
-
const lines =
|
|
527655
|
+
const logP = path56.join(process.env.HOME || "~", ".8gent", "lil-eight.log");
|
|
527656
|
+
if (fs56.existsSync(logP)) {
|
|
527657
|
+
const lines = fs56.readFileSync(logP, "utf-8").trim().split(`
|
|
527000
527658
|
`).slice(-3);
|
|
527001
527659
|
lines.forEach((l2) => console.log(` ${l2}`));
|
|
527002
527660
|
}
|
|
@@ -527496,10 +528154,10 @@ async function sessionCommand(args) {
|
|
|
527496
528154
|
process.exit(1);
|
|
527497
528155
|
}
|
|
527498
528156
|
const { spawn: spawn14 } = await import("child_process");
|
|
527499
|
-
const tuiPath =
|
|
528157
|
+
const tuiPath = path56.join(__dirname, "../apps/tui/src/index.tsx");
|
|
527500
528158
|
const proc = spawn14("bun", ["run", tuiPath, "--resume", nameOrId], {
|
|
527501
528159
|
stdio: "inherit",
|
|
527502
|
-
cwd:
|
|
528160
|
+
cwd: path56.join(__dirname, "..")
|
|
527503
528161
|
});
|
|
527504
528162
|
proc.on("exit", (code2) => process.exit(code2 || 0));
|
|
527505
528163
|
break;
|
|
@@ -527810,9 +528468,9 @@ async function statusCommand(args) {
|
|
|
527810
528468
|
runtime: "bun"
|
|
527811
528469
|
};
|
|
527812
528470
|
try {
|
|
527813
|
-
const configPath =
|
|
527814
|
-
if (
|
|
527815
|
-
status.config = JSON.parse(
|
|
528471
|
+
const configPath = path56.join(cwd, ".8gent", "config.json");
|
|
528472
|
+
if (fs56.existsSync(configPath)) {
|
|
528473
|
+
status.config = JSON.parse(fs56.readFileSync(configPath, "utf-8"));
|
|
527816
528474
|
}
|
|
527817
528475
|
} catch {}
|
|
527818
528476
|
try {
|
|
@@ -527924,7 +528582,7 @@ async function reviewCommand(args) {
|
|
|
527924
528582
|
let diff;
|
|
527925
528583
|
try {
|
|
527926
528584
|
if (diffFile) {
|
|
527927
|
-
diff =
|
|
528585
|
+
diff = fs56.readFileSync(diffFile, "utf-8");
|
|
527928
528586
|
} else if (prNumber) {
|
|
527929
528587
|
diff = execSync4(`gh pr diff ${prNumber}`, { encoding: "utf-8" });
|
|
527930
528588
|
} else {
|
|
@@ -527987,12 +528645,12 @@ async function doctorCommand() {
|
|
|
527987
528645
|
issues++;
|
|
527988
528646
|
}
|
|
527989
528647
|
}
|
|
527990
|
-
const dbPath =
|
|
527991
|
-
console.log(
|
|
527992
|
-
const cfgPath =
|
|
527993
|
-
if (
|
|
528648
|
+
const dbPath = path56.join(process.env.HOME || "", ".8gent", "memory.db");
|
|
528649
|
+
console.log(fs56.existsSync(dbPath) ? green(`Memory DB (${(fs56.statSync(dbPath).size / 1024).toFixed(0)} KB)`) : dim(" No memory DB yet"));
|
|
528650
|
+
const cfgPath = path56.join(process.env.HOME || "", ".8gent", "config.json");
|
|
528651
|
+
if (fs56.existsSync(cfgPath)) {
|
|
527994
528652
|
try {
|
|
527995
|
-
JSON.parse(
|
|
528653
|
+
JSON.parse(fs56.readFileSync(cfgPath, "utf-8"));
|
|
527996
528654
|
console.log(green("Config valid"));
|
|
527997
528655
|
} catch {
|
|
527998
528656
|
console.log(red("Config invalid JSON"));
|
|
@@ -528009,10 +528667,10 @@ async function doctorCommand() {
|
|
|
528009
528667
|
} catch {
|
|
528010
528668
|
console.log(dim(" NemoClaw skip"));
|
|
528011
528669
|
}
|
|
528012
|
-
const mcpPath =
|
|
528013
|
-
if (
|
|
528670
|
+
const mcpPath = path56.join(process.env.HOME || "", ".8gent", "mcp.json");
|
|
528671
|
+
if (fs56.existsSync(mcpPath)) {
|
|
528014
528672
|
try {
|
|
528015
|
-
const m2 = JSON.parse(
|
|
528673
|
+
const m2 = JSON.parse(fs56.readFileSync(mcpPath, "utf-8"));
|
|
528016
528674
|
console.log(green(`MCP: ${Object.keys(m2.servers || m2.mcpServers || {}).length} servers`));
|
|
528017
528675
|
} catch {
|
|
528018
528676
|
console.log(red("MCP config invalid"));
|