@animalabs/agent-framework 0.5.1 → 0.5.4
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/agent.d.ts +9 -0
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +9 -0
- package/dist/src/agent.js.map +1 -1
- package/dist/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +73 -11
- package/dist/src/framework.js.map +1 -1
- package/dist/src/modules/health/index.d.ts +59 -0
- package/dist/src/modules/health/index.d.ts.map +1 -0
- package/dist/src/modules/health/index.js +213 -0
- package/dist/src/modules/health/index.js.map +1 -0
- package/dist/src/modules/index.d.ts +2 -0
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +1 -0
- package/dist/src/modules/index.js.map +1 -1
- package/dist/src/types/agent.d.ts +10 -0
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/agent.ts +9 -0
- package/src/framework.ts +78 -11
- package/src/modules/health/index.ts +275 -0
- package/src/modules/index.ts +3 -0
- package/src/types/agent.ts +11 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HealthModule — minimal framework self-introspection.
|
|
3
|
+
*
|
|
4
|
+
* Exposes a single tool, `health--snapshot`, that returns a structured
|
|
5
|
+
* snapshot of recent framework activity. Useful when an agent gets a
|
|
6
|
+
* concurrency timeout, a 400 from the API, or wants to verify it's not
|
|
7
|
+
* silently failing.
|
|
8
|
+
*
|
|
9
|
+
* Sources:
|
|
10
|
+
* - `framework/inference-log` (queryInferenceLogs) — recent inference
|
|
11
|
+
* success/error counts, last N errors, per-agent token totals.
|
|
12
|
+
* - `modules/subagent/state` — best-effort. The slot is owned by
|
|
13
|
+
* `connectome-host`'s SubagentModule, not by this module. We read it
|
|
14
|
+
* directly from the chronicle store so the tool works even when the
|
|
15
|
+
* HealthModule has no awareness of SubagentModule's internals.
|
|
16
|
+
* - Registered module names.
|
|
17
|
+
*
|
|
18
|
+
* Kept deliberately read-only: no side effects, no kill switches.
|
|
19
|
+
* Reaping/cancellation lives in the SubagentModule.
|
|
20
|
+
*/
|
|
21
|
+
export class HealthModule {
|
|
22
|
+
name = 'health';
|
|
23
|
+
ctx = null;
|
|
24
|
+
framework = null;
|
|
25
|
+
store = null;
|
|
26
|
+
config;
|
|
27
|
+
constructor(config = {}) {
|
|
28
|
+
this.config = {
|
|
29
|
+
defaultLookback: config.defaultLookback ?? 20,
|
|
30
|
+
subagentStateId: config.subagentStateId ?? 'modules/subagent/state',
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Wire framework + store. Host calls this after AgentFramework.create()
|
|
35
|
+
* so the module can query inference logs and chronicle state.
|
|
36
|
+
*/
|
|
37
|
+
bind(framework, store) {
|
|
38
|
+
this.framework = framework;
|
|
39
|
+
this.store = store;
|
|
40
|
+
}
|
|
41
|
+
async start(ctx) {
|
|
42
|
+
this.ctx = ctx;
|
|
43
|
+
}
|
|
44
|
+
async stop() {
|
|
45
|
+
this.ctx = null;
|
|
46
|
+
}
|
|
47
|
+
getTools() {
|
|
48
|
+
return [
|
|
49
|
+
{
|
|
50
|
+
name: 'snapshot',
|
|
51
|
+
description: 'Return a structured snapshot of framework health: recent inference success/error counts, last errors, per-agent token totals, active subagent registry, and registered modules. Read-only. Useful when diagnosing why a spawn timed out, why an inference failed, or whether the framework is silently degraded.',
|
|
52
|
+
inputSchema: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
properties: {
|
|
55
|
+
lookback: {
|
|
56
|
+
type: 'number',
|
|
57
|
+
description: `How many recent inferences to summarize (default ${this.config.defaultLookback}).`,
|
|
58
|
+
},
|
|
59
|
+
includeTokens: {
|
|
60
|
+
type: 'boolean',
|
|
61
|
+
description: 'Include per-agent token totals (default true).',
|
|
62
|
+
},
|
|
63
|
+
includeSubagents: {
|
|
64
|
+
type: 'boolean',
|
|
65
|
+
description: 'Include subagent registry summary (default true).',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
async handleToolCall(call) {
|
|
73
|
+
if (call.name !== 'snapshot') {
|
|
74
|
+
return { success: false, isError: true, error: `Unknown tool: ${call.name}` };
|
|
75
|
+
}
|
|
76
|
+
const input = (call.input ?? {});
|
|
77
|
+
const lookback = input.lookback ?? this.config.defaultLookback;
|
|
78
|
+
const includeTokens = input.includeTokens ?? true;
|
|
79
|
+
const includeSubagents = input.includeSubagents ?? true;
|
|
80
|
+
try {
|
|
81
|
+
const snapshot = this.buildSnapshot(lookback, includeTokens, includeSubagents);
|
|
82
|
+
return { success: true, data: snapshot };
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
return {
|
|
86
|
+
success: false,
|
|
87
|
+
isError: true,
|
|
88
|
+
error: error instanceof Error ? error.message : String(error),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async onProcess(_event, _state) {
|
|
93
|
+
return {};
|
|
94
|
+
}
|
|
95
|
+
buildSnapshot(lookback, includeTokens, includeSubagents) {
|
|
96
|
+
if (!this.framework || !this.store) {
|
|
97
|
+
throw new Error('HealthModule not bound — host must call bind(framework, store) before tool dispatch.');
|
|
98
|
+
}
|
|
99
|
+
// ── Inference log summary ───────────────────────────────────────────
|
|
100
|
+
// queryInferenceLogs returns InferenceLogEntryWithId. Prefer the
|
|
101
|
+
// `summary` field (no blob deref) but fall back to `entry` for older
|
|
102
|
+
// records or if the summarizer wasn't populated.
|
|
103
|
+
const recent = this.framework.queryInferenceLogs({ limit: lookback });
|
|
104
|
+
const recentEntries = recent.entries ?? [];
|
|
105
|
+
const projectSummary = (e) => {
|
|
106
|
+
const s = e.summary ?? e.entry;
|
|
107
|
+
return {
|
|
108
|
+
timestamp: s.timestamp,
|
|
109
|
+
agentName: s.agentName,
|
|
110
|
+
success: s.success,
|
|
111
|
+
error: s.error,
|
|
112
|
+
requestId: s.requestId,
|
|
113
|
+
tokenUsage: s.tokenUsage,
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
const recentErrors = recentEntries
|
|
117
|
+
.map(projectSummary)
|
|
118
|
+
.filter((s) => s.success === false)
|
|
119
|
+
.slice(0, 10)
|
|
120
|
+
.map((s) => ({
|
|
121
|
+
timestamp: s.timestamp,
|
|
122
|
+
agentName: s.agentName,
|
|
123
|
+
error: typeof s.error === 'string' ? s.error.slice(0, 400) : s.error,
|
|
124
|
+
requestId: s.requestId,
|
|
125
|
+
}));
|
|
126
|
+
let tokenTotals;
|
|
127
|
+
if (includeTokens) {
|
|
128
|
+
// Pull a larger window for totals — defaults to 1000 entries which is
|
|
129
|
+
// enough to characterize ongoing usage without dragging the entire log.
|
|
130
|
+
const wide = this.framework.queryInferenceLogs({ limit: 1000 });
|
|
131
|
+
tokenTotals = {};
|
|
132
|
+
for (const raw of wide.entries ?? []) {
|
|
133
|
+
const s = projectSummary(raw);
|
|
134
|
+
const agent = s.agentName ?? 'unknown';
|
|
135
|
+
const t = tokenTotals[agent] ?? { input: 0, output: 0, cacheRead: 0, inferences: 0 };
|
|
136
|
+
t.inferences++;
|
|
137
|
+
const u = s.tokenUsage;
|
|
138
|
+
if (u) {
|
|
139
|
+
t.input += u.input ?? 0;
|
|
140
|
+
t.output += u.output ?? 0;
|
|
141
|
+
t.cacheRead += u.cacheRead ?? 0;
|
|
142
|
+
}
|
|
143
|
+
tokenTotals[agent] = t;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// ── Subagent registry summary (best-effort) ────────────────────────
|
|
147
|
+
let subagents;
|
|
148
|
+
if (includeSubagents) {
|
|
149
|
+
try {
|
|
150
|
+
const raw = this.store.getStateJson(this.config.subagentStateId);
|
|
151
|
+
if (raw) {
|
|
152
|
+
const parsed = typeof raw === 'string' ? JSON.parse(raw) : raw;
|
|
153
|
+
const agents = parsed?.agents
|
|
154
|
+
?? {};
|
|
155
|
+
const now = Date.now();
|
|
156
|
+
subagents = Object.entries(agents).map(([key, sa]) => {
|
|
157
|
+
const startedAt = sa.startedAt ?? 0;
|
|
158
|
+
const lastActivityAt = sa.lastActivityAt ?? startedAt;
|
|
159
|
+
return {
|
|
160
|
+
key,
|
|
161
|
+
name: sa.name,
|
|
162
|
+
type: sa.type,
|
|
163
|
+
status: sa.status,
|
|
164
|
+
startedAt: startedAt > 0 ? new Date(startedAt).toISOString() : null,
|
|
165
|
+
lastActivityAt: lastActivityAt > 0 ? new Date(lastActivityAt).toISOString() : null,
|
|
166
|
+
runtimeSeconds: startedAt > 0 ? Math.floor((now - startedAt) / 1000) : null,
|
|
167
|
+
silentSeconds: lastActivityAt > 0 ? Math.floor((now - lastActivityAt) / 1000) : null,
|
|
168
|
+
toolCallsCount: sa.toolCallsCount,
|
|
169
|
+
statusMessage: sa.statusMessage,
|
|
170
|
+
};
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
subagents = 'no subagent state registered';
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
subagents = `error reading subagent state: ${error instanceof Error ? error.message : String(error)}`;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// ── Module list ────────────────────────────────────────────────────
|
|
182
|
+
const modules = this.ctx ? this.listModulesViaContext() : [];
|
|
183
|
+
return {
|
|
184
|
+
timestamp: new Date().toISOString(),
|
|
185
|
+
window: {
|
|
186
|
+
lookback,
|
|
187
|
+
inferencesInWindow: recentEntries.length,
|
|
188
|
+
},
|
|
189
|
+
inferences: {
|
|
190
|
+
successCount: recentEntries.filter((e) => projectSummary(e).success).length,
|
|
191
|
+
errorCount: recentEntries.filter((e) => projectSummary(e).success === false).length,
|
|
192
|
+
recentErrors,
|
|
193
|
+
},
|
|
194
|
+
tokenTotalsByAgent: tokenTotals,
|
|
195
|
+
subagents,
|
|
196
|
+
modules,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
listModulesViaContext() {
|
|
200
|
+
// ModuleContext.getActiveTools returns flat tool names; derive module set
|
|
201
|
+
// from the prefix before '--'. This avoids needing a dedicated module-list
|
|
202
|
+
// accessor on ModuleContext (kept narrow on purpose).
|
|
203
|
+
const tools = this.ctx?.getActiveTools() ?? [];
|
|
204
|
+
const set = new Set();
|
|
205
|
+
for (const t of tools) {
|
|
206
|
+
const i = t.name.indexOf('--');
|
|
207
|
+
if (i > 0)
|
|
208
|
+
set.add(t.name.slice(0, i));
|
|
209
|
+
}
|
|
210
|
+
return [...set].sort();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/health/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AA2CH,MAAM,OAAO,YAAY;IACd,IAAI,GAAG,QAAQ,CAAC;IAEjB,GAAG,GAAyB,IAAI,CAAC;IACjC,SAAS,GAA0B,IAAI,CAAC;IACxC,KAAK,GAAmB,IAAI,CAAC;IAC7B,MAAM,CAA+B;IAE7C,YAAY,SAA6B,EAAE;QACzC,IAAI,CAAC,MAAM,GAAG;YACZ,eAAe,EAAE,MAAM,CAAC,eAAe,IAAI,EAAE;YAC7C,eAAe,EAAE,MAAM,CAAC,eAAe,IAAI,wBAAwB;SACpE,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,SAAyB,EAAE,KAAc;QAC5C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,GAAkB;QAC5B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,GAAG,GAAG,IAAI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K,CAAC,CAAC,MAAM;gBACnF,YAAY;aACb;YACD,kBAAkB,EAAE,WAAW;YAC/B,SAAS;YACT,OAAO;SACR,CAAC;IACJ,CAAC;IAEO,qBAAqB;QAC3B,0EAA0E;QAC1E,2EAA2E;QAC3E,sDAAsD;QACtD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;QAC/C,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;QAC9B,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC/B,IAAI,CAAC,GAAG,CAAC;gBAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export { ApiModule } from './api/index.js';
|
|
5
5
|
export type { ApiEvent } from './api/index.js';
|
|
6
|
+
export { HealthModule } from './health/index.js';
|
|
7
|
+
export type { HealthModuleConfig } from './health/index.js';
|
|
6
8
|
export { WorkspaceModule } from './workspace/index.js';
|
|
7
9
|
export type { WorkspaceConfig, MountConfig, MountState, WorkspaceModuleState, ReadInput, WriteInput, EditInput, DeleteInput, LsInput, GlobInput, GrepInput, StatusInput, MaterializeInput, SyncInput, } from './workspace/index.js';
|
|
8
10
|
export { DiscordModule, DiscordJsClient } from './discord/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EACV,eAAe,EACf,WAAW,EACX,UAAU,EACV,oBAAoB,EACpB,SAAS,EACT,UAAU,EACV,SAAS,EACT,WAAW,EACX,OAAO,EACP,SAAS,EACT,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,SAAS,GACV,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACpE,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,IAAI,gBAAgB,EAC7B,WAAW,EACX,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EACV,eAAe,EACf,WAAW,EACX,UAAU,EACV,oBAAoB,EACpB,SAAS,EACT,UAAU,EACV,SAAS,EACT,WAAW,EACX,OAAO,EACP,SAAS,EACT,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,SAAS,GACV,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACpE,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,IAAI,gBAAgB,EAC7B,WAAW,EACX,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Built-in modules for the agent framework
|
|
3
3
|
*/
|
|
4
4
|
export { ApiModule } from './api/index.js';
|
|
5
|
+
export { HealthModule } from './health/index.js';
|
|
5
6
|
export { WorkspaceModule } from './workspace/index.js';
|
|
6
7
|
export { DiscordModule, DiscordJsClient } from './discord/index.js';
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAkBvD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAkBvD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -32,6 +32,16 @@ export interface AgentConfig {
|
|
|
32
32
|
/** Max input tokens before framework breaks a yielding stream and
|
|
33
33
|
* restarts with recompiled (compressed) context. Default: 150000. */
|
|
34
34
|
maxStreamTokens?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Extended thinking config. When `enabled: true`, the agent runs with
|
|
37
|
+
* Anthropic's native extended thinking; responses include `thinking` blocks
|
|
38
|
+
* with cryptographic signatures, and the API enforces `temperature: 1`
|
|
39
|
+
* (Membrane handles this). Omit or set `enabled: false` to disable.
|
|
40
|
+
*/
|
|
41
|
+
thinking?: {
|
|
42
|
+
enabled: boolean;
|
|
43
|
+
budgetTokens?: number;
|
|
44
|
+
};
|
|
35
45
|
}
|
|
36
46
|
/**
|
|
37
47
|
* Result of running inference.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/types/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IAEb,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IAEd,oBAAoB;IACpB,YAAY,EAAE,MAAM,CAAC;IAErB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,eAAe,CAAC;IAE3B;;;;OAIG;IACH,YAAY,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,CAAC;IAEhC;;;;OAIG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,CAAC;IAElC,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;0EACsE;IACtE,eAAe,CAAC,EAAE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