@thincoder/core 0.11.4 → 0.11.5

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/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to the core package are documented here.
4
4
  Format: Keep a Changelog · 中文 · 号在发布时定(CalVer——见 `docs/RELEASE.md` §4)。
5
5
 
6
+ ## [0.11.5] — 2026-11-28
7
+
8
+ ### Fixed
9
+
10
+ - **越窗守卫被短路**:`runCompactionCheck` 收缩检查的两个 `return` 把 `enforceContextFit` 挡在 `try` 外,溢出守卫永远到不了——历史压不下去、发送前净判直接拒发。现改为布尔移出 `try`、守卫在 `catch` 闭合后与 `return` 前执行(仍不被压缩失败吞掉)。
11
+
6
12
  ## [0.11.4] — 2026-11-28
7
13
 
8
14
  ### Added
@@ -118,8 +118,9 @@ export async function runCompactionCheck(agent, ctx) {
118
118
  // 其余全同(同 splitHistory / 同尾部预算 / 同摘要链 / 同回注 / 同基线失效)。
119
119
  const pending = agent._pendingCompact
120
120
  agent._pendingCompact = null
121
+ let compacted = false
121
122
  try {
122
- let compacted = await compressIfNeeded(
123
+ compacted = await compressIfNeeded(
123
124
  agent, threshold, callbacks,
124
125
  pending ? { ...compactionOverhead, force: true, focus: pending.focus } : compactionOverhead,
125
126
  signal,
@@ -138,7 +139,6 @@ export async function runCompactionCheck(agent, ctx) {
138
139
  compacted = await compressIfNeeded(agent, threshold, callbacks, compactionOverhead, signal)
139
140
  }
140
141
  if (compacted) bookkeepCompaction(agent, ctx)
141
- return Boolean(compacted)
142
142
  } catch (compressError) {
143
143
  noteCompressFailure(agent, ctx, compressError)
144
144
  if (pending) {
@@ -146,12 +146,13 @@ export async function runCompactionCheck(agent, ctx) {
146
146
  const { compactFailureNote } = await import("../agent-tools/context.mjs")
147
147
  pushInject(agent, { role: "user", content: compactFailureNote(errText(compressError), agent._compressFailures) })
148
148
  }
149
- return false
149
+ compacted = false
150
150
  }
151
151
 
152
152
  // 溢出守卫(CONTEXT-COMPACTION.md §6.17 / D-CC32——兜底,非主修;本缝 = catch 闭合后、返回前)。
153
153
  // 判据 / 强压 / 再判 / 抛三实数 全住 `enforceContextFit`——与 §6.17.1 链三的自适应面**同一个原子**(零复制)。
154
154
  await enforceContextFit(agent, ctx)
155
+ return Boolean(compacted)
155
156
  }
156
157
 
157
158
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thincoder/core",
3
- "version": "0.11.4",
3
+ "version": "0.11.5",
4
4
  "description": "ThinCoder shared core — shared mechanism modules + shared prompt content (CLI ↔ VS Code extension).",
5
5
  "keywords": [
6
6
  "ai",