cliskill 1.0.9 → 1.1.0

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "../chunk-MM3EHZQQ.js";
4
+ } from "../chunk-LHS6LLBW.js";
5
5
  import "../chunk-AJENHWD3.js";
6
6
  export {
7
7
  runCli
@@ -6531,12 +6531,33 @@ ${result.summary}` }]
6531
6531
  inputTokens: state.totalInputTokens,
6532
6532
  outputTokens: state.totalOutputTokens
6533
6533
  };
6534
+ const currentContextTokens = parser.usage.inputTokens;
6534
6535
  const budget = checkTokenBudget(
6535
- state.totalInputTokens,
6536
- state.totalOutputTokens,
6536
+ currentContextTokens,
6537
+ 0,
6538
+ // output already included in next turn's input
6537
6539
  contextWindow.getMaxTokens()
6538
6540
  );
6539
6541
  if (budget.shouldBlock) {
6542
+ const compactionInput = state.messages.map((m) => ({
6543
+ role: m.role,
6544
+ content: formatContentBlocks2(m.content)
6545
+ }));
6546
+ try {
6547
+ const compactResult = await compactor.compact(compactionInput, effectiveSystemPrompt);
6548
+ if (compactResult.removedMessages > 0) {
6549
+ const summaryMsg = {
6550
+ role: "user",
6551
+ content: [{ type: "text", text: `[Previous conversation summary]
6552
+ ${compactResult.summary}` }]
6553
+ };
6554
+ const keptStart = state.messages.length - compactResult.keptMessages;
6555
+ state.messages = [summaryMsg, ...state.messages.slice(keptStart)];
6556
+ yield { type: "context_compacted", summary: compactResult.summary, removedCount: compactResult.removedMessages };
6557
+ continue;
6558
+ }
6559
+ } catch {
6560
+ }
6540
6561
  yield {
6541
6562
  type: "error",
6542
6563
  error: new Error(
@@ -11532,4 +11553,4 @@ export {
11532
11553
  MCPConnectionManager,
11533
11554
  runCli
11534
11555
  };
11535
- //# sourceMappingURL=chunk-MM3EHZQQ.js.map
11556
+ //# sourceMappingURL=chunk-LHS6LLBW.js.map