@poncho-ai/harness 0.59.6 → 0.59.7

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,5 +1,5 @@
1
1
 
2
- > @poncho-ai/harness@0.59.6 build /home/runner/work/poncho-ai/poncho-ai/packages/harness
2
+ > @poncho-ai/harness@0.59.7 build /home/runner/work/poncho-ai/poncho-ai/packages/harness
3
3
  > node scripts/embed-docs.js && tsup src/index.ts --format esm --dts
4
4
 
5
5
  [embed-docs] Generated poncho-docs.ts with 4 topics
@@ -9,8 +9,8 @@
9
9
  CLI Target: es2022
10
10
  ESM Build start
11
11
  ESM dist/isolate-F2PPSUL6.js 53.82 KB
12
- ESM dist/index.js 557.73 KB
13
- ESM ⚡️ Build success in 256ms
12
+ ESM dist/index.js 558.06 KB
13
+ ESM ⚡️ Build success in 257ms
14
14
  DTS Build start
15
- DTS ⚡️ Build success in 8276ms
15
+ DTS ⚡️ Build success in 7680ms
16
16
  DTS dist/index.d.ts 101.66 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @poncho-ai/harness
2
2
 
3
+ ## 0.59.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c73cb19`](https://github.com/cesr/poncho-ai/commit/c73cb19ec8bf61fe0598262ae4d050fb84c939b5) Thanks [@cesr](https://github.com/cesr)! - Auto-compaction never fired on cached conversations: the per-step context
8
+ measure (`latestContextTokens`) used `usage.inputTokens`, which with
9
+ Anthropic prompt caching is only the NON-cached slice — a real 190k+
10
+ conversation reported ~12k of "context", so the trigger comparison never
11
+ tripped and transcripts grew past the model's window. Context now counts
12
+ input + cache-read + cache-write tokens (everything the model read). Also
13
+ pins claude-fable-5 / opus-4-8 / opus-4-7 in the context-window registry
14
+ (previously relying on the silent 200k default).
15
+
3
16
  ## 0.59.6
4
17
 
5
18
  ### Patch Changes
package/dist/index.js CHANGED
@@ -7490,6 +7490,12 @@ var completeOpenAICodexDeviceAuth = async (request) => {
7490
7490
 
7491
7491
  // src/model-factory.ts
7492
7492
  var MODEL_CONTEXT_WINDOWS = {
7493
+ // Pinned conservatively at 200k. The API has accepted >204k for fable-5
7494
+ // (its real window is larger), but compacting at trigger×200k keeps
7495
+ // long-conversation cost bounded; raise deliberately, not by omission.
7496
+ "claude-fable-5": 2e5,
7497
+ "claude-opus-4-8": 2e5,
7498
+ "claude-opus-4-7": 2e5,
7493
7499
  "claude-opus-4-6": 2e5,
7494
7500
  "claude-sonnet-4-6": 2e5,
7495
7501
  "claude-opus-4-5": 2e5,
@@ -11362,7 +11368,7 @@ ${textContent}` };
11362
11368
  totalOutputTokens += usage.outputTokens ?? 0;
11363
11369
  totalCachedTokens += stepCachedTokens;
11364
11370
  totalCacheWriteTokens += stepCacheWriteTokens;
11365
- latestContextTokens = stepInputTokens;
11371
+ latestContextTokens = stepInputTokens + stepCachedTokens + stepCacheWriteTokens;
11366
11372
  toolOutputEstimateSinceModel = 0;
11367
11373
  yield pushEvent({
11368
11374
  type: "model:response",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poncho-ai/harness",
3
- "version": "0.59.6",
3
+ "version": "0.59.7",
4
4
  "description": "Agent execution runtime - conversation loop, tool dispatch, streaming",
5
5
  "repository": {
6
6
  "type": "git",
package/src/harness.ts CHANGED
@@ -3208,7 +3208,14 @@ Code is wrapped in an async IIFE — use \`return\` to return a value to the too
3208
3208
  totalOutputTokens += usage.outputTokens ?? 0;
3209
3209
  totalCachedTokens += stepCachedTokens;
3210
3210
  totalCacheWriteTokens += stepCacheWriteTokens;
3211
- latestContextTokens = stepInputTokens;
3211
+ // Context size = EVERYTHING the model read this step. With prompt
3212
+ // caching, Anthropic's `usage.input_tokens` is only the non-cached
3213
+ // slice — the bulk of a long conversation arrives as cache reads.
3214
+ // Counting input alone made the auto-compaction check see ~12k of
3215
+ // "context" on a real 190k+ conversation, so compaction never fired
3216
+ // and the transcript grew unbounded (observed 2026-06-12: 205k real
3217
+ // context, trigger at 190k, no compaction).
3218
+ latestContextTokens = stepInputTokens + stepCachedTokens + stepCacheWriteTokens;
3212
3219
  toolOutputEstimateSinceModel = 0;
3213
3220
 
3214
3221
  yield pushEvent({
@@ -9,6 +9,12 @@ import {
9
9
  export type ModelProviderFactory = (modelName: string) => LanguageModel;
10
10
 
11
11
  const MODEL_CONTEXT_WINDOWS: Record<string, number> = {
12
+ // Pinned conservatively at 200k. The API has accepted >204k for fable-5
13
+ // (its real window is larger), but compacting at trigger×200k keeps
14
+ // long-conversation cost bounded; raise deliberately, not by omission.
15
+ "claude-fable-5": 200_000,
16
+ "claude-opus-4-8": 200_000,
17
+ "claude-opus-4-7": 200_000,
12
18
  "claude-opus-4-6": 200_000,
13
19
  "claude-sonnet-4-6": 200_000,
14
20
  "claude-opus-4-5": 200_000,