kiosapi 0.1.23 → 0.1.24

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.
Files changed (2) hide show
  1. package/dist/agent/run.js +17 -4
  2. package/package.json +1 -1
package/dist/agent/run.js CHANGED
@@ -550,10 +550,23 @@ export async function runTurn(s, userText) {
550
550
  if (count > 1 && READ_ONLY_TOOLS.has(call.function.name) && toolCache.has(sig)) {
551
551
  const toolName = call.function.name;
552
552
  const cachedOut = toolCache.get(sig) ?? '';
553
- const warn = count >= COUNT_LIMIT - 1
554
- ? `⚠ STOP: "${toolName}" sudah dipanggil ${count}× dengan argumen yang sama — hasilnya tidak berubah. WAJIB gunakan tool "selesai" atau eksplorasi path BERBEDA.`
555
- : `[Cache identik dengan panggilan sebelumnya]\n${cachedOut}\n\n⚠ Kamu sudah memanggil "${toolName}" dengan argumen yang sama ${count}×. Jangan ulangi masuk ke subfolder spesifik atau gunakan "selesai".`;
556
- console.log(dim(` ↩ ${toolName} (cache ke-${count})`));
553
+ // Always include the cached content so the model has the data it needs even after
554
+ // trimContext drops old messages from its window. The escalating warning text
555
+ // discourages repetition; withholding the content at count=3+ only causes the model
556
+ // to keep retrying — counter-productive to stopping the loop.
557
+ const stopNote = count >= COUNT_LIMIT - 1
558
+ ? `\n\n⚠ STOP (ke-${count}): JANGAN panggil "${toolName}" lagi dengan argumen yang sama. Gunakan tool "selesai" dan jelaskan kendalanya, atau gunakan cari/baca_file dengan path/range BERBEDA.`
559
+ : `\n\n⚠ Cache ke-${count}: "${toolName}" sudah dipanggil ${count}× dengan argumen sama. Gunakan cari atau baca_file(path, mulai=N) untuk bagian berbeda.`;
560
+ const warn = `[Cache ke-${count}]\n${cachedOut}${stopNote}`;
561
+ const cachePathHint = (() => {
562
+ try {
563
+ return ` ${JSON.parse(call.function.arguments).path ?? ''}`;
564
+ }
565
+ catch {
566
+ return '';
567
+ }
568
+ })();
569
+ console.log(dim(` ↩ ${toolName}${cachePathHint} (cache ke-${count})`));
557
570
  s.messages.push({ role: 'tool', content: warn, tool_call_id: call.id });
558
571
  continue;
559
572
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kiosapi",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "type": "module",
5
5
  "description": "CLI Kiosapi.id berbahasa Indonesia — bangun aplikasimu pakai API key Kiosapi (agen + multimodal).",
6
6
  "keywords": [