@standardagents/code 0.3.0 → 0.3.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/dist/index.js CHANGED
@@ -4365,6 +4365,8 @@ async function runInteractive(tui, api, threadId, projectDir, machine, resumed,
4365
4365
  saveApprovals(api, threadId, perm);
4366
4366
  });
4367
4367
  saveApprovals(api, threadId, perm);
4368
+ void api.kvSet(threadId, "session_info", { cwd: projectDir, machine }).catch(() => {
4369
+ });
4368
4370
  let busy = false;
4369
4371
  let interrupting = false;
4370
4372
  const queued = [];
@@ -4781,10 +4783,14 @@ ${c.bold}why: ${req.requestPermission}${c.reset}` : ""}`,
4781
4783
  } catch {
4782
4784
  }
4783
4785
  const COMPACTION_TRIGGER_FRACTION = 0.5;
4786
+ const COMPACTION_TRIGGER_CAP = 5e4;
4784
4787
  try {
4785
4788
  const cu = await api.kvGet(threadId, "context_usage");
4786
4789
  const used = Number(cu?.inputTokens) || 0;
4787
- const max = (Number(cu?.maxContextTokens) || 0) * COMPACTION_TRIGGER_FRACTION;
4790
+ const max = Math.min(
4791
+ (Number(cu?.maxContextTokens) || 0) * COMPACTION_TRIGGER_FRACTION || Infinity,
4792
+ COMPACTION_TRIGGER_CAP
4793
+ );
4788
4794
  tui.setContextPct(max > 0 && used > 0 ? used / max * 100 : null);
4789
4795
  } catch {
4790
4796
  }