kiosapi 0.1.18 → 0.1.21
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/schemas.js +17 -4
- package/dist/agent/tools.js +14 -4
- package/package.json +1 -1
package/dist/agent/schemas.js
CHANGED
|
@@ -188,9 +188,21 @@ const MODE_BRIEF = {
|
|
|
188
188
|
export function systemPrompt(mode) {
|
|
189
189
|
const platform = process.platform;
|
|
190
190
|
const osName = platform === 'win32' ? 'Windows' : platform === 'darwin' ? 'macOS' : 'Linux';
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
const isGitBash = platform === 'win32' && !!process.env.MSYSTEM;
|
|
192
|
+
const shellNote = isGitBash
|
|
193
|
+
? `Shell: bash (Git Bash on Windows) — gunakan sintaks bash:
|
|
194
|
+
· mkdir -p · rm file · mv src dst · cp src dst · ls · wc -l · grep · cat
|
|
195
|
+
· Path: gunakan forward slash / (bukan backslash)
|
|
196
|
+
· Path dengan [ ] atau spasi: kutip tunggal — wc -l 'src/routes/hub/[slug]/file.svelte'
|
|
197
|
+
· Hitung baris: wc -l 'path/file'`
|
|
198
|
+
: platform === 'win32'
|
|
199
|
+
? `Shell: cmd.exe — sintaks Windows WAJIB:
|
|
200
|
+
· mkdir folder · del file · move src dst · copy src dst · type file
|
|
201
|
+
· DILARANG: wc, grep, cat, ls, find -name, atau perintah bash/unix APAPUN
|
|
202
|
+
· Hitung baris: type "file" | find /c /v "" (BUKAN wc -l)
|
|
203
|
+
· Path berisi [ ] atau spasi WAJIB dikutip ganda: type "path\\[slug]\\file.svelte"
|
|
204
|
+
· Gunakan baca_file/cari/daftar_file — JANGAN shell untuk membaca/mencari konten`
|
|
205
|
+
: 'Shell: bash';
|
|
194
206
|
return `Kamu adalah asisten coding Kiosapi yang bekerja di terminal developer Indonesia.
|
|
195
207
|
${MODE_BRIEF[mode]}
|
|
196
208
|
|
|
@@ -199,8 +211,9 @@ OS: ${osName} · ${shellNote}
|
|
|
199
211
|
Aturan:
|
|
200
212
|
- Bekerja langkah demi langkah: pakai tool untuk membaca sebelum mengubah.
|
|
201
213
|
- Strategi eksplorasi: struktur root tersedia di konteks awal — identifikasi subfolder relevan LANGSUNG, lalu baca dengan baca_file. Jangan ulangi daftar_file pada path yang sama.
|
|
214
|
+
- baca_file menampilkan "[path · N baris · M char]" di baris pertama — TIDAK perlu menghitung baris dengan shell.
|
|
202
215
|
- 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.
|
|
203
|
-
- 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.
|
|
216
|
+
- 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 — atau gunakan cari untuk mencari bagian spesifik.
|
|
204
217
|
- Path selalu relatif ke direktori kerja; akses ke luar ditolak.
|
|
205
218
|
- Gunakan hapus_file/pindah_file untuk menghapus/memindahkan file (lebih aman dari jalankan del/rm).
|
|
206
219
|
- Buat perubahan kecil dan jelas. Setelah tugas beres, panggil tool "selesai" dengan ringkasan.
|
package/dist/agent/tools.js
CHANGED
|
@@ -48,9 +48,11 @@ export function bacaFile(path) {
|
|
|
48
48
|
if (!existsSync(abs))
|
|
49
49
|
return `Error: file tidak ada: ${path}`;
|
|
50
50
|
const text = readFileSync(abs, 'utf8');
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
const lineCount = text.split('\n').length;
|
|
52
|
+
if (text.length > MAX_READ) {
|
|
53
|
+
return `[${path} · ${lineCount} baris · ${text.length} char — terpotong di ${MAX_READ} char]\n${text.slice(0, MAX_READ)}\n…[dipotong — gunakan cari untuk mencari teks spesifik di sisa file]`;
|
|
54
|
+
}
|
|
55
|
+
return `[${path} · ${lineCount} baris · ${text.length} char]\n${text}`;
|
|
54
56
|
}
|
|
55
57
|
/** daftar_file — list a directory (ignored entries hidden).
|
|
56
58
|
* kedalaman controls tree depth (1–5). Defaults: 3 for root ".", 1 for subdirs.
|
|
@@ -306,7 +308,15 @@ export async function jalankan(perintah) {
|
|
|
306
308
|
let output = '';
|
|
307
309
|
let limitHit = false;
|
|
308
310
|
process.stdout.write('\n');
|
|
309
|
-
|
|
311
|
+
// Detect Git Bash on Windows: MSYSTEM is set by Git Bash (MINGW64/MINGW32).
|
|
312
|
+
// When in Git Bash, use bash -c so bash commands (ls, grep, wc, etc.) work correctly.
|
|
313
|
+
// Otherwise on plain Windows, use cmd.exe /c explicitly.
|
|
314
|
+
const isGitBash = process.platform === 'win32' && !!process.env.MSYSTEM;
|
|
315
|
+
const proc = isGitBash
|
|
316
|
+
? spawn('bash', ['-c', perintah], { cwd: ROOT })
|
|
317
|
+
: process.platform === 'win32'
|
|
318
|
+
? spawn('cmd.exe', ['/c', perintah], { cwd: ROOT })
|
|
319
|
+
: spawn(perintah, { cwd: ROOT, shell: true });
|
|
310
320
|
const onData = (chunk) => {
|
|
311
321
|
const text = chunk.toString();
|
|
312
322
|
output += text;
|