@kernel.chat/kbot 2.22.3 → 2.23.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/a2a.d.ts +131 -0
- package/dist/a2a.d.ts.map +1 -0
- package/dist/a2a.js +504 -0
- package/dist/a2a.js.map +1 -0
- package/dist/guardrails.d.ts +61 -0
- package/dist/guardrails.d.ts.map +1 -0
- package/dist/guardrails.js +447 -0
- package/dist/guardrails.js.map +1 -0
- package/dist/handoffs.d.ts +54 -0
- package/dist/handoffs.d.ts.map +1 -0
- package/dist/handoffs.js +257 -0
- package/dist/handoffs.js.map +1 -0
- package/dist/marketplace.d.ts +55 -0
- package/dist/marketplace.d.ts.map +1 -1
- package/dist/marketplace.js +502 -0
- package/dist/marketplace.js.map +1 -1
- package/dist/tools/browser-agent.d.ts +47 -0
- package/dist/tools/browser-agent.d.ts.map +1 -0
- package/dist/tools/browser-agent.js +509 -0
- package/dist/tools/browser-agent.js.map +1 -0
- package/dist/tools/composio.d.ts +11 -0
- package/dist/tools/composio.d.ts.map +1 -0
- package/dist/tools/composio.js +488 -0
- package/dist/tools/composio.js.map +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +9 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/workflows.d.ts +92 -0
- package/dist/workflows.d.ts.map +1 -0
- package/dist/workflows.js +619 -0
- package/dist/workflows.js.map +1 -0
- package/package.json +1 -1
package/dist/handoffs.js
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
// K:BOT Handoff System — Inter-agent routing and context transfer
|
|
2
|
+
//
|
|
3
|
+
// When a specialist agent detects that a query falls outside its domain,
|
|
4
|
+
// it can hand off to a more appropriate specialist. The handoff system:
|
|
5
|
+
//
|
|
6
|
+
// 1. Detects when a handoff is needed (keyword + confidence signals)
|
|
7
|
+
// 2. Builds context for the receiving agent
|
|
8
|
+
// 3. Executes the handoff (calls runAgent with the target agent)
|
|
9
|
+
// 4. Tracks the handoff chain to prevent infinite loops
|
|
10
|
+
//
|
|
11
|
+
// Maximum chain depth: 3 (source → handoff-1 → handoff-2 → handoff-3)
|
|
12
|
+
// Beyond that, the last agent must produce a final response.
|
|
13
|
+
import { SPECIALISTS } from './agents/specialists.js';
|
|
14
|
+
import { printInfo, printWarn } from './ui.js';
|
|
15
|
+
/** Built-in handoff rules — each defines when agent `from` should hand off to agent `to` */
|
|
16
|
+
const HANDOFF_RULES = [
|
|
17
|
+
// coder → guardian: security concerns in code
|
|
18
|
+
{
|
|
19
|
+
from: 'coder',
|
|
20
|
+
to: 'guardian',
|
|
21
|
+
triggers: [
|
|
22
|
+
/\b(vulnerab|exploit|injection|xss|csrf|auth bypass|privilege escalat|security\s+(?:issue|flaw|hole|risk|concern|review|audit))\b/i,
|
|
23
|
+
/\b(CVE-\d{4}|OWASP|sql\s*inject|command\s*inject|insecure|unsafe\s+deserializ)\b/i,
|
|
24
|
+
/\b(hardcoded\s+(?:password|secret|key|token|credential))\b/i,
|
|
25
|
+
],
|
|
26
|
+
description: 'Security concern detected in code context',
|
|
27
|
+
},
|
|
28
|
+
// coder → aesthete: design / UI questions
|
|
29
|
+
{
|
|
30
|
+
from: 'coder',
|
|
31
|
+
to: 'aesthete',
|
|
32
|
+
triggers: [
|
|
33
|
+
/\b(design|layout|UX|UI|user\s*experience|user\s*interface|accessib|a11y)\b/i,
|
|
34
|
+
/\b(visual|aesthetic|typography|color\s*(?:scheme|palette)|spacing|responsive)\b/i,
|
|
35
|
+
/\b(animation|transition|hover\s*state|interaction\s*design|wireframe|mockup)\b/i,
|
|
36
|
+
],
|
|
37
|
+
description: 'Design or UI/UX question detected',
|
|
38
|
+
},
|
|
39
|
+
// researcher → analyst: data needs strategic interpretation
|
|
40
|
+
{
|
|
41
|
+
from: 'researcher',
|
|
42
|
+
to: 'analyst',
|
|
43
|
+
triggers: [
|
|
44
|
+
/\b(strategic|strategy|evaluate|assessment|trade-?off|comparison|pros?\s+(?:and|&|vs)\s+cons?)\b/i,
|
|
45
|
+
/\b(recommend|decision|choose\s+between|which\s+(?:is|should|would)|cost-?benefit)\b/i,
|
|
46
|
+
/\b(business\s+impact|ROI|market\s+(?:analysis|position|opportunity))\b/i,
|
|
47
|
+
],
|
|
48
|
+
description: 'Research findings need strategic interpretation',
|
|
49
|
+
},
|
|
50
|
+
// any → coder: when response requires code implementation
|
|
51
|
+
{
|
|
52
|
+
from: '*',
|
|
53
|
+
to: 'coder',
|
|
54
|
+
triggers: [
|
|
55
|
+
/\b(implement|code\s+(?:this|that|it|up)|write\s+(?:a |the )?(?:function|class|module|component|script))\b/i,
|
|
56
|
+
/\b(build\s+(?:a |the )?(?:feature|system|api|endpoint|service))\b/i,
|
|
57
|
+
/\b(fix\s+(?:the |this )?(?:bug|error|issue|crash)|debug|refactor|patch)\b/i,
|
|
58
|
+
/\b(create\s+(?:a |the )?(?:file|test|migration|hook|util))\b/i,
|
|
59
|
+
],
|
|
60
|
+
description: 'Task requires code implementation',
|
|
61
|
+
},
|
|
62
|
+
// any → researcher: when response needs fact-checking or citations
|
|
63
|
+
{
|
|
64
|
+
from: '*',
|
|
65
|
+
to: 'researcher',
|
|
66
|
+
triggers: [
|
|
67
|
+
/\b(research|find\s+(?:out|information)|look\s+(?:up|into)|investigate|fact.?check)\b/i,
|
|
68
|
+
/\b(what\s+(?:is|are|does|do)\s+.{3,}\??|source|citation|reference|evidence)\b/i,
|
|
69
|
+
/\b(latest|current|recent|up.?to.?date|state\s+of\s+the\s+art)\b/i,
|
|
70
|
+
],
|
|
71
|
+
description: 'Task requires research or fact-checking',
|
|
72
|
+
},
|
|
73
|
+
// any → guardian: explicit security requests
|
|
74
|
+
{
|
|
75
|
+
from: '*',
|
|
76
|
+
to: 'guardian',
|
|
77
|
+
triggers: [
|
|
78
|
+
/\b(security\s+(?:audit|review|scan|check)|pen\s*test|threat\s+model)\b/i,
|
|
79
|
+
/\b(harden|secure\s+(?:this|the)|check\s+for\s+vulnerab)\b/i,
|
|
80
|
+
],
|
|
81
|
+
description: 'Explicit security review requested',
|
|
82
|
+
},
|
|
83
|
+
// any → writer: content creation requests
|
|
84
|
+
{
|
|
85
|
+
from: '*',
|
|
86
|
+
to: 'writer',
|
|
87
|
+
triggers: [
|
|
88
|
+
/\b(write\s+(?:a |the )?(?:blog|article|post|email|newsletter|docs|readme|changelog))\b/i,
|
|
89
|
+
/\b(draft|compose|summarize|paraphrase|rewrite\s+(?:this|the))\b/i,
|
|
90
|
+
],
|
|
91
|
+
description: 'Content writing task detected',
|
|
92
|
+
},
|
|
93
|
+
// any → infrastructure: deployment / DevOps requests
|
|
94
|
+
{
|
|
95
|
+
from: '*',
|
|
96
|
+
to: 'infrastructure',
|
|
97
|
+
triggers: [
|
|
98
|
+
/\b(deploy|CI\s*\/?\s*CD|pipeline|docker|kubernetes|k8s|terraform|helm)\b/i,
|
|
99
|
+
/\b(infrastructure|infra|devops|monitoring|alerting|scaling|load\s*balanc)\b/i,
|
|
100
|
+
],
|
|
101
|
+
description: 'Infrastructure or deployment task detected',
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
/** Maximum depth of handoff chain to prevent infinite loops */
|
|
105
|
+
const MAX_HANDOFF_DEPTH = 3;
|
|
106
|
+
// ── Detection ──
|
|
107
|
+
/**
|
|
108
|
+
* Analyze if the current agent should hand off to another specialist.
|
|
109
|
+
* Checks the response and original query against handoff rules.
|
|
110
|
+
*
|
|
111
|
+
* Returns a Handoff object if a handoff is recommended, null otherwise.
|
|
112
|
+
*/
|
|
113
|
+
export function detectHandoff(agentId, response, query) {
|
|
114
|
+
// Combine response and query for analysis
|
|
115
|
+
const combined = `${query}\n${response}`;
|
|
116
|
+
// Find matching rules (agent-specific first, then wildcard)
|
|
117
|
+
let bestMatch = null;
|
|
118
|
+
for (const rule of HANDOFF_RULES) {
|
|
119
|
+
// Skip rules that don't apply to this agent
|
|
120
|
+
if (rule.from !== '*' && rule.from !== agentId)
|
|
121
|
+
continue;
|
|
122
|
+
// Don't hand off to yourself
|
|
123
|
+
if (rule.to === agentId)
|
|
124
|
+
continue;
|
|
125
|
+
// Don't hand off to an agent that doesn't exist
|
|
126
|
+
if (!SPECIALISTS[rule.to])
|
|
127
|
+
continue;
|
|
128
|
+
// Count trigger matches
|
|
129
|
+
const matchCount = rule.triggers.filter(t => t.test(combined)).length;
|
|
130
|
+
if (matchCount === 0)
|
|
131
|
+
continue;
|
|
132
|
+
// Prefer agent-specific rules over wildcards
|
|
133
|
+
const priority = rule.from === '*' ? matchCount : matchCount + 2;
|
|
134
|
+
if (!bestMatch || priority > bestMatch.matchCount) {
|
|
135
|
+
bestMatch = { rule, matchCount: priority };
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Require at least 1 trigger match for agent-specific rules,
|
|
139
|
+
// or 2 trigger matches for wildcard rules
|
|
140
|
+
if (!bestMatch)
|
|
141
|
+
return null;
|
|
142
|
+
const isWildcard = bestMatch.rule.from === '*';
|
|
143
|
+
if (isWildcard && bestMatch.matchCount < 2)
|
|
144
|
+
return null;
|
|
145
|
+
return {
|
|
146
|
+
from: agentId,
|
|
147
|
+
to: bestMatch.rule.to,
|
|
148
|
+
reason: bestMatch.rule.description,
|
|
149
|
+
context: buildHandoffContext('', {
|
|
150
|
+
from: agentId,
|
|
151
|
+
to: bestMatch.rule.to,
|
|
152
|
+
reason: bestMatch.rule.description,
|
|
153
|
+
context: query,
|
|
154
|
+
preserveHistory: true,
|
|
155
|
+
}),
|
|
156
|
+
preserveHistory: true,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
// ── Context building ──
|
|
160
|
+
/**
|
|
161
|
+
* Build the context string for the receiving agent.
|
|
162
|
+
* Includes a handoff header, the accumulated context, and the reason.
|
|
163
|
+
*/
|
|
164
|
+
export function buildHandoffContext(currentContext, handoff) {
|
|
165
|
+
const fromAgent = SPECIALISTS[handoff.from];
|
|
166
|
+
const fromName = fromAgent ? fromAgent.name : handoff.from;
|
|
167
|
+
const parts = [];
|
|
168
|
+
parts.push(`[Handoff from ${fromName}]`);
|
|
169
|
+
parts.push(`Reason: ${handoff.reason}`);
|
|
170
|
+
if (currentContext) {
|
|
171
|
+
parts.push('');
|
|
172
|
+
parts.push('Previous context:');
|
|
173
|
+
parts.push(currentContext);
|
|
174
|
+
}
|
|
175
|
+
if (handoff.context) {
|
|
176
|
+
parts.push('');
|
|
177
|
+
parts.push('Handoff context:');
|
|
178
|
+
parts.push(handoff.context);
|
|
179
|
+
}
|
|
180
|
+
return parts.join('\n');
|
|
181
|
+
}
|
|
182
|
+
// ── Execution ──
|
|
183
|
+
/**
|
|
184
|
+
* Execute a handoff: call runAgent with the target agent and built context.
|
|
185
|
+
* Tracks the handoff chain and enforces maximum depth.
|
|
186
|
+
*
|
|
187
|
+
* The runAgent function is passed as a parameter to avoid circular imports
|
|
188
|
+
* (agent.ts imports from many modules, and those modules should not import agent.ts).
|
|
189
|
+
*/
|
|
190
|
+
export async function executeHandoff(handoff, query, runAgentFn, chain = []) {
|
|
191
|
+
// Enforce max depth
|
|
192
|
+
// chain contains [from, to, from, to, ...] — each handoff adds 2 entries
|
|
193
|
+
const handoffCount = Math.floor(chain.length / 2);
|
|
194
|
+
if (handoffCount >= MAX_HANDOFF_DEPTH) {
|
|
195
|
+
printWarn(`[handoff] Maximum chain depth (${MAX_HANDOFF_DEPTH}) reached: ${chain.join(' -> ')}. ` +
|
|
196
|
+
`Stopping at ${chain[chain.length - 1]}.`);
|
|
197
|
+
return {
|
|
198
|
+
agent: chain[chain.length - 1] || handoff.from,
|
|
199
|
+
response: `Handoff chain limit reached. The last agent in the chain should provide the final response.`,
|
|
200
|
+
handoffChain: chain,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
const newChain = [...chain, handoff.from, handoff.to];
|
|
204
|
+
const toAgent = SPECIALISTS[handoff.to];
|
|
205
|
+
const toName = toAgent ? toAgent.name : handoff.to;
|
|
206
|
+
printInfo(`[handoff] ${SPECIALISTS[handoff.from]?.name || handoff.from} -> ${toName}: ${handoff.reason}`);
|
|
207
|
+
try {
|
|
208
|
+
// Build prefixed query with handoff context
|
|
209
|
+
const contextualQuery = handoff.preserveHistory
|
|
210
|
+
? `${handoff.context}\n\nUser query: ${query}`
|
|
211
|
+
: query;
|
|
212
|
+
const result = await runAgentFn(contextualQuery, {
|
|
213
|
+
agent: handoff.to,
|
|
214
|
+
});
|
|
215
|
+
// Check if the receiving agent also wants to hand off
|
|
216
|
+
const nextHandoff = detectHandoff(handoff.to, result.content, query);
|
|
217
|
+
const newHandoffCount = Math.floor(newChain.length / 2);
|
|
218
|
+
if (nextHandoff && newHandoffCount < MAX_HANDOFF_DEPTH) {
|
|
219
|
+
// Prevent cycles: don't hand off back to an agent already in the chain
|
|
220
|
+
if (newChain.includes(nextHandoff.to)) {
|
|
221
|
+
printInfo(`[handoff] Cycle detected (${nextHandoff.to} already in chain). Stopping.`);
|
|
222
|
+
return {
|
|
223
|
+
agent: handoff.to,
|
|
224
|
+
response: result.content,
|
|
225
|
+
handoffChain: newChain,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
return executeHandoff(nextHandoff, query, runAgentFn, newChain);
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
agent: handoff.to,
|
|
232
|
+
response: result.content,
|
|
233
|
+
handoffChain: newChain,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
catch (err) {
|
|
237
|
+
printWarn(`[handoff] Failed to hand off to ${toName}: ${err instanceof Error ? err.message : String(err)}`);
|
|
238
|
+
return {
|
|
239
|
+
agent: handoff.from,
|
|
240
|
+
response: `Handoff to ${toName} failed. Continuing with ${SPECIALISTS[handoff.from]?.name || handoff.from}.`,
|
|
241
|
+
handoffChain: [...chain, handoff.from],
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Get all available handoff rules (for diagnostics / UI).
|
|
247
|
+
*/
|
|
248
|
+
export function getHandoffRules() {
|
|
249
|
+
return HANDOFF_RULES;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Check if an agent ID is a valid specialist that can participate in handoffs.
|
|
253
|
+
*/
|
|
254
|
+
export function isHandoffTarget(agentId) {
|
|
255
|
+
return agentId in SPECIALISTS;
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=handoffs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handoffs.js","sourceRoot":"","sources":["../src/handoffs.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,yEAAyE;AACzE,wEAAwE;AACxE,EAAE;AACF,uEAAuE;AACvE,8CAA8C;AAC9C,mEAAmE;AACnE,0DAA0D;AAC1D,EAAE;AACF,sEAAsE;AACtE,6DAA6D;AAE7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AA2B9C,4FAA4F;AAC5F,MAAM,aAAa,GAAkB;IACnC,8CAA8C;IAC9C;QACE,IAAI,EAAE,OAAO;QACb,EAAE,EAAE,UAAU;QACd,QAAQ,EAAE;YACR,mIAAmI;YACnI,mFAAmF;YACnF,6DAA6D;SAC9D;QACD,WAAW,EAAE,2CAA2C;KACzD;IAED,0CAA0C;IAC1C;QACE,IAAI,EAAE,OAAO;QACb,EAAE,EAAE,UAAU;QACd,QAAQ,EAAE;YACR,6EAA6E;YAC7E,kFAAkF;YAClF,iFAAiF;SAClF;QACD,WAAW,EAAE,mCAAmC;KACjD;IAED,4DAA4D;IAC5D;QACE,IAAI,EAAE,YAAY;QAClB,EAAE,EAAE,SAAS;QACb,QAAQ,EAAE;YACR,kGAAkG;YAClG,sFAAsF;YACtF,yEAAyE;SAC1E;QACD,WAAW,EAAE,iDAAiD;KAC/D;IAED,0DAA0D;IAC1D;QACE,IAAI,EAAE,GAAG;QACT,EAAE,EAAE,OAAO;QACX,QAAQ,EAAE;YACR,4GAA4G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matrix.js';
|
|
1
2
|
export interface RegistryEntry {
|
|
2
3
|
name: string;
|
|
3
4
|
description: string;
|
|
@@ -22,4 +23,58 @@ export declare function listInstalled(): InstalledPlugin[];
|
|
|
22
23
|
export declare function updatePlugin(name: string): Promise<InstalledPlugin | null>;
|
|
23
24
|
export declare function formatRegistryResults(entries: RegistryEntry[]): string;
|
|
24
25
|
export declare function formatInstalledList(plugins: InstalledPlugin[]): string;
|
|
26
|
+
export interface MarketplaceAgentConfig {
|
|
27
|
+
name: string;
|
|
28
|
+
icon: string;
|
|
29
|
+
color: string;
|
|
30
|
+
systemPrompt: string;
|
|
31
|
+
}
|
|
32
|
+
export interface MarketplaceAgent {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
description: string;
|
|
36
|
+
author: string;
|
|
37
|
+
version: string;
|
|
38
|
+
downloads: number;
|
|
39
|
+
rating: number;
|
|
40
|
+
tags: string[];
|
|
41
|
+
agentConfig: MarketplaceAgentConfig;
|
|
42
|
+
createdAt: string;
|
|
43
|
+
updatedAt: string;
|
|
44
|
+
}
|
|
45
|
+
export interface MarketplaceManifest {
|
|
46
|
+
agents: MarketplaceAgent[];
|
|
47
|
+
lastUpdated: string;
|
|
48
|
+
}
|
|
49
|
+
export interface InstalledMarketplaceAgent {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
version: string;
|
|
53
|
+
author: string;
|
|
54
|
+
installedAt: string;
|
|
55
|
+
}
|
|
56
|
+
/** Fetch the agent marketplace registry. Uses cached version if within TTL, falls back to bundled agents. */
|
|
57
|
+
export declare function fetchRegistry(): Promise<MarketplaceManifest>;
|
|
58
|
+
/** Search marketplace agents by name, description, or tags. */
|
|
59
|
+
export declare function searchMarketplace(query: string): Promise<MarketplaceAgent[]>;
|
|
60
|
+
/** Install a marketplace agent into the local matrix. */
|
|
61
|
+
export declare function installAgent(agentId: string): Promise<MatrixAgent>;
|
|
62
|
+
/** Package a local matrix agent for publishing to the marketplace. Outputs JSON for the user to submit as a PR. */
|
|
63
|
+
export declare function publishAgent(agent: MatrixAgent, opts: {
|
|
64
|
+
description: string;
|
|
65
|
+
author: string;
|
|
66
|
+
version?: string;
|
|
67
|
+
tags?: string[];
|
|
68
|
+
}): {
|
|
69
|
+
json: string;
|
|
70
|
+
filePath: string;
|
|
71
|
+
};
|
|
72
|
+
/** List all marketplace agents installed locally. */
|
|
73
|
+
export declare function listInstalledAgents(): InstalledMarketplaceAgent[];
|
|
74
|
+
/** Uninstall a marketplace agent. Removes from local tracking and the matrix. */
|
|
75
|
+
export declare function uninstallAgent(agentId: string): boolean;
|
|
76
|
+
export declare function formatMarketplaceResults(agents: MarketplaceAgent[]): string;
|
|
77
|
+
export declare function formatInstalledAgentsList(agents: InstalledMarketplaceAgent[]): string;
|
|
78
|
+
/** Register marketplace tools so the agent can search and install marketplace agents during conversations. */
|
|
79
|
+
export declare function registerMarketplaceTools(): void;
|
|
25
80
|
//# sourceMappingURL=marketplace.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marketplace.d.ts","sourceRoot":"","sources":["../src/marketplace.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"marketplace.d.ts","sourceRoot":"","sources":["../src/marketplace.ts"],"names":[],"mappings":"AAKA,OAAO,EAAsC,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAOlF,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,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