@animalabs/agent-framework 0.9.0 → 0.11.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.
Files changed (109) hide show
  1. package/dist/src/agent.d.ts +1 -1
  2. package/dist/src/agent.d.ts.map +1 -1
  3. package/dist/src/agent.js.map +1 -1
  4. package/dist/src/framework.d.ts +72 -4
  5. package/dist/src/framework.d.ts.map +1 -1
  6. package/dist/src/framework.js +699 -48
  7. package/dist/src/framework.js.map +1 -1
  8. package/dist/src/gate/event-gate.d.ts +62 -7
  9. package/dist/src/gate/event-gate.d.ts.map +1 -1
  10. package/dist/src/gate/event-gate.js +333 -22
  11. package/dist/src/gate/event-gate.js.map +1 -1
  12. package/dist/src/gate/types.d.ts +56 -0
  13. package/dist/src/gate/types.d.ts.map +1 -1
  14. package/dist/src/mcpl/prose-grammar.d.ts +11 -0
  15. package/dist/src/mcpl/prose-grammar.d.ts.map +1 -1
  16. package/dist/src/mcpl/prose-grammar.js +21 -0
  17. package/dist/src/mcpl/prose-grammar.js.map +1 -1
  18. package/dist/src/mcpl/prose-stream-router.d.ts +2 -2
  19. package/dist/src/mcpl/prose-stream-router.d.ts.map +1 -1
  20. package/dist/src/mcpl/prose-stream-router.js +57 -13
  21. package/dist/src/mcpl/prose-stream-router.js.map +1 -1
  22. package/dist/src/modules/discord/index.d.ts.map +1 -1
  23. package/dist/src/modules/discord/index.js +21 -5
  24. package/dist/src/modules/discord/index.js.map +1 -1
  25. package/dist/src/modules/workspace/index.d.ts +23 -0
  26. package/dist/src/modules/workspace/index.d.ts.map +1 -1
  27. package/dist/src/modules/workspace/index.js +53 -3
  28. package/dist/src/modules/workspace/index.js.map +1 -1
  29. package/dist/src/modules/workspace/sync.d.ts +11 -2
  30. package/dist/src/modules/workspace/sync.d.ts.map +1 -1
  31. package/dist/src/modules/workspace/sync.js +27 -11
  32. package/dist/src/modules/workspace/sync.js.map +1 -1
  33. package/dist/src/modules/workspace/watcher.d.ts.map +1 -1
  34. package/dist/src/modules/workspace/watcher.js +9 -6
  35. package/dist/src/modules/workspace/watcher.js.map +1 -1
  36. package/dist/src/queue.d.ts.map +1 -1
  37. package/dist/src/queue.js +9 -2
  38. package/dist/src/queue.js.map +1 -1
  39. package/dist/src/tool-result-history.d.ts +12 -2
  40. package/dist/src/tool-result-history.d.ts.map +1 -1
  41. package/dist/src/tool-result-history.js +12 -2
  42. package/dist/src/tool-result-history.js.map +1 -1
  43. package/dist/src/types/agent.d.ts +6 -1
  44. package/dist/src/types/agent.d.ts.map +1 -1
  45. package/dist/src/types/framework.d.ts +1 -1
  46. package/dist/src/types/trace.d.ts +7 -0
  47. package/dist/src/types/trace.d.ts.map +1 -1
  48. package/dist/test/busy-agent-scheduler.test.js +29 -0
  49. package/dist/test/busy-agent-scheduler.test.js.map +1 -1
  50. package/dist/test/discord-history-delete-window.test.d.ts +2 -0
  51. package/dist/test/discord-history-delete-window.test.d.ts.map +1 -0
  52. package/dist/test/discord-history-delete-window.test.js +81 -0
  53. package/dist/test/discord-history-delete-window.test.js.map +1 -0
  54. package/dist/test/discord-history-sync.test.d.ts +2 -0
  55. package/dist/test/discord-history-sync.test.d.ts.map +1 -0
  56. package/dist/test/discord-history-sync.test.js +56 -0
  57. package/dist/test/discord-history-sync.test.js.map +1 -0
  58. package/dist/test/event-gate-passthrough.test.d.ts +15 -0
  59. package/dist/test/event-gate-passthrough.test.d.ts.map +1 -0
  60. package/dist/test/event-gate-passthrough.test.js +289 -0
  61. package/dist/test/event-gate-passthrough.test.js.map +1 -0
  62. package/dist/test/explicit-prose-routing.test.js +179 -7
  63. package/dist/test/explicit-prose-routing.test.js.map +1 -1
  64. package/dist/test/framework.test.js +33 -0
  65. package/dist/test/framework.test.js.map +1 -1
  66. package/dist/test/prose-stream-router.test.js +43 -0
  67. package/dist/test/prose-stream-router.test.js.map +1 -1
  68. package/dist/test/provider-acceleration-cooldown.test.d.ts +2 -0
  69. package/dist/test/provider-acceleration-cooldown.test.d.ts.map +1 -0
  70. package/dist/test/provider-acceleration-cooldown.test.js +286 -0
  71. package/dist/test/provider-acceleration-cooldown.test.js.map +1 -0
  72. package/dist/test/puppet-tool-call.test.d.ts +2 -0
  73. package/dist/test/puppet-tool-call.test.d.ts.map +1 -0
  74. package/dist/test/puppet-tool-call.test.js +106 -0
  75. package/dist/test/puppet-tool-call.test.js.map +1 -0
  76. package/dist/test/release-changelog.test.d.ts +2 -0
  77. package/dist/test/release-changelog.test.d.ts.map +1 -0
  78. package/dist/test/release-changelog.test.js +159 -0
  79. package/dist/test/release-changelog.test.js.map +1 -0
  80. package/dist/test/tool-result-spill.test.d.ts +1 -1
  81. package/dist/test/tool-result-spill.test.js +18 -9
  82. package/dist/test/tool-result-spill.test.js.map +1 -1
  83. package/dist/test/workspace-path-containment.test.d.ts +19 -0
  84. package/dist/test/workspace-path-containment.test.d.ts.map +1 -0
  85. package/dist/test/workspace-path-containment.test.js +91 -0
  86. package/dist/test/workspace-path-containment.test.js.map +1 -0
  87. package/dist/test/workspace-watcher.test.js +15 -3
  88. package/dist/test/workspace-watcher.test.js.map +1 -1
  89. package/dist/test/xml-round-persist.test.d.ts +19 -0
  90. package/dist/test/xml-round-persist.test.d.ts.map +1 -0
  91. package/dist/test/xml-round-persist.test.js +235 -0
  92. package/dist/test/xml-round-persist.test.js.map +1 -0
  93. package/dist/tsconfig.tsbuildinfo +1 -1
  94. package/package.json +2 -1
  95. package/src/agent.ts +1 -1
  96. package/src/framework.ts +733 -48
  97. package/src/gate/event-gate.ts +355 -24
  98. package/src/gate/types.ts +58 -0
  99. package/src/mcpl/prose-grammar.ts +21 -0
  100. package/src/mcpl/prose-stream-router.ts +48 -14
  101. package/src/modules/discord/index.ts +24 -6
  102. package/src/modules/workspace/index.ts +53 -3
  103. package/src/modules/workspace/sync.ts +39 -10
  104. package/src/modules/workspace/watcher.ts +9 -6
  105. package/src/queue.ts +8 -2
  106. package/src/tool-result-history.ts +12 -2
  107. package/src/types/agent.ts +6 -1
  108. package/src/types/framework.ts +1 -1
  109. package/src/types/trace.ts +13 -0
@@ -0,0 +1,235 @@
1
+ /**
2
+ * XML-mode per-round persist: the framework must store each round's text
3
+ * exactly once.
4
+ *
5
+ * Regression for the Evander 2026-08-08 scaffold-leak pyramid: membrane's
6
+ * `ToolContext.preamble` is CUMULATIVE in XML mode (whole turn so far,
7
+ * including harness-injected <function_results> XML). The per-round persist
8
+ * fallback stored it per round, so a 3-call turn wrote round-1's text 3×,
9
+ * round-2's 2×, and re-persisted injected results as the agent's own words —
10
+ * which the anthropic-xml formatter then replayed to the model as
11
+ * scaffold-in-its-own-voice.
12
+ *
13
+ * With membrane ≥0.5.79 the context carries `roundPreamble` (this round's
14
+ * delta only) and the framework must prefer it. With an older membrane
15
+ * (no `roundPreamble`) the cumulative fallback remains — pinned here so the
16
+ * compat shape stays visible and deliberate.
17
+ */
18
+ import { describe, it } from 'node:test';
19
+ import assert from 'node:assert';
20
+ import { tmpdir } from 'node:os';
21
+ import { mkdtempSync, rmSync } from 'node:fs';
22
+ import { join } from 'node:path';
23
+ import { AgentFramework } from '../src/index.js';
24
+ const R1 = 'ROUND_ONE_TEXT_alpha';
25
+ const R2 = 'ROUND_TWO_TEXT_beta';
26
+ const FINAL = 'FINAL_TEXT_gamma';
27
+ const INJECTED = 'INJECTED_RESULTS_XML_delta';
28
+ const RAW1 = '<function_calls><invoke name="test--echo"><parameter name="message">round1</parameter></invoke></function_calls>';
29
+ const RAW2 = '<function_calls><invoke name="test--echo"><parameter name="message">round2</parameter></invoke></function_calls>';
30
+ /**
31
+ * Mock yielding stream simulating membrane's XML tool mode: tool-calls
32
+ * events carry NO roundContent; `preamble` is cumulative (with injected
33
+ * results XML between rounds), `roundPreamble` optionally carries the
34
+ * per-round delta.
35
+ */
36
+ class XmlMockStream {
37
+ rounds;
38
+ finalText;
39
+ withRoundPreamble;
40
+ events = [];
41
+ _done = false;
42
+ _isWaitingForTools = false;
43
+ _round = 0;
44
+ pendingResolve = null;
45
+ constructor(rounds, finalText, withRoundPreamble) {
46
+ this.rounds = rounds;
47
+ this.finalText = finalText;
48
+ this.withRoundPreamble = withRoundPreamble;
49
+ this.emitRound();
50
+ }
51
+ cumulativePreamble(uptoRound) {
52
+ // preamble before round N's call = r0 text + raw0 + injected results +
53
+ // r1 text + ... + rN text (matches membrane: beforeText minus prefill).
54
+ let out = '';
55
+ for (let i = 0; i < uptoRound; i++) {
56
+ out += this.rounds[i].text + '\n' + this.rounds[i].rawText +
57
+ `\n<function_results>${INJECTED}</function_results>\n`;
58
+ }
59
+ out += this.rounds[uptoRound].text + '\n';
60
+ return out;
61
+ }
62
+ emitRound() {
63
+ const round = this.rounds[this._round];
64
+ if (!round) {
65
+ const response = {
66
+ content: [{ type: 'text', text: this.finalText }],
67
+ stopReason: 'end_turn',
68
+ rawAssistantText: this.finalText,
69
+ toolCalls: [],
70
+ toolResults: [],
71
+ usage: { inputTokens: 10, outputTokens: 5 },
72
+ details: { raw: {} },
73
+ };
74
+ this.events.push({ type: 'complete', response });
75
+ this._done = true;
76
+ return;
77
+ }
78
+ this._isWaitingForTools = true;
79
+ this.events.push({
80
+ type: 'tool-calls',
81
+ calls: [{ id: round.callId, name: 'test--echo', input: round.callInput }],
82
+ context: {
83
+ rawText: round.rawText,
84
+ preamble: this.cumulativePreamble(this._round),
85
+ depth: this._round,
86
+ previousResults: [],
87
+ accumulated: this.cumulativePreamble(this._round) + round.rawText,
88
+ ...(this.withRoundPreamble ? { roundPreamble: round.text + '\n' } : {}),
89
+ },
90
+ });
91
+ }
92
+ provideToolResults(_results) {
93
+ if (!this._isWaitingForTools)
94
+ throw new Error('Not waiting for tools');
95
+ this._isWaitingForTools = false;
96
+ this._round++;
97
+ this.emitRound();
98
+ if (this.pendingResolve) {
99
+ const resolve = this.pendingResolve;
100
+ this.pendingResolve = null;
101
+ resolve();
102
+ }
103
+ }
104
+ cancel() {
105
+ this._done = true;
106
+ this.events.push({ type: 'aborted', reason: 'user' });
107
+ if (this.pendingResolve) {
108
+ const r = this.pendingResolve;
109
+ this.pendingResolve = null;
110
+ r();
111
+ }
112
+ }
113
+ get isWaitingForTools() { return this._isWaitingForTools; }
114
+ get pendingToolCallIds() {
115
+ const round = this.rounds[this._round];
116
+ return this._isWaitingForTools && round ? [round.callId] : [];
117
+ }
118
+ get toolDepth() { return this._round; }
119
+ async *[Symbol.asyncIterator]() {
120
+ while (true) {
121
+ while (this.events.length > 0) {
122
+ const event = this.events.shift();
123
+ yield event;
124
+ if (event.type === 'complete' || event.type === 'error' || event.type === 'aborted') {
125
+ return;
126
+ }
127
+ }
128
+ if (this._done)
129
+ return;
130
+ await new Promise((resolve) => { this.pendingResolve = resolve; });
131
+ }
132
+ }
133
+ }
134
+ class XmlMockMembrane {
135
+ withRoundPreamble;
136
+ constructor(withRoundPreamble) {
137
+ this.withRoundPreamble = withRoundPreamble;
138
+ }
139
+ calls = [];
140
+ async complete(request) {
141
+ this.calls.push(request);
142
+ throw new Error('not used');
143
+ }
144
+ streamYielding(request) {
145
+ this.calls.push(request);
146
+ return new XmlMockStream([
147
+ { text: R1, rawText: RAW1, callId: 'call_1', callInput: { message: 'round1' } },
148
+ { text: R2, rawText: RAW2, callId: 'call_2', callInput: { message: 'round2' } },
149
+ ], FINAL, this.withRoundPreamble);
150
+ }
151
+ asMembrane() {
152
+ return this;
153
+ }
154
+ }
155
+ class EchoModule {
156
+ name = 'test';
157
+ async start(_ctx) { }
158
+ async stop() { }
159
+ getTools() {
160
+ return [{
161
+ name: 'echo',
162
+ description: 'Echoes the input',
163
+ inputSchema: {
164
+ type: 'object',
165
+ properties: { message: { type: 'string', description: 'Message to echo' } },
166
+ required: ['message'],
167
+ },
168
+ }];
169
+ }
170
+ async handleToolCall(call) {
171
+ const input = call.input;
172
+ return { success: true, data: { echoed: input.message } };
173
+ }
174
+ async onProcess(event, _state) {
175
+ if (event.type === 'external-message') {
176
+ return {
177
+ addMessages: [{ participant: 'User', content: [{ type: 'text', text: String(event.content) }] }],
178
+ requestInference: true,
179
+ };
180
+ }
181
+ return {};
182
+ }
183
+ }
184
+ async function runTurn(withRoundPreamble) {
185
+ const tempDir = mkdtempSync(join(tmpdir(), 'xml-round-persist-'));
186
+ const membrane = new XmlMockMembrane(withRoundPreamble);
187
+ const framework = await AgentFramework.create({
188
+ storePath: join(tempDir, 'test.chronicle'),
189
+ membrane: membrane.asMembrane(),
190
+ agents: [{ name: 'assistant', model: 'test-model', systemPrompt: 'Test' }],
191
+ modules: [new EchoModule()],
192
+ });
193
+ try {
194
+ framework.pushEvent({
195
+ type: 'external-message',
196
+ source: 'test',
197
+ content: 'Do two echoes',
198
+ metadata: {},
199
+ });
200
+ await framework.runUntilIdle();
201
+ const cm = framework.getAgent('assistant').getContextManager();
202
+ const msgs = (cm.queryMessages({}).messages ?? []);
203
+ return msgs
204
+ .flatMap((m) => m.content)
205
+ .filter((b) => b.type === 'text')
206
+ .map((b) => b.text ?? '')
207
+ .join('\n---\n');
208
+ }
209
+ finally {
210
+ await framework.stop();
211
+ rmSync(tempDir, { recursive: true, force: true });
212
+ }
213
+ }
214
+ function count(haystack, needle) {
215
+ return haystack.split(needle).length - 1;
216
+ }
217
+ describe('XML-mode per-round persist (scaffold-leak pyramid regression)', () => {
218
+ it('stores each round exactly once when membrane provides roundPreamble', async () => {
219
+ const storedText = await runTurn(true);
220
+ assert.strictEqual(count(storedText, R1), 1, `round-1 text stored once, got: ${count(storedText, R1)}`);
221
+ assert.strictEqual(count(storedText, R2), 1, 'round-2 text stored once');
222
+ assert.strictEqual(count(storedText, FINAL), 1, 'final text stored once');
223
+ assert.strictEqual(count(storedText, INJECTED), 0, 'injected <function_results> XML must never persist as agent text');
224
+ });
225
+ it('legacy membrane without roundPreamble keeps the cumulative fallback (pinned)', async () => {
226
+ const storedText = await runTurn(false);
227
+ // The old shape, deliberately pinned: round-1 in rounds 1+2 = 2 copies,
228
+ // injected results re-persisted once. When the fleet's membrane floor
229
+ // reaches 0.5.79 this contract can be dropped along with the fallback.
230
+ assert.strictEqual(count(storedText, R1), 2, 'cumulative fallback: round-1 text twice');
231
+ assert.strictEqual(count(storedText, R2), 1, 'round-2 text once');
232
+ assert.strictEqual(count(storedText, INJECTED), 1, 'injected XML persisted once by fallback');
233
+ });
234
+ });
235
+ //# sourceMappingURL=xml-round-persist.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml-round-persist.test.js","sourceRoot":"","sources":["../../test/xml-round-persist.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAc,MAAM,WAAW,CAAC;AACrD,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAiBjC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,EAAE,GAAG,sBAAsB,CAAC;AAClC,MAAM,EAAE,GAAG,qBAAqB,CAAC;AACjC,MAAM,KAAK,GAAG,kBAAkB,CAAC;AACjC,MAAM,QAAQ,GAAG,4BAA4B,CAAC;AAE9C,MAAM,IAAI,GAAG,kHAAkH,CAAC;AAChI,MAAM,IAAI,GAAG,kHAAkH,CAAC;AAUhI;;;;;GAKG;AACH,MAAM,aAAa;IAQP;IACA;IACA;IATF,MAAM,GAAkB,EAAE,CAAC;IAC3B,KAAK,GAAG,KAAK,CAAC;IACd,kBAAkB,GAAG,KAAK,CAAC;IAC3B,MAAM,GAAG,CAAC,CAAC;IACX,cAAc,GAAwB,IAAI,CAAC;IAEnD,YACU,MAAkB,EAClB,SAAiB,EACjB,iBAA0B;QAF1B,WAAM,GAAN,MAAM,CAAY;QAClB,cAAS,GAAT,SAAS,CAAQ;QACjB,sBAAiB,GAAjB,iBAAiB,CAAS;QAElC,IAAI,CAAC,SAAS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