@demicodes/agent 0.10.0 → 0.10.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.
Files changed (2) hide show
  1. package/dist/index.mjs +10 -3
  2. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -901,9 +901,16 @@ var CompactionController = class {
901
901
  const transcript = this.host.transcript;
902
902
  if (transcript.pendingToolCalls().length > 0) return false;
903
903
  const window = transcript.findCompactionWindow(this.host.keepRecentTokens);
904
- if (window === null || window.cutPoint <= window.startIndex) return false;
904
+ if (window === null) return false;
905
+ let minCutPoint = window.startIndex;
906
+ while (minCutPoint < window.cutPoint) {
907
+ const type = transcript.blocks[minCutPoint]?.type;
908
+ if (type !== "compaction_boundary" && type !== "compaction_marker") break;
909
+ minCutPoint += 1;
910
+ }
911
+ if (window.cutPoint <= minCutPoint) return false;
905
912
  let cutPoint = window.cutPoint;
906
- while (cutPoint > window.startIndex) {
913
+ while (cutPoint > minCutPoint) {
907
914
  const compactedBlocks = transcript.blocks.slice(window.startIndex, cutPoint);
908
915
  const compactedTokens = compactedBlocks.reduce((total, block) => total + estimateTranscriptBlockTokens(block), 0);
909
916
  try {
@@ -1975,9 +1982,9 @@ var AgentSession = class AgentSession {
1975
1982
  await this.executeRetry();
1976
1983
  return;
1977
1984
  }
1978
- await this.applyPendingModelSwitch();
1979
1985
  this.transcriptLog.truncateFrom(cut);
1980
1986
  this.transcriptLog.markLatestAbortResumed();
1987
+ await this.applyPendingModelSwitch();
1981
1988
  this.transcriptLog.pushResumeTurn(this.currentTurnId(), this.model);
1982
1989
  await this.commitTranscript();
1983
1990
  await this.compaction.preflight();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@demicodes/agent",
3
3
  "description": "Session runtime and transport-neutral client and server protocol for Demi.",
4
- "version": "0.10.0",
4
+ "version": "0.10.2",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "exports": {
@@ -19,10 +19,10 @@
19
19
  }
20
20
  },
21
21
  "dependencies": {
22
- "@demicodes/core": "^0.10.0",
23
- "@demicodes/provider": "^0.10.0",
24
- "@demicodes/shell": "^0.10.0",
25
- "@demicodes/utils": "^0.10.0"
22
+ "@demicodes/core": "^0.10.2",
23
+ "@demicodes/provider": "^0.10.2",
24
+ "@demicodes/shell": "^0.10.2",
25
+ "@demicodes/utils": "^0.10.2"
26
26
  },
27
27
  "license": "Apache-2.0",
28
28
  "main": "./dist/index.mjs",