@8gi-foundation/8gent-code 0.11.0 → 0.11.12
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 +1097 -609
- 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
|
@@ -493326,16 +493326,185 @@ class WorktreeMessaging {
|
|
|
493326
493326
|
}
|
|
493327
493327
|
var init_worktree_messaging = () => {};
|
|
493328
493328
|
|
|
493329
|
+
// packages/settings/defaults.ts
|
|
493330
|
+
var DEFAULT_SETTINGS;
|
|
493331
|
+
var init_defaults = __esm(() => {
|
|
493332
|
+
DEFAULT_SETTINGS = {
|
|
493333
|
+
version: 1,
|
|
493334
|
+
voice: {
|
|
493335
|
+
silenceThresholdMs: 2000,
|
|
493336
|
+
bargeIn: true,
|
|
493337
|
+
ttsVoice: "Ava",
|
|
493338
|
+
outputEnabled: true,
|
|
493339
|
+
perAgent: {
|
|
493340
|
+
orchestrator: "Daniel",
|
|
493341
|
+
engineer: "Karen",
|
|
493342
|
+
qa: "Moira"
|
|
493343
|
+
}
|
|
493344
|
+
},
|
|
493345
|
+
performance: {
|
|
493346
|
+
mode: "auto",
|
|
493347
|
+
introBanner: "auto"
|
|
493348
|
+
},
|
|
493349
|
+
models: {
|
|
493350
|
+
tabs: {
|
|
493351
|
+
orchestrator: { provider: "ollama", model: "qwen3.6:27b" },
|
|
493352
|
+
engineer: { provider: "lmstudio", model: "google/gemma-4-26b-a4b" },
|
|
493353
|
+
qa: { provider: "apfel", model: "apple-foundationmodel" }
|
|
493354
|
+
}
|
|
493355
|
+
},
|
|
493356
|
+
providers: {
|
|
493357
|
+
apfel: { baseURL: "http://localhost:11500/v1" },
|
|
493358
|
+
ollama: { baseURL: "http://localhost:11434/v1" },
|
|
493359
|
+
lmstudio: { baseURL: "http://localhost:1234/v1" },
|
|
493360
|
+
openrouter: { baseURL: "https://openrouter.ai/api/v1" }
|
|
493361
|
+
},
|
|
493362
|
+
ui: {
|
|
493363
|
+
theme: "amber",
|
|
493364
|
+
thinkingVisualiser: {
|
|
493365
|
+
enabled: true,
|
|
493366
|
+
operatorRotationMs: 8000,
|
|
493367
|
+
boredomThresholdMs: 30000
|
|
493368
|
+
},
|
|
493369
|
+
introSound: ""
|
|
493370
|
+
},
|
|
493371
|
+
agents: {
|
|
493372
|
+
names: {
|
|
493373
|
+
orchestrator: "Orchestrator",
|
|
493374
|
+
engineer: "Engineer",
|
|
493375
|
+
qa: "QA"
|
|
493376
|
+
}
|
|
493377
|
+
}
|
|
493378
|
+
};
|
|
493379
|
+
});
|
|
493380
|
+
|
|
493381
|
+
// packages/settings/store.ts
|
|
493382
|
+
import * as fs28 from "fs";
|
|
493383
|
+
import * as os19 from "os";
|
|
493384
|
+
import * as path29 from "path";
|
|
493385
|
+
function ensureDir3() {
|
|
493386
|
+
try {
|
|
493387
|
+
if (!fs28.existsSync(SETTINGS_DIR)) {
|
|
493388
|
+
fs28.mkdirSync(SETTINGS_DIR, { recursive: true });
|
|
493389
|
+
}
|
|
493390
|
+
} catch {}
|
|
493391
|
+
}
|
|
493392
|
+
function deepMerge(defaults, user) {
|
|
493393
|
+
if (user === null || user === undefined)
|
|
493394
|
+
return defaults;
|
|
493395
|
+
if (typeof defaults !== "object" || defaults === null) {
|
|
493396
|
+
if (typeof user === typeof defaults)
|
|
493397
|
+
return user;
|
|
493398
|
+
return defaults;
|
|
493399
|
+
}
|
|
493400
|
+
if (Array.isArray(defaults)) {
|
|
493401
|
+
return Array.isArray(user) ? user : defaults;
|
|
493402
|
+
}
|
|
493403
|
+
const out = { ...defaults };
|
|
493404
|
+
if (typeof user === "object" && user !== null && !Array.isArray(user)) {
|
|
493405
|
+
const u3 = user;
|
|
493406
|
+
for (const key of Object.keys(out)) {
|
|
493407
|
+
if (key in u3) {
|
|
493408
|
+
out[key] = deepMerge(defaults[key], u3[key]);
|
|
493409
|
+
}
|
|
493410
|
+
}
|
|
493411
|
+
}
|
|
493412
|
+
return out;
|
|
493413
|
+
}
|
|
493414
|
+
function loadSettings() {
|
|
493415
|
+
try {
|
|
493416
|
+
if (!fs28.existsSync(SETTINGS_FILE)) {
|
|
493417
|
+
return DEFAULT_SETTINGS;
|
|
493418
|
+
}
|
|
493419
|
+
const raw = fs28.readFileSync(SETTINGS_FILE, "utf-8");
|
|
493420
|
+
const parsed = JSON.parse(raw);
|
|
493421
|
+
const merged = deepMerge(DEFAULT_SETTINGS, parsed);
|
|
493422
|
+
return { ...merged, version: DEFAULT_SETTINGS.version };
|
|
493423
|
+
} catch {
|
|
493424
|
+
return DEFAULT_SETTINGS;
|
|
493425
|
+
}
|
|
493426
|
+
}
|
|
493427
|
+
function saveSettings(s3) {
|
|
493428
|
+
try {
|
|
493429
|
+
ensureDir3();
|
|
493430
|
+
fs28.writeFileSync(SETTINGS_FILE, `${JSON.stringify(s3, null, 2)}
|
|
493431
|
+
`, "utf-8");
|
|
493432
|
+
} catch {}
|
|
493433
|
+
}
|
|
493434
|
+
var SETTINGS_DIR, SETTINGS_FILE;
|
|
493435
|
+
var init_store2 = __esm(() => {
|
|
493436
|
+
init_defaults();
|
|
493437
|
+
SETTINGS_DIR = path29.join(os19.homedir(), ".8gent");
|
|
493438
|
+
SETTINGS_FILE = path29.join(SETTINGS_DIR, "settings.json");
|
|
493439
|
+
});
|
|
493440
|
+
|
|
493441
|
+
// packages/settings/voice.ts
|
|
493442
|
+
var init_voice2 = __esm(() => {
|
|
493443
|
+
init_defaults();
|
|
493444
|
+
init_store2();
|
|
493445
|
+
});
|
|
493446
|
+
|
|
493447
|
+
// packages/settings/agents.ts
|
|
493448
|
+
function isKnownRole(role) {
|
|
493449
|
+
return KNOWN_ROLES.includes(role);
|
|
493450
|
+
}
|
|
493451
|
+
function capitalize(s3) {
|
|
493452
|
+
if (!s3)
|
|
493453
|
+
return s3;
|
|
493454
|
+
return s3.charAt(0).toUpperCase() + s3.slice(1);
|
|
493455
|
+
}
|
|
493456
|
+
function resolveRoleName(role, settings) {
|
|
493457
|
+
const s3 = settings ?? loadSettings();
|
|
493458
|
+
if (isKnownRole(role)) {
|
|
493459
|
+
const chosen = s3.agents?.names?.[role];
|
|
493460
|
+
if (typeof chosen === "string" && chosen.trim().length > 0) {
|
|
493461
|
+
return chosen.trim();
|
|
493462
|
+
}
|
|
493463
|
+
return DEFAULT_SETTINGS.agents.names[role];
|
|
493464
|
+
}
|
|
493465
|
+
return capitalize(role) || "Agent";
|
|
493466
|
+
}
|
|
493467
|
+
var KNOWN_ROLES;
|
|
493468
|
+
var init_agents = __esm(() => {
|
|
493469
|
+
init_defaults();
|
|
493470
|
+
init_store2();
|
|
493471
|
+
KNOWN_ROLES = ["orchestrator", "engineer", "qa"];
|
|
493472
|
+
});
|
|
493473
|
+
|
|
493474
|
+
// packages/settings/index.ts
|
|
493475
|
+
var init_settings = __esm(() => {
|
|
493476
|
+
init_voice2();
|
|
493477
|
+
init_agents();
|
|
493478
|
+
init_defaults();
|
|
493479
|
+
init_store2();
|
|
493480
|
+
});
|
|
493481
|
+
|
|
493329
493482
|
// packages/orchestration/role-registry.ts
|
|
493483
|
+
function buildSystemPrompt(role) {
|
|
493484
|
+
const template = ROLE_PROMPT_TEMPLATES[role] ?? ROLE_PROMPT_TEMPLATES.engineer;
|
|
493485
|
+
return template.replace("{name}", resolveRoleName(role));
|
|
493486
|
+
}
|
|
493330
493487
|
function getRunnerConfig(role) {
|
|
493331
|
-
|
|
493488
|
+
const cfg = ROLE_REGISTRY[role] ?? ROLE_REGISTRY.engineer;
|
|
493489
|
+
return {
|
|
493490
|
+
...cfg,
|
|
493491
|
+
systemPrompt: cfg.systemPrompt
|
|
493492
|
+
};
|
|
493332
493493
|
}
|
|
493333
|
-
var ROLE_REGISTRY;
|
|
493494
|
+
var ROLE_PROMPT_TEMPLATES, ROLE_REGISTRY;
|
|
493334
493495
|
var init_role_registry = __esm(() => {
|
|
493496
|
+
init_settings();
|
|
493497
|
+
ROLE_PROMPT_TEMPLATES = {
|
|
493498
|
+
orchestrator: "You are {name}. Plan, delegate, and coordinate. Think before acting. No code - direct others.",
|
|
493499
|
+
engineer: "You are {name}. Write code, edit files, run commands. Implement exactly what is asked. No fluff.",
|
|
493500
|
+
qa: "You are {name}. Find bugs, review diffs, run tests. Be harsh. Reject anything that doesn't meet the spec."
|
|
493501
|
+
};
|
|
493335
493502
|
ROLE_REGISTRY = {
|
|
493336
493503
|
orchestrator: {
|
|
493337
493504
|
role: "orchestrator",
|
|
493338
|
-
systemPrompt
|
|
493505
|
+
get systemPrompt() {
|
|
493506
|
+
return buildSystemPrompt("orchestrator");
|
|
493507
|
+
},
|
|
493339
493508
|
allowedTools: ["write_notes", "gh_issue_create", "gh_pr_list", "gh_issue_list"],
|
|
493340
493509
|
retryPolicy: { maxAttempts: 2, backoffMs: 1000 },
|
|
493341
493510
|
inferenceMode: "ollama",
|
|
@@ -493343,7 +493512,9 @@ var init_role_registry = __esm(() => {
|
|
|
493343
493512
|
},
|
|
493344
493513
|
engineer: {
|
|
493345
493514
|
role: "engineer",
|
|
493346
|
-
systemPrompt
|
|
493515
|
+
get systemPrompt() {
|
|
493516
|
+
return buildSystemPrompt("engineer");
|
|
493517
|
+
},
|
|
493347
493518
|
allowedTools: [
|
|
493348
493519
|
"read_file",
|
|
493349
493520
|
"write_file",
|
|
@@ -493367,7 +493538,9 @@ var init_role_registry = __esm(() => {
|
|
|
493367
493538
|
},
|
|
493368
493539
|
qa: {
|
|
493369
493540
|
role: "qa",
|
|
493370
|
-
systemPrompt
|
|
493541
|
+
get systemPrompt() {
|
|
493542
|
+
return buildSystemPrompt("qa");
|
|
493543
|
+
},
|
|
493371
493544
|
allowedTools: [
|
|
493372
493545
|
"read_file",
|
|
493373
493546
|
"list_files",
|
|
@@ -494580,12 +494753,12 @@ function createApi(pathParts = []) {
|
|
|
494580
494753
|
const found = ["api", ...pathParts].join(".");
|
|
494581
494754
|
throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${found}\``);
|
|
494582
494755
|
}
|
|
494583
|
-
const
|
|
494756
|
+
const path30 = pathParts.slice(0, -1).join("/");
|
|
494584
494757
|
const exportName = pathParts[pathParts.length - 1];
|
|
494585
494758
|
if (exportName === "default") {
|
|
494586
|
-
return
|
|
494759
|
+
return path30;
|
|
494587
494760
|
} else {
|
|
494588
|
-
return
|
|
494761
|
+
return path30 + ":" + exportName;
|
|
494589
494762
|
}
|
|
494590
494763
|
} else if (prop2 === Symbol.toStringTag) {
|
|
494591
494764
|
return "FunctionReference";
|
|
@@ -497078,16 +497251,16 @@ var init_simple_client_node = __esm(() => {
|
|
|
497078
497251
|
});
|
|
497079
497252
|
require_node_gyp_build = __commonJS2({
|
|
497080
497253
|
"../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
|
|
497254
|
+
var fs29 = __require2("fs");
|
|
497255
|
+
var path30 = __require2("path");
|
|
497256
|
+
var os20 = __require2("os");
|
|
497084
497257
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require2;
|
|
497085
497258
|
var vars = process.config && process.config.variables || {};
|
|
497086
497259
|
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
497087
497260
|
var abi = process.versions.modules;
|
|
497088
497261
|
var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
|
|
497089
|
-
var arch = process.env.npm_config_arch ||
|
|
497090
|
-
var platform4 = process.env.npm_config_platform ||
|
|
497262
|
+
var arch = process.env.npm_config_arch || os20.arch();
|
|
497263
|
+
var platform4 = process.env.npm_config_platform || os20.platform();
|
|
497091
497264
|
var libc = process.env.LIBC || (isAlpine(platform4) ? "musl" : "glibc");
|
|
497092
497265
|
var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || "";
|
|
497093
497266
|
var uv = (process.versions.uv || "").split(".")[0];
|
|
@@ -497096,24 +497269,24 @@ var init_simple_client_node = __esm(() => {
|
|
|
497096
497269
|
return runtimeRequire(load2.resolve(dir));
|
|
497097
497270
|
}
|
|
497098
497271
|
load2.resolve = load2.path = function(dir) {
|
|
497099
|
-
dir =
|
|
497272
|
+
dir = path30.resolve(dir || ".");
|
|
497100
497273
|
try {
|
|
497101
|
-
var name21 = runtimeRequire(
|
|
497274
|
+
var name21 = runtimeRequire(path30.join(dir, "package.json")).name.toUpperCase().replace(/-/g, "_");
|
|
497102
497275
|
if (process.env[name21 + "_PREBUILD"])
|
|
497103
497276
|
dir = process.env[name21 + "_PREBUILD"];
|
|
497104
497277
|
} catch (err) {}
|
|
497105
497278
|
if (!prebuildsOnly) {
|
|
497106
|
-
var release3 = getFirst(
|
|
497279
|
+
var release3 = getFirst(path30.join(dir, "build/Release"), matchBuild);
|
|
497107
497280
|
if (release3)
|
|
497108
497281
|
return release3;
|
|
497109
|
-
var debug = getFirst(
|
|
497282
|
+
var debug = getFirst(path30.join(dir, "build/Debug"), matchBuild);
|
|
497110
497283
|
if (debug)
|
|
497111
497284
|
return debug;
|
|
497112
497285
|
}
|
|
497113
497286
|
var prebuild = resolve9(dir);
|
|
497114
497287
|
if (prebuild)
|
|
497115
497288
|
return prebuild;
|
|
497116
|
-
var nearby = resolve9(
|
|
497289
|
+
var nearby = resolve9(path30.dirname(process.execPath));
|
|
497117
497290
|
if (nearby)
|
|
497118
497291
|
return nearby;
|
|
497119
497292
|
var target = [
|
|
@@ -497132,28 +497305,28 @@ var init_simple_client_node = __esm(() => {
|
|
|
497132
497305
|
loaded from: ` + dir + `
|
|
497133
497306
|
`);
|
|
497134
497307
|
function resolve9(dir2) {
|
|
497135
|
-
var tuples = readdirSync7(
|
|
497308
|
+
var tuples = readdirSync7(path30.join(dir2, "prebuilds")).map(parseTuple);
|
|
497136
497309
|
var tuple2 = tuples.filter(matchTuple(platform4, arch)).sort(compareTuples)[0];
|
|
497137
497310
|
if (!tuple2)
|
|
497138
497311
|
return;
|
|
497139
|
-
var prebuilds =
|
|
497312
|
+
var prebuilds = path30.join(dir2, "prebuilds", tuple2.name);
|
|
497140
497313
|
var parsed = readdirSync7(prebuilds).map(parseTags);
|
|
497141
497314
|
var candidates = parsed.filter(matchTags(runtime, abi));
|
|
497142
497315
|
var winner = candidates.sort(compareTags(runtime))[0];
|
|
497143
497316
|
if (winner)
|
|
497144
|
-
return
|
|
497317
|
+
return path30.join(prebuilds, winner.file);
|
|
497145
497318
|
}
|
|
497146
497319
|
};
|
|
497147
497320
|
function readdirSync7(dir) {
|
|
497148
497321
|
try {
|
|
497149
|
-
return
|
|
497322
|
+
return fs29.readdirSync(dir);
|
|
497150
497323
|
} catch (err) {
|
|
497151
497324
|
return [];
|
|
497152
497325
|
}
|
|
497153
497326
|
}
|
|
497154
497327
|
function getFirst(dir, filter5) {
|
|
497155
497328
|
var files = readdirSync7(dir).filter(filter5);
|
|
497156
|
-
return files[0] &&
|
|
497329
|
+
return files[0] && path30.join(dir, files[0]);
|
|
497157
497330
|
}
|
|
497158
497331
|
function matchBuild(name21) {
|
|
497159
497332
|
return /\.node$/.test(name21);
|
|
@@ -497255,7 +497428,7 @@ var init_simple_client_node = __esm(() => {
|
|
|
497255
497428
|
return typeof window !== "undefined" && window.process && window.process.type === "renderer";
|
|
497256
497429
|
}
|
|
497257
497430
|
function isAlpine(platform22) {
|
|
497258
|
-
return platform22 === "linux" &&
|
|
497431
|
+
return platform22 === "linux" && fs29.existsSync("/etc/alpine-release");
|
|
497259
497432
|
}
|
|
497260
497433
|
load2.parseTags = parseTags;
|
|
497261
497434
|
load2.matchTags = matchTags;
|
|
@@ -501494,16 +501667,16 @@ var init_orchestration = __esm(() => {
|
|
|
501494
501667
|
});
|
|
501495
501668
|
|
|
501496
501669
|
// packages/eight/tools.ts
|
|
501497
|
-
import * as
|
|
501498
|
-
import * as
|
|
501670
|
+
import * as fs29 from "fs";
|
|
501671
|
+
import * as path30 from "path";
|
|
501499
501672
|
function safePath(userPath, workingDirectory) {
|
|
501500
|
-
const normalized2 =
|
|
501501
|
-
const absolutePath =
|
|
501502
|
-
const normalizedBase =
|
|
501503
|
-
const normalizedTarget =
|
|
501673
|
+
const normalized2 = path30.normalize(userPath);
|
|
501674
|
+
const absolutePath = path30.isAbsolute(normalized2) ? path30.resolve(normalized2) : path30.resolve(workingDirectory, normalized2);
|
|
501675
|
+
const normalizedBase = path30.resolve(workingDirectory);
|
|
501676
|
+
const normalizedTarget = path30.resolve(absolutePath);
|
|
501504
501677
|
if (normalizedTarget === normalizedBase)
|
|
501505
501678
|
return normalizedTarget;
|
|
501506
|
-
if (!normalizedTarget.startsWith(normalizedBase +
|
|
501679
|
+
if (!normalizedTarget.startsWith(normalizedBase + path30.sep)) {
|
|
501507
501680
|
throw new Error(`Path traversal blocked: "${userPath}" resolves outside working directory`);
|
|
501508
501681
|
}
|
|
501509
501682
|
return normalizedTarget;
|
|
@@ -502516,8 +502689,8 @@ var init_tools = __esm(() => {
|
|
|
502516
502689
|
}
|
|
502517
502690
|
}
|
|
502518
502691
|
async getOutline(filePath) {
|
|
502519
|
-
const absolutePath =
|
|
502520
|
-
if (!
|
|
502692
|
+
const absolutePath = path30.isAbsolute(filePath) ? filePath : path30.join(this.workingDirectory, filePath);
|
|
502693
|
+
if (!fs29.existsSync(absolutePath)) {
|
|
502521
502694
|
return `File not found: ${absolutePath}`;
|
|
502522
502695
|
}
|
|
502523
502696
|
try {
|
|
@@ -502545,8 +502718,8 @@ var init_tools = __esm(() => {
|
|
|
502545
502718
|
}
|
|
502546
502719
|
const filePath = symbolId.slice(0, separatorIndex);
|
|
502547
502720
|
const symbolName = symbolId.slice(separatorIndex + 2);
|
|
502548
|
-
const absolutePath =
|
|
502549
|
-
if (!
|
|
502721
|
+
const absolutePath = path30.isAbsolute(filePath) ? filePath : path30.join(this.workingDirectory, filePath);
|
|
502722
|
+
if (!fs29.existsSync(absolutePath)) {
|
|
502550
502723
|
return `File not found: ${absolutePath}`;
|
|
502551
502724
|
}
|
|
502552
502725
|
try {
|
|
@@ -502583,7 +502756,7 @@ ${source}`;
|
|
|
502583
502756
|
matches.push({
|
|
502584
502757
|
name: symbol21.name,
|
|
502585
502758
|
kind: symbol21.kind,
|
|
502586
|
-
file:
|
|
502759
|
+
file: path30.relative(this.workingDirectory, file2),
|
|
502587
502760
|
line: symbol21.startLine
|
|
502588
502761
|
});
|
|
502589
502762
|
}
|
|
@@ -502634,11 +502807,11 @@ ${source}`;
|
|
|
502634
502807
|
`);
|
|
502635
502808
|
}
|
|
502636
502809
|
async readFile(filePath) {
|
|
502637
|
-
const absolutePath =
|
|
502638
|
-
if (!
|
|
502810
|
+
const absolutePath = path30.isAbsolute(filePath) ? filePath : path30.join(this.workingDirectory, filePath);
|
|
502811
|
+
if (!fs29.existsSync(absolutePath)) {
|
|
502639
502812
|
return `File not found: ${absolutePath}`;
|
|
502640
502813
|
}
|
|
502641
|
-
const content =
|
|
502814
|
+
const content = fs29.readFileSync(absolutePath, "utf-8");
|
|
502642
502815
|
const lines = content.split(`
|
|
502643
502816
|
`);
|
|
502644
502817
|
const isCodeFile = /\.(ts|tsx|js|jsx)$/.test(absolutePath);
|
|
@@ -502653,7 +502826,7 @@ ${source}`;
|
|
|
502653
502826
|
} catch {}
|
|
502654
502827
|
}
|
|
502655
502828
|
if (this.astIndexReady && this.astRepoId) {
|
|
502656
|
-
const relativePath =
|
|
502829
|
+
const relativePath = path30.relative(this.workingDirectory, absolutePath);
|
|
502657
502830
|
const outline = getFileOutline(this.astRepoId, relativePath);
|
|
502658
502831
|
if (outline && outline.symbols.length > 0) {
|
|
502659
502832
|
const symbolList = outline.symbols.map((s3) => ` ${s3.kind} ${s3.name} (L${s3.startLine}-${s3.endLine})`).join(`
|
|
@@ -502694,15 +502867,15 @@ ${lines.slice(0, 200).join(`
|
|
|
502694
502867
|
return content;
|
|
502695
502868
|
}
|
|
502696
502869
|
async writeFile(filePath, content) {
|
|
502697
|
-
const absolutePath =
|
|
502870
|
+
const absolutePath = path30.isAbsolute(filePath) ? filePath : path30.join(this.workingDirectory, filePath);
|
|
502698
502871
|
const uiExtensions = [".tsx", ".jsx", ".css", ".html", ".svelte", ".vue"];
|
|
502699
|
-
const ext =
|
|
502872
|
+
const ext = path30.extname(absolutePath).toLowerCase();
|
|
502700
502873
|
let designHint = "";
|
|
502701
502874
|
if (uiExtensions.includes(ext)) {
|
|
502702
502875
|
try {
|
|
502703
|
-
const isNewFile = !
|
|
502704
|
-
if (isNewFile && needsDesignDecision(`create UI file ${
|
|
502705
|
-
const detection = await detectDesignNeed(`create UI component: ${
|
|
502876
|
+
const isNewFile = !fs29.existsSync(absolutePath);
|
|
502877
|
+
if (isNewFile && needsDesignDecision(`create UI file ${path30.basename(absolutePath)}`)) {
|
|
502878
|
+
const detection = await detectDesignNeed(`create UI component: ${path30.basename(absolutePath)}`);
|
|
502706
502879
|
if (detection.needsDesign) {
|
|
502707
502880
|
designHint = `
|
|
502708
502881
|
[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 +502883,11 @@ ${lines.slice(0, 200).join(`
|
|
|
502710
502883
|
}
|
|
502711
502884
|
} catch {}
|
|
502712
502885
|
}
|
|
502713
|
-
const dir =
|
|
502714
|
-
if (!
|
|
502715
|
-
|
|
502886
|
+
const dir = path30.dirname(absolutePath);
|
|
502887
|
+
if (!fs29.existsSync(dir)) {
|
|
502888
|
+
fs29.mkdirSync(dir, { recursive: true });
|
|
502716
502889
|
}
|
|
502717
|
-
|
|
502890
|
+
fs29.writeFileSync(absolutePath, content);
|
|
502718
502891
|
if (process.platform === "darwin") {
|
|
502719
502892
|
try {
|
|
502720
502893
|
const { spawn: spawn10 } = await import("child_process");
|
|
@@ -502727,22 +502900,22 @@ ${lines.slice(0, 200).join(`
|
|
|
502727
502900
|
return `File written and opened: ${absolutePath}${designHint}`;
|
|
502728
502901
|
}
|
|
502729
502902
|
async editFile(filePath, oldText, newText) {
|
|
502730
|
-
const absolutePath =
|
|
502731
|
-
if (!
|
|
502903
|
+
const absolutePath = path30.isAbsolute(filePath) ? filePath : path30.join(this.workingDirectory, filePath);
|
|
502904
|
+
if (!fs29.existsSync(absolutePath)) {
|
|
502732
502905
|
return `File not found: ${absolutePath}`;
|
|
502733
502906
|
}
|
|
502734
|
-
const content =
|
|
502907
|
+
const content = fs29.readFileSync(absolutePath, "utf-8");
|
|
502735
502908
|
if (!content.includes(oldText)) {
|
|
502736
502909
|
return `Error: Could not find the text to replace in ${filePath}. Make sure oldText matches exactly.`;
|
|
502737
502910
|
}
|
|
502738
502911
|
const newContent = content.replace(oldText, newText);
|
|
502739
|
-
|
|
502912
|
+
fs29.writeFileSync(absolutePath, newContent);
|
|
502740
502913
|
return `File edited: ${absolutePath}
|
|
502741
502914
|
Replaced ${oldText.length} chars with ${newText.length} chars.`;
|
|
502742
502915
|
}
|
|
502743
502916
|
async listFiles(dirPath = ".", pattern) {
|
|
502744
502917
|
const { glob } = await Promise.resolve().then(() => (init_index_min2(), exports_index_min));
|
|
502745
|
-
const absolutePath =
|
|
502918
|
+
const absolutePath = path30.isAbsolute(dirPath) ? dirPath : path30.join(this.workingDirectory, dirPath);
|
|
502746
502919
|
const files = await glob(pattern || "**/*", {
|
|
502747
502920
|
cwd: absolutePath,
|
|
502748
502921
|
ignore: ["**/node_modules/**", "**/dist/**", "**/.git/**"],
|
|
@@ -502880,7 +503053,7 @@ ${stderr}`);
|
|
|
502880
503053
|
});
|
|
502881
503054
|
}
|
|
502882
503055
|
async handleReadImage(imagePath) {
|
|
502883
|
-
const absolutePath =
|
|
503056
|
+
const absolutePath = path30.isAbsolute(imagePath) ? imagePath : path30.join(this.workingDirectory, imagePath);
|
|
502884
503057
|
try {
|
|
502885
503058
|
const imageInfo = await readImage(absolutePath);
|
|
502886
503059
|
return JSON.stringify({
|
|
@@ -502899,7 +503072,7 @@ ${stderr}`);
|
|
|
502899
503072
|
}
|
|
502900
503073
|
}
|
|
502901
503074
|
async handleDescribeImage(imagePath, prompt) {
|
|
502902
|
-
const absolutePath =
|
|
503075
|
+
const absolutePath = path30.isAbsolute(imagePath) ? imagePath : path30.join(this.workingDirectory, imagePath);
|
|
502903
503076
|
try {
|
|
502904
503077
|
const description = await describeImage(absolutePath, prompt || "Describe this image in detail.", "llava");
|
|
502905
503078
|
return JSON.stringify({
|
|
@@ -502915,7 +503088,7 @@ ${stderr}`);
|
|
|
502915
503088
|
}
|
|
502916
503089
|
}
|
|
502917
503090
|
async handleReadPdf(pdfPath) {
|
|
502918
|
-
const absolutePath =
|
|
503091
|
+
const absolutePath = path30.isAbsolute(pdfPath) ? pdfPath : path30.join(this.workingDirectory, pdfPath);
|
|
502919
503092
|
try {
|
|
502920
503093
|
const pdfInfo = await readPdf(absolutePath);
|
|
502921
503094
|
const maxTextLength = 1e4;
|
|
@@ -502934,7 +503107,7 @@ ${stderr}`);
|
|
|
502934
503107
|
}
|
|
502935
503108
|
}
|
|
502936
503109
|
async handleReadPdfPage(pdfPath, pageNum) {
|
|
502937
|
-
const absolutePath =
|
|
503110
|
+
const absolutePath = path30.isAbsolute(pdfPath) ? pdfPath : path30.join(this.workingDirectory, pdfPath);
|
|
502938
503111
|
try {
|
|
502939
503112
|
const pageContent = await readPdfPage(absolutePath, pageNum);
|
|
502940
503113
|
return JSON.stringify({
|
|
@@ -502948,7 +503121,7 @@ ${stderr}`);
|
|
|
502948
503121
|
}
|
|
502949
503122
|
}
|
|
502950
503123
|
async handleSearchPdf(pdfPath, query, caseSensitive) {
|
|
502951
|
-
const absolutePath =
|
|
503124
|
+
const absolutePath = path30.isAbsolute(pdfPath) ? pdfPath : path30.join(this.workingDirectory, pdfPath);
|
|
502952
503125
|
try {
|
|
502953
503126
|
const results = await searchPdf(absolutePath, query, caseSensitive ?? false);
|
|
502954
503127
|
return JSON.stringify({
|
|
@@ -502962,7 +503135,7 @@ ${stderr}`);
|
|
|
502962
503135
|
}
|
|
502963
503136
|
}
|
|
502964
503137
|
async handleReadNotebook(notebookPath) {
|
|
502965
|
-
const absolutePath =
|
|
503138
|
+
const absolutePath = path30.isAbsolute(notebookPath) ? notebookPath : path30.join(this.workingDirectory, notebookPath);
|
|
502966
503139
|
try {
|
|
502967
503140
|
const notebook = await readNotebook(absolutePath);
|
|
502968
503141
|
const formattedCells = notebook.cells.map((cell) => ({
|
|
@@ -502989,7 +503162,7 @@ ${stderr}`);
|
|
|
502989
503162
|
}
|
|
502990
503163
|
}
|
|
502991
503164
|
async handleNotebookEditCell(notebookPath, cellIndex, newSource) {
|
|
502992
|
-
const absolutePath =
|
|
503165
|
+
const absolutePath = path30.isAbsolute(notebookPath) ? notebookPath : path30.join(this.workingDirectory, notebookPath);
|
|
502993
503166
|
try {
|
|
502994
503167
|
const result = await editCell(absolutePath, cellIndex, newSource);
|
|
502995
503168
|
return JSON.stringify(result, null, 2);
|
|
@@ -502998,7 +503171,7 @@ ${stderr}`);
|
|
|
502998
503171
|
}
|
|
502999
503172
|
}
|
|
503000
503173
|
async handleNotebookInsertCell(notebookPath, afterIndex, cellType, source) {
|
|
503001
|
-
const absolutePath =
|
|
503174
|
+
const absolutePath = path30.isAbsolute(notebookPath) ? notebookPath : path30.join(this.workingDirectory, notebookPath);
|
|
503002
503175
|
try {
|
|
503003
503176
|
const result = await insertCell(absolutePath, afterIndex, cellType, source);
|
|
503004
503177
|
return JSON.stringify(result, null, 2);
|
|
@@ -503007,7 +503180,7 @@ ${stderr}`);
|
|
|
503007
503180
|
}
|
|
503008
503181
|
}
|
|
503009
503182
|
async handleNotebookDeleteCell(notebookPath, cellIndex) {
|
|
503010
|
-
const absolutePath =
|
|
503183
|
+
const absolutePath = path30.isAbsolute(notebookPath) ? notebookPath : path30.join(this.workingDirectory, notebookPath);
|
|
503011
503184
|
try {
|
|
503012
503185
|
const result = await deleteCell(absolutePath, cellIndex);
|
|
503013
503186
|
return JSON.stringify(result, null, 2);
|
|
@@ -503688,24 +503861,24 @@ ${list.map((a5, i4) => `${i4 + 1}. ${a5}`).join(`
|
|
|
503688
503861
|
});
|
|
503689
503862
|
|
|
503690
503863
|
// packages/reporting/runlog.ts
|
|
503691
|
-
import * as
|
|
503692
|
-
import * as
|
|
503693
|
-
import * as
|
|
503694
|
-
function
|
|
503695
|
-
const dir =
|
|
503696
|
-
if (!
|
|
503697
|
-
|
|
503864
|
+
import * as fs30 from "fs";
|
|
503865
|
+
import * as os20 from "os";
|
|
503866
|
+
import * as path31 from "path";
|
|
503867
|
+
function ensureDir4() {
|
|
503868
|
+
const dir = path31.dirname(LOG_PATH);
|
|
503869
|
+
if (!fs30.existsSync(dir)) {
|
|
503870
|
+
fs30.mkdirSync(dir, { recursive: true });
|
|
503698
503871
|
}
|
|
503699
503872
|
}
|
|
503700
503873
|
function appendRun(entry) {
|
|
503701
|
-
|
|
503702
|
-
|
|
503874
|
+
ensureDir4();
|
|
503875
|
+
fs30.appendFileSync(LOG_PATH, `${JSON.stringify(entry)}
|
|
503703
503876
|
`);
|
|
503704
503877
|
}
|
|
503705
503878
|
function readRuns(limit = 20) {
|
|
503706
|
-
if (!
|
|
503879
|
+
if (!fs30.existsSync(LOG_PATH))
|
|
503707
503880
|
return [];
|
|
503708
|
-
const lines =
|
|
503881
|
+
const lines = fs30.readFileSync(LOG_PATH, "utf-8").trim().split(`
|
|
503709
503882
|
`).filter(Boolean);
|
|
503710
503883
|
const entries = [];
|
|
503711
503884
|
for (let i4 = lines.length - 1;i4 >= 0 && entries.length < limit; i4--) {
|
|
@@ -503717,15 +503890,15 @@ function readRuns(limit = 20) {
|
|
|
503717
503890
|
}
|
|
503718
503891
|
var LOG_PATH;
|
|
503719
503892
|
var init_runlog = __esm(() => {
|
|
503720
|
-
LOG_PATH =
|
|
503893
|
+
LOG_PATH = path31.join(os20.homedir(), ".8gent", "runs.jsonl");
|
|
503721
503894
|
});
|
|
503722
503895
|
// packages/secrets/index.ts
|
|
503723
503896
|
import * as crypto5 from "crypto";
|
|
503724
|
-
import * as
|
|
503725
|
-
import * as
|
|
503726
|
-
import * as
|
|
503897
|
+
import * as fs31 from "fs";
|
|
503898
|
+
import * as os21 from "os";
|
|
503899
|
+
import * as path32 from "path";
|
|
503727
503900
|
function deriveKey() {
|
|
503728
|
-
const fingerprint = `${
|
|
503901
|
+
const fingerprint = `${os21.hostname()}:${os21.userInfo().username}`;
|
|
503729
503902
|
const salt = "8gent-vault-v1";
|
|
503730
503903
|
return crypto5.pbkdf2Sync(fingerprint, salt, 1e5, 32, "sha256");
|
|
503731
503904
|
}
|
|
@@ -503735,7 +503908,7 @@ class SecretVault {
|
|
|
503735
503908
|
key;
|
|
503736
503909
|
data;
|
|
503737
503910
|
constructor(vaultPath) {
|
|
503738
|
-
this.vaultPath = vaultPath ??
|
|
503911
|
+
this.vaultPath = vaultPath ?? path32.join(os21.homedir(), ".8gent", "vault.enc");
|
|
503739
503912
|
this.key = deriveKey();
|
|
503740
503913
|
this.data = this.load();
|
|
503741
503914
|
}
|
|
@@ -503787,10 +503960,10 @@ class SecretVault {
|
|
|
503787
503960
|
return callback(value);
|
|
503788
503961
|
}
|
|
503789
503962
|
migrateFromEnv(envPath) {
|
|
503790
|
-
if (!
|
|
503963
|
+
if (!fs31.existsSync(envPath)) {
|
|
503791
503964
|
throw new Error(`File not found: ${envPath}`);
|
|
503792
503965
|
}
|
|
503793
|
-
const content =
|
|
503966
|
+
const content = fs31.readFileSync(envPath, "utf-8");
|
|
503794
503967
|
const imported = [];
|
|
503795
503968
|
const skipped = [];
|
|
503796
503969
|
for (const line of content.split(`
|
|
@@ -503818,11 +503991,11 @@ class SecretVault {
|
|
|
503818
503991
|
return { imported, skipped };
|
|
503819
503992
|
}
|
|
503820
503993
|
load() {
|
|
503821
|
-
if (!
|
|
503994
|
+
if (!fs31.existsSync(this.vaultPath)) {
|
|
503822
503995
|
return { version: 1, entries: {} };
|
|
503823
503996
|
}
|
|
503824
503997
|
try {
|
|
503825
|
-
const raw =
|
|
503998
|
+
const raw = fs31.readFileSync(this.vaultPath, "utf-8");
|
|
503826
503999
|
const parsed = JSON.parse(raw);
|
|
503827
504000
|
if (parsed.version !== 1) {
|
|
503828
504001
|
throw new Error(`Unsupported vault version: ${parsed.version}`);
|
|
@@ -503833,11 +504006,11 @@ class SecretVault {
|
|
|
503833
504006
|
}
|
|
503834
504007
|
}
|
|
503835
504008
|
save() {
|
|
503836
|
-
const dir =
|
|
503837
|
-
if (!
|
|
503838
|
-
|
|
504009
|
+
const dir = path32.dirname(this.vaultPath);
|
|
504010
|
+
if (!fs31.existsSync(dir)) {
|
|
504011
|
+
fs31.mkdirSync(dir, { recursive: true });
|
|
503839
504012
|
}
|
|
503840
|
-
|
|
504013
|
+
fs31.writeFileSync(this.vaultPath, JSON.stringify(this.data, null, 2), { mode: 384 });
|
|
503841
504014
|
}
|
|
503842
504015
|
}
|
|
503843
504016
|
function getVault() {
|
|
@@ -503858,20 +504031,20 @@ __export(exports_telegram, {
|
|
|
503858
504031
|
getActiveTelegramBot: () => getActiveTelegramBot,
|
|
503859
504032
|
TelegramBot: () => TelegramBot
|
|
503860
504033
|
});
|
|
503861
|
-
import * as
|
|
503862
|
-
import * as
|
|
503863
|
-
import * as
|
|
504034
|
+
import * as fs32 from "fs";
|
|
504035
|
+
import * as os22 from "os";
|
|
504036
|
+
import * as path33 from "path";
|
|
503864
504037
|
function loadConfig2() {
|
|
503865
504038
|
try {
|
|
503866
|
-
if (
|
|
503867
|
-
return JSON.parse(
|
|
504039
|
+
if (fs32.existsSync(CONFIG_FILE)) {
|
|
504040
|
+
return JSON.parse(fs32.readFileSync(CONFIG_FILE, "utf-8"));
|
|
503868
504041
|
}
|
|
503869
504042
|
} catch {}
|
|
503870
504043
|
return null;
|
|
503871
504044
|
}
|
|
503872
504045
|
function saveConfig(config2) {
|
|
503873
|
-
|
|
503874
|
-
|
|
504046
|
+
fs32.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
504047
|
+
fs32.writeFileSync(CONFIG_FILE, JSON.stringify(config2, null, 2));
|
|
503875
504048
|
}
|
|
503876
504049
|
async function api3(token, method, body) {
|
|
503877
504050
|
const url2 = `${API_BASE}${token}/${method}`;
|
|
@@ -504081,9 +504254,9 @@ ${taskLines}`;
|
|
|
504081
504254
|
function buildSkillsMenu(agent) {
|
|
504082
504255
|
let skillLines = "No skills loaded.";
|
|
504083
504256
|
try {
|
|
504084
|
-
const indexPath =
|
|
504085
|
-
if (
|
|
504086
|
-
const index2 = JSON.parse(
|
|
504257
|
+
const indexPath = path33.join(os22.homedir(), ".8gent", "skills", ".index.json");
|
|
504258
|
+
if (fs32.existsSync(indexPath)) {
|
|
504259
|
+
const index2 = JSON.parse(fs32.readFileSync(indexPath, "utf-8"));
|
|
504087
504260
|
const cats = Object.entries(index2.categories || {}).sort((a5, b2) => b2[1] - a5[1]).map(([cat, count]) => ` ${cat}: ${count}`).join(`
|
|
504088
504261
|
`);
|
|
504089
504262
|
skillLines = `*${index2.skillCount}* skills loaded (${Math.round(index2.totalTokens / 1000)}k tokens)
|
|
@@ -504218,9 +504391,9 @@ class TelegramBot {
|
|
|
504218
504391
|
|
|
504219
504392
|
No benchmark data found.`;
|
|
504220
504393
|
try {
|
|
504221
|
-
const statePath =
|
|
504222
|
-
if (
|
|
504223
|
-
const state = JSON.parse(
|
|
504394
|
+
const statePath = path33.join(os22.homedir(), "iris-observatory", "benchmarks", "autoresearch", "loop-state.json");
|
|
504395
|
+
if (fs32.existsSync(statePath)) {
|
|
504396
|
+
const state = JSON.parse(fs32.readFileSync(statePath, "utf-8"));
|
|
504224
504397
|
const lastHistory = state.history?.[state.history.length - 1];
|
|
504225
504398
|
if (lastHistory) {
|
|
504226
504399
|
const scores = Object.entries(lastHistory.scores || {}).map(([id2, score]) => {
|
|
@@ -504492,8 +504665,8 @@ async function validateToken(token) {
|
|
|
504492
504665
|
}
|
|
504493
504666
|
var CONFIG_DIR, CONFIG_FILE, API_BASE = "https://api.telegram.org/bot", activeBotInstance = null;
|
|
504494
504667
|
var init_telegram = __esm(() => {
|
|
504495
|
-
CONFIG_DIR =
|
|
504496
|
-
CONFIG_FILE =
|
|
504668
|
+
CONFIG_DIR = path33.join(os22.homedir(), ".8gent");
|
|
504669
|
+
CONFIG_FILE = path33.join(CONFIG_DIR, "telegram.json");
|
|
504497
504670
|
});
|
|
504498
504671
|
|
|
504499
504672
|
// packages/self-autonomy/onboarding.ts
|
|
@@ -504501,19 +504674,39 @@ var exports_onboarding = {};
|
|
|
504501
504674
|
__export(exports_onboarding, {
|
|
504502
504675
|
runTelegramSetup: () => runTelegramSetup,
|
|
504503
504676
|
default: () => onboarding_default,
|
|
504677
|
+
PROVIDER_INSTALL_HINTS: () => PROVIDER_INSTALL_HINTS,
|
|
504504
504678
|
OnboardingManager: () => OnboardingManager
|
|
504505
504679
|
});
|
|
504506
504680
|
import { exec as exec3 } from "child_process";
|
|
504507
|
-
import * as
|
|
504508
|
-
import * as
|
|
504509
|
-
import * as
|
|
504681
|
+
import * as fs33 from "fs";
|
|
504682
|
+
import * as os23 from "os";
|
|
504683
|
+
import * as path34 from "path";
|
|
504510
504684
|
import { promisify as promisify2 } from "util";
|
|
504685
|
+
function persistAgentName(roleKey, name21) {
|
|
504686
|
+
const trimmed = (name21 ?? "").trim();
|
|
504687
|
+
if (!trimmed)
|
|
504688
|
+
return;
|
|
504689
|
+
try {
|
|
504690
|
+
const current = loadSettings();
|
|
504691
|
+
const next2 = {
|
|
504692
|
+
...current,
|
|
504693
|
+
agents: {
|
|
504694
|
+
...current.agents,
|
|
504695
|
+
names: {
|
|
504696
|
+
...current.agents.names,
|
|
504697
|
+
[roleKey]: trimmed
|
|
504698
|
+
}
|
|
504699
|
+
}
|
|
504700
|
+
};
|
|
504701
|
+
saveSettings(next2);
|
|
504702
|
+
} catch {}
|
|
504703
|
+
}
|
|
504511
504704
|
|
|
504512
504705
|
class OnboardingManager {
|
|
504513
504706
|
userConfigPath;
|
|
504514
504707
|
user;
|
|
504515
504708
|
constructor(workingDirectory = process.cwd()) {
|
|
504516
|
-
this.userConfigPath =
|
|
504709
|
+
this.userConfigPath = path34.join(process.env.HOME || os23.homedir(), ".8gent", "user.json");
|
|
504517
504710
|
this.user = this.loadUserConfig();
|
|
504518
504711
|
}
|
|
504519
504712
|
static async autoDetect() {
|
|
@@ -504580,19 +504773,19 @@ class OnboardingManager {
|
|
|
504580
504773
|
}
|
|
504581
504774
|
loadUserConfig() {
|
|
504582
504775
|
try {
|
|
504583
|
-
if (
|
|
504584
|
-
const content =
|
|
504776
|
+
if (fs33.existsSync(this.userConfigPath)) {
|
|
504777
|
+
const content = fs33.readFileSync(this.userConfigPath, "utf-8");
|
|
504585
504778
|
return JSON.parse(content);
|
|
504586
504779
|
}
|
|
504587
504780
|
} catch {}
|
|
504588
504781
|
return getDefaultUserConfig();
|
|
504589
504782
|
}
|
|
504590
504783
|
saveUserConfig() {
|
|
504591
|
-
const dir =
|
|
504592
|
-
if (!
|
|
504593
|
-
|
|
504784
|
+
const dir = path34.dirname(this.userConfigPath);
|
|
504785
|
+
if (!fs33.existsSync(dir)) {
|
|
504786
|
+
fs33.mkdirSync(dir, { recursive: true });
|
|
504594
504787
|
}
|
|
504595
|
-
|
|
504788
|
+
fs33.writeFileSync(this.userConfigPath, JSON.stringify(this.user, null, 2));
|
|
504596
504789
|
}
|
|
504597
504790
|
needsOnboarding() {
|
|
504598
504791
|
return !this.user.onboardingComplete;
|
|
@@ -504610,6 +504803,9 @@ class OnboardingManager {
|
|
|
504610
504803
|
}
|
|
504611
504804
|
return false;
|
|
504612
504805
|
}
|
|
504806
|
+
getTotalSteps() {
|
|
504807
|
+
return ONBOARDING_QUESTIONS.length;
|
|
504808
|
+
}
|
|
504613
504809
|
getNextQuestion() {
|
|
504614
504810
|
if (this.user.onboardingComplete) {
|
|
504615
504811
|
return null;
|
|
@@ -504777,6 +504973,17 @@ class OnboardingManager {
|
|
|
504777
504973
|
text4 = text4.replace("{detected_provider}", this.user.preferences.model.provider || "not detected");
|
|
504778
504974
|
text4 = text4.replace("{detected_models}", this.user.integrations.ollama.models.slice(0, 3).join(", ") || "none found");
|
|
504779
504975
|
text4 = text4.replace("{agent_name}", this.user.preferences.voice?.agentName || "Eight");
|
|
504976
|
+
try {
|
|
504977
|
+
const s3 = loadSettings();
|
|
504978
|
+
const names = s3?.agents?.names ?? DEFAULT_SETTINGS.agents.names;
|
|
504979
|
+
text4 = text4.replace("{agent_orchestrator}", names.orchestrator);
|
|
504980
|
+
text4 = text4.replace("{agent_engineer}", names.engineer);
|
|
504981
|
+
text4 = text4.replace("{agent_qa}", names.qa);
|
|
504982
|
+
} catch {
|
|
504983
|
+
text4 = text4.replace("{agent_orchestrator}", DEFAULT_SETTINGS.agents.names.orchestrator);
|
|
504984
|
+
text4 = text4.replace("{agent_engineer}", DEFAULT_SETTINGS.agents.names.engineer);
|
|
504985
|
+
text4 = text4.replace("{agent_qa}", DEFAULT_SETTINGS.agents.names.qa);
|
|
504986
|
+
}
|
|
504780
504987
|
return { ...question, question: text4 };
|
|
504781
504988
|
}
|
|
504782
504989
|
}
|
|
@@ -504920,63 +505127,123 @@ Use \x1B[36m/telegram start\x1B[0m to launch the bot, or it will auto-start next
|
|
|
504920
505127
|
`);
|
|
504921
505128
|
return true;
|
|
504922
505129
|
}
|
|
504923
|
-
var execAsync2, ONBOARDING_QUESTIONS, onboarding_default;
|
|
505130
|
+
var execAsync2, PROVIDER_INSTALL_HINTS, ONBOARDING_QUESTIONS, onboarding_default;
|
|
504924
505131
|
var init_onboarding = __esm(() => {
|
|
504925
505132
|
init_secrets();
|
|
505133
|
+
init_settings();
|
|
504926
505134
|
execAsync2 = promisify2(exec3);
|
|
505135
|
+
PROVIDER_INSTALL_HINTS = {
|
|
505136
|
+
ollama: "Install: https://ollama.ai (or `brew install ollama && ollama serve`). Then `ollama pull qwen3.6:27b`.",
|
|
505137
|
+
lmstudio: "Install: https://lmstudio.ai. Open it, load `google/gemma-4-26b-a4b`, click Start Server (port 1234).",
|
|
505138
|
+
apfel: "Install: `brew install arthur-ficial/tap/apfel`. Run: `apfel --serve --port 11500`."
|
|
505139
|
+
};
|
|
504927
505140
|
ONBOARDING_QUESTIONS = [
|
|
504928
505141
|
{
|
|
504929
|
-
step: "
|
|
505142
|
+
step: "language",
|
|
504930
505143
|
question: `Good day. I'm 8gent, The Infinite Gentleman.
|
|
504931
505144
|
|
|
504932
|
-
` + `Here's what I detected:
|
|
505145
|
+
` + `Here's what I detected from your environment:
|
|
504933
505146
|
` + ` Name: {detected_name}
|
|
504934
505147
|
` + ` Email: {detected_email}
|
|
504935
505148
|
` + ` GitHub: {detected_github}
|
|
504936
505149
|
` + ` Provider: {detected_provider}
|
|
504937
505150
|
` + ` Models: {detected_models}
|
|
504938
505151
|
|
|
504939
|
-
` + "
|
|
505152
|
+
` + "I'll walk you through a short setup so I can serve you properly.",
|
|
505153
|
+
kind: "select",
|
|
505154
|
+
choices: [{ label: "Press Enter to begin", value: "ok" }],
|
|
505155
|
+
options: ["ok", "yes", "y"],
|
|
505156
|
+
processor: (_answer, user) => ({
|
|
505157
|
+
...user,
|
|
505158
|
+
completedSteps: [...user.completedSteps, "language"]
|
|
505159
|
+
})
|
|
505160
|
+
},
|
|
505161
|
+
{
|
|
505162
|
+
step: "identity",
|
|
505163
|
+
question: "What should I call you? (default: {detected_name})",
|
|
504940
505164
|
processor: (answer, user) => {
|
|
504941
505165
|
const name21 = answer.trim() || user.identity.name;
|
|
504942
505166
|
return {
|
|
504943
505167
|
...user,
|
|
504944
505168
|
identity: { ...user.identity, name: name21 || user.identity.name },
|
|
504945
|
-
completedSteps: [
|
|
504946
|
-
|
|
504947
|
-
|
|
504948
|
-
|
|
504949
|
-
|
|
504950
|
-
|
|
504951
|
-
|
|
504952
|
-
|
|
504953
|
-
|
|
504954
|
-
|
|
504955
|
-
|
|
505169
|
+
completedSteps: [...user.completedSteps, "identity"]
|
|
505170
|
+
};
|
|
505171
|
+
}
|
|
505172
|
+
},
|
|
505173
|
+
{
|
|
505174
|
+
step: "role",
|
|
505175
|
+
question: "What best describes you?",
|
|
505176
|
+
kind: "select",
|
|
505177
|
+
choices: [
|
|
505178
|
+
{ label: "Engineer", value: "engineer", description: "Builder of software" },
|
|
505179
|
+
{ label: "Designer", value: "designer", description: "Crafter of interfaces" },
|
|
505180
|
+
{ label: "Founder", value: "founder", description: "Wearer of many hats" },
|
|
505181
|
+
{ label: "Hobbyist", value: "hobbyist", description: "Tinkerer, learner" },
|
|
505182
|
+
{ label: "Other", value: "other", description: "Something else entirely" }
|
|
505183
|
+
],
|
|
505184
|
+
options: ["engineer", "designer", "founder", "hobbyist", "other"],
|
|
505185
|
+
processor: (answer, user) => {
|
|
505186
|
+
const role = answer.trim().toLowerCase() || "engineer";
|
|
505187
|
+
return {
|
|
505188
|
+
...user,
|
|
505189
|
+
identity: { ...user.identity, role },
|
|
505190
|
+
completedSteps: [...user.completedSteps, "role"]
|
|
505191
|
+
};
|
|
505192
|
+
}
|
|
505193
|
+
},
|
|
505194
|
+
{
|
|
505195
|
+
step: "projects",
|
|
505196
|
+
question: "What are you working on? (one short line, optional - press Enter to skip)",
|
|
505197
|
+
processor: (answer, user) => {
|
|
505198
|
+
const desc = answer.trim();
|
|
505199
|
+
if (!desc) {
|
|
505200
|
+
return {
|
|
505201
|
+
...user,
|
|
505202
|
+
completedSteps: [...user.completedSteps, "projects"]
|
|
505203
|
+
};
|
|
505204
|
+
}
|
|
505205
|
+
return {
|
|
505206
|
+
...user,
|
|
505207
|
+
projects: {
|
|
505208
|
+
...user.projects,
|
|
505209
|
+
primary: desc,
|
|
505210
|
+
all: user.projects.all.includes(desc) ? user.projects.all : [...user.projects.all, desc],
|
|
505211
|
+
descriptions: { ...user.projects.descriptions, [desc]: desc }
|
|
505212
|
+
},
|
|
505213
|
+
completedSteps: [...user.completedSteps, "projects"]
|
|
504956
505214
|
};
|
|
504957
505215
|
}
|
|
504958
505216
|
},
|
|
504959
505217
|
{
|
|
504960
505218
|
step: "communication",
|
|
504961
|
-
question:
|
|
504962
|
-
|
|
504963
|
-
|
|
504964
|
-
|
|
504965
|
-
|
|
504966
|
-
|
|
504967
|
-
|
|
505219
|
+
question: "How should I communicate with you?",
|
|
505220
|
+
kind: "select",
|
|
505221
|
+
choices: [
|
|
505222
|
+
{
|
|
505223
|
+
label: "Dry-witted, sarcastic, seriously motivational",
|
|
505224
|
+
value: "1",
|
|
505225
|
+
description: "Roast me into greatness"
|
|
505226
|
+
},
|
|
505227
|
+
{ label: "Concise & direct", value: "2", description: "Just the facts" },
|
|
505228
|
+
{ label: "Detailed & explanatory", value: "3", description: "Teach me as we go" },
|
|
505229
|
+
{ label: "Casual & friendly", value: "4", description: "We're collaborators" },
|
|
505230
|
+
{ label: "Formal & precise", value: "5", description: "Professional tone" }
|
|
505231
|
+
],
|
|
505232
|
+
options: ["1", "2", "3", "4", "5", "sarcastic", "concise", "detailed", "casual", "formal"],
|
|
504968
505233
|
processor: (answer, user) => {
|
|
504969
505234
|
const styleMap = {
|
|
504970
|
-
"1": "
|
|
504971
|
-
"2": "
|
|
504972
|
-
"3": "
|
|
504973
|
-
"4": "
|
|
505235
|
+
"1": "sarcastic",
|
|
505236
|
+
"2": "concise",
|
|
505237
|
+
"3": "detailed",
|
|
505238
|
+
"4": "casual",
|
|
505239
|
+
"5": "formal",
|
|
505240
|
+
sarcastic: "sarcastic",
|
|
504974
505241
|
concise: "concise",
|
|
504975
505242
|
detailed: "detailed",
|
|
504976
505243
|
casual: "casual",
|
|
504977
505244
|
formal: "formal"
|
|
504978
505245
|
};
|
|
504979
|
-
const style = styleMap[answer.toLowerCase()] || "
|
|
505246
|
+
const style = styleMap[answer.toLowerCase()] || "sarcastic";
|
|
504980
505247
|
return {
|
|
504981
505248
|
...user,
|
|
504982
505249
|
identity: { ...user.identity, communicationStyle: style },
|
|
@@ -504984,6 +505251,110 @@ var init_onboarding = __esm(() => {
|
|
|
504984
505251
|
};
|
|
504985
505252
|
}
|
|
504986
505253
|
},
|
|
505254
|
+
{
|
|
505255
|
+
step: "provider-check-ollama",
|
|
505256
|
+
question: "Provider check: Ollama (local LLM runtime)",
|
|
505257
|
+
kind: "providerCheck",
|
|
505258
|
+
provider: "ollama",
|
|
505259
|
+
installHint: PROVIDER_INSTALL_HINTS.ollama,
|
|
505260
|
+
processor: (answer, user) => {
|
|
505261
|
+
const live = answer === "live";
|
|
505262
|
+
return {
|
|
505263
|
+
...user,
|
|
505264
|
+
integrations: {
|
|
505265
|
+
...user.integrations,
|
|
505266
|
+
ollama: {
|
|
505267
|
+
...user.integrations.ollama,
|
|
505268
|
+
available: live || user.integrations.ollama.available
|
|
505269
|
+
}
|
|
505270
|
+
},
|
|
505271
|
+
completedSteps: [...user.completedSteps, "provider-check-ollama"]
|
|
505272
|
+
};
|
|
505273
|
+
}
|
|
505274
|
+
},
|
|
505275
|
+
{
|
|
505276
|
+
step: "provider-check-lmstudio",
|
|
505277
|
+
question: "Provider check: LM Studio (local LLM runtime)",
|
|
505278
|
+
kind: "providerCheck",
|
|
505279
|
+
provider: "lmstudio",
|
|
505280
|
+
installHint: PROVIDER_INSTALL_HINTS.lmstudio,
|
|
505281
|
+
processor: (answer, user) => {
|
|
505282
|
+
const live = answer === "live";
|
|
505283
|
+
return {
|
|
505284
|
+
...user,
|
|
505285
|
+
integrations: {
|
|
505286
|
+
...user.integrations,
|
|
505287
|
+
lmstudio: {
|
|
505288
|
+
...user.integrations.lmstudio,
|
|
505289
|
+
available: live || user.integrations.lmstudio.available
|
|
505290
|
+
}
|
|
505291
|
+
},
|
|
505292
|
+
completedSteps: [...user.completedSteps, "provider-check-lmstudio"]
|
|
505293
|
+
};
|
|
505294
|
+
}
|
|
505295
|
+
},
|
|
505296
|
+
{
|
|
505297
|
+
step: "provider-check-apfel",
|
|
505298
|
+
question: "Provider check: apfel (Apple Foundation Model)",
|
|
505299
|
+
kind: "providerCheck",
|
|
505300
|
+
provider: "apfel",
|
|
505301
|
+
installHint: PROVIDER_INSTALL_HINTS.apfel,
|
|
505302
|
+
processor: (_answer, user) => ({
|
|
505303
|
+
...user,
|
|
505304
|
+
completedSteps: [...user.completedSteps, "provider-check-apfel"]
|
|
505305
|
+
})
|
|
505306
|
+
},
|
|
505307
|
+
{
|
|
505308
|
+
step: "agent-name-orchestrator",
|
|
505309
|
+
question: `Name your Orchestrator agent. (default: Orchestrator)
|
|
505310
|
+
|
|
505311
|
+
` + "Press Enter to keep, or type a custom name (e.g. Architect, Plato):",
|
|
505312
|
+
kind: "agentName",
|
|
505313
|
+
roleKey: "orchestrator",
|
|
505314
|
+
default: "Orchestrator",
|
|
505315
|
+
processor: (answer, user) => {
|
|
505316
|
+
const chosen = answer.trim() || DEFAULT_SETTINGS.agents.names.orchestrator;
|
|
505317
|
+
persistAgentName("orchestrator", chosen);
|
|
505318
|
+
return {
|
|
505319
|
+
...user,
|
|
505320
|
+
completedSteps: [...user.completedSteps, "agent-name-orchestrator"]
|
|
505321
|
+
};
|
|
505322
|
+
}
|
|
505323
|
+
},
|
|
505324
|
+
{
|
|
505325
|
+
step: "agent-name-engineer",
|
|
505326
|
+
question: `Name your Engineer agent. (default: Engineer)
|
|
505327
|
+
|
|
505328
|
+
` + "Press Enter to keep, or type a custom name (e.g. Coder, Hephaestus):",
|
|
505329
|
+
kind: "agentName",
|
|
505330
|
+
roleKey: "engineer",
|
|
505331
|
+
default: "Engineer",
|
|
505332
|
+
processor: (answer, user) => {
|
|
505333
|
+
const chosen = answer.trim() || DEFAULT_SETTINGS.agents.names.engineer;
|
|
505334
|
+
persistAgentName("engineer", chosen);
|
|
505335
|
+
return {
|
|
505336
|
+
...user,
|
|
505337
|
+
completedSteps: [...user.completedSteps, "agent-name-engineer"]
|
|
505338
|
+
};
|
|
505339
|
+
}
|
|
505340
|
+
},
|
|
505341
|
+
{
|
|
505342
|
+
step: "agent-name-qa",
|
|
505343
|
+
question: `Name your QA agent. (default: QA)
|
|
505344
|
+
|
|
505345
|
+
` + "Press Enter to keep, or type a custom name (e.g. Reviewer, Cassandra):",
|
|
505346
|
+
kind: "agentName",
|
|
505347
|
+
roleKey: "qa",
|
|
505348
|
+
default: "QA",
|
|
505349
|
+
processor: (answer, user) => {
|
|
505350
|
+
const chosen = answer.trim() || DEFAULT_SETTINGS.agents.names.qa;
|
|
505351
|
+
persistAgentName("qa", chosen);
|
|
505352
|
+
return {
|
|
505353
|
+
...user,
|
|
505354
|
+
completedSteps: [...user.completedSteps, "agent-name-qa"]
|
|
505355
|
+
};
|
|
505356
|
+
}
|
|
505357
|
+
},
|
|
504987
505358
|
{
|
|
504988
505359
|
step: "voice",
|
|
504989
505360
|
question: `What should your 8gent be called? (default: Eight)
|
|
@@ -505012,12 +505383,20 @@ var init_onboarding = __esm(() => {
|
|
|
505012
505383
|
|
|
505013
505384
|
` + `This downloads KittenTTS - a free, local neural text-to-speech engine.
|
|
505014
505385
|
` + `No API keys needed. Runs entirely on your machine.
|
|
505015
|
-
` +
|
|
505016
|
-
|
|
505017
|
-
|
|
505018
|
-
|
|
505019
|
-
|
|
505020
|
-
|
|
505386
|
+
` + "Download size: ~200MB (model + dependencies)",
|
|
505387
|
+
kind: "select",
|
|
505388
|
+
choices: [
|
|
505389
|
+
{
|
|
505390
|
+
label: "Yes, install AI voices",
|
|
505391
|
+
value: "1",
|
|
505392
|
+
description: "Recommended. Free local neural TTS via KittenTTS."
|
|
505393
|
+
},
|
|
505394
|
+
{
|
|
505395
|
+
label: "No, use system voices only",
|
|
505396
|
+
value: "2",
|
|
505397
|
+
description: "Skip the download. Use macOS built-in voices."
|
|
505398
|
+
}
|
|
505399
|
+
],
|
|
505021
505400
|
options: ["1", "2", "yes", "no", "y", "n"],
|
|
505022
505401
|
processor: (answer, user) => {
|
|
505023
505402
|
const wantsAI = ["1", "yes", "y"].includes(answer.toLowerCase());
|
|
@@ -505052,26 +505431,23 @@ var init_onboarding = __esm(() => {
|
|
|
505052
505431
|
},
|
|
505053
505432
|
{
|
|
505054
505433
|
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):",
|
|
505434
|
+
question: "Pick a voice for your agent.",
|
|
505435
|
+
kind: "select",
|
|
505436
|
+
choices: [
|
|
505437
|
+
{ label: "Bruno", value: "1", description: "AI - male, warm & authoritative (recommended)" },
|
|
505438
|
+
{ label: "Bella", value: "2", description: "AI - female, warm & clear" },
|
|
505439
|
+
{ label: "Jasper", value: "3", description: "AI - male, crisp & technical" },
|
|
505440
|
+
{ label: "Luna", value: "4", description: "AI - female, soft & creative" },
|
|
505441
|
+
{ label: "Rosie", value: "5", description: "AI - female, bright & energetic" },
|
|
505442
|
+
{ label: "Hugo", value: "6", description: "AI - male, neutral & steady" },
|
|
505443
|
+
{ label: "Kiki", value: "7", description: "AI - female, light & friendly" },
|
|
505444
|
+
{ label: "Leo", value: "8", description: "AI - male, rich & expressive" },
|
|
505445
|
+
{ label: "Moira", value: "9", description: "System - Irish (macOS)" },
|
|
505446
|
+
{ label: "Daniel", value: "10", description: "System - British (macOS)" },
|
|
505447
|
+
{ label: "Samantha", value: "11", description: "System - American (macOS)" },
|
|
505448
|
+
{ label: "Karen", value: "12", description: "System - Australian (macOS)" },
|
|
505449
|
+
{ label: "Rishi", value: "13", description: "System - Indian (macOS)" }
|
|
505450
|
+
],
|
|
505075
505451
|
options: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13"],
|
|
505076
505452
|
processor: (answer, user) => {
|
|
505077
505453
|
const kittenVoices = {
|
|
@@ -505115,13 +505491,22 @@ var init_onboarding = __esm(() => {
|
|
|
505115
505491
|
question: `Excellent. All set:
|
|
505116
505492
|
|
|
505117
505493
|
` + `- Name: {name}
|
|
505494
|
+
` + `- Role: {role}
|
|
505495
|
+
` + `- Project: {project}
|
|
505118
505496
|
` + `- Style: {style}
|
|
505119
505497
|
` + `- Provider: {provider}
|
|
505120
|
-
` + `-
|
|
505498
|
+
` + `- 8gent: {agent_name}
|
|
505121
505499
|
` + `- Voice: {voice}
|
|
505500
|
+
` + `- Orchestrator: {agent_orchestrator}
|
|
505501
|
+
` + `- Engineer: {agent_engineer}
|
|
505502
|
+
` + `- QA: {agent_qa}
|
|
505122
505503
|
|
|
505123
|
-
` +
|
|
505124
|
-
|
|
505504
|
+
` + "Ready to begin?",
|
|
505505
|
+
kind: "select",
|
|
505506
|
+
choices: [
|
|
505507
|
+
{ label: "Yes, let's go", value: "yes" },
|
|
505508
|
+
{ label: "No, restart later", value: "no" }
|
|
505509
|
+
],
|
|
505125
505510
|
options: ["yes", "no", "y", "n"],
|
|
505126
505511
|
processor: (answer, user) => {
|
|
505127
505512
|
return {
|
|
@@ -505146,11 +505531,11 @@ var init_onboarding = __esm(() => {
|
|
|
505146
505531
|
});
|
|
505147
505532
|
|
|
505148
505533
|
// packages/skills/compound.ts
|
|
505149
|
-
import { homedir as
|
|
505150
|
-
import { join as
|
|
505534
|
+
import { homedir as homedir24 } from "os";
|
|
505535
|
+
import { join as join43 } from "path";
|
|
505151
505536
|
var LEARNED_SKILLS_DIR;
|
|
505152
505537
|
var init_compound = __esm(() => {
|
|
505153
|
-
LEARNED_SKILLS_DIR =
|
|
505538
|
+
LEARNED_SKILLS_DIR = join43(homedir24(), ".8gent", "learned-skills");
|
|
505154
505539
|
});
|
|
505155
505540
|
|
|
505156
505541
|
// packages/skills/matcher.ts
|
|
@@ -505159,11 +505544,11 @@ var init_matcher = __esm(() => {
|
|
|
505159
505544
|
});
|
|
505160
505545
|
|
|
505161
505546
|
// packages/skills/experiment.ts
|
|
505162
|
-
import { join as
|
|
505547
|
+
import { join as join44 } from "path";
|
|
505163
505548
|
var EXPERIMENTS_DIR;
|
|
505164
505549
|
var init_experiment = __esm(() => {
|
|
505165
505550
|
init_compound();
|
|
505166
|
-
EXPERIMENTS_DIR =
|
|
505551
|
+
EXPERIMENTS_DIR = join44(LEARNED_SKILLS_DIR, ".experiments");
|
|
505167
505552
|
});
|
|
505168
505553
|
|
|
505169
505554
|
// packages/skills/creator.ts
|
|
@@ -505217,9 +505602,9 @@ var init_creator = __esm(() => {
|
|
|
505217
505602
|
});
|
|
505218
505603
|
|
|
505219
505604
|
// packages/skills/index.ts
|
|
505220
|
-
import * as
|
|
505221
|
-
import * as
|
|
505222
|
-
import * as
|
|
505605
|
+
import * as fs34 from "fs";
|
|
505606
|
+
import * as os24 from "os";
|
|
505607
|
+
import * as path35 from "path";
|
|
505223
505608
|
import { fileURLToPath } from "url";
|
|
505224
505609
|
function parseFrontmatter(content) {
|
|
505225
505610
|
const frontmatterRegex = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/;
|
|
@@ -505260,21 +505645,21 @@ function parseFrontmatter(content) {
|
|
|
505260
505645
|
};
|
|
505261
505646
|
}
|
|
505262
505647
|
function collectNestedSkillMdPaths(skillsRoot) {
|
|
505263
|
-
if (!
|
|
505648
|
+
if (!fs34.existsSync(skillsRoot))
|
|
505264
505649
|
return [];
|
|
505265
505650
|
const out = [];
|
|
505266
|
-
for (const name21 of
|
|
505267
|
-
const skillMd =
|
|
505268
|
-
if (
|
|
505651
|
+
for (const name21 of fs34.readdirSync(skillsRoot)) {
|
|
505652
|
+
const skillMd = path35.join(skillsRoot, name21, "SKILL.md");
|
|
505653
|
+
if (fs34.existsSync(skillMd)) {
|
|
505269
505654
|
out.push(skillMd);
|
|
505270
505655
|
}
|
|
505271
505656
|
}
|
|
505272
505657
|
return out;
|
|
505273
505658
|
}
|
|
505274
505659
|
function discoverBundledSkillMdFiles() {
|
|
505275
|
-
const entryDir =
|
|
505660
|
+
const entryDir = path35.dirname(fileURLToPath(import.meta.url));
|
|
505276
505661
|
const nested = [...collectNestedSkillMdPaths(entryDir)];
|
|
505277
|
-
nested.push(...collectNestedSkillMdPaths(
|
|
505662
|
+
nested.push(...collectNestedSkillMdPaths(path35.join(entryDir, "skills")));
|
|
505278
505663
|
return nested;
|
|
505279
505664
|
}
|
|
505280
505665
|
|
|
@@ -505284,31 +505669,31 @@ class SkillManager {
|
|
|
505284
505669
|
skillsDirectory;
|
|
505285
505670
|
invocations = new Map;
|
|
505286
505671
|
constructor(skillsDirectory) {
|
|
505287
|
-
this.skillsDirectory = skillsDirectory ||
|
|
505672
|
+
this.skillsDirectory = skillsDirectory || path35.join(os24.homedir(), ".8gent", "skills");
|
|
505288
505673
|
}
|
|
505289
505674
|
async loadSkills() {
|
|
505290
505675
|
this.skills.clear();
|
|
505291
505676
|
this.aliasToCanonical.clear();
|
|
505292
|
-
if (!
|
|
505293
|
-
|
|
505677
|
+
if (!fs34.existsSync(this.skillsDirectory)) {
|
|
505678
|
+
fs34.mkdirSync(this.skillsDirectory, { recursive: true });
|
|
505294
505679
|
this.createExampleSkill();
|
|
505295
505680
|
}
|
|
505296
|
-
const files =
|
|
505681
|
+
const files = fs34.readdirSync(this.skillsDirectory);
|
|
505297
505682
|
const skillFiles = files.filter((f3) => f3.endsWith(".md"));
|
|
505298
505683
|
for (const file2 of skillFiles) {
|
|
505299
|
-
this.tryIngestSkillFile(
|
|
505684
|
+
this.tryIngestSkillFile(path35.join(this.skillsDirectory, file2), false);
|
|
505300
505685
|
}
|
|
505301
|
-
const claudeSkillsRoot =
|
|
505686
|
+
const claudeSkillsRoot = path35.join(process.cwd(), ".claude", "skills");
|
|
505302
505687
|
for (const filePath of collectNestedSkillMdPaths(claudeSkillsRoot)) {
|
|
505303
505688
|
this.tryIngestSkillFile(filePath, true);
|
|
505304
505689
|
}
|
|
505305
505690
|
for (const filePath of discoverBundledSkillMdFiles()) {
|
|
505306
505691
|
this.tryIngestSkillFile(filePath, true);
|
|
505307
505692
|
}
|
|
505308
|
-
if (
|
|
505309
|
-
const learnedFiles =
|
|
505693
|
+
if (fs34.existsSync(LEARNED_DIR)) {
|
|
505694
|
+
const learnedFiles = fs34.readdirSync(LEARNED_DIR).filter((f3) => f3.endsWith(".md"));
|
|
505310
505695
|
for (const file2 of learnedFiles) {
|
|
505311
|
-
this.tryIngestSkillFile(
|
|
505696
|
+
this.tryIngestSkillFile(path35.join(LEARNED_DIR, file2), true);
|
|
505312
505697
|
}
|
|
505313
505698
|
}
|
|
505314
505699
|
return this.getAllSkills();
|
|
@@ -505346,7 +505731,7 @@ class SkillManager {
|
|
|
505346
505731
|
}
|
|
505347
505732
|
tryIngestSkillFile(filePath, skipIfExists) {
|
|
505348
505733
|
try {
|
|
505349
|
-
const content =
|
|
505734
|
+
const content = fs34.readFileSync(filePath, "utf-8");
|
|
505350
505735
|
const { frontmatter, body } = parseFrontmatter(content);
|
|
505351
505736
|
if (skipIfExists && this.skills.has(frontmatter.name))
|
|
505352
505737
|
return;
|
|
@@ -505391,8 +505776,8 @@ examples:
|
|
|
505391
505776
|
- Don't commit node_modules, .env, or other sensitive files
|
|
505392
505777
|
- Group related changes into single commits
|
|
505393
505778
|
`;
|
|
505394
|
-
const filePath =
|
|
505395
|
-
|
|
505779
|
+
const filePath = path35.join(this.skillsDirectory, "commit.md");
|
|
505780
|
+
fs34.writeFileSync(filePath, exampleSkill);
|
|
505396
505781
|
console.log(`[skills] Created example skill: ${filePath}`);
|
|
505397
505782
|
}
|
|
505398
505783
|
getSkill(name21) {
|
|
@@ -505480,8 +505865,8 @@ ${skill.examples.map((e3) => ` - ${e3}`).join(`
|
|
|
505480
505865
|
${skill.prompt}
|
|
505481
505866
|
`;
|
|
505482
505867
|
const fileName = `${skill.name.toLowerCase().replace(/\s+/g, "-")}.md`;
|
|
505483
|
-
const filePath =
|
|
505484
|
-
|
|
505868
|
+
const filePath = path35.join(this.skillsDirectory, fileName);
|
|
505869
|
+
fs34.writeFileSync(filePath, content);
|
|
505485
505870
|
skill.filePath = filePath;
|
|
505486
505871
|
this.skills.set(skill.name, skill);
|
|
505487
505872
|
}
|
|
@@ -505547,14 +505932,14 @@ var init_skills = __esm(() => {
|
|
|
505547
505932
|
init_matcher();
|
|
505548
505933
|
init_experiment();
|
|
505549
505934
|
init_creator();
|
|
505550
|
-
LEARNED_DIR =
|
|
505935
|
+
LEARNED_DIR = path35.join(os24.homedir(), ".8gent", "learned-skills");
|
|
505551
505936
|
});
|
|
505552
505937
|
|
|
505553
505938
|
// packages/tasks/index.ts
|
|
505554
505939
|
import { EventEmitter as EventEmitter8 } from "events";
|
|
505555
|
-
import * as
|
|
505556
|
-
import * as
|
|
505557
|
-
import * as
|
|
505940
|
+
import * as fs35 from "fs";
|
|
505941
|
+
import * as os25 from "os";
|
|
505942
|
+
import * as path36 from "path";
|
|
505558
505943
|
function getTaskManager(storePath) {
|
|
505559
505944
|
if (!taskManagerInstance2) {
|
|
505560
505945
|
taskManagerInstance2 = new TaskManager(storePath);
|
|
@@ -505689,17 +506074,17 @@ var init_tasks = __esm(() => {
|
|
|
505689
506074
|
autoSave = true;
|
|
505690
506075
|
constructor(storePath) {
|
|
505691
506076
|
super();
|
|
505692
|
-
this.storePath = storePath ||
|
|
506077
|
+
this.storePath = storePath || path36.join(os25.homedir(), ".8gent", "tasks.json");
|
|
505693
506078
|
this.store = this.loadStore();
|
|
505694
506079
|
}
|
|
505695
506080
|
loadStore() {
|
|
505696
|
-
const dir =
|
|
505697
|
-
if (!
|
|
505698
|
-
|
|
506081
|
+
const dir = path36.dirname(this.storePath);
|
|
506082
|
+
if (!fs35.existsSync(dir)) {
|
|
506083
|
+
fs35.mkdirSync(dir, { recursive: true });
|
|
505699
506084
|
}
|
|
505700
|
-
if (
|
|
506085
|
+
if (fs35.existsSync(this.storePath)) {
|
|
505701
506086
|
try {
|
|
505702
|
-
const data2 =
|
|
506087
|
+
const data2 = fs35.readFileSync(this.storePath, "utf-8");
|
|
505703
506088
|
const store = JSON.parse(data2);
|
|
505704
506089
|
for (const task of [...store.tasks, ...store.archivedTasks]) {
|
|
505705
506090
|
const match = task.id.match(/^task-(\d+)/);
|
|
@@ -505724,7 +506109,7 @@ var init_tasks = __esm(() => {
|
|
|
505724
506109
|
}
|
|
505725
506110
|
saveStore() {
|
|
505726
506111
|
this.store.lastUpdated = new Date().toISOString();
|
|
505727
|
-
|
|
506112
|
+
fs35.writeFileSync(this.storePath, JSON.stringify(this.store, null, 2));
|
|
505728
506113
|
}
|
|
505729
506114
|
generateId() {
|
|
505730
506115
|
this.idCounter++;
|
|
@@ -506435,8 +506820,8 @@ class ProactivePlanner {
|
|
|
506435
506820
|
for (const cmd of commands.slice(0, 5)) {
|
|
506436
506821
|
const fileMatch = cmd.match(/(?:src|lib|packages)\/[\w/.-]+\.(ts|tsx|js|jsx)/);
|
|
506437
506822
|
if (fileMatch) {
|
|
506438
|
-
const
|
|
506439
|
-
const dir =
|
|
506823
|
+
const path37 = fileMatch[0];
|
|
506824
|
+
const dir = path37.split("/").slice(0, -1).join("/");
|
|
506440
506825
|
patterns.push({
|
|
506441
506826
|
target: `files in ${dir}`,
|
|
506442
506827
|
path: dir,
|
|
@@ -506467,15 +506852,15 @@ __export(exports_modes, {
|
|
|
506467
506852
|
ModeManager: () => ModeManager,
|
|
506468
506853
|
FAST_MODE_MODELS: () => FAST_MODE_MODELS
|
|
506469
506854
|
});
|
|
506470
|
-
import * as
|
|
506471
|
-
import * as
|
|
506472
|
-
import * as
|
|
506855
|
+
import * as fs36 from "fs";
|
|
506856
|
+
import * as os26 from "os";
|
|
506857
|
+
import * as path37 from "path";
|
|
506473
506858
|
function loadCustomModes(filePath) {
|
|
506474
506859
|
const result = {};
|
|
506475
|
-
if (!
|
|
506860
|
+
if (!fs36.existsSync(filePath))
|
|
506476
506861
|
return result;
|
|
506477
506862
|
try {
|
|
506478
|
-
const raw =
|
|
506863
|
+
const raw = fs36.readFileSync(filePath, "utf-8");
|
|
506479
506864
|
const parsed = $parse(raw);
|
|
506480
506865
|
if (!parsed?.modes || typeof parsed.modes !== "object")
|
|
506481
506866
|
return result;
|
|
@@ -506504,7 +506889,7 @@ class ModeManager {
|
|
|
506504
506889
|
_fastMode = false;
|
|
506505
506890
|
_previousModel = null;
|
|
506506
506891
|
constructor(customModesPath) {
|
|
506507
|
-
const modesPath = customModesPath ||
|
|
506892
|
+
const modesPath = customModesPath || path37.join(process.env.EIGHT_DATA_DIR || path37.join(os26.homedir(), ".8gent"), "modes.yaml");
|
|
506508
506893
|
this.modes = { ...BUILT_IN_MODES, ...loadCustomModes(modesPath) };
|
|
506509
506894
|
}
|
|
506510
506895
|
getMode(name21) {
|
|
@@ -506648,21 +507033,21 @@ __export(exports_i18n, {
|
|
|
506648
507033
|
LanguageManager: () => LanguageManager,
|
|
506649
507034
|
LANGUAGES: () => LANGUAGES
|
|
506650
507035
|
});
|
|
506651
|
-
import * as
|
|
506652
|
-
import * as
|
|
506653
|
-
import * as
|
|
507036
|
+
import * as fs37 from "fs";
|
|
507037
|
+
import * as os27 from "os";
|
|
507038
|
+
import * as path38 from "path";
|
|
506654
507039
|
|
|
506655
507040
|
class LanguageManager {
|
|
506656
507041
|
settings;
|
|
506657
507042
|
settingsPath;
|
|
506658
507043
|
constructor(settingsPath) {
|
|
506659
|
-
this.settingsPath = settingsPath ||
|
|
507044
|
+
this.settingsPath = settingsPath || path38.join(os27.homedir(), ".8gent", "language.json");
|
|
506660
507045
|
this.settings = this.loadSettings();
|
|
506661
507046
|
}
|
|
506662
507047
|
loadSettings() {
|
|
506663
507048
|
try {
|
|
506664
|
-
if (
|
|
506665
|
-
const data2 =
|
|
507049
|
+
if (fs37.existsSync(this.settingsPath)) {
|
|
507050
|
+
const data2 = fs37.readFileSync(this.settingsPath, "utf-8");
|
|
506666
507051
|
return JSON.parse(data2);
|
|
506667
507052
|
}
|
|
506668
507053
|
} catch (err) {}
|
|
@@ -506672,11 +507057,11 @@ class LanguageManager {
|
|
|
506672
507057
|
};
|
|
506673
507058
|
}
|
|
506674
507059
|
saveSettings() {
|
|
506675
|
-
const dir =
|
|
506676
|
-
if (!
|
|
506677
|
-
|
|
507060
|
+
const dir = path38.dirname(this.settingsPath);
|
|
507061
|
+
if (!fs37.existsSync(dir)) {
|
|
507062
|
+
fs37.mkdirSync(dir, { recursive: true });
|
|
506678
507063
|
}
|
|
506679
|
-
|
|
507064
|
+
fs37.writeFileSync(this.settingsPath, JSON.stringify(this.settings, null, 2));
|
|
506680
507065
|
}
|
|
506681
507066
|
getActiveLanguage() {
|
|
506682
507067
|
return LANGUAGES[this.settings.activeLanguage] || LANGUAGES.en;
|
|
@@ -506921,15 +507306,15 @@ var init_i18n = __esm(() => {
|
|
|
506921
507306
|
});
|
|
506922
507307
|
|
|
506923
507308
|
// packages/eight/repl.ts
|
|
506924
|
-
import * as
|
|
506925
|
-
import * as
|
|
506926
|
-
import * as
|
|
507309
|
+
import * as fs38 from "fs";
|
|
507310
|
+
import * as os28 from "os";
|
|
507311
|
+
import * as path39 from "path";
|
|
506927
507312
|
import * as readline2 from "readline";
|
|
506928
507313
|
async function startREPL(config2) {
|
|
506929
|
-
const configPath =
|
|
507314
|
+
const configPath = path39.join(os28.homedir(), ".8gent", "config.json");
|
|
506930
507315
|
let savedConfig = {};
|
|
506931
|
-
if (
|
|
506932
|
-
savedConfig = JSON.parse(
|
|
507316
|
+
if (fs38.existsSync(configPath)) {
|
|
507317
|
+
savedConfig = JSON.parse(fs38.readFileSync(configPath, "utf-8"));
|
|
506933
507318
|
}
|
|
506934
507319
|
const finalConfig = {
|
|
506935
507320
|
model: config2?.model || savedConfig.model || "glm-4.7-flash:latest",
|
|
@@ -507461,13 +507846,13 @@ Output format: PLAN: 1) ... 2) ... 3) ...`;
|
|
|
507461
507846
|
return true;
|
|
507462
507847
|
}
|
|
507463
507848
|
if (trimmed === "/nightly") {
|
|
507464
|
-
const nightlyLog =
|
|
507465
|
-
const dreamsLog =
|
|
507849
|
+
const nightlyLog = path39.join(os28.homedir(), ".8gent", "nightly.log");
|
|
507850
|
+
const dreamsLog = path39.join(os28.homedir(), ".8gent", "dreams.log");
|
|
507466
507851
|
console.log(`
|
|
507467
507852
|
\x1B[36m8gent Nightly Training Status:\x1B[0m
|
|
507468
507853
|
`);
|
|
507469
|
-
if (
|
|
507470
|
-
const content =
|
|
507854
|
+
if (fs38.existsSync(nightlyLog)) {
|
|
507855
|
+
const content = fs38.readFileSync(nightlyLog, "utf-8");
|
|
507471
507856
|
const lines = content.trim().split(`
|
|
507472
507857
|
`);
|
|
507473
507858
|
const tail = lines.slice(-25);
|
|
@@ -507487,8 +507872,8 @@ Output format: PLAN: 1) ... 2) ... 3) ...`;
|
|
|
507487
507872
|
console.log(" \x1B[33mNo nightly training log found.\x1B[0m");
|
|
507488
507873
|
console.log(" Nightly training runs at 2:00 AM PST via cron.");
|
|
507489
507874
|
}
|
|
507490
|
-
if (
|
|
507491
|
-
const content =
|
|
507875
|
+
if (fs38.existsSync(dreamsLog)) {
|
|
507876
|
+
const content = fs38.readFileSync(dreamsLog, "utf-8");
|
|
507492
507877
|
const lines = content.trim().split(`
|
|
507493
507878
|
`);
|
|
507494
507879
|
const tail = lines.slice(-10);
|
|
@@ -507697,9 +508082,9 @@ async function handleVoiceCommands(trimmed) {
|
|
|
507697
508082
|
}
|
|
507698
508083
|
function handlePersonalCommands(trimmed) {
|
|
507699
508084
|
if (trimmed === "/personal" || trimmed === "/personal status") {
|
|
507700
|
-
const loraDir =
|
|
507701
|
-
const metaPath =
|
|
507702
|
-
if (!
|
|
508085
|
+
const loraDir = path39.join(os28.homedir(), ".8gent", "personal-lora");
|
|
508086
|
+
const metaPath = path39.join(loraDir, "meta.json");
|
|
508087
|
+
if (!fs38.existsSync(loraDir) || !fs38.existsSync(metaPath)) {
|
|
507703
508088
|
console.log(`
|
|
507704
508089
|
\x1B[33mPersonal LoRA:\x1B[0m Not configured`);
|
|
507705
508090
|
console.log(` No personal LoRA found at ${loraDir}`);
|
|
@@ -507708,7 +508093,7 @@ function handlePersonalCommands(trimmed) {
|
|
|
507708
508093
|
return true;
|
|
507709
508094
|
}
|
|
507710
508095
|
try {
|
|
507711
|
-
const meta3 = JSON.parse(
|
|
508096
|
+
const meta3 = JSON.parse(fs38.readFileSync(metaPath, "utf-8"));
|
|
507712
508097
|
console.log(`
|
|
507713
508098
|
\x1B[36mPersonal LoRA Status:\x1B[0m`);
|
|
507714
508099
|
console.log(` Path: ${loraDir}`);
|
|
@@ -507731,9 +508116,9 @@ function handlePersonalCommands(trimmed) {
|
|
|
507731
508116
|
return true;
|
|
507732
508117
|
}
|
|
507733
508118
|
if (trimmed === "/personal reset") {
|
|
507734
|
-
const loraDir =
|
|
507735
|
-
if (
|
|
507736
|
-
|
|
508119
|
+
const loraDir = path39.join(os28.homedir(), ".8gent", "personal-lora");
|
|
508120
|
+
if (fs38.existsSync(loraDir)) {
|
|
508121
|
+
fs38.rmSync(loraDir, { recursive: true, force: true });
|
|
507737
508122
|
console.log("\x1B[32mPersonal LoRA reset. Reverted to base Eight.\x1B[0m");
|
|
507738
508123
|
} else {
|
|
507739
508124
|
console.log("No personal LoRA to reset.");
|
|
@@ -508412,8 +508797,8 @@ var init_repl = __esm(() => {
|
|
|
508412
508797
|
|
|
508413
508798
|
// packages/eight/harness/session.ts
|
|
508414
508799
|
import * as crypto6 from "crypto";
|
|
508415
|
-
import * as
|
|
508416
|
-
import * as
|
|
508800
|
+
import * as fs39 from "fs";
|
|
508801
|
+
import * as path40 from "path";
|
|
508417
508802
|
function computeHash(id, timestamp, type, payload, prevHash) {
|
|
508418
508803
|
const data2 = JSON.stringify({ id, timestamp, type, payload, prevHash });
|
|
508419
508804
|
return crypto6.createHash("sha256").update(data2).digest("hex");
|
|
@@ -508427,8 +508812,8 @@ function parseLine(line) {
|
|
|
508427
508812
|
}
|
|
508428
508813
|
function createSession(sessionId) {
|
|
508429
508814
|
const id = sessionId || crypto6.randomUUID().slice(0, 12);
|
|
508430
|
-
const filePath =
|
|
508431
|
-
|
|
508815
|
+
const filePath = path40.join(SESSIONS_DIR, `${id}.jsonl`);
|
|
508816
|
+
fs39.mkdirSync(SESSIONS_DIR, { recursive: true, mode: 448 });
|
|
508432
508817
|
let cachedLastHash = null;
|
|
508433
508818
|
async function getLastHash() {
|
|
508434
508819
|
if (cachedLastHash !== null)
|
|
@@ -508438,9 +508823,9 @@ function createSession(sessionId) {
|
|
|
508438
508823
|
return cachedLastHash;
|
|
508439
508824
|
}
|
|
508440
508825
|
async function readAllEntries() {
|
|
508441
|
-
if (!
|
|
508826
|
+
if (!fs39.existsSync(filePath))
|
|
508442
508827
|
return [];
|
|
508443
|
-
const content =
|
|
508828
|
+
const content = fs39.readFileSync(filePath, "utf-8").trim();
|
|
508444
508829
|
if (!content)
|
|
508445
508830
|
return [];
|
|
508446
508831
|
return content.split(`
|
|
@@ -508464,7 +508849,7 @@ function createSession(sessionId) {
|
|
|
508464
508849
|
};
|
|
508465
508850
|
const line = `${JSON.stringify(entry)}
|
|
508466
508851
|
`;
|
|
508467
|
-
|
|
508852
|
+
fs39.appendFileSync(filePath, line, { encoding: "utf-8", mode: 384 });
|
|
508468
508853
|
cachedLastHash = hash2;
|
|
508469
508854
|
return hash2;
|
|
508470
508855
|
},
|
|
@@ -508492,23 +508877,23 @@ function createSession(sessionId) {
|
|
|
508492
508877
|
return session;
|
|
508493
508878
|
}
|
|
508494
508879
|
function openSession(sessionId) {
|
|
508495
|
-
const filePath =
|
|
508496
|
-
if (!
|
|
508880
|
+
const filePath = path40.join(SESSIONS_DIR, `${sessionId}.jsonl`);
|
|
508881
|
+
if (!fs39.existsSync(filePath)) {
|
|
508497
508882
|
throw new Error(`Session not found: ${sessionId}`);
|
|
508498
508883
|
}
|
|
508499
508884
|
return createSession(sessionId);
|
|
508500
508885
|
}
|
|
508501
508886
|
function listSessions() {
|
|
508502
|
-
if (!
|
|
508887
|
+
if (!fs39.existsSync(SESSIONS_DIR))
|
|
508503
508888
|
return [];
|
|
508504
|
-
return
|
|
508889
|
+
return fs39.readdirSync(SESSIONS_DIR).filter((f3) => f3.endsWith(".jsonl")).map((f3) => f3.replace(".jsonl", "")).sort();
|
|
508505
508890
|
}
|
|
508506
508891
|
function getSessionsDir() {
|
|
508507
508892
|
return SESSIONS_DIR;
|
|
508508
508893
|
}
|
|
508509
508894
|
var SESSIONS_DIR;
|
|
508510
508895
|
var init_session = __esm(() => {
|
|
508511
|
-
SESSIONS_DIR =
|
|
508896
|
+
SESSIONS_DIR = path40.join(process.env.HOME || "~", ".8gent", "audit");
|
|
508512
508897
|
});
|
|
508513
508898
|
|
|
508514
508899
|
// packages/eight/harness/harness.ts
|
|
@@ -508643,12 +509028,12 @@ function createSandbox(vault) {
|
|
|
508643
509028
|
}
|
|
508644
509029
|
|
|
508645
509030
|
// packages/eight/harness/vault.ts
|
|
508646
|
-
import * as
|
|
509031
|
+
import * as fs40 from "fs";
|
|
508647
509032
|
function parseDotenv(filePath) {
|
|
508648
|
-
if (!
|
|
509033
|
+
if (!fs40.existsSync(filePath))
|
|
508649
509034
|
return {};
|
|
508650
509035
|
const result = {};
|
|
508651
|
-
const lines =
|
|
509036
|
+
const lines = fs40.readFileSync(filePath, "utf-8").split(`
|
|
508652
509037
|
`);
|
|
508653
509038
|
for (const line of lines) {
|
|
508654
509039
|
const trimmed = line.trim();
|
|
@@ -509446,19 +509831,19 @@ What alternative approach will you try now?`;
|
|
|
509446
509831
|
});
|
|
509447
509832
|
|
|
509448
509833
|
// benchmarks/autoresearch/model-router.ts
|
|
509449
|
-
import { existsSync as
|
|
509450
|
-
import { join as
|
|
509834
|
+
import { existsSync as existsSync45, readFileSync as readFileSync38, writeFileSync as writeFileSync23 } from "fs";
|
|
509835
|
+
import { join as join51 } from "path";
|
|
509451
509836
|
function loadExperience() {
|
|
509452
509837
|
try {
|
|
509453
|
-
if (
|
|
509454
|
-
return JSON.parse(
|
|
509838
|
+
if (existsSync45(EXPERIENCE_FILE)) {
|
|
509839
|
+
return JSON.parse(readFileSync38(EXPERIENCE_FILE, "utf-8"));
|
|
509455
509840
|
}
|
|
509456
509841
|
} catch {}
|
|
509457
509842
|
return { byDomain: {}, byBenchmark: {}, runCounts: {}, updatedAt: "" };
|
|
509458
509843
|
}
|
|
509459
509844
|
function saveExperience(db2) {
|
|
509460
509845
|
db2.updatedAt = new Date().toISOString();
|
|
509461
|
-
|
|
509846
|
+
writeFileSync23(EXPERIENCE_FILE, JSON.stringify(db2, null, 2));
|
|
509462
509847
|
}
|
|
509463
509848
|
function recordResult(model, domain2, benchmarkId, score) {
|
|
509464
509849
|
const db2 = loadExperience();
|
|
@@ -509485,12 +509870,12 @@ function recordResult(model, domain2, benchmarkId, score) {
|
|
|
509485
509870
|
}
|
|
509486
509871
|
var ROOT, EXPERIENCE_FILE;
|
|
509487
509872
|
var init_model_router = __esm(() => {
|
|
509488
|
-
ROOT =
|
|
509489
|
-
EXPERIENCE_FILE =
|
|
509873
|
+
ROOT = join51(import.meta.dir, "..");
|
|
509874
|
+
EXPERIENCE_FILE = join51(ROOT, "autoresearch", "model-experience.json");
|
|
509490
509875
|
});
|
|
509491
509876
|
|
|
509492
509877
|
// packages/kernel/judge.ts
|
|
509493
|
-
import { existsSync as
|
|
509878
|
+
import { existsSync as existsSync46, mkdirSync as mkdirSync31, readFileSync as readFileSync39, writeFileSync as writeFileSync24 } from "fs";
|
|
509494
509879
|
import { dirname as dirname18 } from "path";
|
|
509495
509880
|
|
|
509496
509881
|
class JudgeScorer {
|
|
@@ -509601,8 +509986,8 @@ Score this response:`;
|
|
|
509601
509986
|
}
|
|
509602
509987
|
loadHistory() {
|
|
509603
509988
|
try {
|
|
509604
|
-
if (
|
|
509605
|
-
return JSON.parse(
|
|
509989
|
+
if (existsSync46(this.config.historyPath)) {
|
|
509990
|
+
return JSON.parse(readFileSync39(this.config.historyPath, "utf-8"));
|
|
509606
509991
|
}
|
|
509607
509992
|
} catch {}
|
|
509608
509993
|
return {
|
|
@@ -509635,9 +510020,9 @@ Score this response:`;
|
|
|
509635
510020
|
}
|
|
509636
510021
|
history.updatedAt = new Date().toISOString();
|
|
509637
510022
|
const dir = dirname18(this.config.historyPath);
|
|
509638
|
-
if (!
|
|
509639
|
-
|
|
509640
|
-
|
|
510023
|
+
if (!existsSync46(dir))
|
|
510024
|
+
mkdirSync31(dir, { recursive: true });
|
|
510025
|
+
writeFileSync24(this.config.historyPath, JSON.stringify(history, null, 2));
|
|
509641
510026
|
}
|
|
509642
510027
|
}
|
|
509643
510028
|
function clamp2(v4) {
|
|
@@ -509669,7 +510054,7 @@ var init_judge = __esm(() => {
|
|
|
509669
510054
|
});
|
|
509670
510055
|
|
|
509671
510056
|
// packages/kernel/proxy.ts
|
|
509672
|
-
import { existsSync as
|
|
510057
|
+
import { existsSync as existsSync47 } from "fs";
|
|
509673
510058
|
import { resolve as resolve10 } from "path";
|
|
509674
510059
|
var {spawn: spawn10 } = globalThis.Bun;
|
|
509675
510060
|
|
|
@@ -509693,7 +510078,7 @@ class TrainingProxy {
|
|
|
509693
510078
|
throw new Error(`Ollama not reachable at ${this.config.ollamaUrl}`);
|
|
509694
510079
|
}
|
|
509695
510080
|
const configPath = resolve10(this.config.configPath);
|
|
509696
|
-
if (!
|
|
510081
|
+
if (!existsSync47(configPath)) {
|
|
509697
510082
|
throw new Error(`Training proxy config not found at ${configPath}`);
|
|
509698
510083
|
}
|
|
509699
510084
|
this.process = spawn10({
|
|
@@ -509825,8 +510210,8 @@ var init_proxy = __esm(() => {
|
|
|
509825
510210
|
});
|
|
509826
510211
|
|
|
509827
510212
|
// packages/kernel/training.ts
|
|
509828
|
-
import { existsSync as
|
|
509829
|
-
import { dirname as dirname19, join as
|
|
510213
|
+
import { existsSync as existsSync48, mkdirSync as mkdirSync32, readFileSync as readFileSync41, writeFileSync as writeFileSync25 } from "fs";
|
|
510214
|
+
import { dirname as dirname19, join as join53 } from "path";
|
|
509830
510215
|
var {spawn: spawn11 } = globalThis.Bun;
|
|
509831
510216
|
|
|
509832
510217
|
class TrainingOrchestrator {
|
|
@@ -509885,8 +510270,8 @@ class TrainingOrchestrator {
|
|
|
509885
510270
|
batchId,
|
|
509886
510271
|
createdAt: new Date().toISOString()
|
|
509887
510272
|
};
|
|
509888
|
-
const batchPath =
|
|
509889
|
-
|
|
510273
|
+
const batchPath = join53(this.config.dataDir, "batches", `${batchId}.json`);
|
|
510274
|
+
writeFileSync25(batchPath, JSON.stringify(batch, null, 2));
|
|
509890
510275
|
this.state.currentBatch = [];
|
|
509891
510276
|
this.state.totalTrainingRuns += 1;
|
|
509892
510277
|
this.saveState();
|
|
@@ -509970,9 +510355,9 @@ class TrainingOrchestrator {
|
|
|
509970
510355
|
const exitCode = await proc.exited;
|
|
509971
510356
|
const stdout = await new Response(proc.stdout).text();
|
|
509972
510357
|
try {
|
|
509973
|
-
const resultsPath =
|
|
509974
|
-
if (
|
|
509975
|
-
const results = JSON.parse(
|
|
510358
|
+
const resultsPath = join53(dirname19(this.config.validateCommand.split(" ").pop()), "checkpoint-results.json");
|
|
510359
|
+
if (existsSync48(resultsPath)) {
|
|
510360
|
+
const results = JSON.parse(readFileSync41(resultsPath, "utf-8"));
|
|
509976
510361
|
return results.avgScore ?? 0;
|
|
509977
510362
|
}
|
|
509978
510363
|
} catch {}
|
|
@@ -509990,10 +510375,10 @@ class TrainingOrchestrator {
|
|
|
509990
510375
|
} catch {}
|
|
509991
510376
|
}
|
|
509992
510377
|
loadState() {
|
|
509993
|
-
const statePath =
|
|
510378
|
+
const statePath = join53(this.config.dataDir, "state.json");
|
|
509994
510379
|
try {
|
|
509995
|
-
if (
|
|
509996
|
-
return JSON.parse(
|
|
510380
|
+
if (existsSync48(statePath)) {
|
|
510381
|
+
return JSON.parse(readFileSync41(statePath, "utf-8"));
|
|
509997
510382
|
}
|
|
509998
510383
|
} catch {}
|
|
509999
510384
|
return {
|
|
@@ -510007,15 +510392,15 @@ class TrainingOrchestrator {
|
|
|
510007
510392
|
};
|
|
510008
510393
|
}
|
|
510009
510394
|
saveState() {
|
|
510010
|
-
const statePath =
|
|
510395
|
+
const statePath = join53(this.config.dataDir, "state.json");
|
|
510011
510396
|
this.state.updatedAt = new Date().toISOString();
|
|
510012
|
-
|
|
510397
|
+
writeFileSync25(statePath, JSON.stringify(this.state, null, 2));
|
|
510013
510398
|
}
|
|
510014
510399
|
ensureDirs() {
|
|
510015
510400
|
for (const sub of ["batches", "checkpoints"]) {
|
|
510016
|
-
const dir =
|
|
510017
|
-
if (!
|
|
510018
|
-
|
|
510401
|
+
const dir = join53(this.config.dataDir, sub);
|
|
510402
|
+
if (!existsSync48(dir))
|
|
510403
|
+
mkdirSync32(dir, { recursive: true });
|
|
510019
510404
|
}
|
|
510020
510405
|
}
|
|
510021
510406
|
}
|
|
@@ -510222,8 +510607,8 @@ var init_loop = __esm(() => {
|
|
|
510222
510607
|
});
|
|
510223
510608
|
|
|
510224
510609
|
// packages/kernel/personal-collector.ts
|
|
510225
|
-
import { appendFileSync as appendFileSync9, existsSync as
|
|
510226
|
-
import { join as
|
|
510610
|
+
import { appendFileSync as appendFileSync9, existsSync as existsSync49, mkdirSync as mkdirSync33, readFileSync as readFileSync42, writeFileSync as writeFileSync26 } from "fs";
|
|
510611
|
+
import { join as join54, resolve as resolve11 } from "path";
|
|
510227
510612
|
|
|
510228
510613
|
class PersonalCollector {
|
|
510229
510614
|
trainingDir;
|
|
@@ -510233,8 +510618,8 @@ class PersonalCollector {
|
|
|
510233
510618
|
stats;
|
|
510234
510619
|
constructor(projectRoot = process.cwd(), minScore = 0.7) {
|
|
510235
510620
|
this.trainingDir = resolve11(projectRoot, ".8gent", "kernel", "training");
|
|
510236
|
-
this.pairsPath =
|
|
510237
|
-
this.statsPath =
|
|
510621
|
+
this.pairsPath = join54(this.trainingDir, "pairs.jsonl");
|
|
510622
|
+
this.statsPath = join54(this.trainingDir, "stats.json");
|
|
510238
510623
|
this.minScore = minScore;
|
|
510239
510624
|
this.stats = this.loadStats();
|
|
510240
510625
|
}
|
|
@@ -510273,9 +510658,9 @@ class PersonalCollector {
|
|
|
510273
510658
|
return true;
|
|
510274
510659
|
}
|
|
510275
510660
|
getPairs(userId) {
|
|
510276
|
-
if (!
|
|
510661
|
+
if (!existsSync49(this.pairsPath))
|
|
510277
510662
|
return [];
|
|
510278
|
-
const lines =
|
|
510663
|
+
const lines = readFileSync42(this.pairsPath, "utf-8").split(`
|
|
510279
510664
|
`).filter(Boolean);
|
|
510280
510665
|
const pairs = lines.map((line) => {
|
|
510281
510666
|
try {
|
|
@@ -510296,14 +510681,14 @@ class PersonalCollector {
|
|
|
510296
510681
|
return this.getPairs(userId).length;
|
|
510297
510682
|
}
|
|
510298
510683
|
ensureDir() {
|
|
510299
|
-
if (!
|
|
510300
|
-
|
|
510684
|
+
if (!existsSync49(this.trainingDir)) {
|
|
510685
|
+
mkdirSync33(this.trainingDir, { recursive: true });
|
|
510301
510686
|
}
|
|
510302
510687
|
}
|
|
510303
510688
|
loadStats() {
|
|
510304
510689
|
try {
|
|
510305
|
-
if (
|
|
510306
|
-
return JSON.parse(
|
|
510690
|
+
if (existsSync49(this.statsPath)) {
|
|
510691
|
+
return JSON.parse(readFileSync42(this.statsPath, "utf-8"));
|
|
510307
510692
|
}
|
|
510308
510693
|
} catch {}
|
|
510309
510694
|
return {
|
|
@@ -510315,7 +510700,7 @@ class PersonalCollector {
|
|
|
510315
510700
|
}
|
|
510316
510701
|
saveStats() {
|
|
510317
510702
|
this.ensureDir();
|
|
510318
|
-
|
|
510703
|
+
writeFileSync26(this.statsPath, JSON.stringify(this.stats, null, 2));
|
|
510319
510704
|
}
|
|
510320
510705
|
}
|
|
510321
510706
|
var init_personal_collector = () => {};
|
|
@@ -510325,7 +510710,7 @@ var exports_manager = {};
|
|
|
510325
510710
|
__export(exports_manager, {
|
|
510326
510711
|
KernelManager: () => KernelManager
|
|
510327
510712
|
});
|
|
510328
|
-
import { existsSync as
|
|
510713
|
+
import { existsSync as existsSync50, readFileSync as readFileSync43 } from "fs";
|
|
510329
510714
|
import { resolve as resolve12 } from "path";
|
|
510330
510715
|
|
|
510331
510716
|
class KernelManager {
|
|
@@ -510339,11 +510724,11 @@ class KernelManager {
|
|
|
510339
510724
|
}
|
|
510340
510725
|
static fromProjectConfig(projectRoot = process.cwd()) {
|
|
510341
510726
|
const configPath = resolve12(projectRoot, ".8gent/config.json");
|
|
510342
|
-
if (!
|
|
510727
|
+
if (!existsSync50(configPath)) {
|
|
510343
510728
|
return new KernelManager;
|
|
510344
510729
|
}
|
|
510345
510730
|
try {
|
|
510346
|
-
const config2 = JSON.parse(
|
|
510731
|
+
const config2 = JSON.parse(readFileSync43(configPath, "utf-8"));
|
|
510347
510732
|
const mc = config2.training_proxy ?? {};
|
|
510348
510733
|
return new KernelManager({
|
|
510349
510734
|
enabled: mc.enabled ?? false,
|
|
@@ -510480,15 +510865,15 @@ var init_reporting = __esm(() => {
|
|
|
510480
510865
|
|
|
510481
510866
|
// packages/self-autonomy/evolution-db.ts
|
|
510482
510867
|
import { Database as Database4 } from "bun:sqlite";
|
|
510483
|
-
import * as
|
|
510484
|
-
import * as
|
|
510485
|
-
import * as
|
|
510868
|
+
import * as fs41 from "fs";
|
|
510869
|
+
import * as os29 from "os";
|
|
510870
|
+
import * as path41 from "path";
|
|
510486
510871
|
function getDbPath() {
|
|
510487
|
-
const base2 = process.env.EIGHT_DATA_DIR ||
|
|
510488
|
-
const dir =
|
|
510489
|
-
if (!
|
|
510490
|
-
|
|
510491
|
-
return
|
|
510872
|
+
const base2 = process.env.EIGHT_DATA_DIR || path41.join(os29.homedir(), ".8gent");
|
|
510873
|
+
const dir = path41.join(base2, "evolution");
|
|
510874
|
+
if (!fs41.existsSync(dir))
|
|
510875
|
+
fs41.mkdirSync(dir, { recursive: true });
|
|
510876
|
+
return path41.join(dir, "evolution.db");
|
|
510492
510877
|
}
|
|
510493
510878
|
function getDb() {
|
|
510494
510879
|
if (_db)
|
|
@@ -510703,8 +511088,8 @@ var init_learned_skills = __esm(() => {
|
|
|
510703
511088
|
|
|
510704
511089
|
// packages/self-autonomy/index.ts
|
|
510705
511090
|
import { execSync as execSync3 } from "child_process";
|
|
510706
|
-
import * as
|
|
510707
|
-
import * as
|
|
511091
|
+
import * as fs42 from "fs";
|
|
511092
|
+
import * as path42 from "path";
|
|
510708
511093
|
|
|
510709
511094
|
class AutoGit {
|
|
510710
511095
|
cwd;
|
|
@@ -510830,7 +511215,7 @@ class SelfHeal {
|
|
|
510830
511215
|
constructor(workingDirectory, verbose = false) {
|
|
510831
511216
|
this.cwd = workingDirectory;
|
|
510832
511217
|
this.verbose = verbose;
|
|
510833
|
-
this.memoryPath =
|
|
511218
|
+
this.memoryPath = path42.join(workingDirectory, ".8gent", "context", "healing.json");
|
|
510834
511219
|
this.memory = this.loadMemory();
|
|
510835
511220
|
}
|
|
510836
511221
|
log(message) {
|
|
@@ -510840,18 +511225,18 @@ class SelfHeal {
|
|
|
510840
511225
|
}
|
|
510841
511226
|
loadMemory() {
|
|
510842
511227
|
try {
|
|
510843
|
-
if (
|
|
510844
|
-
return JSON.parse(
|
|
511228
|
+
if (fs42.existsSync(this.memoryPath)) {
|
|
511229
|
+
return JSON.parse(fs42.readFileSync(this.memoryPath, "utf-8"));
|
|
510845
511230
|
}
|
|
510846
511231
|
} catch {}
|
|
510847
511232
|
return { patterns: {} };
|
|
510848
511233
|
}
|
|
510849
511234
|
saveMemory() {
|
|
510850
|
-
const dir =
|
|
510851
|
-
if (!
|
|
510852
|
-
|
|
511235
|
+
const dir = path42.dirname(this.memoryPath);
|
|
511236
|
+
if (!fs42.existsSync(dir)) {
|
|
511237
|
+
fs42.mkdirSync(dir, { recursive: true });
|
|
510853
511238
|
}
|
|
510854
|
-
|
|
511239
|
+
fs42.writeFileSync(this.memoryPath, JSON.stringify(this.memory, null, 2));
|
|
510855
511240
|
}
|
|
510856
511241
|
getKnownSolution(errorPattern) {
|
|
510857
511242
|
const pattern = this.memory.patterns[errorPattern];
|
|
@@ -510930,7 +511315,7 @@ class SessionMemory {
|
|
|
510930
511315
|
verbose;
|
|
510931
511316
|
constructor(workingDirectory, verbose = false) {
|
|
510932
511317
|
this.cwd = workingDirectory;
|
|
510933
|
-
this.contextPath =
|
|
511318
|
+
this.contextPath = path42.join(workingDirectory, ".8gent", "context");
|
|
510934
511319
|
this.verbose = verbose;
|
|
510935
511320
|
}
|
|
510936
511321
|
log(message) {
|
|
@@ -510939,15 +511324,15 @@ class SessionMemory {
|
|
|
510939
511324
|
}
|
|
510940
511325
|
}
|
|
510941
511326
|
ensureDirectories() {
|
|
510942
|
-
if (!
|
|
510943
|
-
|
|
511327
|
+
if (!fs42.existsSync(this.contextPath)) {
|
|
511328
|
+
fs42.mkdirSync(this.contextPath, { recursive: true });
|
|
510944
511329
|
}
|
|
510945
511330
|
}
|
|
510946
511331
|
getWorkingContext() {
|
|
510947
|
-
const contextFile =
|
|
511332
|
+
const contextFile = path42.join(this.contextPath, "working.json");
|
|
510948
511333
|
try {
|
|
510949
|
-
if (
|
|
510950
|
-
const context3 = JSON.parse(
|
|
511334
|
+
if (fs42.existsSync(contextFile)) {
|
|
511335
|
+
const context3 = JSON.parse(fs42.readFileSync(contextFile, "utf-8"));
|
|
510951
511336
|
const started = new Date(context3.started);
|
|
510952
511337
|
const now2 = new Date;
|
|
510953
511338
|
const hoursDiff = (now2.getTime() - started.getTime()) / (1000 * 60 * 60);
|
|
@@ -510961,12 +511346,12 @@ class SessionMemory {
|
|
|
510961
511346
|
}
|
|
510962
511347
|
saveWorkingContext(context3) {
|
|
510963
511348
|
this.ensureDirectories();
|
|
510964
|
-
const contextFile =
|
|
510965
|
-
|
|
511349
|
+
const contextFile = path42.join(this.contextPath, "working.json");
|
|
511350
|
+
fs42.writeFileSync(contextFile, JSON.stringify(context3, null, 2));
|
|
510966
511351
|
this.log("Saved working context");
|
|
510967
511352
|
}
|
|
510968
511353
|
logEvolution(entry) {
|
|
510969
|
-
const logFile =
|
|
511354
|
+
const logFile = path42.join(this.cwd, ".8gent", "evolution.log");
|
|
510970
511355
|
const line = `[${entry.timestamp}] ${entry.action} ${entry.file}
|
|
510971
511356
|
` + ` REASON: ${entry.reason}
|
|
510972
511357
|
` + ` RESULT: ${entry.result}
|
|
@@ -510974,7 +511359,7 @@ class SessionMemory {
|
|
|
510974
511359
|
` + ` MERGED: ${entry.merged}
|
|
510975
511360
|
|
|
510976
511361
|
`;
|
|
510977
|
-
|
|
511362
|
+
fs42.appendFileSync(logFile, line);
|
|
510978
511363
|
this.log(`Evolution: ${entry.action} ${entry.file} \u2192 ${entry.result}`);
|
|
510979
511364
|
}
|
|
510980
511365
|
}
|
|
@@ -511007,7 +511392,7 @@ class SelfAutonomy {
|
|
|
511007
511392
|
this.memory.saveWorkingContext({
|
|
511008
511393
|
session: `sess_${Date.now()}`,
|
|
511009
511394
|
started: new Date().toISOString(),
|
|
511010
|
-
project:
|
|
511395
|
+
project: path42.basename(this.config.workingDirectory),
|
|
511011
511396
|
branch: this.currentBranch,
|
|
511012
511397
|
activeFiles: [],
|
|
511013
511398
|
currentTask: taskDescription,
|
|
@@ -511464,9 +511849,9 @@ var init_heartbeat = __esm(() => {
|
|
|
511464
511849
|
});
|
|
511465
511850
|
|
|
511466
511851
|
// packages/specifications/session/writer.ts
|
|
511467
|
-
import * as
|
|
511468
|
-
import * as
|
|
511469
|
-
import * as
|
|
511852
|
+
import * as fs43 from "fs";
|
|
511853
|
+
import * as os30 from "os";
|
|
511854
|
+
import * as path43 from "path";
|
|
511470
511855
|
|
|
511471
511856
|
class SessionWriter {
|
|
511472
511857
|
filePath;
|
|
@@ -511489,16 +511874,16 @@ class SessionWriter {
|
|
|
511489
511874
|
this.sessionId = sessionId;
|
|
511490
511875
|
this.startTime = Date.now();
|
|
511491
511876
|
const dir = sessionsDir || SESSIONS_DIR2;
|
|
511492
|
-
if (!
|
|
511493
|
-
|
|
511877
|
+
if (!fs43.existsSync(dir)) {
|
|
511878
|
+
fs43.mkdirSync(dir, { recursive: true });
|
|
511494
511879
|
}
|
|
511495
|
-
this.filePath =
|
|
511496
|
-
this.fd =
|
|
511880
|
+
this.filePath = path43.join(dir, `${sessionId}.jsonl`);
|
|
511881
|
+
this.fd = fs43.openSync(this.filePath, "a");
|
|
511497
511882
|
}
|
|
511498
511883
|
write(entry) {
|
|
511499
511884
|
const line = `${JSON.stringify(entry)}
|
|
511500
511885
|
`;
|
|
511501
|
-
|
|
511886
|
+
fs43.writeSync(this.fd, line);
|
|
511502
511887
|
}
|
|
511503
511888
|
nextSeq() {
|
|
511504
511889
|
return this.seq++;
|
|
@@ -511689,7 +512074,7 @@ class SessionWriter {
|
|
|
511689
512074
|
reportId: reportId ?? null
|
|
511690
512075
|
}
|
|
511691
512076
|
});
|
|
511692
|
-
|
|
512077
|
+
fs43.closeSync(this.fd);
|
|
511693
512078
|
}
|
|
511694
512079
|
getFilePath() {
|
|
511695
512080
|
return this.filePath;
|
|
@@ -511728,18 +512113,18 @@ class SessionWriter {
|
|
|
511728
512113
|
}
|
|
511729
512114
|
var SESSIONS_DIR2;
|
|
511730
512115
|
var init_writer = __esm(() => {
|
|
511731
|
-
SESSIONS_DIR2 =
|
|
512116
|
+
SESSIONS_DIR2 = path43.join(os30.homedir(), ".8gent", "sessions");
|
|
511732
512117
|
});
|
|
511733
512118
|
|
|
511734
512119
|
// packages/eight/compaction.ts
|
|
511735
512120
|
class FileTracker {
|
|
511736
512121
|
read = new Set;
|
|
511737
512122
|
modified = new Set;
|
|
511738
|
-
trackRead(
|
|
511739
|
-
this.read.add(
|
|
512123
|
+
trackRead(path44) {
|
|
512124
|
+
this.read.add(path44);
|
|
511740
512125
|
}
|
|
511741
|
-
trackModified(
|
|
511742
|
-
this.modified.add(
|
|
512126
|
+
trackModified(path44) {
|
|
512127
|
+
this.modified.add(path44);
|
|
511743
512128
|
}
|
|
511744
512129
|
merge(other) {
|
|
511745
512130
|
Array.from(other.read).forEach((p) => this.read.add(p));
|
|
@@ -512123,7 +512508,7 @@ __export(exports_mapper, {
|
|
|
512123
512508
|
RepoMapper: () => RepoMapper
|
|
512124
512509
|
});
|
|
512125
512510
|
import { readFile, readdir, stat } from "fs/promises";
|
|
512126
|
-
import { basename as basename9, extname as extname8, join as
|
|
512511
|
+
import { basename as basename9, extname as extname8, join as join58, relative as relative3 } from "path";
|
|
512127
512512
|
|
|
512128
512513
|
class RepoMapper {
|
|
512129
512514
|
files = new Map;
|
|
@@ -512142,7 +512527,7 @@ class RepoMapper {
|
|
|
512142
512527
|
return;
|
|
512143
512528
|
}
|
|
512144
512529
|
for (const e3 of entries) {
|
|
512145
|
-
const full =
|
|
512530
|
+
const full = join58(dir, e3.name);
|
|
512146
512531
|
if (SKIP.test(e3.name))
|
|
512147
512532
|
continue;
|
|
512148
512533
|
if (e3.isDirectory()) {
|
|
@@ -512198,8 +512583,8 @@ class RepoMapper {
|
|
|
512198
512583
|
if (score > 0.05)
|
|
512199
512584
|
scored.push({ path: rel, score });
|
|
512200
512585
|
}
|
|
512201
|
-
return scored.sort((a5, b2) => b2.score - a5.score).slice(0, 20).map(({ path:
|
|
512202
|
-
path:
|
|
512586
|
+
return scored.sort((a5, b2) => b2.score - a5.score).slice(0, 20).map(({ path: path44, score }) => ({
|
|
512587
|
+
path: path44,
|
|
512203
512588
|
score,
|
|
512204
512589
|
content: "",
|
|
512205
512590
|
mode: "full"
|
|
@@ -512225,7 +512610,7 @@ class RepoMapper {
|
|
|
512225
512610
|
continue;
|
|
512226
512611
|
let content;
|
|
512227
512612
|
try {
|
|
512228
|
-
content = await readFile(
|
|
512613
|
+
content = await readFile(join58(this.root, file2.path), "utf-8");
|
|
512229
512614
|
} catch {
|
|
512230
512615
|
continue;
|
|
512231
512616
|
}
|
|
@@ -512276,15 +512661,15 @@ var init_repo_context = __esm(() => {
|
|
|
512276
512661
|
});
|
|
512277
512662
|
|
|
512278
512663
|
// packages/eight/instruction-loader.ts
|
|
512279
|
-
import { existsSync as
|
|
512280
|
-
import { homedir as
|
|
512281
|
-
import { dirname as dirname21, join as
|
|
512664
|
+
import { existsSync as existsSync54, readFileSync as readFileSync45 } from "fs";
|
|
512665
|
+
import { homedir as homedir32 } from "os";
|
|
512666
|
+
import { dirname as dirname21, join as join59, resolve as resolve13 } from "path";
|
|
512282
512667
|
function findInstructionFile(dir) {
|
|
512283
512668
|
for (const filename of INSTRUCTION_FILES) {
|
|
512284
|
-
const filePath =
|
|
512285
|
-
if (
|
|
512669
|
+
const filePath = join59(dir, filename);
|
|
512670
|
+
if (existsSync54(filePath)) {
|
|
512286
512671
|
try {
|
|
512287
|
-
return
|
|
512672
|
+
return readFileSync45(filePath, "utf-8");
|
|
512288
512673
|
} catch {}
|
|
512289
512674
|
}
|
|
512290
512675
|
}
|
|
@@ -512308,7 +512693,7 @@ function walkUp(startDir) {
|
|
|
512308
512693
|
}
|
|
512309
512694
|
function loadInstructions(cwd) {
|
|
512310
512695
|
const parts = [];
|
|
512311
|
-
const globalDir =
|
|
512696
|
+
const globalDir = join59(homedir32(), ".8gent");
|
|
512312
512697
|
const globalContent = findInstructionFile(globalDir);
|
|
512313
512698
|
if (globalContent) {
|
|
512314
512699
|
parts.push(globalContent.trim());
|
|
@@ -512802,9 +513187,9 @@ var require_windowsPtyAgent = __commonJS((exports) => {
|
|
|
512802
513187
|
var __dirname = "/Users/jamesspalding/8gent-code/node_modules/node-pty/lib";
|
|
512803
513188
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
512804
513189
|
exports.argsToCommandLine = exports.WindowsPtyAgent = undefined;
|
|
512805
|
-
var
|
|
512806
|
-
var
|
|
512807
|
-
var
|
|
513190
|
+
var fs44 = __require("fs");
|
|
513191
|
+
var os31 = __require("os");
|
|
513192
|
+
var path44 = __require("path");
|
|
512808
513193
|
var child_process_1 = __require("child_process");
|
|
512809
513194
|
var net_1 = __require("net");
|
|
512810
513195
|
var windowsConoutConnection_1 = require_windowsConoutConnection();
|
|
@@ -512838,7 +513223,7 @@ var require_windowsPtyAgent = __commonJS((exports) => {
|
|
|
512838
513223
|
}
|
|
512839
513224
|
}
|
|
512840
513225
|
this._ptyNative = this._useConpty ? conptyNative : winptyNative;
|
|
512841
|
-
cwd =
|
|
513226
|
+
cwd = path44.resolve(cwd);
|
|
512842
513227
|
var commandLine = argsToCommandLine(file2, args);
|
|
512843
513228
|
var term;
|
|
512844
513229
|
if (this._useConpty) {
|
|
@@ -512859,7 +513244,7 @@ var require_windowsPtyAgent = __commonJS((exports) => {
|
|
|
512859
513244
|
this._outSocket.on("connect", function() {
|
|
512860
513245
|
_this._outSocket.emit("ready_datapipe");
|
|
512861
513246
|
});
|
|
512862
|
-
var inSocketFD =
|
|
513247
|
+
var inSocketFD = fs44.openSync(term.conin, "w");
|
|
512863
513248
|
this._inSocket = new net_1.Socket({
|
|
512864
513249
|
fd: inSocketFD,
|
|
512865
513250
|
readable: false,
|
|
@@ -512958,7 +513343,7 @@ var require_windowsPtyAgent = __commonJS((exports) => {
|
|
|
512958
513343
|
WindowsPtyAgent2.prototype._getConsoleProcessList = function() {
|
|
512959
513344
|
var _this = this;
|
|
512960
513345
|
return new Promise(function(resolve14) {
|
|
512961
|
-
var agent = child_process_1.fork(
|
|
513346
|
+
var agent = child_process_1.fork(path44.join(__dirname, "conpty_console_list_agent"), [_this._innerPid.toString()]);
|
|
512962
513347
|
agent.on("message", function(message) {
|
|
512963
513348
|
clearTimeout(timeout);
|
|
512964
513349
|
resolve14(message.consoleProcessList);
|
|
@@ -512981,7 +513366,7 @@ var require_windowsPtyAgent = __commonJS((exports) => {
|
|
|
512981
513366
|
configurable: true
|
|
512982
513367
|
});
|
|
512983
513368
|
WindowsPtyAgent2.prototype._getWindowsBuildNumber = function() {
|
|
512984
|
-
var osVersion = /(\d+)\.(\d+)\.(\d+)/g.exec(
|
|
513369
|
+
var osVersion = /(\d+)\.(\d+)\.(\d+)/g.exec(os31.release());
|
|
512985
513370
|
var buildNumber = 0;
|
|
512986
513371
|
if (osVersion && osVersion.length === 4) {
|
|
512987
513372
|
buildNumber = parseInt(osVersion[3]);
|
|
@@ -513286,15 +513671,15 @@ var require_unixTerminal = __commonJS((exports) => {
|
|
|
513286
513671
|
}();
|
|
513287
513672
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
513288
513673
|
exports.UnixTerminal = undefined;
|
|
513289
|
-
var
|
|
513290
|
-
var
|
|
513674
|
+
var fs44 = __require("fs");
|
|
513675
|
+
var path44 = __require("path");
|
|
513291
513676
|
var tty = __require("tty");
|
|
513292
513677
|
var terminal_1 = require_terminal();
|
|
513293
513678
|
var utils_1 = require_utils11();
|
|
513294
513679
|
var native = utils_1.loadNativeModule("pty");
|
|
513295
513680
|
var pty = native.module;
|
|
513296
513681
|
var helperPath = native.dir + "/spawn-helper";
|
|
513297
|
-
helperPath =
|
|
513682
|
+
helperPath = path44.resolve(__dirname, helperPath);
|
|
513298
513683
|
helperPath = helperPath.replace("app.asar", "app.asar.unpacked");
|
|
513299
513684
|
helperPath = helperPath.replace("node_modules.asar", "node_modules.asar.unpacked");
|
|
513300
513685
|
var DEFAULT_FILE = "sh";
|
|
@@ -513538,7 +513923,7 @@ var require_unixTerminal = __commonJS((exports) => {
|
|
|
513538
513923
|
return;
|
|
513539
513924
|
}
|
|
513540
513925
|
var task = this._writeQueue[0];
|
|
513541
|
-
|
|
513926
|
+
fs44.write(this._fd, task.buffer, task.offset, function(err, written) {
|
|
513542
513927
|
if (err) {
|
|
513543
513928
|
if ("code" in err && err.code === "EAGAIN") {
|
|
513544
513929
|
_this._writeImmediate = setImmediate(function() {
|
|
@@ -514552,9 +514937,9 @@ __export(exports_skill_creator, {
|
|
|
514552
514937
|
_resetForTests: () => _resetForTests,
|
|
514553
514938
|
MAX_AUTO_SKILLS_PER_SESSION: () => MAX_AUTO_SKILLS_PER_SESSION
|
|
514554
514939
|
});
|
|
514555
|
-
import * as
|
|
514556
|
-
import { homedir as
|
|
514557
|
-
import * as
|
|
514940
|
+
import * as fs44 from "fs";
|
|
514941
|
+
import { homedir as homedir33 } from "os";
|
|
514942
|
+
import * as path44 from "path";
|
|
514558
514943
|
function createAutoSkill(spec, context3) {
|
|
514559
514944
|
if (createdThisSession >= MAX_AUTO_SKILLS_PER_SESSION) {
|
|
514560
514945
|
return {
|
|
@@ -514572,11 +514957,11 @@ function createAutoSkill(spec, context3) {
|
|
|
514572
514957
|
if (!spec.body || spec.body.trim().length < 30) {
|
|
514573
514958
|
return { ok: false, reason: "body-too-short" };
|
|
514574
514959
|
}
|
|
514575
|
-
const targetDir =
|
|
514576
|
-
if (!targetDir.startsWith(SKILLS_DIR +
|
|
514960
|
+
const targetDir = path44.join(SKILLS_DIR, safeName);
|
|
514961
|
+
if (!targetDir.startsWith(SKILLS_DIR + path44.sep) && targetDir !== SKILLS_DIR) {
|
|
514577
514962
|
return { ok: false, reason: "path-traversal-blocked" };
|
|
514578
514963
|
}
|
|
514579
|
-
if (
|
|
514964
|
+
if (fs44.existsSync(targetDir)) {
|
|
514580
514965
|
return { ok: false, reason: "name-collision" };
|
|
514581
514966
|
}
|
|
514582
514967
|
const frontmatter = [
|
|
@@ -514592,8 +514977,8 @@ function createAutoSkill(spec, context3) {
|
|
|
514592
514977
|
const content = `${frontmatter}${spec.body.trim()}
|
|
514593
514978
|
`;
|
|
514594
514979
|
try {
|
|
514595
|
-
|
|
514596
|
-
|
|
514980
|
+
fs44.mkdirSync(targetDir, { recursive: true });
|
|
514981
|
+
fs44.writeFileSync(path44.join(targetDir, "SKILL.md"), content, "utf-8");
|
|
514597
514982
|
} catch (err) {
|
|
514598
514983
|
return { ok: false, reason: `write-failed: ${err.message}` };
|
|
514599
514984
|
}
|
|
@@ -514602,7 +514987,7 @@ function createAutoSkill(spec, context3) {
|
|
|
514602
514987
|
timestamp: new Date().toISOString(),
|
|
514603
514988
|
sessionId: context3.sessionId,
|
|
514604
514989
|
name: safeName,
|
|
514605
|
-
path:
|
|
514990
|
+
path: path44.join(targetDir, "SKILL.md"),
|
|
514606
514991
|
description: spec.description,
|
|
514607
514992
|
rationale: spec.rationale ?? null,
|
|
514608
514993
|
revert
|
|
@@ -514638,21 +515023,21 @@ function escapeYamlScalar(s3) {
|
|
|
514638
515023
|
}
|
|
514639
515024
|
function appendLog(entry) {
|
|
514640
515025
|
try {
|
|
514641
|
-
|
|
514642
|
-
|
|
515026
|
+
fs44.mkdirSync(path44.dirname(LOG_FILE), { recursive: true });
|
|
515027
|
+
fs44.appendFileSync(LOG_FILE, `${JSON.stringify(entry)}
|
|
514643
515028
|
`, "utf-8");
|
|
514644
515029
|
} catch {}
|
|
514645
515030
|
}
|
|
514646
515031
|
var MAX_AUTO_SKILLS_PER_SESSION = 3, REPO_ROOT, SKILLS_DIR, LOG_FILE, createdThisSession = 0;
|
|
514647
515032
|
var init_skill_creator = __esm(() => {
|
|
514648
|
-
REPO_ROOT =
|
|
514649
|
-
SKILLS_DIR =
|
|
514650
|
-
LOG_FILE =
|
|
515033
|
+
REPO_ROOT = path44.resolve(import.meta.dir, "..", "..");
|
|
515034
|
+
SKILLS_DIR = path44.join(REPO_ROOT, "packages", "skills");
|
|
515035
|
+
LOG_FILE = path44.join(homedir33(), ".8gent", "auto-created-skills.jsonl");
|
|
514651
515036
|
});
|
|
514652
515037
|
|
|
514653
515038
|
// packages/ai/tools.ts
|
|
514654
|
-
import * as
|
|
514655
|
-
import * as
|
|
515039
|
+
import * as fs45 from "fs";
|
|
515040
|
+
import * as path45 from "path";
|
|
514656
515041
|
function setToolContext(ctx) {
|
|
514657
515042
|
_ctx = ctx;
|
|
514658
515043
|
}
|
|
@@ -514663,7 +515048,7 @@ function getRuntimeParams() {
|
|
|
514663
515048
|
return _runtime;
|
|
514664
515049
|
}
|
|
514665
515050
|
function resolvePath(p) {
|
|
514666
|
-
return
|
|
515051
|
+
return path45.isAbsolute(p) ? p : path45.join(_ctx.workingDirectory, p);
|
|
514667
515052
|
}
|
|
514668
515053
|
async function runShellCommand(command) {
|
|
514669
515054
|
const { getPermissionManager: getPermissionManager3, isCommandDangerous: isCommandDangerous2 } = await Promise.resolve().then(() => (init_permissions(), exports_permissions));
|
|
@@ -514831,7 +515216,8 @@ var init_tools2 = __esm(() => {
|
|
|
514831
515216
|
systemPromptLength: 0,
|
|
514832
515217
|
messageHistoryLength: 0,
|
|
514833
515218
|
stepCount: 0,
|
|
514834
|
-
appendedContext: []
|
|
515219
|
+
appendedContext: [],
|
|
515220
|
+
voiceChatActive: false
|
|
514835
515221
|
};
|
|
514836
515222
|
_runtime = { ...DEFAULT_RUNTIME };
|
|
514837
515223
|
getOutline = tool({
|
|
@@ -514842,7 +515228,7 @@ var init_tools2 = __esm(() => {
|
|
|
514842
515228
|
execute: async ({ filePath }) => {
|
|
514843
515229
|
const { parseTypeScriptFile: parseTypeScriptFile2 } = await Promise.resolve().then(() => (init_typescript_parser(), exports_typescript_parser));
|
|
514844
515230
|
const absolutePath = resolvePath(filePath);
|
|
514845
|
-
if (!
|
|
515231
|
+
if (!fs45.existsSync(absolutePath))
|
|
514846
515232
|
return `File not found: ${absolutePath}`;
|
|
514847
515233
|
try {
|
|
514848
515234
|
const outline = parseTypeScriptFile2(absolutePath);
|
|
@@ -514876,7 +515262,7 @@ var init_tools2 = __esm(() => {
|
|
|
514876
515262
|
const filePath = symbolId.slice(0, separatorIndex);
|
|
514877
515263
|
const symbolName = symbolId.slice(separatorIndex + 2);
|
|
514878
515264
|
const absolutePath = resolvePath(filePath);
|
|
514879
|
-
if (!
|
|
515265
|
+
if (!fs45.existsSync(absolutePath))
|
|
514880
515266
|
return `File not found: ${absolutePath}`;
|
|
514881
515267
|
try {
|
|
514882
515268
|
const outline = parseTypeScriptFile2(absolutePath);
|
|
@@ -514919,7 +515305,7 @@ ${source}`;
|
|
|
514919
515305
|
matches.push({
|
|
514920
515306
|
name: symbol21.name,
|
|
514921
515307
|
kind: symbol21.kind,
|
|
514922
|
-
file:
|
|
515308
|
+
file: path45.relative(_ctx.workingDirectory, file2),
|
|
514923
515309
|
line: symbol21.startLine
|
|
514924
515310
|
});
|
|
514925
515311
|
}
|
|
@@ -514940,9 +515326,9 @@ ${source}`;
|
|
|
514940
515326
|
}),
|
|
514941
515327
|
execute: async ({ path: filePath }) => {
|
|
514942
515328
|
const absolutePath = resolvePath(filePath);
|
|
514943
|
-
if (!
|
|
515329
|
+
if (!fs45.existsSync(absolutePath))
|
|
514944
515330
|
return `File not found: ${absolutePath}`;
|
|
514945
|
-
const content =
|
|
515331
|
+
const content = fs45.readFileSync(absolutePath, "utf-8");
|
|
514946
515332
|
const lines = content.split(`
|
|
514947
515333
|
`);
|
|
514948
515334
|
if (lines.length > 200) {
|
|
@@ -514964,10 +515350,10 @@ ${lines.slice(0, 200).join(`
|
|
|
514964
515350
|
}),
|
|
514965
515351
|
execute: async ({ path: filePath, content }) => {
|
|
514966
515352
|
const absolutePath = resolvePath(filePath);
|
|
514967
|
-
const dir =
|
|
514968
|
-
if (!
|
|
514969
|
-
|
|
514970
|
-
|
|
515353
|
+
const dir = path45.dirname(absolutePath);
|
|
515354
|
+
if (!fs45.existsSync(dir))
|
|
515355
|
+
fs45.mkdirSync(dir, { recursive: true });
|
|
515356
|
+
fs45.writeFileSync(absolutePath, content);
|
|
514971
515357
|
return `File written: ${absolutePath}`;
|
|
514972
515358
|
}
|
|
514973
515359
|
});
|
|
@@ -514980,12 +515366,12 @@ ${lines.slice(0, 200).join(`
|
|
|
514980
515366
|
}),
|
|
514981
515367
|
execute: async ({ path: filePath, oldText, newText }) => {
|
|
514982
515368
|
const absolutePath = resolvePath(filePath);
|
|
514983
|
-
if (!
|
|
515369
|
+
if (!fs45.existsSync(absolutePath))
|
|
514984
515370
|
return `File not found: ${absolutePath}`;
|
|
514985
|
-
const content =
|
|
515371
|
+
const content = fs45.readFileSync(absolutePath, "utf-8");
|
|
514986
515372
|
if (!content.includes(oldText))
|
|
514987
515373
|
return `Error: Could not find the text to replace in ${filePath}. Make sure oldText matches exactly.`;
|
|
514988
|
-
|
|
515374
|
+
fs45.writeFileSync(absolutePath, content.replace(oldText, newText));
|
|
514989
515375
|
return `File edited: ${absolutePath}
|
|
514990
515376
|
Replaced ${oldText.length} chars with ${newText.length} chars.`;
|
|
514991
515377
|
}
|
|
@@ -515007,7 +515393,7 @@ Replaced ${oldText.length} chars with ${newText.length} chars.`;
|
|
|
515007
515393
|
const results = [];
|
|
515008
515394
|
for (const f3 of files.slice(0, 100)) {
|
|
515009
515395
|
try {
|
|
515010
|
-
const s3 = await fsStat(
|
|
515396
|
+
const s3 = await fsStat(path45.join(absolutePath, f3));
|
|
515011
515397
|
results.push(s3.isDirectory() ? `${f3}/` : f3);
|
|
515012
515398
|
} catch {
|
|
515013
515399
|
results.push(f3);
|
|
@@ -515746,16 +516132,16 @@ ${changes.slice(0, 1000)}`;
|
|
|
515746
516132
|
append: exports_external.boolean().optional().describe("If true, appends to existing note with same title instead of creating new")
|
|
515747
516133
|
}),
|
|
515748
516134
|
execute: async ({ title, content, append: append3 }) => {
|
|
515749
|
-
const { existsSync:
|
|
515750
|
-
const { join:
|
|
515751
|
-
const dataDir =
|
|
515752
|
-
const filepath =
|
|
515753
|
-
if (!
|
|
515754
|
-
|
|
516135
|
+
const { existsSync: existsSync57, mkdirSync: mkdirSync39, readFileSync: readFileSync47, writeFileSync: writeFileSync30 } = await import("fs");
|
|
516136
|
+
const { join: join62 } = await import("path");
|
|
516137
|
+
const dataDir = join62(process.env.HOME || "~", ".8gent", "tabs");
|
|
516138
|
+
const filepath = join62(dataDir, "notes.json");
|
|
516139
|
+
if (!existsSync57(dataDir))
|
|
516140
|
+
mkdirSync39(dataDir, { recursive: true });
|
|
515755
516141
|
let notes = [];
|
|
515756
516142
|
try {
|
|
515757
|
-
if (
|
|
515758
|
-
const raw = JSON.parse(
|
|
516143
|
+
if (existsSync57(filepath)) {
|
|
516144
|
+
const raw = JSON.parse(readFileSync47(filepath, "utf-8"));
|
|
515759
516145
|
notes = raw.notes || [];
|
|
515760
516146
|
}
|
|
515761
516147
|
} catch {}
|
|
@@ -515785,7 +516171,7 @@ ${content}`;
|
|
|
515785
516171
|
updatedAt: now2
|
|
515786
516172
|
});
|
|
515787
516173
|
}
|
|
515788
|
-
|
|
516174
|
+
writeFileSync30(filepath, JSON.stringify({ notes }, null, 2));
|
|
515789
516175
|
return { ok: true, noteCount: notes.length, title };
|
|
515790
516176
|
}
|
|
515791
516177
|
});
|
|
@@ -517580,6 +517966,43 @@ var init_vision_interpreter = __esm(() => {
|
|
|
517580
517966
|
init_vision_router();
|
|
517581
517967
|
});
|
|
517582
517968
|
|
|
517969
|
+
// packages/eight/auto-tune.ts
|
|
517970
|
+
function computeAutoTune(settings) {
|
|
517971
|
+
return {
|
|
517972
|
+
liteMode: resolveLiteMode(settings.performance.mode),
|
|
517973
|
+
showIntro: resolveIntroBanner(settings.performance.introBanner),
|
|
517974
|
+
voiceSilenceMs: settings.voice.silenceThresholdMs
|
|
517975
|
+
};
|
|
517976
|
+
}
|
|
517977
|
+
function resolveLiteMode(mode) {
|
|
517978
|
+
if (mode === "lite")
|
|
517979
|
+
return true;
|
|
517980
|
+
if (mode === "full")
|
|
517981
|
+
return false;
|
|
517982
|
+
if (process.env.CI === "true")
|
|
517983
|
+
return true;
|
|
517984
|
+
if (!process.stdout.isTTY)
|
|
517985
|
+
return true;
|
|
517986
|
+
if (process.env["8GENT_LITE"] === "1")
|
|
517987
|
+
return true;
|
|
517988
|
+
if (process.env["8GENT_FULL"] === "1")
|
|
517989
|
+
return false;
|
|
517990
|
+
return false;
|
|
517991
|
+
}
|
|
517992
|
+
function resolveIntroBanner(introBanner) {
|
|
517993
|
+
if (introBanner === "on")
|
|
517994
|
+
return true;
|
|
517995
|
+
if (introBanner === "off")
|
|
517996
|
+
return false;
|
|
517997
|
+
if (!process.stdout.isTTY)
|
|
517998
|
+
return false;
|
|
517999
|
+
if (process.env["8GENT_NO_INTRO"] === "1")
|
|
518000
|
+
return false;
|
|
518001
|
+
if (process.env["8GENT_LITE"] === "1")
|
|
518002
|
+
return false;
|
|
518003
|
+
return true;
|
|
518004
|
+
}
|
|
518005
|
+
|
|
517583
518006
|
// packages/proactive/opportunity-scanner.ts
|
|
517584
518007
|
var init_opportunity_scanner = () => {};
|
|
517585
518008
|
|
|
@@ -517587,19 +518010,19 @@ var init_opportunity_scanner = () => {};
|
|
|
517587
518010
|
var init_capability_matcher = () => {};
|
|
517588
518011
|
|
|
517589
518012
|
// packages/proactive/work-tracker.ts
|
|
517590
|
-
import { join as
|
|
518013
|
+
import { join as join62 } from "path";
|
|
517591
518014
|
var DATA_DIR2, STORE_PATH;
|
|
517592
518015
|
var init_work_tracker = __esm(() => {
|
|
517593
|
-
DATA_DIR2 =
|
|
517594
|
-
STORE_PATH =
|
|
518016
|
+
DATA_DIR2 = join62(process.env.HOME || "~", ".8gent");
|
|
518017
|
+
STORE_PATH = join62(DATA_DIR2, "opportunities.json");
|
|
517595
518018
|
});
|
|
517596
518019
|
|
|
517597
518020
|
// packages/proactive/revenue-engine.ts
|
|
517598
|
-
import { join as
|
|
518021
|
+
import { join as join63 } from "path";
|
|
517599
518022
|
var DATA_DIR3, STORE_PATH2;
|
|
517600
518023
|
var init_revenue_engine = __esm(() => {
|
|
517601
|
-
DATA_DIR3 =
|
|
517602
|
-
STORE_PATH2 =
|
|
518024
|
+
DATA_DIR3 = join63(process.env.HOME || "~", ".8gent");
|
|
518025
|
+
STORE_PATH2 = join63(DATA_DIR3, "revenue.json");
|
|
517603
518026
|
});
|
|
517604
518027
|
|
|
517605
518028
|
// packages/proactive/deliverable-generator.ts
|
|
@@ -517612,11 +518035,11 @@ var init_client_outreach = () => {};
|
|
|
517612
518035
|
var init_content_packaging = () => {};
|
|
517613
518036
|
|
|
517614
518037
|
// packages/tools/browser/cache.ts
|
|
517615
|
-
import { homedir as
|
|
517616
|
-
import { join as
|
|
518038
|
+
import { homedir as homedir34 } from "os";
|
|
518039
|
+
import { join as join64 } from "path";
|
|
517617
518040
|
var CACHE_DIR, TTL_MS, MAX_CACHE_BYTES;
|
|
517618
518041
|
var init_cache2 = __esm(() => {
|
|
517619
|
-
CACHE_DIR =
|
|
518042
|
+
CACHE_DIR = join64(process.env.EIGHT_DATA_DIR || join64(homedir34(), ".8gent"), "browser-cache");
|
|
517620
518043
|
TTL_MS = 60 * 60 * 1000;
|
|
517621
518044
|
MAX_CACHE_BYTES = 100 * 1024 * 1024;
|
|
517622
518045
|
});
|
|
@@ -518266,7 +518689,7 @@ class Voice {
|
|
|
518266
518689
|
}
|
|
518267
518690
|
}
|
|
518268
518691
|
var PERSONALITY, GREETINGS, COMPLETION_PHRASES, ERROR_PHRASES, IDLE_QUIPS, THINKING_PHRASES, PROGRESS_PHRASES, voice;
|
|
518269
|
-
var
|
|
518692
|
+
var init_voice3 = __esm(() => {
|
|
518270
518693
|
PERSONALITY = {
|
|
518271
518694
|
name: "8gent",
|
|
518272
518695
|
tagline: "The Infinite Gentleman",
|
|
@@ -519236,8 +519659,8 @@ function createOpenAICompatible(options) {
|
|
|
519236
519659
|
const getHeaders = () => withUserAgentSuffix(headers, `ai-sdk/openai-compatible/${VERSION4}`);
|
|
519237
519660
|
const getCommonModelConfig = (modelType) => ({
|
|
519238
519661
|
provider: `${providerName}.${modelType}`,
|
|
519239
|
-
url: ({ path:
|
|
519240
|
-
const url2 = new URL(`${baseURL}${
|
|
519662
|
+
url: ({ path: path46 }) => {
|
|
519663
|
+
const url2 = new URL(`${baseURL}${path46}`);
|
|
519241
519664
|
if (options.queryParams) {
|
|
519242
519665
|
url2.search = new URLSearchParams(options.queryParams).toString();
|
|
519243
519666
|
}
|
|
@@ -520496,14 +520919,14 @@ var init_agent = __esm(() => {
|
|
|
520496
520919
|
});
|
|
520497
520920
|
|
|
520498
520921
|
// packages/ai/task-router.ts
|
|
520499
|
-
import { join as
|
|
520922
|
+
import { join as join65 } from "path";
|
|
520500
520923
|
var CONFIG_DIR2, ROUTER_CONFIG_PATH, ROUTER_STATS_PATH, ClassificationSchema;
|
|
520501
520924
|
var init_task_router = __esm(() => {
|
|
520502
520925
|
init_zod();
|
|
520503
520926
|
init_providers2();
|
|
520504
|
-
CONFIG_DIR2 =
|
|
520505
|
-
ROUTER_CONFIG_PATH =
|
|
520506
|
-
ROUTER_STATS_PATH =
|
|
520927
|
+
CONFIG_DIR2 = join65(process.env.HOME || "~", ".8gent");
|
|
520928
|
+
ROUTER_CONFIG_PATH = join65(CONFIG_DIR2, "router.json");
|
|
520929
|
+
ROUTER_STATS_PATH = join65(CONFIG_DIR2, "router-stats.json");
|
|
520507
520930
|
ClassificationSchema = exports_external.object({
|
|
520508
520931
|
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
520932
|
confidence: exports_external.number().min(0).max(1).describe("How confident you are in this classification (0-1)"),
|
|
@@ -520517,11 +520940,11 @@ var init_toolshed_bridge = __esm(() => {
|
|
|
520517
520940
|
});
|
|
520518
520941
|
|
|
520519
520942
|
// packages/ai/embedding-cache.ts
|
|
520520
|
-
import { join as
|
|
520943
|
+
import { join as join66 } from "path";
|
|
520521
520944
|
var CACHE_DIR2, CACHE_PATH;
|
|
520522
520945
|
var init_embedding_cache = __esm(() => {
|
|
520523
|
-
CACHE_DIR2 =
|
|
520524
|
-
CACHE_PATH =
|
|
520946
|
+
CACHE_DIR2 = join66(process.env.HOME || "~", ".8gent");
|
|
520947
|
+
CACHE_PATH = join66(CACHE_DIR2, "embedding-cache.json");
|
|
520525
520948
|
});
|
|
520526
520949
|
|
|
520527
520950
|
// packages/ai/edge-inference.ts
|
|
@@ -520543,12 +520966,40 @@ var init_ai = __esm(() => {
|
|
|
520543
520966
|
init_embedding_cache();
|
|
520544
520967
|
});
|
|
520545
520968
|
|
|
520969
|
+
// packages/eight/visualiser-bridge.ts
|
|
520970
|
+
var exports_visualiser_bridge = {};
|
|
520971
|
+
__export(exports_visualiser_bridge, {
|
|
520972
|
+
setVisualiserTokenSink: () => setVisualiserTokenSink,
|
|
520973
|
+
notifyVisualiserToken: () => notifyVisualiserToken,
|
|
520974
|
+
_hasSink: () => _hasSink
|
|
520975
|
+
});
|
|
520976
|
+
function setVisualiserTokenSink(next2) {
|
|
520977
|
+
sink = next2;
|
|
520978
|
+
}
|
|
520979
|
+
function notifyVisualiserToken(text4) {
|
|
520980
|
+
if (!sink || !text4)
|
|
520981
|
+
return;
|
|
520982
|
+
const parts = text4.split(/\s+/).filter(Boolean).slice(0, 24);
|
|
520983
|
+
for (const part of parts) {
|
|
520984
|
+
try {
|
|
520985
|
+
sink(part);
|
|
520986
|
+
} catch {}
|
|
520987
|
+
}
|
|
520988
|
+
}
|
|
520989
|
+
function _hasSink() {
|
|
520990
|
+
return sink !== null;
|
|
520991
|
+
}
|
|
520992
|
+
var sink = null;
|
|
520993
|
+
|
|
520546
520994
|
// packages/eight/agent.ts
|
|
520547
520995
|
var exports_agent = {};
|
|
520548
520996
|
__export(exports_agent, {
|
|
520549
520997
|
Agent: () => Agent
|
|
520550
520998
|
});
|
|
520551
520999
|
import * as crypto8 from "crypto";
|
|
521000
|
+
import * as fs46 from "fs";
|
|
521001
|
+
import * as os31 from "os";
|
|
521002
|
+
import * as path46 from "path";
|
|
520552
521003
|
|
|
520553
521004
|
class Agent {
|
|
520554
521005
|
executor;
|
|
@@ -520568,7 +521019,6 @@ class Agent {
|
|
|
520568
521019
|
evidenceCollector;
|
|
520569
521020
|
sessionEvidence = [];
|
|
520570
521021
|
proactiveGatherer = null;
|
|
520571
|
-
workflowValidator;
|
|
520572
521022
|
kanban = getKanbanBoard();
|
|
520573
521023
|
currentBmadTask = null;
|
|
520574
521024
|
heartbeat;
|
|
@@ -520589,6 +521039,8 @@ class Agent {
|
|
|
520589
521039
|
this.hookManager = getHookManager();
|
|
520590
521040
|
this.sessionId = `session_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
520591
521041
|
this.sessionStartTime = Date.now();
|
|
521042
|
+
const autoTuneSettings = readSettingsFileSync();
|
|
521043
|
+
const LITE = autoTuneSettings !== null ? computeAutoTune(autoTuneSettings).liteMode : process.env["8GENT_LITE"] === "0" || process.env["8GENT_FULL"] === "1" ? false : true;
|
|
520592
521044
|
this.hookManager.setWorkingDirectory(config2.workingDirectory || process.cwd());
|
|
520593
521045
|
setToolContext({
|
|
520594
521046
|
workingDirectory: config2.workingDirectory || process.cwd()
|
|
@@ -520596,24 +521048,23 @@ class Agent {
|
|
|
520596
521048
|
this.toolRegistry = new ToolRegistry(config2.allTools ?? false);
|
|
520597
521049
|
this.compaction = new ProactiveCompression;
|
|
520598
521050
|
const cwd = config2.workingDirectory || process.cwd();
|
|
520599
|
-
|
|
520600
|
-
|
|
520601
|
-
|
|
521051
|
+
if (!LITE) {
|
|
521052
|
+
indexFolder(cwd).then((index2) => {
|
|
521053
|
+
if (process.env.DEBUG === "1") {
|
|
521054
|
+
console.log(`[AST] Indexed ${index2.fileCount} files, ${index2.symbolCount} symbols`);
|
|
521055
|
+
}
|
|
521056
|
+
}).catch(() => {});
|
|
521057
|
+
}
|
|
520602
521058
|
this.planner = getProactivePlanner();
|
|
520603
521059
|
this.evidenceCollector = new EvidenceCollector({
|
|
520604
521060
|
workingDirectory: config2.workingDirectory || process.cwd()
|
|
520605
521061
|
});
|
|
520606
|
-
this.workflowValidator = new PlanValidateLoop({
|
|
520607
|
-
workingDirectory: config2.workingDirectory || process.cwd(),
|
|
520608
|
-
maxRetries: 2,
|
|
520609
|
-
validateEachStep: true,
|
|
520610
|
-
collectEvidence: true,
|
|
520611
|
-
abortOnFailure: false
|
|
520612
|
-
});
|
|
520613
521062
|
this.onboarding = new OnboardingManager(config2.workingDirectory || process.cwd());
|
|
520614
521063
|
if (this.onboarding.needsOnboarding()) {
|
|
520615
521064
|
this.onboarding.detectIntegrations().catch(() => {});
|
|
520616
|
-
|
|
521065
|
+
if (process.env.DEBUG === "1") {
|
|
521066
|
+
console.log("[8gent] First run detected - onboarding available. The agent can ask setup questions.");
|
|
521067
|
+
}
|
|
520617
521068
|
}
|
|
520618
521069
|
const basePrompt = config2.systemPrompt || DEFAULT_SYSTEM_PROMPT;
|
|
520619
521070
|
const languageInstruction = this.getLanguageInstruction();
|
|
@@ -520682,11 +521133,15 @@ ${buildToolCatalogSegment({ concise: true })}`;
|
|
|
520682
521133
|
agent: agentInfo,
|
|
520683
521134
|
environment: env
|
|
520684
521135
|
});
|
|
520685
|
-
const syncEnabled = this._readSyncToConvex();
|
|
521136
|
+
const syncEnabled = LITE ? false : this._readSyncToConvex();
|
|
520686
521137
|
this.sessionSync = new SessionSyncManager(syncEnabled);
|
|
520687
|
-
|
|
521138
|
+
if (!LITE && syncEnabled) {
|
|
521139
|
+
this.sessionSync.startSession(config2.model, config2.runtime, config2.workingDirectory).catch(() => {});
|
|
521140
|
+
}
|
|
520688
521141
|
this.kernel = KernelManager.fromProjectConfig(config2.workingDirectory || process.cwd());
|
|
520689
|
-
|
|
521142
|
+
if (!LITE) {
|
|
521143
|
+
this.kernel.start().catch(() => {});
|
|
521144
|
+
}
|
|
520690
521145
|
this.orchestratorBus = getOrchestratorBus();
|
|
520691
521146
|
import("child_process").then(({ exec: exec4 }) => {
|
|
520692
521147
|
exec4("git rev-parse --abbrev-ref HEAD", { cwd, timeout: 2000 }, (err, stdout) => {
|
|
@@ -520712,8 +521167,10 @@ ${buildToolCatalogSegment({ concise: true })}`;
|
|
|
520712
521167
|
workingDirectory: config2.workingDirectory || process.cwd(),
|
|
520713
521168
|
verbose: false
|
|
520714
521169
|
});
|
|
520715
|
-
|
|
520716
|
-
|
|
521170
|
+
if (!LITE) {
|
|
521171
|
+
this.heartbeat.start();
|
|
521172
|
+
this.heartbeat.updateContext({ currentTask: "Agent initialized" });
|
|
521173
|
+
}
|
|
520717
521174
|
const vault = getVault();
|
|
520718
521175
|
if (vault.has("TELEGRAM_BOT_TOKEN") && !getActiveTelegramBot()) {
|
|
520719
521176
|
const telegramToken = vault.get("TELEGRAM_BOT_TOKEN");
|
|
@@ -520722,7 +521179,9 @@ ${buildToolCatalogSegment({ concise: true })}`;
|
|
|
520722
521179
|
startTelegramBot(telegramToken, this, {
|
|
520723
521180
|
allowedUsers: chatId ? [Number.parseInt(chatId, 10)] : undefined
|
|
520724
521181
|
}).catch((err) => {
|
|
520725
|
-
|
|
521182
|
+
if (process.env.DEBUG === "1") {
|
|
521183
|
+
console.log(`[8gent] Telegram auto-start failed: ${err.message}`);
|
|
521184
|
+
}
|
|
520726
521185
|
});
|
|
520727
521186
|
}
|
|
520728
521187
|
}
|
|
@@ -520734,10 +521193,14 @@ ${buildToolCatalogSegment({ concise: true })}`;
|
|
|
520734
521193
|
for (const [name21, fn] of Object.entries(extTools)) {
|
|
520735
521194
|
this.toolRegistry.registerExternalTool(name21, fn);
|
|
520736
521195
|
}
|
|
520737
|
-
|
|
521196
|
+
if (process.env.DEBUG === "1") {
|
|
521197
|
+
console.log(`[ext] ${loaded.length} extension(s), ${Object.keys(extTools).length} tool(s) registered`);
|
|
521198
|
+
}
|
|
520738
521199
|
}
|
|
520739
521200
|
}).catch((err) => {
|
|
520740
|
-
|
|
521201
|
+
if (process.env.DEBUG === "1") {
|
|
521202
|
+
console.log(`[ext] Extension loading failed: ${err}`);
|
|
521203
|
+
}
|
|
520741
521204
|
});
|
|
520742
521205
|
}
|
|
520743
521206
|
async chat(userMessage, imageBase64, imageMimeType) {
|
|
@@ -520872,6 +521335,12 @@ Ask the user naturally \u2014 don't mention this system instruction. After they
|
|
|
520872
521335
|
## Agent Self-Appended Context
|
|
520873
521336
|
${tunedParams.appendedContext.map((c3, i4) => `[${i4 + 1}] ${c3}`).join(`
|
|
520874
521337
|
`)}`;
|
|
521338
|
+
}
|
|
521339
|
+
if (tunedParams.voiceChatActive) {
|
|
521340
|
+
effectiveInstructions += `
|
|
521341
|
+
|
|
521342
|
+
## Voice Chat Mode (active)
|
|
521343
|
+
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.`;
|
|
520875
521344
|
}
|
|
520876
521345
|
let agentConfig = {
|
|
520877
521346
|
provider: providerConfig,
|
|
@@ -521053,6 +521522,10 @@ Do NOT repeat the same fix again.`
|
|
|
521053
521522
|
stepCount,
|
|
521054
521523
|
messageHistoryLength: this.messageHistory.length
|
|
521055
521524
|
});
|
|
521525
|
+
try {
|
|
521526
|
+
const { notifyVisualiserToken: notifyVisualiserToken2 } = await Promise.resolve().then(() => exports_visualiser_bridge);
|
|
521527
|
+
notifyVisualiserToken2(event.text);
|
|
521528
|
+
} catch {}
|
|
521056
521529
|
this.events.onStepFinish?.({
|
|
521057
521530
|
stepNumber: event.stepNumber,
|
|
521058
521531
|
finishReason: event.finishReason,
|
|
@@ -521474,11 +521947,11 @@ ${summary || " (no provider errors recorded)"}`);
|
|
|
521474
521947
|
}
|
|
521475
521948
|
_readSyncToConvex() {
|
|
521476
521949
|
try {
|
|
521477
|
-
const
|
|
521478
|
-
const
|
|
521950
|
+
const fs47 = __require("fs");
|
|
521951
|
+
const path47 = __require("path");
|
|
521479
521952
|
const cwd = this.config.workingDirectory || process.cwd();
|
|
521480
|
-
const configPath =
|
|
521481
|
-
const raw =
|
|
521953
|
+
const configPath = path47.join(cwd, ".8gent", "config.json");
|
|
521954
|
+
const raw = fs47.readFileSync(configPath, "utf-8");
|
|
521482
521955
|
const config2 = JSON.parse(raw);
|
|
521483
521956
|
if (typeof config2.syncToConvex === "boolean")
|
|
521484
521957
|
return config2.syncToConvex;
|
|
@@ -521528,6 +522001,21 @@ ${summary || " (no provider errors recorded)"}`);
|
|
|
521528
522001
|
await manager.stopAll();
|
|
521529
522002
|
}
|
|
521530
522003
|
}
|
|
522004
|
+
function readSettingsFileSync() {
|
|
522005
|
+
try {
|
|
522006
|
+
const file2 = path46.join(os31.homedir(), ".8gent", "settings.json");
|
|
522007
|
+
if (!fs46.existsSync(file2))
|
|
522008
|
+
return null;
|
|
522009
|
+
const raw = fs46.readFileSync(file2, "utf8");
|
|
522010
|
+
const parsed = JSON.parse(raw);
|
|
522011
|
+
if (parsed && typeof parsed === "object" && parsed.performance && typeof parsed.performance.mode === "string" && typeof parsed.performance.introBanner === "string" && parsed.voice && typeof parsed.voice.silenceThresholdMs === "number") {
|
|
522012
|
+
return parsed;
|
|
522013
|
+
}
|
|
522014
|
+
return null;
|
|
522015
|
+
} catch {
|
|
522016
|
+
return null;
|
|
522017
|
+
}
|
|
522018
|
+
}
|
|
521531
522019
|
var init_agent2 = __esm(() => {
|
|
521532
522020
|
init_ast_index();
|
|
521533
522021
|
init_extensions();
|
|
@@ -521555,7 +522043,7 @@ var init_agent2 = __esm(() => {
|
|
|
521555
522043
|
init_vision_interpreter();
|
|
521556
522044
|
init_proactive();
|
|
521557
522045
|
init_brand();
|
|
521558
|
-
|
|
522046
|
+
init_voice3();
|
|
521559
522047
|
init_workflow();
|
|
521560
522048
|
init_ai();
|
|
521561
522049
|
});
|
|
@@ -521731,8 +522219,8 @@ __export(exports_cli, {
|
|
|
521731
522219
|
runCLI: () => runCLI,
|
|
521732
522220
|
parseCLIArgs: () => parseCLIArgs
|
|
521733
522221
|
});
|
|
521734
|
-
import * as
|
|
521735
|
-
import * as
|
|
522222
|
+
import * as fs47 from "fs";
|
|
522223
|
+
import * as path47 from "path";
|
|
521736
522224
|
function parseCLIArgs(args) {
|
|
521737
522225
|
if (!args.includes("--cli"))
|
|
521738
522226
|
return null;
|
|
@@ -521787,11 +522275,11 @@ function extractCode(text4) {
|
|
|
521787
522275
|
return null;
|
|
521788
522276
|
}
|
|
521789
522277
|
function writeOutput(filePath, content) {
|
|
521790
|
-
const existed =
|
|
521791
|
-
const dir =
|
|
521792
|
-
if (!
|
|
521793
|
-
|
|
521794
|
-
|
|
522278
|
+
const existed = fs47.existsSync(filePath);
|
|
522279
|
+
const dir = path47.dirname(filePath);
|
|
522280
|
+
if (!fs47.existsSync(dir))
|
|
522281
|
+
fs47.mkdirSync(dir, { recursive: true });
|
|
522282
|
+
fs47.writeFileSync(filePath, content, "utf-8");
|
|
521795
522283
|
if (existed) {
|
|
521796
522284
|
filesModified.push(filePath);
|
|
521797
522285
|
} else {
|
|
@@ -521878,14 +522366,14 @@ __export(exports_session_manager, {
|
|
|
521878
522366
|
SessionManager: () => SessionManager
|
|
521879
522367
|
});
|
|
521880
522368
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
521881
|
-
import * as
|
|
521882
|
-
import * as
|
|
522369
|
+
import * as fs48 from "fs";
|
|
522370
|
+
import * as path48 from "path";
|
|
521883
522371
|
|
|
521884
522372
|
class SessionManager {
|
|
521885
522373
|
dir;
|
|
521886
522374
|
constructor(dataDir) {
|
|
521887
|
-
this.dir = dataDir ||
|
|
521888
|
-
|
|
522375
|
+
this.dir = dataDir || path48.join(process.env.HOME || "~", ".8gent", "sessions");
|
|
522376
|
+
fs48.mkdirSync(this.dir, { recursive: true });
|
|
521889
522377
|
}
|
|
521890
522378
|
create(opts) {
|
|
521891
522379
|
const now2 = new Date().toISOString();
|
|
@@ -521945,14 +522433,14 @@ class SessionManager {
|
|
|
521945
522433
|
this.write(id, file2);
|
|
521946
522434
|
}
|
|
521947
522435
|
filePath(id) {
|
|
521948
|
-
return
|
|
522436
|
+
return path48.join(this.dir, `${id}.json`);
|
|
521949
522437
|
}
|
|
521950
522438
|
write(id, data2) {
|
|
521951
|
-
|
|
522439
|
+
fs48.writeFileSync(this.filePath(id), JSON.stringify(data2, null, 2));
|
|
521952
522440
|
}
|
|
521953
522441
|
readFile(id) {
|
|
521954
522442
|
try {
|
|
521955
|
-
const raw =
|
|
522443
|
+
const raw = fs48.readFileSync(this.filePath(id), "utf-8");
|
|
521956
522444
|
return JSON.parse(raw);
|
|
521957
522445
|
} catch {
|
|
521958
522446
|
return null;
|
|
@@ -521960,11 +522448,11 @@ class SessionManager {
|
|
|
521960
522448
|
}
|
|
521961
522449
|
listAll() {
|
|
521962
522450
|
try {
|
|
521963
|
-
const files =
|
|
522451
|
+
const files = fs48.readdirSync(this.dir).filter((f3) => f3.endsWith(".json"));
|
|
521964
522452
|
const sessions2 = [];
|
|
521965
522453
|
for (const f3 of files) {
|
|
521966
522454
|
try {
|
|
521967
|
-
const raw =
|
|
522455
|
+
const raw = fs48.readFileSync(path48.join(this.dir, f3), "utf-8");
|
|
521968
522456
|
const parsed = JSON.parse(raw);
|
|
521969
522457
|
const { messages: _4, ...info3 } = parsed;
|
|
521970
522458
|
sessions2.push(info3);
|
|
@@ -522267,8 +522755,8 @@ __export(exports_companion, {
|
|
|
522267
522755
|
formatDeckSummary: () => formatDeckSummary,
|
|
522268
522756
|
endSession: () => endSession
|
|
522269
522757
|
});
|
|
522270
|
-
import { existsSync as
|
|
522271
|
-
import { join as
|
|
522758
|
+
import { existsSync as existsSync59, mkdirSync as mkdirSync41, readFileSync as readFileSync49, writeFileSync as writeFileSync32 } from "fs";
|
|
522759
|
+
import { join as join69 } from "path";
|
|
522272
522760
|
function seedRng(seed) {
|
|
522273
522761
|
let h2 = 0;
|
|
522274
522762
|
for (let i4 = 0;i4 < seed.length; i4++) {
|
|
@@ -522406,13 +522894,13 @@ function generateCompanion(sessionId) {
|
|
|
522406
522894
|
}
|
|
522407
522895
|
function getDeckPath() {
|
|
522408
522896
|
const home = process.env.HOME || process.env.USERPROFILE || "~";
|
|
522409
|
-
return
|
|
522897
|
+
return join69(home, ".8gent", "companion-deck.json");
|
|
522410
522898
|
}
|
|
522411
522899
|
function loadDeck() {
|
|
522412
522900
|
const deckPath = getDeckPath();
|
|
522413
522901
|
try {
|
|
522414
|
-
if (
|
|
522415
|
-
return JSON.parse(
|
|
522902
|
+
if (existsSync59(deckPath)) {
|
|
522903
|
+
return JSON.parse(readFileSync49(deckPath, "utf-8"));
|
|
522416
522904
|
}
|
|
522417
522905
|
} catch {}
|
|
522418
522906
|
return {
|
|
@@ -522429,9 +522917,9 @@ function loadDeck() {
|
|
|
522429
522917
|
}
|
|
522430
522918
|
function saveDeck(deck) {
|
|
522431
522919
|
const deckPath = getDeckPath();
|
|
522432
|
-
const dir =
|
|
522433
|
-
|
|
522434
|
-
|
|
522920
|
+
const dir = join69(process.env.HOME || "~", ".8gent");
|
|
522921
|
+
mkdirSync41(dir, { recursive: true });
|
|
522922
|
+
writeFileSync32(deckPath, JSON.stringify(deck, null, 2));
|
|
522435
522923
|
}
|
|
522436
522924
|
function registerCompanion(sessionId, companion, model) {
|
|
522437
522925
|
const deck = loadDeck();
|
|
@@ -524715,9 +525203,9 @@ function formatDeviceFlowStatus(state) {
|
|
|
524715
525203
|
|
|
524716
525204
|
// packages/auth/github.ts
|
|
524717
525205
|
import * as crypto9 from "crypto";
|
|
524718
|
-
import * as
|
|
524719
|
-
import * as
|
|
524720
|
-
import * as
|
|
525206
|
+
import * as fs49 from "fs";
|
|
525207
|
+
import * as os32 from "os";
|
|
525208
|
+
import * as path49 from "path";
|
|
524721
525209
|
async function persistToken(token) {
|
|
524722
525210
|
cachedToken = token;
|
|
524723
525211
|
if (process.platform === "darwin") {
|
|
@@ -524813,10 +525301,10 @@ async function runSecurity(args) {
|
|
|
524813
525301
|
}
|
|
524814
525302
|
}
|
|
524815
525303
|
function getFilePath() {
|
|
524816
|
-
return
|
|
525304
|
+
return path49.join(os32.homedir(), ".8gent", GITHUB_TOKEN_FILE);
|
|
524817
525305
|
}
|
|
524818
525306
|
function deriveKey2() {
|
|
524819
|
-
const fingerprint = `${
|
|
525307
|
+
const fingerprint = `${os32.hostname()}:${os32.userInfo().username}`;
|
|
524820
525308
|
return crypto9.pbkdf2Sync(fingerprint, GITHUB_KEY_SALT, 1e5, 32, "sha256");
|
|
524821
525309
|
}
|
|
524822
525310
|
function fileStore(token) {
|
|
@@ -524833,17 +525321,17 @@ function fileStore(token) {
|
|
|
524833
525321
|
ciphertext
|
|
524834
525322
|
};
|
|
524835
525323
|
const filePath = getFilePath();
|
|
524836
|
-
const dir =
|
|
524837
|
-
if (!
|
|
524838
|
-
|
|
524839
|
-
|
|
525324
|
+
const dir = path49.dirname(filePath);
|
|
525325
|
+
if (!fs49.existsSync(dir))
|
|
525326
|
+
fs49.mkdirSync(dir, { recursive: true });
|
|
525327
|
+
fs49.writeFileSync(filePath, JSON.stringify(envelope), { mode: 384 });
|
|
524840
525328
|
}
|
|
524841
525329
|
function fileRetrieve() {
|
|
524842
525330
|
const filePath = getFilePath();
|
|
524843
|
-
if (!
|
|
525331
|
+
if (!fs49.existsSync(filePath))
|
|
524844
525332
|
return null;
|
|
524845
525333
|
try {
|
|
524846
|
-
const raw =
|
|
525334
|
+
const raw = fs49.readFileSync(filePath, "utf-8");
|
|
524847
525335
|
const envelope = JSON.parse(raw);
|
|
524848
525336
|
if (envelope.version !== 1)
|
|
524849
525337
|
return null;
|
|
@@ -524860,8 +525348,8 @@ function fileRetrieve() {
|
|
|
524860
525348
|
}
|
|
524861
525349
|
function fileClear() {
|
|
524862
525350
|
const filePath = getFilePath();
|
|
524863
|
-
if (
|
|
524864
|
-
|
|
525351
|
+
if (fs49.existsSync(filePath))
|
|
525352
|
+
fs49.unlinkSync(filePath);
|
|
524865
525353
|
}
|
|
524866
525354
|
async function fetchGitHubUser(token) {
|
|
524867
525355
|
try {
|
|
@@ -524968,9 +525456,9 @@ var init_github = __esm(() => {
|
|
|
524968
525456
|
|
|
524969
525457
|
// packages/auth/token-store.ts
|
|
524970
525458
|
import * as crypto10 from "crypto";
|
|
524971
|
-
import * as
|
|
524972
|
-
import * as
|
|
524973
|
-
import * as
|
|
525459
|
+
import * as fs50 from "fs";
|
|
525460
|
+
import * as os33 from "os";
|
|
525461
|
+
import * as path50 from "path";
|
|
524974
525462
|
function getTokenStore() {
|
|
524975
525463
|
if (process.platform === "darwin") {
|
|
524976
525464
|
return new KeychainTokenStore;
|
|
@@ -525070,7 +525558,7 @@ class EncryptedFileTokenStore {
|
|
|
525070
525558
|
filePath;
|
|
525071
525559
|
key;
|
|
525072
525560
|
constructor(filePath) {
|
|
525073
|
-
this.filePath = filePath ??
|
|
525561
|
+
this.filePath = filePath ?? path50.join(os33.homedir(), ".8gent", TOKEN_FILE_NAME);
|
|
525074
525562
|
this.key = this.deriveKey();
|
|
525075
525563
|
}
|
|
525076
525564
|
async store(token) {
|
|
@@ -525086,19 +525574,19 @@ class EncryptedFileTokenStore {
|
|
|
525086
525574
|
tag: tag2.toString("hex"),
|
|
525087
525575
|
ciphertext
|
|
525088
525576
|
};
|
|
525089
|
-
const dir =
|
|
525090
|
-
if (!
|
|
525091
|
-
|
|
525577
|
+
const dir = path50.dirname(this.filePath);
|
|
525578
|
+
if (!fs50.existsSync(dir)) {
|
|
525579
|
+
fs50.mkdirSync(dir, { recursive: true });
|
|
525092
525580
|
}
|
|
525093
|
-
|
|
525581
|
+
fs50.writeFileSync(this.filePath, JSON.stringify(envelope), {
|
|
525094
525582
|
mode: 384
|
|
525095
525583
|
});
|
|
525096
525584
|
}
|
|
525097
525585
|
async retrieve() {
|
|
525098
|
-
if (!
|
|
525586
|
+
if (!fs50.existsSync(this.filePath))
|
|
525099
525587
|
return null;
|
|
525100
525588
|
try {
|
|
525101
|
-
const raw =
|
|
525589
|
+
const raw = fs50.readFileSync(this.filePath, "utf-8");
|
|
525102
525590
|
const envelope = JSON.parse(raw);
|
|
525103
525591
|
if (envelope.version !== 1)
|
|
525104
525592
|
return null;
|
|
@@ -525113,15 +525601,15 @@ class EncryptedFileTokenStore {
|
|
|
525113
525601
|
}
|
|
525114
525602
|
}
|
|
525115
525603
|
async clear() {
|
|
525116
|
-
if (
|
|
525117
|
-
|
|
525604
|
+
if (fs50.existsSync(this.filePath)) {
|
|
525605
|
+
fs50.unlinkSync(this.filePath);
|
|
525118
525606
|
}
|
|
525119
525607
|
}
|
|
525120
525608
|
async exists() {
|
|
525121
|
-
return
|
|
525609
|
+
return fs50.existsSync(this.filePath);
|
|
525122
525610
|
}
|
|
525123
525611
|
deriveKey() {
|
|
525124
|
-
const fingerprint = `${
|
|
525612
|
+
const fingerprint = `${os33.hostname()}:${os33.userInfo().username}`;
|
|
525125
525613
|
return crypto10.pbkdf2Sync(fingerprint, KEY_DERIVATION_SALT, 1e5, 32, "sha256");
|
|
525126
525614
|
}
|
|
525127
525615
|
}
|
|
@@ -525299,8 +525787,8 @@ async function runCLIAuthFlow(webBaseUrl = "https://8gent.app", callbacks, timeo
|
|
|
525299
525787
|
var init_cli_auth_server = () => {};
|
|
525300
525788
|
|
|
525301
525789
|
// packages/auth/github-tools.ts
|
|
525302
|
-
import * as
|
|
525303
|
-
import * as
|
|
525790
|
+
import * as fs51 from "fs";
|
|
525791
|
+
import * as path51 from "path";
|
|
525304
525792
|
function githubHeaders(token) {
|
|
525305
525793
|
return {
|
|
525306
525794
|
Authorization: `Bearer ${token}`,
|
|
@@ -525324,11 +525812,11 @@ async function listRepos(token, opts) {
|
|
|
525324
525812
|
}
|
|
525325
525813
|
async function getCurrentRepoInfo(cwd) {
|
|
525326
525814
|
const dir = cwd ?? process.cwd();
|
|
525327
|
-
const gitConfigPath =
|
|
525328
|
-
if (!
|
|
525815
|
+
const gitConfigPath = path51.join(dir, ".git", "config");
|
|
525816
|
+
if (!fs51.existsSync(gitConfigPath))
|
|
525329
525817
|
return null;
|
|
525330
525818
|
try {
|
|
525331
|
-
const config2 =
|
|
525819
|
+
const config2 = fs51.readFileSync(gitConfigPath, "utf-8");
|
|
525332
525820
|
const remoteMatch = config2.match(/\[remote "origin"\][^[]*url\s*=\s*(.+)/m);
|
|
525333
525821
|
if (!remoteMatch)
|
|
525334
525822
|
return null;
|
|
@@ -525453,13 +525941,13 @@ var init_github_tools = () => {};
|
|
|
525453
525941
|
|
|
525454
525942
|
// packages/auth/proxy-provider.ts
|
|
525455
525943
|
import * as crypto11 from "crypto";
|
|
525456
|
-
import * as
|
|
525457
|
-
import * as
|
|
525458
|
-
import * as
|
|
525944
|
+
import * as fs52 from "fs";
|
|
525945
|
+
import * as os34 from "os";
|
|
525946
|
+
import * as path52 from "path";
|
|
525459
525947
|
function ensureDataDir() {
|
|
525460
|
-
const dir =
|
|
525461
|
-
if (!
|
|
525462
|
-
|
|
525948
|
+
const dir = path52.join(os34.homedir(), ".8gent");
|
|
525949
|
+
if (!fs52.existsSync(dir)) {
|
|
525950
|
+
fs52.mkdirSync(dir, { recursive: true });
|
|
525463
525951
|
}
|
|
525464
525952
|
}
|
|
525465
525953
|
function generateVesselId() {
|
|
@@ -525467,8 +525955,8 @@ function generateVesselId() {
|
|
|
525467
525955
|
}
|
|
525468
525956
|
function loadProxyConfig() {
|
|
525469
525957
|
try {
|
|
525470
|
-
if (
|
|
525471
|
-
const data2 = JSON.parse(
|
|
525958
|
+
if (fs52.existsSync(AUTH_CONFIG_PATH)) {
|
|
525959
|
+
const data2 = JSON.parse(fs52.readFileSync(AUTH_CONFIG_PATH, "utf-8"));
|
|
525472
525960
|
return {
|
|
525473
525961
|
proxyUrl: data2.proxyUrl || DEFAULT_PROXY_URL,
|
|
525474
525962
|
vesselId: data2.vesselId || generateVesselId()
|
|
@@ -525484,7 +525972,7 @@ function loadProxyConfig() {
|
|
|
525484
525972
|
}
|
|
525485
525973
|
function saveProxyConfig(config2) {
|
|
525486
525974
|
ensureDataDir();
|
|
525487
|
-
|
|
525975
|
+
fs52.writeFileSync(AUTH_CONFIG_PATH, JSON.stringify(config2, null, 2), {
|
|
525488
525976
|
mode: 384
|
|
525489
525977
|
});
|
|
525490
525978
|
}
|
|
@@ -525509,7 +525997,7 @@ function getProxyUrl() {
|
|
|
525509
525997
|
}
|
|
525510
525998
|
var DEFAULT_PROXY_URL = "https://8gi-model-proxy.fly.dev", AUTH_CONFIG_PATH;
|
|
525511
525999
|
var init_proxy_provider = __esm(() => {
|
|
525512
|
-
AUTH_CONFIG_PATH =
|
|
526000
|
+
AUTH_CONFIG_PATH = path52.join(os34.homedir(), ".8gent", "auth-proxy.json");
|
|
525513
526001
|
});
|
|
525514
526002
|
|
|
525515
526003
|
// packages/auth/index.ts
|
|
@@ -525838,8 +526326,8 @@ __export(exports_cron, {
|
|
|
525838
526326
|
CronManager: () => CronManager
|
|
525839
526327
|
});
|
|
525840
526328
|
import * as crypto12 from "crypto";
|
|
525841
|
-
import * as
|
|
525842
|
-
import * as
|
|
526329
|
+
import * as fs53 from "fs";
|
|
526330
|
+
import * as path53 from "path";
|
|
525843
526331
|
function matchField(field, value, max2) {
|
|
525844
526332
|
if (field === "*")
|
|
525845
526333
|
return true;
|
|
@@ -525869,22 +526357,22 @@ class CronManager {
|
|
|
525869
526357
|
jobs;
|
|
525870
526358
|
constructor(dataPath) {
|
|
525871
526359
|
const home = process.env.HOME || process.env.USERPROFILE || "~";
|
|
525872
|
-
this.filePath = dataPath ||
|
|
526360
|
+
this.filePath = dataPath || path53.join(home, ".8gent", "cron.json");
|
|
525873
526361
|
this.jobs = this.load();
|
|
525874
526362
|
}
|
|
525875
526363
|
load() {
|
|
525876
526364
|
try {
|
|
525877
|
-
if (
|
|
525878
|
-
return JSON.parse(
|
|
526365
|
+
if (fs53.existsSync(this.filePath)) {
|
|
526366
|
+
return JSON.parse(fs53.readFileSync(this.filePath, "utf-8"));
|
|
525879
526367
|
}
|
|
525880
526368
|
} catch {}
|
|
525881
526369
|
return [];
|
|
525882
526370
|
}
|
|
525883
526371
|
save() {
|
|
525884
|
-
const dir =
|
|
525885
|
-
if (!
|
|
525886
|
-
|
|
525887
|
-
|
|
526372
|
+
const dir = path53.dirname(this.filePath);
|
|
526373
|
+
if (!fs53.existsSync(dir))
|
|
526374
|
+
fs53.mkdirSync(dir, { recursive: true });
|
|
526375
|
+
fs53.writeFileSync(this.filePath, JSON.stringify(this.jobs, null, 2));
|
|
525888
526376
|
}
|
|
525889
526377
|
add(job) {
|
|
525890
526378
|
const entry = { ...job, id: crypto12.randomUUID().slice(0, 8) };
|
|
@@ -525945,8 +526433,8 @@ __export(exports_session_export, {
|
|
|
525945
526433
|
saveSessionExport: () => saveSessionExport,
|
|
525946
526434
|
exportSession: () => exportSession
|
|
525947
526435
|
});
|
|
525948
|
-
import * as
|
|
525949
|
-
import * as
|
|
526436
|
+
import * as fs54 from "fs";
|
|
526437
|
+
import * as path54 from "path";
|
|
525950
526438
|
function escapeHtml(str) {
|
|
525951
526439
|
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
525952
526440
|
}
|
|
@@ -526030,10 +526518,10 @@ ${messageHtml}
|
|
|
526030
526518
|
}
|
|
526031
526519
|
async function saveSessionExport(messages, metadata) {
|
|
526032
526520
|
const html3 = await exportSession(messages, metadata);
|
|
526033
|
-
const dir =
|
|
526034
|
-
|
|
526035
|
-
const filePath =
|
|
526036
|
-
|
|
526521
|
+
const dir = path54.join(process.env.HOME || process.env.USERPROFILE || ".", ".8gent", "exports");
|
|
526522
|
+
fs54.mkdirSync(dir, { recursive: true });
|
|
526523
|
+
const filePath = path54.join(dir, `${metadata.sessionId}.html`);
|
|
526524
|
+
fs54.writeFileSync(filePath, html3, "utf-8");
|
|
526037
526525
|
return filePath;
|
|
526038
526526
|
}
|
|
526039
526527
|
var init_session_export = () => {};
|
|
@@ -526043,8 +526531,8 @@ var exports_preferences_sync = {};
|
|
|
526043
526531
|
__export(exports_preferences_sync, {
|
|
526044
526532
|
PreferencesSyncManager: () => PreferencesSyncManager
|
|
526045
526533
|
});
|
|
526046
|
-
import * as
|
|
526047
|
-
import * as
|
|
526534
|
+
import * as fs55 from "fs";
|
|
526535
|
+
import * as path55 from "path";
|
|
526048
526536
|
|
|
526049
526537
|
class PreferencesSyncManager {
|
|
526050
526538
|
workingDirectory;
|
|
@@ -526054,7 +526542,7 @@ class PreferencesSyncManager {
|
|
|
526054
526542
|
_resolved = false;
|
|
526055
526543
|
constructor(workingDirectory = process.cwd()) {
|
|
526056
526544
|
this.workingDirectory = workingDirectory;
|
|
526057
|
-
this.userConfigPath =
|
|
526545
|
+
this.userConfigPath = path55.join(workingDirectory, ".8gent", "user.json");
|
|
526058
526546
|
}
|
|
526059
526547
|
async resolveConvex() {
|
|
526060
526548
|
if (this._resolved)
|
|
@@ -526129,18 +526617,18 @@ class PreferencesSyncManager {
|
|
|
526129
526617
|
}
|
|
526130
526618
|
loadLocalConfig() {
|
|
526131
526619
|
try {
|
|
526132
|
-
if (
|
|
526133
|
-
return JSON.parse(
|
|
526620
|
+
if (fs55.existsSync(this.userConfigPath)) {
|
|
526621
|
+
return JSON.parse(fs55.readFileSync(this.userConfigPath, "utf-8"));
|
|
526134
526622
|
}
|
|
526135
526623
|
} catch {}
|
|
526136
526624
|
return null;
|
|
526137
526625
|
}
|
|
526138
526626
|
saveLocalConfig(config2) {
|
|
526139
|
-
const dir =
|
|
526140
|
-
if (!
|
|
526141
|
-
|
|
526627
|
+
const dir = path55.dirname(this.userConfigPath);
|
|
526628
|
+
if (!fs55.existsSync(dir)) {
|
|
526629
|
+
fs55.mkdirSync(dir, { recursive: true });
|
|
526142
526630
|
}
|
|
526143
|
-
|
|
526631
|
+
fs55.writeFileSync(this.userConfigPath, JSON.stringify(config2, null, 2));
|
|
526144
526632
|
}
|
|
526145
526633
|
}
|
|
526146
526634
|
var init_preferences_sync = () => {};
|
|
@@ -526219,10 +526707,10 @@ Output a flat list. Each item: [ERROR|WARNING|INFO] file:line - description
|
|
|
526219
526707
|
If no issues, say "No issues found." No preamble.`;
|
|
526220
526708
|
|
|
526221
526709
|
// bin/8gent.ts
|
|
526222
|
-
import * as
|
|
526223
|
-
import * as
|
|
526710
|
+
import * as fs56 from "fs";
|
|
526711
|
+
import * as path56 from "path";
|
|
526224
526712
|
var __dirname = "/Users/jamesspalding/8gent-code/bin";
|
|
526225
|
-
var VERSION5 = "0.11.
|
|
526713
|
+
var VERSION5 = "0.11.12";
|
|
526226
526714
|
var BANNER = `
|
|
526227
526715
|
\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
|
|
526228
526716
|
\u2551 \u2551
|
|
@@ -526545,11 +527033,11 @@ async function initCommand(args) {
|
|
|
526545
527033
|
console.log(BANNER);
|
|
526546
527034
|
console.log(`Initializing 8gent Code...
|
|
526547
527035
|
`);
|
|
526548
|
-
const configPath =
|
|
526549
|
-
const indexPath =
|
|
526550
|
-
if (!
|
|
526551
|
-
|
|
526552
|
-
|
|
527036
|
+
const configPath = path56.join(process.cwd(), ".8gent");
|
|
527037
|
+
const indexPath = path56.join(configPath, "index");
|
|
527038
|
+
if (!fs56.existsSync(configPath)) {
|
|
527039
|
+
fs56.mkdirSync(configPath, { recursive: true });
|
|
527040
|
+
fs56.mkdirSync(indexPath, { recursive: true });
|
|
526553
527041
|
const config2 = {
|
|
526554
527042
|
version: VERSION5,
|
|
526555
527043
|
initialized: new Date().toISOString(),
|
|
@@ -526560,7 +527048,7 @@ async function initCommand(args) {
|
|
|
526560
527048
|
ignorePatterns: ["**/node_modules/**", "**/dist/**"]
|
|
526561
527049
|
}
|
|
526562
527050
|
};
|
|
526563
|
-
|
|
527051
|
+
fs56.writeFileSync(path56.join(configPath, "config.json"), JSON.stringify(config2, null, 2));
|
|
526564
527052
|
console.log("\u2705 Created .8gent directory");
|
|
526565
527053
|
console.log("\u2705 Created config.json");
|
|
526566
527054
|
console.log(`
|
|
@@ -526581,7 +527069,7 @@ async function outlineCommand(args) {
|
|
|
526581
527069
|
const start = performance.now();
|
|
526582
527070
|
const outline = parseTypeScriptFile2(filePath);
|
|
526583
527071
|
const time3 = performance.now() - start;
|
|
526584
|
-
const fileSize =
|
|
527072
|
+
const fileSize = fs56.statSync(filePath).size;
|
|
526585
527073
|
const fullTokens = Math.ceil(fileSize / 4);
|
|
526586
527074
|
const outlineJson = JSON.stringify(outline.symbols);
|
|
526587
527075
|
const outlineTokens = Math.ceil(outlineJson.length / 4);
|
|
@@ -526607,7 +527095,7 @@ async function outlineCommand(args) {
|
|
|
526607
527095
|
}, null, 2));
|
|
526608
527096
|
} else {
|
|
526609
527097
|
console.log(`
|
|
526610
|
-
\uD83D\uDCC4 ${
|
|
527098
|
+
\uD83D\uDCC4 ${path56.basename(filePath)} (${outline.language})`);
|
|
526611
527099
|
console.log(` ${outline.symbols.length} symbols \u2022 ${time3.toFixed(1)}ms \u2022 ${percent}% token savings
|
|
526612
527100
|
`);
|
|
526613
527101
|
for (const symbol21 of outline.symbols) {
|
|
@@ -526648,14 +527136,14 @@ Available symbols:`);
|
|
|
526648
527136
|
process.exit(1);
|
|
526649
527137
|
}
|
|
526650
527138
|
const source = getSymbolSource2(filePath, symbol21.startLine, symbol21.endLine, contextLines);
|
|
526651
|
-
const fileSize =
|
|
527139
|
+
const fileSize = fs56.statSync(filePath).size;
|
|
526652
527140
|
const fullTokens = Math.ceil(fileSize / 4);
|
|
526653
527141
|
const symbolTokens = Math.ceil(source.length / 4);
|
|
526654
527142
|
const saved = fullTokens - symbolTokens;
|
|
526655
527143
|
const percent = (saved / fullTokens * 100).toFixed(1);
|
|
526656
527144
|
console.log(`
|
|
526657
527145
|
${getSymbolIcon(symbol21.kind)} ${symbol21.name} (${symbol21.kind})`);
|
|
526658
|
-
console.log(` Lines ${symbol21.startLine}-${symbol21.endLine} in ${
|
|
527146
|
+
console.log(` Lines ${symbol21.startLine}-${symbol21.endLine} in ${path56.basename(filePath)}`);
|
|
526659
527147
|
if (symbol21.signature) {
|
|
526660
527148
|
console.log(` ${symbol21.signature}`);
|
|
526661
527149
|
}
|
|
@@ -526711,27 +527199,27 @@ async function searchCommand(args) {
|
|
|
526711
527199
|
} else {
|
|
526712
527200
|
for (const { symbol: symbol21, file: file2 } of matches) {
|
|
526713
527201
|
const icon = getSymbolIcon(symbol21.kind);
|
|
526714
|
-
console.log(` ${icon} ${symbol21.name.padEnd(30)} ${symbol21.kind.padEnd(10)} ${
|
|
527202
|
+
console.log(` ${icon} ${symbol21.name.padEnd(30)} ${symbol21.kind.padEnd(10)} ${path56.relative(process.cwd(), file2)}`);
|
|
526715
527203
|
}
|
|
526716
527204
|
console.log(`
|
|
526717
527205
|
Found ${matches.length} match${matches.length === 1 ? "" : "es"}`);
|
|
526718
527206
|
}
|
|
526719
527207
|
}
|
|
526720
527208
|
async function benchmarkCommand(args) {
|
|
526721
|
-
const benchmarkPath =
|
|
527209
|
+
const benchmarkPath = path56.join(__dirname, "../scripts/benchmark.ts");
|
|
526722
527210
|
const { spawn: spawn14 } = await import("child_process");
|
|
526723
527211
|
const proc = spawn14("bun", ["run", benchmarkPath, ...args], {
|
|
526724
527212
|
stdio: "inherit",
|
|
526725
|
-
cwd:
|
|
527213
|
+
cwd: path56.join(__dirname, "..")
|
|
526726
527214
|
});
|
|
526727
527215
|
proc.on("exit", (code2) => process.exit(code2 || 0));
|
|
526728
527216
|
}
|
|
526729
527217
|
async function demoCommand(args) {
|
|
526730
|
-
const demoPath =
|
|
527218
|
+
const demoPath = path56.join(__dirname, "../scripts/demo-savings.ts");
|
|
526731
527219
|
const { spawn: spawn14 } = await import("child_process");
|
|
526732
527220
|
const proc = spawn14("bun", ["run", demoPath, ...args], {
|
|
526733
527221
|
stdio: "inherit",
|
|
526734
|
-
cwd:
|
|
527222
|
+
cwd: path56.join(__dirname, "..")
|
|
526735
527223
|
});
|
|
526736
527224
|
proc.on("exit", (code2) => process.exit(code2 || 0));
|
|
526737
527225
|
}
|
|
@@ -526741,8 +527229,8 @@ async function spawnPet(sessionId) {
|
|
|
526741
527229
|
if (platform4 !== "darwin") {
|
|
526742
527230
|
console.log("\x1B[36m[pet] Lil Eight terminal mode (cross-platform)\x1B[0m");
|
|
526743
527231
|
try {
|
|
526744
|
-
const petPath =
|
|
526745
|
-
if (
|
|
527232
|
+
const petPath = path56.join(__dirname, "../packages/pet/terminal-pet.ts");
|
|
527233
|
+
if (fs56.existsSync(petPath)) {
|
|
526746
527234
|
const { TerminalPet } = await import(petPath);
|
|
526747
527235
|
const pet = new TerminalPet({ label: sessionId || "eight" });
|
|
526748
527236
|
const rows = process.stdout.rows || 24;
|
|
@@ -526763,12 +527251,12 @@ async function spawnPet(sessionId) {
|
|
|
526763
527251
|
} catch (e3) {}
|
|
526764
527252
|
try {
|
|
526765
527253
|
const home = process.env.HOME || process.env.USERPROFILE || "~";
|
|
526766
|
-
const meshDir =
|
|
526767
|
-
|
|
526768
|
-
const registryPath =
|
|
527254
|
+
const meshDir = path56.join(home, ".8gent", "mesh");
|
|
527255
|
+
fs56.mkdirSync(meshDir, { recursive: true });
|
|
527256
|
+
const registryPath = path56.join(meshDir, "registry.json");
|
|
526769
527257
|
let registry2 = {};
|
|
526770
527258
|
try {
|
|
526771
|
-
registry2 = JSON.parse(
|
|
527259
|
+
registry2 = JSON.parse(fs56.readFileSync(registryPath, "utf-8"));
|
|
526772
527260
|
} catch {}
|
|
526773
527261
|
const agentId = sessionId || `eight-tui-${process.pid}`;
|
|
526774
527262
|
registry2[agentId] = {
|
|
@@ -526782,7 +527270,7 @@ async function spawnPet(sessionId) {
|
|
|
526782
527270
|
lastHeartbeat: Date.now(),
|
|
526783
527271
|
channel: "terminal"
|
|
526784
527272
|
};
|
|
526785
|
-
|
|
527273
|
+
fs56.writeFileSync(registryPath, JSON.stringify(registry2, null, 2));
|
|
526786
527274
|
} catch {}
|
|
526787
527275
|
return;
|
|
526788
527276
|
}
|
|
@@ -526790,8 +527278,8 @@ async function spawnPet(sessionId) {
|
|
|
526790
527278
|
const { generateCompanion: generateCompanion2 } = await Promise.resolve().then(() => (init_companion(), exports_companion));
|
|
526791
527279
|
const companion = generateCompanion2(sessionId || `session-${Date.now()}`);
|
|
526792
527280
|
const home = process.env.HOME || "~";
|
|
526793
|
-
|
|
526794
|
-
|
|
527281
|
+
fs56.mkdirSync(path56.join(home, ".8gent"), { recursive: true });
|
|
527282
|
+
fs56.writeFileSync(path56.join(home, ".8gent", "active-companion.json"), JSON.stringify({
|
|
526795
527283
|
fullName: companion.fullName,
|
|
526796
527284
|
species: companion.species,
|
|
526797
527285
|
element: companion.element,
|
|
@@ -526803,11 +527291,11 @@ async function spawnPet(sessionId) {
|
|
|
526803
527291
|
stats: companion.stats
|
|
526804
527292
|
}, null, 2));
|
|
526805
527293
|
} catch {}
|
|
526806
|
-
const lilEightScript =
|
|
527294
|
+
const lilEightScript = path56.join(__dirname, "lil-eight.sh");
|
|
526807
527295
|
try {
|
|
526808
527296
|
execSync4("pkill -f LilEight 2>/dev/null", { stdio: "pipe" });
|
|
526809
527297
|
} catch {}
|
|
526810
|
-
if (
|
|
527298
|
+
if (fs56.existsSync(lilEightScript)) {
|
|
526811
527299
|
const pet = spawnProc("bash", [lilEightScript, "start"], {
|
|
526812
527300
|
detached: true,
|
|
526813
527301
|
stdio: "ignore"
|
|
@@ -526815,8 +527303,8 @@ async function spawnPet(sessionId) {
|
|
|
526815
527303
|
pet.unref();
|
|
526816
527304
|
console.log("\x1B[36m[pet] Lil Eight spawned on Dock\x1B[0m");
|
|
526817
527305
|
} else {
|
|
526818
|
-
const buildScript =
|
|
526819
|
-
if (
|
|
527306
|
+
const buildScript = path56.join(__dirname, "../apps/lil-eight/build.sh");
|
|
527307
|
+
if (fs56.existsSync(buildScript)) {
|
|
526820
527308
|
console.log("\x1B[36m[pet] Building Lil Eight...\x1B[0m");
|
|
526821
527309
|
try {
|
|
526822
527310
|
execSync4(`bash "${buildScript}"`, { stdio: "pipe" });
|
|
@@ -526832,13 +527320,13 @@ async function spawnPet(sessionId) {
|
|
|
526832
527320
|
}
|
|
526833
527321
|
}
|
|
526834
527322
|
try {
|
|
526835
|
-
const meshDir =
|
|
526836
|
-
const registryPath =
|
|
526837
|
-
|
|
527323
|
+
const meshDir = path56.join(process.env.HOME || "~", ".8gent", "mesh");
|
|
527324
|
+
const registryPath = path56.join(meshDir, "registry.json");
|
|
527325
|
+
fs56.mkdirSync(meshDir, { recursive: true });
|
|
526838
527326
|
const agentId = sessionId || `eight-tui-${process.pid}`;
|
|
526839
527327
|
let registry2 = {};
|
|
526840
527328
|
try {
|
|
526841
|
-
registry2 = JSON.parse(
|
|
527329
|
+
registry2 = JSON.parse(fs56.readFileSync(registryPath, "utf-8"));
|
|
526842
527330
|
} catch {}
|
|
526843
527331
|
registry2[agentId] = {
|
|
526844
527332
|
id: agentId,
|
|
@@ -526851,12 +527339,12 @@ async function spawnPet(sessionId) {
|
|
|
526851
527339
|
lastHeartbeat: Date.now(),
|
|
526852
527340
|
channel: "terminal"
|
|
526853
527341
|
};
|
|
526854
|
-
|
|
527342
|
+
fs56.writeFileSync(registryPath, JSON.stringify(registry2, null, 2));
|
|
526855
527343
|
const cleanup = () => {
|
|
526856
527344
|
try {
|
|
526857
|
-
const reg = JSON.parse(
|
|
527345
|
+
const reg = JSON.parse(fs56.readFileSync(registryPath, "utf-8"));
|
|
526858
527346
|
delete reg[agentId];
|
|
526859
|
-
|
|
527347
|
+
fs56.writeFileSync(registryPath, JSON.stringify(reg, null, 2));
|
|
526860
527348
|
} catch {}
|
|
526861
527349
|
};
|
|
526862
527350
|
process.on("exit", cleanup);
|
|
@@ -526880,10 +527368,10 @@ async function tuiCommand(args) {
|
|
|
526880
527368
|
console.log(`Launching TUI...
|
|
526881
527369
|
`);
|
|
526882
527370
|
const { spawn: spawn14 } = await import("child_process");
|
|
526883
|
-
const tuiPath =
|
|
527371
|
+
const tuiPath = path56.join(__dirname, "../apps/tui/src/index.tsx");
|
|
526884
527372
|
const proc = spawn14("bun", ["run", tuiPath, ...filteredArgs], {
|
|
526885
527373
|
stdio: "inherit",
|
|
526886
|
-
cwd:
|
|
527374
|
+
cwd: path56.join(__dirname, "..")
|
|
526887
527375
|
});
|
|
526888
527376
|
proc.on("exit", (code2) => process.exit(code2 || 0));
|
|
526889
527377
|
}
|
|
@@ -526901,8 +527389,8 @@ async function airdropCommand(args) {
|
|
|
526901
527389
|
}
|
|
526902
527390
|
const target = args.join(" ");
|
|
526903
527391
|
const { execSync: execSync4 } = await import("child_process");
|
|
526904
|
-
if (
|
|
526905
|
-
const resolved =
|
|
527392
|
+
if (fs56.existsSync(target) || fs56.existsSync(path56.resolve(target))) {
|
|
527393
|
+
const resolved = path56.resolve(target);
|
|
526906
527394
|
console.log(`AirDropping: ${resolved}`);
|
|
526907
527395
|
const script = `
|
|
526908
527396
|
tell application "Finder"
|
|
@@ -526932,7 +527420,7 @@ async function airdropCommand(args) {
|
|
|
526932
527420
|
}
|
|
526933
527421
|
`;
|
|
526934
527422
|
const tmpSwift = "/tmp/eight-airdrop.swift";
|
|
526935
|
-
|
|
527423
|
+
fs56.writeFileSync(tmpSwift, swiftHelper);
|
|
526936
527424
|
try {
|
|
526937
527425
|
execSync4(`swiftc -o /tmp/eight-airdrop -framework Cocoa "${tmpSwift}" && /tmp/eight-airdrop`, {
|
|
526938
527426
|
stdio: "inherit",
|
|
@@ -526943,7 +527431,7 @@ async function airdropCommand(args) {
|
|
|
526943
527431
|
}
|
|
526944
527432
|
} else {
|
|
526945
527433
|
const tmpFile = `/tmp/eight-note-${Date.now()}.txt`;
|
|
526946
|
-
|
|
527434
|
+
fs56.writeFileSync(tmpFile, target);
|
|
526947
527435
|
console.log(`AirDropping note: "${target.slice(0, 50)}..."`);
|
|
526948
527436
|
await airdropCommand([tmpFile]);
|
|
526949
527437
|
}
|
|
@@ -526951,10 +527439,10 @@ async function airdropCommand(args) {
|
|
|
526951
527439
|
async function petCommand(args) {
|
|
526952
527440
|
const subCmd = args[0] || "start";
|
|
526953
527441
|
const { execSync: execSync4 } = await import("child_process");
|
|
526954
|
-
const lilEightScript =
|
|
526955
|
-
if (!
|
|
527442
|
+
const lilEightScript = path56.join(__dirname, "lil-eight.sh");
|
|
527443
|
+
if (!fs56.existsSync(lilEightScript)) {
|
|
526956
527444
|
console.log("Building Lil Eight first...");
|
|
526957
|
-
const buildScript =
|
|
527445
|
+
const buildScript = path56.join(__dirname, "../apps/lil-eight/build.sh");
|
|
526958
527446
|
execSync4(`bash "${buildScript}"`, { stdio: "inherit" });
|
|
526959
527447
|
}
|
|
526960
527448
|
switch (subCmd) {
|
|
@@ -526978,14 +527466,14 @@ async function petCommand(args) {
|
|
|
526978
527466
|
setTimeout(() => spawnPet(), 1000);
|
|
526979
527467
|
break;
|
|
526980
527468
|
case "build":
|
|
526981
|
-
execSync4(`bash "${
|
|
527469
|
+
execSync4(`bash "${path56.join(__dirname, "../apps/lil-eight/build.sh")}"`, {
|
|
526982
527470
|
stdio: "inherit"
|
|
526983
527471
|
});
|
|
526984
527472
|
break;
|
|
526985
527473
|
case "log":
|
|
526986
527474
|
case "logs": {
|
|
526987
527475
|
const { spawn: sp } = await import("child_process");
|
|
526988
|
-
const logPath =
|
|
527476
|
+
const logPath = path56.join(process.env.HOME || "~", ".8gent", "lil-eight.log");
|
|
526989
527477
|
sp("tail", ["-f", logPath], { stdio: "inherit" });
|
|
526990
527478
|
break;
|
|
526991
527479
|
}
|
|
@@ -526993,9 +527481,9 @@ async function petCommand(args) {
|
|
|
526993
527481
|
try {
|
|
526994
527482
|
execSync4("pgrep -f LilEight", { stdio: "pipe" });
|
|
526995
527483
|
console.log("Lil Eight is running");
|
|
526996
|
-
const logP =
|
|
526997
|
-
if (
|
|
526998
|
-
const lines =
|
|
527484
|
+
const logP = path56.join(process.env.HOME || "~", ".8gent", "lil-eight.log");
|
|
527485
|
+
if (fs56.existsSync(logP)) {
|
|
527486
|
+
const lines = fs56.readFileSync(logP, "utf-8").trim().split(`
|
|
526999
527487
|
`).slice(-3);
|
|
527000
527488
|
lines.forEach((l2) => console.log(` ${l2}`));
|
|
527001
527489
|
}
|
|
@@ -527495,10 +527983,10 @@ async function sessionCommand(args) {
|
|
|
527495
527983
|
process.exit(1);
|
|
527496
527984
|
}
|
|
527497
527985
|
const { spawn: spawn14 } = await import("child_process");
|
|
527498
|
-
const tuiPath =
|
|
527986
|
+
const tuiPath = path56.join(__dirname, "../apps/tui/src/index.tsx");
|
|
527499
527987
|
const proc = spawn14("bun", ["run", tuiPath, "--resume", nameOrId], {
|
|
527500
527988
|
stdio: "inherit",
|
|
527501
|
-
cwd:
|
|
527989
|
+
cwd: path56.join(__dirname, "..")
|
|
527502
527990
|
});
|
|
527503
527991
|
proc.on("exit", (code2) => process.exit(code2 || 0));
|
|
527504
527992
|
break;
|
|
@@ -527809,9 +528297,9 @@ async function statusCommand(args) {
|
|
|
527809
528297
|
runtime: "bun"
|
|
527810
528298
|
};
|
|
527811
528299
|
try {
|
|
527812
|
-
const configPath =
|
|
527813
|
-
if (
|
|
527814
|
-
status.config = JSON.parse(
|
|
528300
|
+
const configPath = path56.join(cwd, ".8gent", "config.json");
|
|
528301
|
+
if (fs56.existsSync(configPath)) {
|
|
528302
|
+
status.config = JSON.parse(fs56.readFileSync(configPath, "utf-8"));
|
|
527815
528303
|
}
|
|
527816
528304
|
} catch {}
|
|
527817
528305
|
try {
|
|
@@ -527923,7 +528411,7 @@ async function reviewCommand(args) {
|
|
|
527923
528411
|
let diff;
|
|
527924
528412
|
try {
|
|
527925
528413
|
if (diffFile) {
|
|
527926
|
-
diff =
|
|
528414
|
+
diff = fs56.readFileSync(diffFile, "utf-8");
|
|
527927
528415
|
} else if (prNumber) {
|
|
527928
528416
|
diff = execSync4(`gh pr diff ${prNumber}`, { encoding: "utf-8" });
|
|
527929
528417
|
} else {
|
|
@@ -527986,12 +528474,12 @@ async function doctorCommand() {
|
|
|
527986
528474
|
issues++;
|
|
527987
528475
|
}
|
|
527988
528476
|
}
|
|
527989
|
-
const dbPath =
|
|
527990
|
-
console.log(
|
|
527991
|
-
const cfgPath =
|
|
527992
|
-
if (
|
|
528477
|
+
const dbPath = path56.join(process.env.HOME || "", ".8gent", "memory.db");
|
|
528478
|
+
console.log(fs56.existsSync(dbPath) ? green(`Memory DB (${(fs56.statSync(dbPath).size / 1024).toFixed(0)} KB)`) : dim(" No memory DB yet"));
|
|
528479
|
+
const cfgPath = path56.join(process.env.HOME || "", ".8gent", "config.json");
|
|
528480
|
+
if (fs56.existsSync(cfgPath)) {
|
|
527993
528481
|
try {
|
|
527994
|
-
JSON.parse(
|
|
528482
|
+
JSON.parse(fs56.readFileSync(cfgPath, "utf-8"));
|
|
527995
528483
|
console.log(green("Config valid"));
|
|
527996
528484
|
} catch {
|
|
527997
528485
|
console.log(red("Config invalid JSON"));
|
|
@@ -528008,10 +528496,10 @@ async function doctorCommand() {
|
|
|
528008
528496
|
} catch {
|
|
528009
528497
|
console.log(dim(" NemoClaw skip"));
|
|
528010
528498
|
}
|
|
528011
|
-
const mcpPath =
|
|
528012
|
-
if (
|
|
528499
|
+
const mcpPath = path56.join(process.env.HOME || "", ".8gent", "mcp.json");
|
|
528500
|
+
if (fs56.existsSync(mcpPath)) {
|
|
528013
528501
|
try {
|
|
528014
|
-
const m2 = JSON.parse(
|
|
528502
|
+
const m2 = JSON.parse(fs56.readFileSync(mcpPath, "utf-8"));
|
|
528015
528503
|
console.log(green(`MCP: ${Object.keys(m2.servers || m2.mcpServers || {}).length} servers`));
|
|
528016
528504
|
} catch {
|
|
528017
528505
|
console.log(red("MCP config invalid"));
|