@brunobracaioli/aibrain 0.3.0-beta.13 → 0.3.0-beta.15

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/README.md CHANGED
@@ -3,11 +3,22 @@
3
3
  Assisted AI Brain context beta client for Linux/WSL with Node.js 22 or newer.
4
4
 
5
5
  The reviewed native compatibility set is Claude Code 2.1.294, 2.1.295, 2.1.296,
6
- 2.1.299, 2.1.300, 2.1.301 or 2.1.302, and Codex CLI 0.161.0,
6
+ 2.1.299, 2.1.300, 2.1.301, 2.1.302 or 2.1.303, and Codex CLI 0.161.0,
7
7
  0.162.0, 0.162.1 or 0.163.0. A newer stable Codex 0.x release may continue only
8
8
  after its locally generated experimental protocol schemas and transport flags
9
9
  match the bundled adapter contract; prereleases, older releases and new majors
10
- remain rejected.
10
+ remain rejected. Starting with beta14, newer stable Claude 2.1 patches can
11
+ continue after isolated strict plugin validation, required hook/API checks and
12
+ an enabled-hook test in the native offline runner. Doctor distinguishes
13
+ `host_checked` from `qualified`; this check does not establish full behavioral
14
+ equivalence with a tested native release. Unknown older patches, prereleases
15
+ and other major/minor families remain rejected. No credentials, conversations,
16
+ model requests or JEV calls are used by these compatibility probes.
17
+
18
+ The Codex terminal bridge permits the native session picker's separate read-only
19
+ connection while keeping the primary conversation and monitor intact. A picker
20
+ cannot compact, start a turn, inject history or take ownership of the primary
21
+ connection. Its failure or timeout closes only that auxiliary connection.
11
22
 
12
23
  ```sh
13
24
  # Install the published beta:
@@ -57,7 +68,7 @@ text; they do not claim that a live session is being monitored. Codex keeps nati
57
68
  compaction and recovery notes in the same thread. The backend checks paid access
58
69
  and unchanged shared quotas before any JEV request.
59
70
 
60
- The `0.3.0-beta.13` Claude launcher uses the durable context strategy and
71
+ The `0.3.0-beta.14` Claude launcher uses the durable context strategy and
61
72
  records bounded recovery reasons when native summary proof cannot be confirmed:
62
73
  JEV selects compatible historical tool evidence, bounded private notes retain
63
74
  the selected text, and Claude core summarizes the reduced input. The next
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-brain-context-compaction",
3
- "version": "0.3.0-beta.13",
3
+ "version": "0.3.0-beta.14",
4
4
  "author": { "name": "AISAC" },
5
5
  "description": "AI Brain paid-plan context monitoring with conservative Claude compaction fallback.",
6
6
  "hooks": "./hooks/hooks.json",
@@ -0,0 +1,18 @@
1
+ import { register as registerContext } from './context-compaction.ts';
2
+
3
+ export function register(on: Parameters<typeof registerContext>[0]): void {
4
+ return registerContext(on, {
5
+ enabled: true,
6
+ disclosed: true,
7
+ policyVersion: 2,
8
+ compactAtPercent: 60,
9
+ keepThreshold: 0.5,
10
+ preserveRecentMessages: 6,
11
+ minReductionRatio: 0.25,
12
+ truncateHeadChars: 300,
13
+ maxStateTokens: 25_000,
14
+ maxRequestTokens: 30_000,
15
+ compactionStrategy: 'native_summary_notes',
16
+ preservationMode: 'upstream_compatible',
17
+ });
18
+ }
@@ -0,0 +1,42 @@
1
+ import { expect, test } from 'claude-code/testing';
2
+
3
+ const contractTest: Parameters<typeof test>[2] = async ($, on) => {
4
+ on('prompt.submit', () => ({ text: 'native-host-contract-ok' }));
5
+ on('tool.call', () => ({ result: { content: 'native-host-tool-ok' } }));
6
+ on('session.messages', () => ({ value: [] }));
7
+ let usageCalls = 0;
8
+ on('session.usage', () => ({
9
+ value: (() => {
10
+ usageCalls += 1;
11
+ return { context: { percent: 90, tokens: 900, window: 1_000 } };
12
+ })(),
13
+ }));
14
+ on('ui.log', () => ({ value: undefined }));
15
+ on('ui.toast', () => ({ value: undefined }));
16
+ let compactCalls = 0;
17
+ on('session.compact', () => {
18
+ compactCalls += 1;
19
+ return {
20
+ messages: [{ role: 'assistant', text: 'native-summary-contract-ok', toolUses: [] }],
21
+ };
22
+ });
23
+ on('turn.complete', () => ({ text: '' }));
24
+ const prompt = await $.prompt.submit({ text: 'native-host-contract-input' });
25
+ const tool = await $.tool.call({ tool: 'Read', file_path: 'native-host-contract.txt' });
26
+ await $.turn.complete({
27
+ turnId: 'native-contract-turn',
28
+ answer: 'native-turn-contract-ok',
29
+ durationMs: 1,
30
+ isAborted: false,
31
+ usage: null,
32
+ });
33
+ expect(prompt.text).toBe('native-host-contract-ok');
34
+ expect(tool.result.content).toBe('native-host-tool-ok');
35
+ expect(usageCalls).toBe(1);
36
+ expect(compactCalls).toBe(1);
37
+ };
38
+
39
+ test(
40
+ 'AI Brain enabled host contract invokes usage and native compaction through the dispatcher',
41
+ contractTest,
42
+ );