osborn 0.9.178 → 0.9.179
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/dist/claude-llm.js +5 -5
- package/package.json +1 -1
- package/tests/autocompact-pct.test.ts +77 -0
package/dist/claude-llm.js
CHANGED
|
@@ -167,7 +167,7 @@ ensureCompactionSettings();
|
|
|
167
167
|
// (1M) window; without it opus runs at its 200K default. NOTE: 1M activation
|
|
168
168
|
// also depends on account entitlement (auto on Team seats; else usage credits).
|
|
169
169
|
process.env.ENABLE_1M_CONTEXT = '1';
|
|
170
|
-
process.env.CLAUDE_AUTOCOMPACT_PCT_OVERRIDE = '
|
|
170
|
+
process.env.CLAUDE_AUTOCOMPACT_PCT_OVERRIDE = '75'; // auto-compact at 75% of 1M context (750k tokens) — prevents compaction at extreme tail
|
|
171
171
|
// Research mode tools — full research capabilities
|
|
172
172
|
// Named sub-agents — the orchestrator delegates to these specialists. Each has
|
|
173
173
|
// a specific role, model, and tool set. Module-level + exported so the HTTP
|
|
@@ -276,13 +276,13 @@ export const NAMED_AGENTS = {
|
|
|
276
276
|
},
|
|
277
277
|
writer: {
|
|
278
278
|
description: [
|
|
279
|
-
'Execution agent with file write/edit permissions (
|
|
279
|
+
'Execution agent with file write/edit permissions (Opus).',
|
|
280
280
|
'Handles ALL file operations: code, config, docs, scripts, data files.',
|
|
281
281
|
'VERIFY-FIRST workflow: checks assumptions before making changes, runs tests after.',
|
|
282
282
|
'If anything is unclear, asks the main agent for clarification before touching files.',
|
|
283
283
|
].join(' '),
|
|
284
284
|
tools: ['Read', 'Write', 'Edit', 'MultiEdit', 'Bash', 'Glob', 'Grep', 'NotebookRead', 'NotebookEdit'],
|
|
285
|
-
model: '
|
|
285
|
+
model: 'opus',
|
|
286
286
|
prompt: [
|
|
287
287
|
'You are Osborn\'s writer agent. You execute file changes with a verify-first approach.',
|
|
288
288
|
'',
|
|
@@ -329,12 +329,12 @@ export const NAMED_AGENTS = {
|
|
|
329
329
|
},
|
|
330
330
|
tester: {
|
|
331
331
|
description: [
|
|
332
|
-
'Test-runner agent (
|
|
332
|
+
'Test-runner agent (Opus). Use for: running test suites, executing builds, interpreting',
|
|
333
333
|
'CI failures, checking compilation errors, verifying that a change did not break anything.',
|
|
334
334
|
'Returns structured pass/fail results with exact output — does NOT edit files.',
|
|
335
335
|
].join(' '),
|
|
336
336
|
tools: ['Bash', 'Read', 'Glob', 'Grep', 'Write', 'Edit'],
|
|
337
|
-
model: '
|
|
337
|
+
model: 'opus',
|
|
338
338
|
prompt: [
|
|
339
339
|
'You are Osborn\'s tester agent. Your job is running tests and builds, then reporting results.',
|
|
340
340
|
'',
|
package/package.json
CHANGED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regression tests for CLAUDE_AUTOCOMPACT_PCT_OVERRIDE in claude-llm.ts
|
|
3
|
+
*
|
|
4
|
+
* Scope: verifies that the compaction threshold is set to a value that
|
|
5
|
+
* leaves meaningful context headroom before compaction fires.
|
|
6
|
+
*
|
|
7
|
+
* Derived from: requirements documented in CLAUDE.md (ENABLE_1M_CONTEXT,
|
|
8
|
+
* compaction rationale comments in claude-llm.ts) and the 0.9.177 → 0.9.178
|
|
9
|
+
* change that lowered the threshold from 92 → 60.
|
|
10
|
+
* NOT derived from the implementation diff.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { strict as assert } from 'node:assert'
|
|
14
|
+
import { readFileSync } from 'node:fs'
|
|
15
|
+
import { dirname, join } from 'node:path'
|
|
16
|
+
import { fileURLToPath } from 'node:url'
|
|
17
|
+
|
|
18
|
+
const here = dirname(fileURLToPath(import.meta.url))
|
|
19
|
+
const src = readFileSync(join(here, '../src/claude-llm.ts'), 'utf8')
|
|
20
|
+
|
|
21
|
+
let passed = 0
|
|
22
|
+
let failed = 0
|
|
23
|
+
|
|
24
|
+
function test(name: string, fn: () => void) {
|
|
25
|
+
try {
|
|
26
|
+
fn()
|
|
27
|
+
console.log(` ✅ ${name}`)
|
|
28
|
+
passed++
|
|
29
|
+
} catch (err: any) {
|
|
30
|
+
console.error(` ❌ ${name}`)
|
|
31
|
+
console.error(` ${err.message}`)
|
|
32
|
+
failed++
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Extract the numeric value of CLAUDE_AUTOCOMPACT_PCT_OVERRIDE from source
|
|
37
|
+
const match = src.match(/process\.env\.CLAUDE_AUTOCOMPACT_PCT_OVERRIDE\s*=\s*'(\d+)'/)
|
|
38
|
+
const pctValue = match ? parseInt(match[1], 10) : NaN
|
|
39
|
+
|
|
40
|
+
console.log('\n=== autocompact PCT override regression tests ===\n')
|
|
41
|
+
console.log(` (detected value: CLAUDE_AUTOCOMPACT_PCT_OVERRIDE = '${pctValue}')`)
|
|
42
|
+
console.log()
|
|
43
|
+
|
|
44
|
+
test('CLAUDE_AUTOCOMPACT_PCT_OVERRIDE is set in claude-llm.ts', () => {
|
|
45
|
+
assert.ok(
|
|
46
|
+
!isNaN(pctValue),
|
|
47
|
+
'CLAUDE_AUTOCOMPACT_PCT_OVERRIDE must be explicitly set in claude-llm.ts'
|
|
48
|
+
)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
test('CLAUDE_AUTOCOMPACT_PCT_OVERRIDE is a valid percentage (1–99)', () => {
|
|
52
|
+
assert.ok(
|
|
53
|
+
pctValue >= 1 && pctValue <= 99,
|
|
54
|
+
`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE must be between 1 and 99, got ${pctValue}`
|
|
55
|
+
)
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
test('CLAUDE_AUTOCOMPACT_PCT_OVERRIDE is ≤ 92 (prevents compaction at extreme tail)', () => {
|
|
59
|
+
// Values above 92 leave almost no headroom before hitting the token limit.
|
|
60
|
+
// The long-standing default was 92; anything higher than that risks the
|
|
61
|
+
// "compacting every message" bug described in memory/osborn-1m-context-and-worker-restart.md
|
|
62
|
+
assert.ok(
|
|
63
|
+
pctValue <= 92,
|
|
64
|
+
`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE is ${pctValue} which is above 92 — ` +
|
|
65
|
+
'values this high risk compaction firing on every message at the context ceiling'
|
|
66
|
+
)
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
test('ENABLE_1M_CONTEXT is also set in claude-llm.ts', () => {
|
|
70
|
+
assert.ok(
|
|
71
|
+
src.includes("process.env.ENABLE_1M_CONTEXT = '1'"),
|
|
72
|
+
"ENABLE_1M_CONTEXT = '1' must be set alongside CLAUDE_AUTOCOMPACT_PCT_OVERRIDE"
|
|
73
|
+
)
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
console.log(`\n--- ${passed + failed} tests: ${passed} passed, ${failed} failed ---\n`)
|
|
77
|
+
if (failed > 0) process.exit(1)
|