kiosapi 0.1.25 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/run.js +18 -7
- package/dist/agent/schemas.js +2 -1
- package/package.json +1 -1
package/dist/agent/run.js
CHANGED
|
@@ -436,13 +436,23 @@ export async function runTurn(s, userText) {
|
|
|
436
436
|
catch {
|
|
437
437
|
/* ignore */
|
|
438
438
|
}
|
|
439
|
-
|
|
440
|
-
|
|
439
|
+
// Project context files: read upfront and embed in system message so the model
|
|
440
|
+
// never needs to tool-call for them. blueprint.md / kiosapi.json are orientation
|
|
441
|
+
// anchors that models otherwise read repeatedly when they lose track.
|
|
442
|
+
const CONTEXT_FILES = [
|
|
443
|
+
{ name: 'blueprint.md', cap: 3_000 },
|
|
444
|
+
{ name: 'kiosapi.json', cap: 2_000 },
|
|
445
|
+
{ name: 'package.json', cap: 1_500 },
|
|
446
|
+
{ name: 'pyproject.toml', cap: 1_500 },
|
|
447
|
+
{ name: 'Cargo.toml', cap: 1_500 },
|
|
448
|
+
{ name: 'go.mod', cap: 1_500 },
|
|
449
|
+
];
|
|
450
|
+
for (const { name, cap } of CONTEXT_FILES) {
|
|
451
|
+
const abs = join(process.cwd(), name);
|
|
441
452
|
if (existsSync(abs)) {
|
|
442
453
|
try {
|
|
443
454
|
const content = readFileSync(abs, 'utf8');
|
|
444
|
-
|
|
445
|
-
snippets.push(`<file path="${f}">\n${content.slice(0, 1_500)}\n</file>`);
|
|
455
|
+
snippets.push(`<file path="${name}">\n${content.slice(0, cap)}\n</file>`);
|
|
446
456
|
}
|
|
447
457
|
catch {
|
|
448
458
|
/* unreadable — skip */
|
|
@@ -452,11 +462,12 @@ export async function runTurn(s, userText) {
|
|
|
452
462
|
if (snippets.length > 0) {
|
|
453
463
|
const sysMsg = s.messages[0];
|
|
454
464
|
if (sysMsg?.role === 'system') {
|
|
455
|
-
// Hard cap:
|
|
465
|
+
// Hard cap: 10KB keeps things manageable for most models. blueprint.md alone can
|
|
466
|
+
// be large; cap individual files above and total here.
|
|
456
467
|
const joined = snippets.join('\n\n');
|
|
457
|
-
const capped = joined.length >
|
|
468
|
+
const capped = joined.length > 10_000 ? `${joined.slice(0, 10_000)}\n…` : joined;
|
|
458
469
|
sysMsg.content +=
|
|
459
|
-
`\n\n## Konteks Proyek\n${capped}`;
|
|
470
|
+
`\n\n## Konteks Proyek (sudah tersedia — JANGAN baca ulang dengan baca_file)\n${capped}`;
|
|
460
471
|
}
|
|
461
472
|
}
|
|
462
473
|
}
|
package/dist/agent/schemas.js
CHANGED
|
@@ -214,7 +214,8 @@ Direktori kerja: ${process.cwd()}
|
|
|
214
214
|
OS: ${osName} · ${shellNote}
|
|
215
215
|
Aturan:
|
|
216
216
|
- Bekerja langkah demi langkah: pakai tool untuk membaca sebelum mengubah.
|
|
217
|
-
-
|
|
217
|
+
- Konteks proyek (blueprint.md, kiosapi.json, struktur root) sudah di-inject ke system message — JANGAN baca ulang dengan baca_file. Langsung kerjakan tugas.
|
|
218
|
+
- Strategi eksplorasi: identifikasi subfolder relevan dari konteks awal, lalu baca spesifik dengan baca_file. JANGAN ulangi daftar_file pada path yang sama.
|
|
218
219
|
- baca_file menampilkan "[path · N baris · M char]" — jika ada "TERPOTONG", panggil baca_file(path, baris_lanjutan) BUKAN dengan argumen identik. Gunakan mulai/sampai untuk baca bagian tertentu.
|
|
219
220
|
- Kedalaman daftar_file: gunakan kedalaman=2 (default) untuk subfolder besar. Kedalaman=3 hanya jika kamu sudah tahu folder itu kecil. JANGAN gunakan kedalaman=4+ kecuali diminta eksplisit.
|
|
220
221
|
- JANGAN memanggil tool APAPUN dengan argumen identik lebih dari 1× dalam satu sesi. Jika tool mengembalikan peringatan cache "⚠", langsung ganti ke path atau argumen BERBEDA — untuk baca_file: gunakan mulai= berbeda atau gunakan cari.
|