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