@ai-agent-forge/agent-forge 0.86.0 → 0.86.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 (33) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/bundle/.build-manifest.json +14 -14
  3. package/dist/bundle/chunks/{chunk-2L25YYPC.js → chunk-JR3Q27QP.js} +4 -4
  4. package/dist/bundle/cli.js +1 -1
  5. package/dist/bundle/index.js +1 -1
  6. package/dist/bundle/rpc-entry.js +1 -1
  7. package/dist/core/agent-session-compaction.d.ts +5 -0
  8. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  9. package/dist/core/agent-session-compaction.js +178 -4
  10. package/dist/core/agent-session-compaction.js.map +1 -1
  11. package/dist/core/agent-session-internal.d.ts +8 -0
  12. package/dist/core/agent-session-internal.d.ts.map +1 -1
  13. package/dist/core/agent-session-internal.js.map +1 -1
  14. package/dist/core/agent-session.d.ts +9 -0
  15. package/dist/core/agent-session.d.ts.map +1 -1
  16. package/dist/core/agent-session.js +17 -0
  17. package/dist/core/agent-session.js.map +1 -1
  18. package/dist/core/compaction/compaction.d.ts +2 -0
  19. package/dist/core/compaction/compaction.d.ts.map +1 -1
  20. package/dist/core/compaction/compaction.js +2 -1
  21. package/dist/core/compaction/compaction.js.map +1 -1
  22. package/dist/core/extensions/bootstrap-compaction-policy.d.ts.map +1 -1
  23. package/dist/core/extensions/bootstrap-compaction-policy.js +3 -1
  24. package/dist/core/extensions/bootstrap-compaction-policy.js.map +1 -1
  25. package/dist/core/extensions/microcompact.d.ts +3 -2
  26. package/dist/core/extensions/microcompact.d.ts.map +1 -1
  27. package/dist/core/extensions/microcompact.js +14 -5
  28. package/dist/core/extensions/microcompact.js.map +1 -1
  29. package/dist/core/settings-manager.d.ts +3 -0
  30. package/dist/core/settings-manager.d.ts.map +1 -1
  31. package/dist/core/settings-manager.js +4 -0
  32. package/dist/core/settings-manager.js.map +1 -1
  33. package/package.json +1 -1
@@ -101,6 +101,16 @@ export class AgentSession {
101
101
  _autoCompactionAbortController = undefined;
102
102
  // biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
103
103
  _overflowRecoveryAttempted = false;
104
+ // biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
105
+ _overflowTrimStage = 0;
106
+ /**
107
+ * microcompact 冷却(按模型请求计数,0 = 不冷却):relief 落地时置
108
+ * MICROCOMPACT_COOLDOWN_ASSISTANT_RESPONSES,此后每次 assistant message_end
109
+ * (无论 stopReason)减 1、下限 0;user message_start 不复位。冷却期内阈值
110
+ * decide 以 microcompactEnabled:false 关闭便宜缓解。微观经济动机见
111
+ * agent-session-compaction.ts 的常量注释(中部历史改写 × 不稳定前缀缓存)。
112
+ */
113
+ _microcompactCooldown = 0;
104
114
  // Branch summarization state
105
115
  _branchSummaryAbortController = undefined;
106
116
  _branchSummaryPromise = undefined;
@@ -440,6 +450,7 @@ export class AgentSession {
440
450
  // This ensures the UI sees the updated queue state
441
451
  if (event.type === "message_start" && event.message.role === "user") {
442
452
  this._overflowRecoveryAttempted = false;
453
+ this._overflowTrimStage = 0;
443
454
  const messageText = contentText(event.message.content, "");
444
455
  if (messageText) {
445
456
  // Check steering queue first
@@ -501,6 +512,12 @@ export class AgentSession {
501
512
  const assistantMsg = event.message;
502
513
  if (assistantMsg.stopReason !== "error" && assistantMsg.stopReason !== "length") {
503
514
  this._overflowRecoveryAttempted = false;
515
+ this._overflowTrimStage = 0;
516
+ }
517
+ // microcompact 冷却按模型请求计数:每个完成的 assistant 响应(无论
518
+ // stopReason)释放一档,下限 0;冷却期内的阈值 decide 不做便宜缓解。
519
+ if (this._microcompactCooldown > 0) {
520
+ this._microcompactCooldown -= 1;
504
521
  }
505
522
  // Reset retry counter immediately on successful assistant response
506
523
  // This prevents accumulation across multiple LLM calls within a turn