llm-kb 0.4.0 → 0.4.2
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 +183 -42
- package/bin/anthropic-5TIU2EED.js +5515 -0
- package/bin/azure-openai-responses-ZVUVMK3G.js +190 -0
- package/bin/chunk-2WV6TQRI.js +4792 -0
- package/bin/chunk-3YMNGUZZ.js +262 -0
- package/bin/chunk-5PYKQQLA.js +14295 -0
- package/bin/chunk-65KFH7OI.js +31 -0
- package/bin/chunk-DHOXVEIR.js +7261 -0
- package/bin/chunk-EAQYK3U2.js +41 -0
- package/bin/chunk-IFS3OKBN.js +428 -0
- package/bin/chunk-LDHOKBJA.js +86 -0
- package/bin/chunk-SLYBG6ZQ.js +32681 -0
- package/bin/chunk-UEODFF7H.js +17 -0
- package/bin/chunk-XCXTZJGO.js +174 -0
- package/bin/chunk-XFV534WU.js +7056 -0
- package/bin/cli.js +30 -4
- package/bin/dist-3YH7P2QF.js +1244 -0
- package/bin/google-JFC43EFJ.js +371 -0
- package/bin/google-gemini-cli-K4XNMYDI.js +712 -0
- package/bin/google-vertex-Y42F254G.js +414 -0
- package/bin/indexer-KSYRIVVN.js +10 -0
- package/bin/mistral-ZU2JS5XZ.js +38406 -0
- package/bin/multipart-parser-CO464TZY.js +371 -0
- package/bin/openai-codex-responses-NW2LELBH.js +712 -0
- package/bin/openai-completions-TW3VKTHO.js +662 -0
- package/bin/openai-responses-VGL522MK.js +198 -0
- package/bin/src-Y22OHE3S.js +1408 -0
- package/package.json +6 -1
- package/PHASE2_SPEC.md +0 -274
- package/PHASE3_SPEC.md +0 -245
- package/PHASE4_SPEC.md +0 -358
- package/SPEC.md +0 -275
- package/plan.md +0 -300
- package/src/auth.ts +0 -55
- package/src/cli.ts +0 -257
- package/src/config.ts +0 -61
- package/src/eval.ts +0 -548
- package/src/indexer.ts +0 -152
- package/src/md-stream.ts +0 -133
- package/src/pdf.ts +0 -119
- package/src/query.ts +0 -408
- package/src/resolve-kb.ts +0 -19
- package/src/scan.ts +0 -59
- package/src/session-store.ts +0 -22
- package/src/session-watcher.ts +0 -89
- package/src/trace-builder.ts +0 -168
- package/src/tui-display.ts +0 -281
- package/src/utils.ts +0 -17
- package/src/watcher.ts +0 -87
- package/src/wiki-updater.ts +0 -136
- package/test/auth.test.ts +0 -65
- package/test/config.test.ts +0 -96
- package/test/md-stream.test.ts +0 -98
- package/test/resolve-kb.test.ts +0 -33
- package/test/scan.test.ts +0 -65
- package/test/trace-builder.test.ts +0 -215
- package/tsconfig.json +0 -14
- package/vitest.config.ts +0 -8
package/bin/cli.js
CHANGED
|
@@ -699,7 +699,14 @@ ${wikiContent}
|
|
|
699
699
|
`- Always cite sources with filename and page number`,
|
|
700
700
|
`- Read the FULL source file, not just the beginning (for .md sources)`,
|
|
701
701
|
`- For non-PDF files, extract ONLY relevant sections \u2014 never dump entire files`,
|
|
702
|
-
`- Prefer primary sources over previous analyses
|
|
702
|
+
`- Prefer primary sources over previous analyses`,
|
|
703
|
+
``,
|
|
704
|
+
`## Guidelines`,
|
|
705
|
+
`A guidelines file may exist at .llm-kb/guidelines.md with learned rules from`,
|
|
706
|
+
`past evaluations and user preferences. Read it when:`,
|
|
707
|
+
`- You're unsure about citation accuracy or format`,
|
|
708
|
+
`- You're about to read source files (guidelines may suggest using wiki instead)`,
|
|
709
|
+
`- The question touches a topic that may have had issues in past evaluations`
|
|
703
710
|
];
|
|
704
711
|
if (save) {
|
|
705
712
|
lines.push(``, `## Research Mode`, `Save your analysis to .llm-kb/wiki/outputs/ with a descriptive filename.`, `Include the question at the top and all citations.`);
|
|
@@ -1322,10 +1329,28 @@ async function runEval(kbRoot, options) {
|
|
|
1322
1329
|
await mkdir6(outputsDir, { recursive: true });
|
|
1323
1330
|
const report = buildReport(result);
|
|
1324
1331
|
await writeFile5(join7(outputsDir, "eval-report.md"), report, "utf-8");
|
|
1325
|
-
|
|
1326
|
-
|
|
1332
|
+
const guidelinesPath = join7(kbRoot, ".llm-kb", "guidelines.md");
|
|
1333
|
+
await writeGuidelines(guidelinesPath, result.agentsInsights);
|
|
1334
|
+
log("Insights saved to .llm-kb/guidelines.md (agent reads on-demand)");
|
|
1327
1335
|
return result;
|
|
1328
1336
|
}
|
|
1337
|
+
var EVAL_SECTION_RE = /## Eval Insights[\s\S]*?(?=\n## |$)/;
|
|
1338
|
+
async function writeGuidelines(path3, evalSection) {
|
|
1339
|
+
let existing = "";
|
|
1340
|
+
try {
|
|
1341
|
+
existing = await readFile5(path3, "utf-8");
|
|
1342
|
+
} catch {
|
|
1343
|
+
}
|
|
1344
|
+
if (!existing) {
|
|
1345
|
+
await writeFile5(path3, evalSection, "utf-8");
|
|
1346
|
+
return;
|
|
1347
|
+
}
|
|
1348
|
+
if (EVAL_SECTION_RE.test(existing)) {
|
|
1349
|
+
await writeFile5(path3, existing.replace(EVAL_SECTION_RE, evalSection.trim()), "utf-8");
|
|
1350
|
+
} else {
|
|
1351
|
+
await writeFile5(path3, evalSection + "\n\n" + existing, "utf-8");
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1329
1354
|
function extractText2(content) {
|
|
1330
1355
|
if (!content) return "";
|
|
1331
1356
|
if (typeof content === "string") return content;
|
|
@@ -5457,7 +5482,8 @@ import chalk5 from "chalk";
|
|
|
5457
5482
|
function checkAuth() {
|
|
5458
5483
|
const piAuthPath = join11(homedir4(), ".pi", "agent", "auth.json");
|
|
5459
5484
|
if (existsSync7(piAuthPath)) {
|
|
5460
|
-
|
|
5485
|
+
const authStorage = AuthStorage4.create();
|
|
5486
|
+
return { ok: true, method: "pi-sdk", authStorage };
|
|
5461
5487
|
}
|
|
5462
5488
|
if (process.env.ANTHROPIC_API_KEY) {
|
|
5463
5489
|
const authStorage = AuthStorage4.inMemory({
|