@animalabs/agent-framework 0.17.0 → 0.18.0
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/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +12 -3
- package/dist/src/framework.js.map +1 -1
- package/dist/src/thinking-token-stamp.d.ts +7 -0
- package/dist/src/thinking-token-stamp.d.ts.map +1 -0
- package/dist/src/thinking-token-stamp.js +103 -0
- package/dist/src/thinking-token-stamp.js.map +1 -0
- package/dist/test/thinking-token-stamp.test.d.ts +12 -0
- package/dist/test/thinking-token-stamp.test.d.ts.map +1 -0
- package/dist/test/thinking-token-stamp.test.js +129 -0
- package/dist/test/thinking-token-stamp.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/framework.ts +15 -3
- package/src/thinking-token-stamp.ts +95 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ContentBlock } from '@animalabs/membrane';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a new array; carrier blocks are shallow-copied with `tokenEstimate`
|
|
4
|
+
* set, every other block is the same object.
|
|
5
|
+
*/
|
|
6
|
+
export declare function stampThinkingTokenEstimates(blocks: ContentBlock[], outputTokens: number): ContentBlock[];
|
|
7
|
+
//# sourceMappingURL=thinking-token-stamp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thinking-token-stamp.d.ts","sourceRoot":"","sources":["../../src/thinking-token-stamp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAiExD;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,YAAY,EAAE,CAyBxG"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stamp signed thinking blocks with the tokens they will cost when replayed.
|
|
3
|
+
*
|
|
4
|
+
* On keep-all models (Opus >= 4.5, Sonnet >= 4.6, Fable/Mythos) every prior
|
|
5
|
+
* assistant thinking block is sent back and billed as INPUT at the size of
|
|
6
|
+
* the full hidden chain of thought — whatever its visible text says (empty
|
|
7
|
+
* under `display: "omitted"`, a short summary under `"summarized"`). The
|
|
8
|
+
* signature encodes that chain but its length is not a reliable measure
|
|
9
|
+
* (2.8–8.7 chars/token measured on Opus 4.8), and the stored block carries
|
|
10
|
+
* no other trace of the size. The response DOES: `usage.output_tokens` is
|
|
11
|
+
* the visible blocks plus the hidden thinking. So at creation, price each
|
|
12
|
+
* carrier block from the residual of this call's output tokens over its
|
|
13
|
+
* visible blocks, split across carriers by signature length, and stamp it
|
|
14
|
+
* as `tokenEstimate` — the field context-manager already prefers over any
|
|
15
|
+
* heuristic for thinking, redacted_thinking and image blocks.
|
|
16
|
+
*
|
|
17
|
+
* Carriers: `thinking` with a non-empty `signature`, `redacted_thinking`
|
|
18
|
+
* with `data`. Blocks that already carry a `tokenEstimate` keep it. When the
|
|
19
|
+
* residual is not positive (no thinking, or the visible estimate over-
|
|
20
|
+
* shoots) nothing is stamped and context-manager's own fallback applies.
|
|
21
|
+
*
|
|
22
|
+
* The visible-block rates mirror context-manager's estimator (prose 2.9,
|
|
23
|
+
* JSON 2.3 chars/token); their precision matters little — on agentic turns
|
|
24
|
+
* the hidden thinking is the bulk of the output, and this stamp is what makes
|
|
25
|
+
* the compiled budget honest (see context-manager `SIGNATURE_CHARS_PER_TOKEN`).
|
|
26
|
+
*
|
|
27
|
+
* Wire safety: membrane's Anthropic formatter builds thinking blocks field
|
|
28
|
+
* by field (`type`, `thinking`, `signature`), so the stamp never reaches the
|
|
29
|
+
* provider; the signature itself is copied, never edited.
|
|
30
|
+
*/
|
|
31
|
+
const PROSE_CHARS_PER_TOKEN = 2.9;
|
|
32
|
+
const DENSE_CHARS_PER_TOKEN = 2.3;
|
|
33
|
+
function carrierWeight(block) {
|
|
34
|
+
if (block.type === 'thinking') {
|
|
35
|
+
const sig = block.signature;
|
|
36
|
+
return typeof sig === 'string' ? sig.length : 0;
|
|
37
|
+
}
|
|
38
|
+
if (block.type === 'redacted_thinking') {
|
|
39
|
+
const data = block.data;
|
|
40
|
+
return typeof data === 'string' ? data.length : 0;
|
|
41
|
+
}
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
function visibleTokens(block) {
|
|
45
|
+
switch (block.type) {
|
|
46
|
+
case 'text':
|
|
47
|
+
return Math.ceil((block.text ?? '').length / PROSE_CHARS_PER_TOKEN);
|
|
48
|
+
case 'tool_use': {
|
|
49
|
+
let json = '';
|
|
50
|
+
try {
|
|
51
|
+
json = JSON.stringify(block.input ?? {});
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
json = '';
|
|
55
|
+
}
|
|
56
|
+
return Math.ceil(json.length / DENSE_CHARS_PER_TOKEN) + 20;
|
|
57
|
+
}
|
|
58
|
+
case 'thinking':
|
|
59
|
+
// Unsigned thinking (text-only providers, XML mode): the text is the
|
|
60
|
+
// whole cost and is priced by context-manager as text.
|
|
61
|
+
return carrierWeight(block) > 0 ? 0 : Math.ceil((block.thinking ?? '').length / PROSE_CHARS_PER_TOKEN);
|
|
62
|
+
default:
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Returns a new array; carrier blocks are shallow-copied with `tokenEstimate`
|
|
68
|
+
* set, every other block is the same object.
|
|
69
|
+
*/
|
|
70
|
+
export function stampThinkingTokenEstimates(blocks, outputTokens) {
|
|
71
|
+
if (!Array.isArray(blocks) || blocks.length === 0)
|
|
72
|
+
return blocks;
|
|
73
|
+
if (!Number.isFinite(outputTokens) || outputTokens <= 0)
|
|
74
|
+
return blocks;
|
|
75
|
+
let totalWeight = 0;
|
|
76
|
+
let visible = 0;
|
|
77
|
+
for (const block of blocks) {
|
|
78
|
+
const already = block.tokenEstimate;
|
|
79
|
+
const w = typeof already === 'number' ? 0 : carrierWeight(block);
|
|
80
|
+
if (w > 0)
|
|
81
|
+
totalWeight += w;
|
|
82
|
+
else
|
|
83
|
+
visible += visibleTokens(block);
|
|
84
|
+
if (typeof already === 'number')
|
|
85
|
+
visible += already;
|
|
86
|
+
}
|
|
87
|
+
if (totalWeight <= 0)
|
|
88
|
+
return blocks;
|
|
89
|
+
const residual = outputTokens - visible;
|
|
90
|
+
if (residual <= 0)
|
|
91
|
+
return blocks;
|
|
92
|
+
return blocks.map((block) => {
|
|
93
|
+
const already = block.tokenEstimate;
|
|
94
|
+
if (typeof already === 'number')
|
|
95
|
+
return block;
|
|
96
|
+
const w = carrierWeight(block);
|
|
97
|
+
if (w <= 0)
|
|
98
|
+
return block;
|
|
99
|
+
const tokenEstimate = Math.max(1, Math.round((residual * w) / totalWeight));
|
|
100
|
+
return { ...block, tokenEstimate };
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=thinking-token-stamp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thinking-token-stamp.js","sourceRoot":"","sources":["../../src/thinking-token-stamp.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC,SAAS,aAAa,CAAC,KAAmB;IACxC,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAI,KAAiC,CAAC,SAAS,CAAC;QACzD,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;QACvC,MAAM,IAAI,GAAI,KAA4B,CAAC,IAAI,CAAC;QAChD,OAAO,OAAO,IAAI,KAAK,QAAQ,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* Signed thinking blocks are stamped with their replay price at persist time.
|
|
3
|
+
*
|
|
4
|
+
* On keep-all models the hidden chain of thought behind a signed thinking
|
|
5
|
+
* block is replayed and billed as input on every later call; the only exact
|
|
6
|
+
* measure of its size is this call's `usage.output_tokens` minus the visible
|
|
7
|
+
* blocks. The framework stamps that residual as `tokenEstimate` on the
|
|
8
|
+
* signed blocks (context-manager prefers the stamp over any heuristic), per
|
|
9
|
+
* round for tool-use turns and on the trailing content at completion.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=thinking-token-stamp.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thinking-token-stamp.test.d.ts","sourceRoot":"","sources":["../../test/thinking-token-stamp.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Signed thinking blocks are stamped with their replay price at persist time.
|
|
3
|
+
*
|
|
4
|
+
* On keep-all models the hidden chain of thought behind a signed thinking
|
|
5
|
+
* block is replayed and billed as input on every later call; the only exact
|
|
6
|
+
* measure of its size is this call's `usage.output_tokens` minus the visible
|
|
7
|
+
* blocks. The framework stamps that residual as `tokenEstimate` on the
|
|
8
|
+
* signed blocks (context-manager prefers the stamp over any heuristic), per
|
|
9
|
+
* round for tool-use turns and on the trailing content at completion.
|
|
10
|
+
*/
|
|
11
|
+
import { describe, it } from 'node:test';
|
|
12
|
+
import assert from 'node:assert/strict';
|
|
13
|
+
import { mkdtempSync, rmSync } from 'node:fs';
|
|
14
|
+
import { tmpdir } from 'node:os';
|
|
15
|
+
import { join } from 'node:path';
|
|
16
|
+
import { AgentFramework } from '../src/index.js';
|
|
17
|
+
import { stampThinkingTokenEstimates } from '../src/thinking-token-stamp.js';
|
|
18
|
+
import { MockMembrane, createMockResponse } from './helpers/mock-membrane.js';
|
|
19
|
+
const SIG_A = 'A'.repeat(4_000);
|
|
20
|
+
const SIG_B = 'B'.repeat(3_000);
|
|
21
|
+
describe('stampThinkingTokenEstimates (pure)', () => {
|
|
22
|
+
it('stamps the residual of output tokens over visible blocks on the signed block', () => {
|
|
23
|
+
const blocks = [
|
|
24
|
+
{ type: 'thinking', thinking: '', signature: SIG_A },
|
|
25
|
+
{ type: 'text', text: 'hello' },
|
|
26
|
+
];
|
|
27
|
+
const out = stampThinkingTokenEstimates(blocks, 3_000);
|
|
28
|
+
assert.equal(out[0].tokenEstimate, 3_000 - Math.ceil(5 / 2.9));
|
|
29
|
+
assert.equal(out[0].signature, SIG_A);
|
|
30
|
+
assert.equal(out[1], blocks[1], 'non-carrier blocks are the same object');
|
|
31
|
+
assert.equal(blocks[0].tokenEstimate, undefined, 'input block is not mutated');
|
|
32
|
+
});
|
|
33
|
+
it('splits the residual across several carriers by signature length', () => {
|
|
34
|
+
const blocks = [
|
|
35
|
+
{ type: 'thinking', thinking: '', signature: 'A'.repeat(3_000) },
|
|
36
|
+
{ type: 'tool_use', id: 't1', name: 'x', input: {} },
|
|
37
|
+
{ type: 'redacted_thinking', data: 'B'.repeat(1_000) },
|
|
38
|
+
];
|
|
39
|
+
const out = stampThinkingTokenEstimates(blocks, 4_021); // tool_use {} = 1 + 20 tokens
|
|
40
|
+
assert.equal(out[0].tokenEstimate, 3_000);
|
|
41
|
+
assert.equal(out[2].tokenEstimate, 1_000);
|
|
42
|
+
});
|
|
43
|
+
it('leaves unsigned thinking, already-stamped blocks and non-positive residuals alone', () => {
|
|
44
|
+
const unsigned = [{ type: 'thinking', thinking: 'visible reasoning' }];
|
|
45
|
+
assert.equal(stampThinkingTokenEstimates(unsigned, 500), unsigned);
|
|
46
|
+
const stamped = [{ type: 'thinking', thinking: '', signature: SIG_A, tokenEstimate: 42 }];
|
|
47
|
+
assert.equal(stampThinkingTokenEstimates(stamped, 5_000)[0].tokenEstimate, 42);
|
|
48
|
+
const overshoot = [
|
|
49
|
+
{ type: 'thinking', thinking: '', signature: SIG_A },
|
|
50
|
+
{ type: 'text', text: 'x'.repeat(10_000) },
|
|
51
|
+
];
|
|
52
|
+
assert.equal(stampThinkingTokenEstimates(overshoot, 100), overshoot);
|
|
53
|
+
assert.equal(stampThinkingTokenEstimates(overshoot, 0), overshoot);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
class EchoModule {
|
|
57
|
+
name = 'test';
|
|
58
|
+
async start(_ctx) { }
|
|
59
|
+
async stop() { }
|
|
60
|
+
getTools() {
|
|
61
|
+
return [{
|
|
62
|
+
name: 'echo',
|
|
63
|
+
description: 'Echoes the input',
|
|
64
|
+
inputSchema: { type: 'object', properties: { message: { type: 'string' } }, required: ['message'] },
|
|
65
|
+
}];
|
|
66
|
+
}
|
|
67
|
+
async handleToolCall(call) {
|
|
68
|
+
return { success: true, data: { echoed: call.input.message } };
|
|
69
|
+
}
|
|
70
|
+
async onProcess(event, _state) {
|
|
71
|
+
if (event.type !== 'external-message')
|
|
72
|
+
return {};
|
|
73
|
+
return {
|
|
74
|
+
addMessages: [{ participant: 'User', content: [{ type: 'text', text: String(event.content) }] }],
|
|
75
|
+
requestInference: true,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
describe('thinking token stamp through the stream loop', () => {
|
|
80
|
+
it('stamps each round from that call\'s own output tokens (membrane usage is cumulative)', async () => {
|
|
81
|
+
const tempDir = mkdtempSync(join(tmpdir(), 'thinking-stamp-'));
|
|
82
|
+
const membrane = new MockMembrane();
|
|
83
|
+
const round1 = createMockResponse([
|
|
84
|
+
{ type: 'thinking', thinking: '', signature: SIG_A },
|
|
85
|
+
{ type: 'text', text: 'looking' },
|
|
86
|
+
{ type: 'tool_use', id: 'call_1', name: 'test--echo', input: { message: 'one' } },
|
|
87
|
+
], 'tool_use');
|
|
88
|
+
round1.usage = { inputTokens: 100, outputTokens: 2_000 };
|
|
89
|
+
const round2 = createMockResponse([
|
|
90
|
+
{ type: 'thinking', thinking: '', signature: SIG_B },
|
|
91
|
+
{ type: 'text', text: 'done' },
|
|
92
|
+
]);
|
|
93
|
+
// Membrane reports usage CUMULATIVELY across the tool loop.
|
|
94
|
+
round2.usage = { inputTokens: 250, outputTokens: 3_500 };
|
|
95
|
+
membrane.pushResponse(round1);
|
|
96
|
+
membrane.pushResponse(round2);
|
|
97
|
+
const framework = await AgentFramework.create({
|
|
98
|
+
storePath: join(tempDir, 'test.chronicle'),
|
|
99
|
+
membrane: membrane.asMembrane(),
|
|
100
|
+
agents: [{ name: 'assistant', model: 'test-model', systemPrompt: 'Test' }],
|
|
101
|
+
modules: [new EchoModule()],
|
|
102
|
+
});
|
|
103
|
+
try {
|
|
104
|
+
framework.pushEvent({ type: 'external-message', source: 'test', content: 'go', metadata: {} });
|
|
105
|
+
await framework.runUntilIdle();
|
|
106
|
+
const cm = framework.getAgent('assistant').getContextManager();
|
|
107
|
+
const msgs = (cm.queryMessages({}).messages ?? []);
|
|
108
|
+
const thinking = msgs.flatMap((m) => m.content).filter((b) => b.type === 'thinking');
|
|
109
|
+
assert.equal(thinking.length, 2, 'both rounds persisted their thinking block');
|
|
110
|
+
const [t1, t2] = thinking;
|
|
111
|
+
assert.equal(t1.signature, SIG_A);
|
|
112
|
+
assert.equal(t2.signature, SIG_B);
|
|
113
|
+
// Round 1: 2000 output tokens minus 'looking' and the tool_use JSON.
|
|
114
|
+
const toolJson = JSON.stringify({ message: 'one' }).length;
|
|
115
|
+
const visible1 = Math.ceil('looking'.length / 2.9) + Math.ceil(toolJson / 2.3) + 20;
|
|
116
|
+
assert.equal(t1.tokenEstimate, 2_000 - visible1);
|
|
117
|
+
// Round 2: (3500 - 2000) output tokens minus 'done' — not the cumulative 3500.
|
|
118
|
+
assert.equal(t2.tokenEstimate, 1_500 - Math.ceil('done'.length / 2.9));
|
|
119
|
+
const others = msgs.flatMap((m) => m.content).filter((b) => b.type !== 'thinking');
|
|
120
|
+
for (const b of others)
|
|
121
|
+
assert.equal(b.tokenEstimate, undefined, `${b.type} must not be stamped`);
|
|
122
|
+
}
|
|
123
|
+
finally {
|
|
124
|
+
await framework.stop();
|
|
125
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
//# sourceMappingURL=thinking-token-stamp.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thinking-token-stamp.test.js","sourceRoot":"","sources":["../../test/thinking-token-stamp.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAYjC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAE9E,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChC,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAIhC,QAAQ,CAAC,oCAAoC,EAAE,GAAG,EAAE;IAClD,EAAE,CAAC,8EAA8E,EAAE,GAAG,EAAE;QACtF,MAAM,MAAM,GAAmB;YAC7B,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAkB;YACpE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE;SAChC,CAAC;QACF,MAAM,GAAG,GAAG,2BAA2B,CAAC,MAAM,EAAE,KAAK,CAAc,CAAC;QACpE,MAAM,CAAC,K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