@mcoda/agents 0.1.9 → 0.1.10

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.
@@ -13,11 +13,12 @@ export declare class AgentService {
13
13
  private getDecryptedSecret;
14
14
  private buildAdapterConfig;
15
15
  private resolveAdapterType;
16
- getAdapter(agent: Agent): Promise<AgentAdapter>;
16
+ getAdapter(agent: Agent, adapterOverride?: string): Promise<AgentAdapter>;
17
17
  healthCheck(agentId: string): Promise<AgentHealth>;
18
18
  invoke(agentId: string, request: InvocationRequest): Promise<InvocationResult>;
19
19
  invokeStream(agentId: string, request: InvocationRequest): Promise<AsyncGenerator<InvocationResult>>;
20
20
  private applyGatewayHandoff;
21
+ private recordInvocationFailure;
21
22
  private applyDocdexGuidance;
22
23
  }
23
24
  //# sourceMappingURL=AgentService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentService.d.ts","sourceRoot":"","sources":["../../src/AgentService/AgentService.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzG,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAU7C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAuGhG,qBAAa,YAAY;IACX,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,gBAAgB;WAE7B,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;IAKtC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAUhD,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAIrE,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IA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AAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;YAIpD,kBAAkB;YAMlB,kBAAkB;IA6BhC,OAAO,CAAC,kBAAkB;IA+BpB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAyCzE,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAmBlD,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAyB9E,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;YAyC5F,mBAAmB;YAkBnB,uBAAuB;YAwBvB,mBAAmB;CAYlC"}
@@ -6,13 +6,14 @@ import { GlobalRepository } from "@mcoda/db";
6
6
  import { CodexAdapter } from "../adapters/codex/CodexAdapter.js";
7
7
  import { GeminiAdapter } from "../adapters/gemini/GeminiAdapter.js";
8
8
  import { LocalAdapter } from "../adapters/local/LocalAdapter.js";
9
+ import { CodaliAdapter } from "../adapters/codali/CodaliAdapter.js";
9
10
  import { OllamaRemoteAdapter } from "../adapters/ollama/OllamaRemoteAdapter.js";
10
11
  import { OllamaCliAdapter } from "../adapters/ollama/OllamaCliAdapter.js";
11
12
  import { OpenAiAdapter } from "../adapters/openai/OpenAiAdapter.js";
12
13
  import { OpenAiCliAdapter } from "../adapters/openai/OpenAiCliAdapter.js";
13
14
  import { ZhipuApiAdapter } from "../adapters/zhipu/ZhipuApiAdapter.js";
14
15
  import { QaAdapter } from "../adapters/qa/QaAdapter.js";
15
- const CLI_BASED_ADAPTERS = new Set(["codex-cli", "gemini-cli", "openai-cli", "ollama-cli"]);
16
+ const CLI_BASED_ADAPTERS = new Set(["codex-cli", "gemini-cli", "openai-cli", "ollama-cli", "codali-cli"]);
16
17
  const LOCAL_ADAPTERS = new Set(["local-model"]);
17
18
  const SUPPORTED_ADAPTERS = new Set([
18
19
  "openai-api",
@@ -24,21 +25,22 @@ const SUPPORTED_ADAPTERS = new Set([
24
25
  "qa-cli",
25
26
  "ollama-remote",
26
27
  "ollama-cli",
28
+ "codali-cli",
27
29
  ]);
28
30
  const DEFAULT_JOB_PROMPT = "You are an mcoda agent that follows workspace runbooks and responds with actionable, concise output.";
29
31
  const DEFAULT_CHARACTER_PROMPT = "Write clearly, avoid hallucinations, cite assumptions, and prioritize risk mitigation for the user.";
30
32
  const HANDOFF_ENV_INLINE = "MCODA_GATEWAY_HANDOFF";
31
33
  const HANDOFF_ENV_PATH = "MCODA_GATEWAY_HANDOFF_PATH";
32
34
  const HANDOFF_HEADER = "[Gateway handoff]";
33
- const MAX_HANDOFF_CHARS = 8000;
34
35
  const IO_ENV = "MCODA_STREAM_IO";
35
36
  const IO_PROMPT_ENV = "MCODA_STREAM_IO_PROMPT";
36
37
  const IO_PREFIX = "[agent-io]";
37
38
  const DOCDEX_GUIDANCE_HEADER = "[Docdex guidance]";
38
- const DOCDEX_GUIDANCE_MAX_CHARS = 12000;
39
39
  const DOCDEX_GUIDANCE_PATH = path.join(os.homedir(), ".docdex", "agents.md");
40
40
  let docdexGuidanceCache;
41
41
  let docdexGuidanceLoaded = false;
42
+ const DOCDEX_JSON_ONLY_MARKERS = [/output json only/i, /return json only/i, /no prose, no analysis/i];
43
+ const HANDOFF_END_MARKERS = [/^\s*END OF FILE\s*$/i, /^\s*\*\*\* End of File\s*$/i];
42
44
  const isIoEnabled = () => {
43
45
  const raw = process.env[IO_ENV];
44
46
  if (!raw)
@@ -53,9 +55,19 @@ const isIoPromptEnabled = () => {
53
55
  const normalized = raw.trim().toLowerCase();
54
56
  return !["0", "false", "off", "no"].includes(normalized);
55
57
  };
58
+ let ioWriteQueue = Promise.resolve();
56
59
  const emitIoLine = (line) => {
57
60
  const normalized = line.endsWith("\n") ? line : `${line}\n`;
58
- process.stderr.write(normalized);
61
+ ioWriteQueue = ioWriteQueue
62
+ .then(() => new Promise((resolve) => {
63
+ try {
64
+ process.stderr.write(normalized, () => resolve());
65
+ }
66
+ catch {
67
+ resolve();
68
+ }
69
+ }))
70
+ .catch(() => { });
59
71
  };
60
72
  const renderIoHeader = (agent, request, mode) => {
61
73
  emitIoLine(`${IO_PREFIX} begin agent=${agent.slug ?? agent.id} adapter=${agent.adapter} model=${agent.defaultModel ?? "default"} mode=${mode}`);
@@ -72,23 +84,58 @@ const renderIoChunk = (chunk) => {
72
84
  emitIoLine(`${IO_PREFIX} output ${chunk.output}`);
73
85
  }
74
86
  };
87
+ const createStreamIoRenderer = () => {
88
+ let buffer = "";
89
+ const flushLine = (line) => {
90
+ const cleaned = line.endsWith("\r") ? line.slice(0, -1) : line;
91
+ emitIoLine(`${IO_PREFIX} output ${cleaned}`);
92
+ };
93
+ return {
94
+ push: (chunk) => {
95
+ if (!chunk.output)
96
+ return;
97
+ buffer += chunk.output;
98
+ let newlineIndex = buffer.indexOf("\n");
99
+ while (newlineIndex !== -1) {
100
+ const line = buffer.slice(0, newlineIndex);
101
+ flushLine(line);
102
+ buffer = buffer.slice(newlineIndex + 1);
103
+ newlineIndex = buffer.indexOf("\n");
104
+ }
105
+ },
106
+ flush: () => {
107
+ if (!buffer)
108
+ return;
109
+ flushLine(buffer);
110
+ buffer = "";
111
+ },
112
+ };
113
+ };
75
114
  const renderIoEnd = () => {
76
115
  emitIoLine(`${IO_PREFIX} end`);
77
116
  };
117
+ const stripHandoffEndMarkers = (content) => {
118
+ const lines = content.split(/\r?\n/);
119
+ const filtered = lines.filter((line) => !HANDOFF_END_MARKERS.some((marker) => marker.test(line)));
120
+ return filtered.join("\n").trim();
121
+ };
78
122
  const readGatewayHandoff = async () => {
79
123
  const inline = process.env[HANDOFF_ENV_INLINE];
80
124
  if (inline && inline.trim()) {
81
- return inline.trim().slice(0, MAX_HANDOFF_CHARS);
125
+ const normalized = stripHandoffEndMarkers(inline.trim());
126
+ if (!normalized)
127
+ return undefined;
128
+ return normalized;
82
129
  }
83
130
  const filePath = process.env[HANDOFF_ENV_PATH];
84
131
  if (!filePath)
85
132
  return undefined;
86
133
  try {
87
134
  const content = await fs.readFile(filePath, "utf8");
88
- const trimmed = content.trim();
89
- if (!trimmed)
135
+ const normalized = stripHandoffEndMarkers(content.trim());
136
+ if (!normalized)
90
137
  return undefined;
91
- return trimmed.slice(0, MAX_HANDOFF_CHARS);
138
+ return normalized;
92
139
  }
93
140
  catch {
94
141
  return undefined;
@@ -103,13 +150,32 @@ const readDocdexGuidance = async () => {
103
150
  const trimmed = content.trim();
104
151
  if (!trimmed)
105
152
  return undefined;
106
- docdexGuidanceCache = trimmed.slice(0, DOCDEX_GUIDANCE_MAX_CHARS);
153
+ docdexGuidanceCache = trimmed;
107
154
  return docdexGuidanceCache;
108
155
  }
109
156
  catch {
110
157
  return undefined;
111
158
  }
112
159
  };
160
+ const stripJsonOnlyGuidance = (guidance) => {
161
+ const lines = guidance.split(/\r?\n/);
162
+ const filtered = lines.filter((line) => !DOCDEX_JSON_ONLY_MARKERS.some((marker) => marker.test(line)));
163
+ return filtered.join("\n").trim();
164
+ };
165
+ const normalizeDocdexGuidanceInput = (input, prefix) => {
166
+ const trimmed = input.trimStart();
167
+ if (!trimmed.startsWith(DOCDEX_GUIDANCE_HEADER)) {
168
+ return `${prefix}${input}`;
169
+ }
170
+ if (!trimmed.startsWith(prefix)) {
171
+ return trimmed;
172
+ }
173
+ let remainder = trimmed.slice(prefix.length);
174
+ while (remainder.startsWith(prefix)) {
175
+ remainder = remainder.slice(prefix.length);
176
+ }
177
+ return `${prefix}${remainder}`;
178
+ };
113
179
  export class AgentService {
114
180
  constructor(repo) {
115
181
  this.repo = repo;
@@ -172,12 +238,12 @@ export class AgentService {
172
238
  authMetadata,
173
239
  };
174
240
  }
175
- resolveAdapterType(agent, apiKey) {
241
+ resolveAdapterType(agent, apiKey, adapterOverride) {
176
242
  const hasSecret = Boolean(apiKey);
177
243
  const config = agent.config;
178
244
  const cliAdapter = config?.cliAdapter;
179
245
  const localAdapter = config?.localAdapter;
180
- let adapterType = agent.adapter;
246
+ let adapterType = adapterOverride?.trim() || agent.adapter;
181
247
  if (!SUPPORTED_ADAPTERS.has(adapterType)) {
182
248
  throw new Error(`Unsupported adapter type: ${adapterType}`);
183
249
  }
@@ -203,9 +269,9 @@ export class AgentService {
203
269
  }
204
270
  return adapterType;
205
271
  }
206
- async getAdapter(agent) {
272
+ async getAdapter(agent, adapterOverride) {
207
273
  const config = await this.buildAdapterConfig(agent);
208
- const adapterType = this.resolveAdapterType(agent, config.apiKey);
274
+ const adapterType = this.resolveAdapterType(agent, config.apiKey, adapterOverride);
209
275
  const configWithAdapter = { ...config, adapter: adapterType };
210
276
  if (adapterType === "openai-api") {
211
277
  return new OpenAiAdapter(configWithAdapter);
@@ -231,6 +297,9 @@ export class AgentService {
231
297
  if (adapterType === "ollama-cli") {
232
298
  return new OllamaCliAdapter(configWithAdapter);
233
299
  }
300
+ if (adapterType === "codali-cli") {
301
+ return new CodaliAdapter(configWithAdapter);
302
+ }
234
303
  if (adapterType === "gemini-cli") {
235
304
  return new GeminiAdapter(configWithAdapter);
236
305
  }
@@ -260,7 +329,7 @@ export class AgentService {
260
329
  }
261
330
  async invoke(agentId, request) {
262
331
  const agent = await this.resolveAgent(agentId);
263
- const adapter = await this.getAdapter(agent);
332
+ const adapter = await this.getAdapter(agent, request.adapterType);
264
333
  if (!adapter.invoke) {
265
334
  throw new Error("Adapter does not support invoke");
266
335
  }
@@ -270,34 +339,56 @@ export class AgentService {
270
339
  if (ioEnabled) {
271
340
  renderIoHeader(agent, enriched, "invoke");
272
341
  }
273
- const result = await adapter.invoke(enriched);
274
- if (ioEnabled) {
275
- renderIoChunk(result);
276
- renderIoEnd();
342
+ try {
343
+ const result = await adapter.invoke(enriched);
344
+ if (ioEnabled) {
345
+ renderIoChunk(result);
346
+ renderIoEnd();
347
+ }
348
+ return result;
349
+ }
350
+ catch (error) {
351
+ await this.recordInvocationFailure(agent, error);
352
+ throw error;
277
353
  }
278
- return result;
279
354
  }
280
355
  async invokeStream(agentId, request) {
281
356
  const agent = await this.resolveAgent(agentId);
282
- const adapter = await this.getAdapter(agent);
357
+ const adapter = await this.getAdapter(agent, request.adapterType);
283
358
  if (!adapter.invokeStream) {
284
359
  throw new Error("Adapter does not support streaming");
285
360
  }
286
361
  const withDocdex = await this.applyDocdexGuidance(request);
287
362
  const enriched = await this.applyGatewayHandoff(withDocdex);
288
363
  const ioEnabled = isIoEnabled();
289
- const generator = await adapter.invokeStream(enriched);
364
+ let generator;
365
+ try {
366
+ generator = await adapter.invokeStream(enriched);
367
+ }
368
+ catch (error) {
369
+ await this.recordInvocationFailure(agent, error);
370
+ throw error;
371
+ }
372
+ const recordFailure = (error) => this.recordInvocationFailure(agent, error);
290
373
  async function* wrap() {
374
+ const streamIo = ioEnabled ? createStreamIoRenderer() : undefined;
291
375
  if (ioEnabled) {
292
376
  renderIoHeader(agent, enriched, "stream");
293
377
  }
294
- for await (const chunk of generator) {
295
- if (ioEnabled) {
296
- renderIoChunk(chunk);
378
+ try {
379
+ for await (const chunk of generator) {
380
+ if (ioEnabled) {
381
+ streamIo?.push(chunk);
382
+ }
383
+ yield chunk;
297
384
  }
298
- yield chunk;
385
+ }
386
+ catch (error) {
387
+ await recordFailure(error);
388
+ throw error;
299
389
  }
300
390
  if (ioEnabled) {
391
+ streamIo?.flush();
301
392
  renderIoEnd();
302
393
  }
303
394
  }
@@ -307,17 +398,59 @@ export class AgentService {
307
398
  if (request.metadata?.command === "gateway-agent") {
308
399
  return request;
309
400
  }
401
+ const currentInput = request.input ?? "";
402
+ if (currentInput.includes(HANDOFF_HEADER)) {
403
+ return request;
404
+ }
405
+ if (request.metadata?.gatewayHandoffApplied) {
406
+ return request;
407
+ }
310
408
  const handoff = await readGatewayHandoff();
311
409
  if (!handoff)
312
410
  return request;
313
411
  const suffix = `\n\n${HANDOFF_HEADER}\n${handoff}`;
314
- return { ...request, input: `${request.input ?? ""}${suffix}` };
412
+ const metadata = { ...(request.metadata ?? {}), gatewayHandoffApplied: true };
413
+ return { ...request, input: `${currentInput}${suffix}`, metadata };
414
+ }
415
+ async recordInvocationFailure(agent, error) {
416
+ const adapter = (agent.adapter ?? "").toLowerCase();
417
+ if (adapter !== "ollama-remote")
418
+ return;
419
+ const message = error instanceof Error ? error.message : String(error ?? "");
420
+ if (!/MODEL_NOT_FOUND/i.test(message))
421
+ return;
422
+ const baseUrl = agent.config?.baseUrl;
423
+ const health = {
424
+ agentId: agent.id,
425
+ status: "unreachable",
426
+ lastCheckedAt: new Date().toISOString(),
427
+ details: {
428
+ reason: "model_missing",
429
+ model: agent.defaultModel ?? null,
430
+ baseUrl,
431
+ error: message,
432
+ },
433
+ };
434
+ try {
435
+ await this.repo.setAgentHealth(health);
436
+ }
437
+ catch {
438
+ // ignore health update failures
439
+ }
315
440
  }
316
441
  async applyDocdexGuidance(request) {
317
442
  const guidance = await readDocdexGuidance();
318
443
  if (!guidance)
319
444
  return request;
320
- const prefix = `${DOCDEX_GUIDANCE_HEADER}\n${guidance}\n\n`;
321
- return { ...request, input: `${prefix}${request.input ?? ""}` };
445
+ const command = request.metadata?.command ? String(request.metadata.command) : "";
446
+ const cleaned = command === "gateway-agent" ? guidance : stripJsonOnlyGuidance(guidance);
447
+ if (!cleaned)
448
+ return request;
449
+ const prefix = `${DOCDEX_GUIDANCE_HEADER}\n${cleaned}\n\n`;
450
+ const currentInput = request.input ?? "";
451
+ const nextInput = normalizeDocdexGuidanceInput(currentInput, prefix);
452
+ if (nextInput === currentInput)
453
+ return request;
454
+ return { ...request, input: nextInput };
322
455
  }
323
456
  }
@@ -4,6 +4,16 @@ export interface AdapterConfig {
4
4
  capabilities: string[];
5
5
  model?: string;
6
6
  apiKey?: string;
7
+ provider?: string;
8
+ baseUrl?: string;
9
+ docdexBaseUrl?: string;
10
+ docdexRepoId?: string;
11
+ docdexRepoRoot?: string;
12
+ docdex?: {
13
+ baseUrl?: string;
14
+ repoId?: string;
15
+ repoRoot?: string;
16
+ };
7
17
  prompts?: AgentPromptManifest;
8
18
  authMetadata?: AgentAuthMetadata;
9
19
  adapter?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"AdapterTypes.d.ts","sourceRoot":"","sources":["../../src/adapters/AdapterTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE3F,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,eAAe,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACrC,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IACpC,MAAM,CAAC,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC/D,YAAY,CAAC,CAAC,MAAM,EAAE,iBAAiB,GAAG,cAAc,CAAC,gBAAgB,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;CAC3F;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IACh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BAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC"}
@@ -0,0 +1,19 @@
1
+ import { AgentHealth } from "@mcoda/shared";
2
+ import { AdapterConfig, AgentAdapter, InvocationRequest, InvocationResult } from "../AdapterTypes.js";
3
+ export declare const resolveCodaliProviderFromAdapter: (params: {
4
+ sourceAdapter?: string;
5
+ explicitProvider?: string;
6
+ }) => {
7
+ provider: string;
8
+ sourceAdapter?: string;
9
+ requiresApiKey: boolean;
10
+ };
11
+ export declare class CodaliAdapter implements AgentAdapter {
12
+ private config;
13
+ constructor(config: AdapterConfig);
14
+ getCapabilities(): Promise<string[]>;
15
+ healthCheck(): Promise<AgentHealth>;
16
+ invoke(request: InvocationRequest): Promise<InvocationResult>;
17
+ invokeStream(request: InvocationRequest): AsyncGenerator<InvocationResult, void, unknown>;
18
+ }
19
+ //# sourceMappingURL=CodaliAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodaliAdapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/codali/CodaliAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAyEtG,eAAO,MAAM,gCAAgC,GAAI,QAAQ;IACvD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,KAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,OAAO,CAAA;CAiCtE,CAAC;AAmEF,qBAAa,aAAc,YAAW,YAAY;IACpC,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEnC,eAAe,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAIpC,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;IAanC,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAwE5D,YAAY,CAAC,OAAO,EAAE,iBAAiB,GAAG,cAAc,CAAC,gBAAgB,EAAE,IAAI,EAAE,OAAO,CAAC;CAyEjG"}