@dxos/mcp-client 0.8.4-main.cb12b3f963 → 0.8.4-main.dfabb4ec29
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/lib/neutral/index.mjs +25 -19
- package/dist/lib/neutral/index.mjs.map +3 -3
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/types/src/McpToolkit.d.ts +6 -6
- package/dist/types/src/McpToolkit.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/McpToolkit.test.ts +3 -3
- package/src/McpToolkit.ts +34 -27
|
@@ -21,10 +21,10 @@ import * as Effect from "effect/Effect";
|
|
|
21
21
|
import * as Schema from "effect/Schema";
|
|
22
22
|
import { OpaqueToolkit } from "@dxos/ai";
|
|
23
23
|
import { invariant } from "@dxos/invariant";
|
|
24
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/core/mcp-client/src/McpToolkit.ts";
|
|
24
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/core/compute/mcp-client/src/McpToolkit.ts";
|
|
25
25
|
var McpConnectionError = class extends Schema.TaggedError("McpConnectionError")("McpConnectionError", {
|
|
26
26
|
url: Schema.String,
|
|
27
|
-
|
|
27
|
+
protocol: Schema.Literal("sse", "http"),
|
|
28
28
|
message: Schema.String
|
|
29
29
|
}) {
|
|
30
30
|
};
|
|
@@ -33,12 +33,12 @@ var CLIENT_INFO = {
|
|
|
33
33
|
version: "0.8.3"
|
|
34
34
|
};
|
|
35
35
|
var make3 = (options) => Effect.gen(function* () {
|
|
36
|
-
const client = yield* connectWithFallback(options);
|
|
36
|
+
const { client, protocol } = yield* connectWithFallback(options);
|
|
37
37
|
const { tools } = yield* Effect.tryPromise({
|
|
38
38
|
try: () => client.listTools(),
|
|
39
39
|
catch: (cause) => new McpConnectionError({
|
|
40
40
|
url: options.url,
|
|
41
|
-
|
|
41
|
+
protocol,
|
|
42
42
|
message: `Failed to list MCP tools: ${formatCause(cause)}`
|
|
43
43
|
})
|
|
44
44
|
});
|
|
@@ -87,31 +87,37 @@ var is405 = (error) => {
|
|
|
87
87
|
return cause instanceof Error && cause.message.includes("405");
|
|
88
88
|
};
|
|
89
89
|
var connectWithFallback = (options) => Effect.gen(function* () {
|
|
90
|
-
const
|
|
91
|
-
const primary = yield* connectClient(options.url, options.
|
|
90
|
+
const fallbackProtocol = options.protocol === "sse" ? "http" : "sse";
|
|
91
|
+
const primary = yield* connectClient(options.url, options.protocol, options.apiKey).pipe(Effect.either);
|
|
92
92
|
if (primary._tag === "Right") {
|
|
93
|
-
return
|
|
93
|
+
return {
|
|
94
|
+
client: primary.right,
|
|
95
|
+
protocol: options.protocol
|
|
96
|
+
};
|
|
94
97
|
}
|
|
95
98
|
if (is405(primary.left)) {
|
|
96
|
-
const fallback = yield* connectClient(options.url,
|
|
99
|
+
const fallback = yield* connectClient(options.url, fallbackProtocol, options.apiKey).pipe(Effect.either);
|
|
97
100
|
if (fallback._tag === "Right") {
|
|
98
|
-
return
|
|
101
|
+
return {
|
|
102
|
+
client: fallback.right,
|
|
103
|
+
protocol: fallbackProtocol
|
|
104
|
+
};
|
|
99
105
|
}
|
|
100
106
|
return yield* Effect.fail(new McpConnectionError({
|
|
101
107
|
url: options.url,
|
|
102
|
-
|
|
103
|
-
message: `Failed to connect via ${
|
|
108
|
+
protocol: fallbackProtocol,
|
|
109
|
+
message: `Failed to connect via ${fallbackProtocol} after 405 fallback: ${formatCause(fallback.left)}`
|
|
104
110
|
}));
|
|
105
111
|
}
|
|
106
112
|
return yield* Effect.fail(new McpConnectionError({
|
|
107
113
|
url: options.url,
|
|
108
|
-
|
|
109
|
-
message: `Failed to connect via ${options.
|
|
114
|
+
protocol: options.protocol,
|
|
115
|
+
message: `Failed to connect via ${options.protocol}: ${formatCause(primary.left)}`
|
|
110
116
|
}));
|
|
111
117
|
});
|
|
112
|
-
var connectClient = (url,
|
|
118
|
+
var connectClient = (url, protocol, apiKey) => Effect.tryPromise(() => {
|
|
113
119
|
const client = new Client(CLIENT_INFO);
|
|
114
|
-
const transport = createTransport(url,
|
|
120
|
+
const transport = createTransport(url, protocol, apiKey);
|
|
115
121
|
return client.connect(transport).then(() => client);
|
|
116
122
|
});
|
|
117
123
|
var formatCause = (error) => {
|
|
@@ -124,14 +130,14 @@ var formatCause = (error) => {
|
|
|
124
130
|
}
|
|
125
131
|
return String(inner);
|
|
126
132
|
};
|
|
127
|
-
var createTransport = (url,
|
|
133
|
+
var createTransport = (url, protocol, apiKey) => {
|
|
128
134
|
const urlObj = new URL(url);
|
|
129
135
|
const requestInit = apiKey ? {
|
|
130
136
|
headers: {
|
|
131
137
|
Authorization: `Bearer ${apiKey}`
|
|
132
138
|
}
|
|
133
139
|
} : void 0;
|
|
134
|
-
switch (
|
|
140
|
+
switch (protocol) {
|
|
135
141
|
case "sse":
|
|
136
142
|
return new SSEClientTransport(urlObj, {
|
|
137
143
|
requestInit
|
|
@@ -141,8 +147,8 @@ var createTransport = (url, kind, apiKey) => {
|
|
|
141
147
|
requestInit
|
|
142
148
|
});
|
|
143
149
|
default: {
|
|
144
|
-
const _exhaustive =
|
|
145
|
-
return invariant(false, `Unsupported MCP transport
|
|
150
|
+
const _exhaustive = protocol;
|
|
151
|
+
return invariant(false, `Unsupported MCP transport protocol: ${_exhaustive}`, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 169, S: void 0, A: ["false", "`Unsupported MCP transport protocol: ${_exhaustive}`"] });
|
|
146
152
|
}
|
|
147
153
|
}
|
|
148
154
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/McpToolkit.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Tool from '@effect/ai/Tool';\nimport * as Toolkit from '@effect/ai/Toolkit';\nimport { Client } from '@modelcontextprotocol/sdk/client/index.js';\nimport { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';\nimport { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';\nimport * as Cause from 'effect/Cause';\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { OpaqueToolkit } from '@dxos/ai';\nimport { invariant } from '@dxos/invariant';\n\
|
|
5
|
-
"mappings": ";;;;;;;AAAA;;;;cAAAA;;AAMA,YAAYC,UAAU;AACtB,YAAYC,aAAa;AACzB,SAASC,cAAc;
|
|
6
|
-
"names": ["make", "Tool", "Toolkit", "Client", "SSEClientTransport", "StreamableHTTPClientTransport", "Cause", "Effect", "Schema", "OpaqueToolkit", "invariant", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Tool from '@effect/ai/Tool';\nimport * as Toolkit from '@effect/ai/Toolkit';\nimport { Client } from '@modelcontextprotocol/sdk/client/index.js';\n// SSEClientTransport is marked @deprecated in the SDK in favor of StreamableHTTP, but the\n// SDK itself notes that clients should keep supporting both while servers migrate.\n// `connectWithFallback` below tries the configured protocol first, then the other on 405.\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nimport { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';\nimport { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';\nimport * as Cause from 'effect/Cause';\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { OpaqueToolkit } from '@dxos/ai';\nimport { invariant } from '@dxos/invariant';\n\n/**\n * Typed failure raised when the MCP client cannot connect or list tools.\n * Carries the underlying cause and the server URL for diagnostics.\n */\nexport class McpConnectionError extends Schema.TaggedError<McpConnectionError>('McpConnectionError')(\n 'McpConnectionError',\n {\n url: Schema.String,\n protocol: Schema.Literal('sse', 'http'),\n message: Schema.String,\n },\n) {}\n\n/**\n * Creates an OpaqueToolkit that connects to an MCP server and exposes its tools to the assistant.\n *\n * @param options MCP server URL and transport protocol ('http' for Streamable HTTP, 'sse' for SSE).\n * @returns An OpaqueToolkit containing all tools from the MCP server.\n */\nconst CLIENT_INFO = { name: '@dxos/mcp-client', version: '0.8.3' };\n\nexport interface McpToolkitOptions {\n url: string;\n protocol: 'sse' | 'http';\n apiKey?: string;\n}\n\nexport const make = (options: McpToolkitOptions): Effect.Effect<OpaqueToolkit.OpaqueToolkit, McpConnectionError> =>\n Effect.gen(function* () {\n const { client, protocol } = yield* connectWithFallback(options);\n\n const { tools } = yield* Effect.tryPromise({\n try: () => client.listTools(),\n catch: (cause) =>\n new McpConnectionError({\n url: options.url,\n protocol,\n message: `Failed to list MCP tools: ${formatCause(cause)}`,\n }),\n });\n if (tools.length === 0) {\n return OpaqueToolkit.empty;\n }\n\n const effectTools = tools.map((mcpTool) => {\n const parameters: any = {};\n for (const [key, value] of Object.entries(mcpTool.inputSchema.properties ?? {})) {\n if (mcpTool.inputSchema.required?.includes(key)) {\n parameters[key] = Schema.Unknown.pipe(Schema.annotations({ jsonSchema: value }));\n } else {\n parameters[key] = Schema.Unknown.pipe(Schema.annotations({ jsonSchema: value })).pipe(Schema.optional);\n }\n }\n\n return Tool.make(sanitizeToolName(mcpTool.name), {\n description: mcpTool.description ?? `MCP tool: ${mcpTool.name}`,\n parameters,\n success: Schema.String,\n failure: Schema.Never,\n });\n });\n\n const toolkit = Toolkit.make(...effectTools);\n\n const handlers = Object.fromEntries(\n tools.map((mcpTool) => {\n const toolName = sanitizeToolName(mcpTool.name);\n return [\n toolName,\n Effect.fn(function* (args: unknown) {\n const result = yield* Effect.promise(() =>\n client.callTool({\n name: mcpTool.name,\n arguments: args as any,\n }),\n );\n return formatToolResult(result);\n }),\n ];\n }),\n ) as any;\n\n const layer = toolkit.toLayer(handlers);\n\n return OpaqueToolkit.make(toolkit, layer);\n }).pipe(Effect.withSpan('McpToolkit.make'));\n\n/**\n * Returns true when the error (or its wrapped cause) contains a 405 status code.\n * `Effect.tryPromise` wraps thrown errors in `UnknownException`, so we unwrap first.\n */\nexport const is405 = (error: unknown): boolean => {\n const cause = error != null && typeof error === 'object' && 'error' in error ? (error as any).error : error;\n return cause instanceof Error && cause.message.includes('405');\n};\n\n/**\n * Connects to an MCP server, falling back to the alternate transport on 405 errors.\n * Per the MCP spec, a 405 indicates the server uses the other transport protocol.\n * Returns the connected Client (a fresh instance is created for the fallback attempt).\n *\n * Failures are surfaced as typed `McpConnectionError` so callers can recover (e.g. drop\n * the misconfigured server) without breaking the surrounding effect.\n */\nconst connectWithFallback = (\n options: McpToolkitOptions,\n): Effect.Effect<{ client: Client; protocol: McpToolkitOptions['protocol'] }, McpConnectionError> =>\n Effect.gen(function* () {\n const fallbackProtocol = options.protocol === 'sse' ? 'http' : 'sse';\n const primary = yield* connectClient(options.url, options.protocol, options.apiKey).pipe(Effect.either);\n if (primary._tag === 'Right') {\n return { client: primary.right, protocol: options.protocol };\n }\n if (is405(primary.left)) {\n const fallback = yield* connectClient(options.url, fallbackProtocol, options.apiKey).pipe(Effect.either);\n if (fallback._tag === 'Right') {\n return { client: fallback.right, protocol: fallbackProtocol };\n }\n return yield* Effect.fail(\n new McpConnectionError({\n url: options.url,\n protocol: fallbackProtocol,\n message: `Failed to connect via ${fallbackProtocol} after 405 fallback: ${formatCause(fallback.left)}`,\n }),\n );\n }\n return yield* Effect.fail(\n new McpConnectionError({\n url: options.url,\n protocol: options.protocol,\n message: `Failed to connect via ${options.protocol}: ${formatCause(primary.left)}`,\n }),\n );\n });\n\nconst connectClient = (url: string, protocol: McpToolkitOptions['protocol'], apiKey?: string) =>\n Effect.tryPromise(() => {\n const client = new Client(CLIENT_INFO);\n const transport = createTransport(url, protocol, apiKey);\n return client.connect(transport).then(() => client);\n });\n\n/**\n * Renders a thrown value to a short string for inclusion in error messages.\n * `Effect.tryPromise` wraps thrown errors in `UnknownException`; unwrap when present.\n */\nconst formatCause = (error: unknown): string => {\n const inner = error != null && typeof error === 'object' && 'error' in error ? (error as any).error : error;\n if (inner instanceof Error) {\n return inner.message;\n }\n if (Cause.isCause(error)) {\n return Cause.pretty(error);\n }\n\n return String(inner);\n};\n\n/**\n * Creates a transport for the given MCP server URL and protocol.\n */\nconst createTransport = (\n url: string,\n protocol: McpToolkitOptions['protocol'],\n apiKey?: string,\n): SSEClientTransport | StreamableHTTPClientTransport => {\n const urlObj = new URL(url);\n const requestInit: RequestInit | undefined = apiKey ? { headers: { Authorization: `Bearer ${apiKey}` } } : undefined;\n switch (protocol) {\n case 'sse':\n return new SSEClientTransport(urlObj, { requestInit });\n case 'http':\n return new StreamableHTTPClientTransport(urlObj, { requestInit });\n default: {\n const _exhaustive: never = protocol;\n return invariant(false, `Unsupported MCP transport protocol: ${_exhaustive}`) as never;\n }\n }\n};\n\n/**\n * Sanitizes MCP tool names for use as Effect tool names (replaces / with _).\n */\nconst sanitizeToolName = (name: string): string => name.replace(/\\//g, '_');\n\n/**\n * Formats MCP callTool result content for the assistant.\n */\nconst formatToolResult = (result: Awaited<ReturnType<Client['callTool']>>): string => {\n if ('toolResult' in result && result.toolResult !== undefined) {\n return JSON.stringify(result.toolResult);\n }\n if ('content' in result && Array.isArray(result.content)) {\n return result.content\n .filter((part): part is { type: 'text'; text: string } => part.type === 'text')\n .map((part) => part.text)\n .join('\\n');\n }\n\n return String(result);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAAA;;;;cAAAA;;AAMA,YAAYC,UAAU;AACtB,YAAYC,aAAa;AACzB,SAASC,cAAc;AAKvB,SAASC,0BAA0B;AACnC,SAASC,qCAAqC;AAC9C,YAAYC,WAAW;AACvB,YAAYC,YAAY;AACxB,YAAYC,YAAY;AAExB,SAASC,qBAAqB;AAC9B,SAASC,iBAAiB;AAE1B,IAAA,eAAA;AAQIC,IAAUH,qBAAVG,cAAgC,mBAAA,oBAAA,EAAA,sBAAA;EAChCC,KAASJ;EACX,UAAA,eAAA,OAAA,MAAA;EACC,SAAA;AAEH,CAAA,EAAA;;AAMgDK,IAAAA,cAAS;EAAQ,M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ACIN,WAAMoD,MAAO;;AAEjB,MAAA,cAAA,KAAA,GAAA;AAEA,WAAcD,aAAAA,KAAAA;EAChB;AAEA,SAAA,OAAA,KAAA;;AASE,IAAME,kBAAuCJ,CAAAA,KAAS,UAAA,WAAA;QAAEK,SAAS,IAAA,IAAA,GAAA;sBAAEC,SAAgB;IAAkB,SAAA;MAAMC,eAAAA,UAAAA,MAAAA;IAC3G;MACE;oBACS;;AAA6C,aAAA,IAAA,mBAAA,QAAA;QACjD;MACH,CAAA;;AAA+D,aAAA,IAAA,8BAAA,QAAA;QACjE;MAAS,CAAA;;AAGT,YAAA,cAAA;AACF,aAAA,UAAA,OAAA,uCAAA,WAAA,IAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,KAAA,GAAA,QAAA,GAAA,CAAA,SAAA,sDAAA,EAAA,CAAA;IACF;EAEA;;;IAUI,mBAAqB,CAACC,WAAOC;AAC/B,MAAA,gBAAA,UAAA,OAAA,eAAA,QAAA;AACI,WAAA,KAAA,UAAaD,OAAgBE,UAAQF;;AAKzC,MAAA,aAAA,UAAA,MAAA,QAAA,OAAA,OAAA,GAAA;AAEA,WAAO3B,OAAO2B,QAAAA,OAAAA,CAAAA,SAAAA,KAAAA,SAAAA,MAAAA,EAAAA,IAAAA,CAAAA,SAAAA,KAAAA,IAAAA,EAAAA,KAAAA,IAAAA;EAChB;;;",
|
|
6
|
+
"names": ["make", "Tool", "Toolkit", "Client", "SSEClientTransport", "StreamableHTTPClientTransport", "Cause", "Effect", "Schema", "OpaqueToolkit", "invariant", "protocol", "message", "version", "tools", "tryPromise", "try", "client", "listTools", "catch", "cause", "McpConnectionError", "url", "options", "effectTools", "key", "value", "Object", "entries", "inputSchema", "parameters", "Unknown", "pipe", "annotations", "jsonSchema", "success", "String", "failure", "sanitizeToolName", "mcpTool", "toolName", "name", "arguments", "args", "formatToolResult", "withSpan", "Error", "connectClient", "primary", "is405", "fallback", "_tag", "fallbackProtocol", "transport", "createTransport", "apiKey", "connect", "inner", "isCause", "requestInit", "headers", "Authorization", "undefined", "result", "toolResult", "isArray"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/McpToolkit.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/McpToolkit.ts":{"bytes":26854,"imports":[{"path":"@effect/ai/Tool","kind":"import-statement","external":true},{"path":"@effect/ai/Toolkit","kind":"import-statement","external":true},{"path":"@modelcontextprotocol/sdk/client/index.js","kind":"import-statement","external":true},{"path":"@modelcontextprotocol/sdk/client/sse.js","kind":"import-statement","external":true},{"path":"@modelcontextprotocol/sdk/client/streamableHttp.js","kind":"import-statement","external":true},{"path":"effect/Cause","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":452,"imports":[{"path":"src/McpToolkit.ts","kind":"import-statement","original":"./McpToolkit"}],"format":"esm"}},"outputs":{"dist/lib/neutral/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":12362},"dist/lib/neutral/index.mjs":{"imports":[{"path":"@effect/ai/Tool","kind":"import-statement","external":true},{"path":"@effect/ai/Toolkit","kind":"import-statement","external":true},{"path":"@modelcontextprotocol/sdk/client/index.js","kind":"import-statement","external":true},{"path":"@modelcontextprotocol/sdk/client/sse.js","kind":"import-statement","external":true},{"path":"@modelcontextprotocol/sdk/client/streamableHttp.js","kind":"import-statement","external":true},{"path":"effect/Cause","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"exports":["McpToolkit"],"entryPoint":"src/index.ts","inputs":{"src/McpToolkit.ts":{"bytesInOutput":5642},"src/index.ts":{"bytesInOutput":0}},"bytes":5913}}}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import * as Effect from 'effect/Effect';
|
|
2
2
|
import * as Schema from 'effect/Schema';
|
|
3
3
|
import { OpaqueToolkit } from '@dxos/ai';
|
|
4
|
-
export interface McpToolkitOptions {
|
|
5
|
-
url: string;
|
|
6
|
-
kind: 'sse' | 'http';
|
|
7
|
-
apiKey?: string;
|
|
8
|
-
}
|
|
9
4
|
declare const McpConnectionError_base: Schema.TaggedErrorClass<McpConnectionError, "McpConnectionError", {
|
|
10
5
|
readonly _tag: Schema.tag<"McpConnectionError">;
|
|
11
6
|
} & {
|
|
12
7
|
url: typeof Schema.String;
|
|
13
|
-
|
|
8
|
+
protocol: Schema.Literal<["sse", "http"]>;
|
|
14
9
|
message: typeof Schema.String;
|
|
15
10
|
}>;
|
|
16
11
|
/**
|
|
@@ -19,6 +14,11 @@ declare const McpConnectionError_base: Schema.TaggedErrorClass<McpConnectionErro
|
|
|
19
14
|
*/
|
|
20
15
|
export declare class McpConnectionError extends McpConnectionError_base {
|
|
21
16
|
}
|
|
17
|
+
export interface McpToolkitOptions {
|
|
18
|
+
url: string;
|
|
19
|
+
protocol: 'sse' | 'http';
|
|
20
|
+
apiKey?: string;
|
|
21
|
+
}
|
|
22
22
|
export declare const make: (options: McpToolkitOptions) => Effect.Effect<OpaqueToolkit.OpaqueToolkit, McpConnectionError>;
|
|
23
23
|
/**
|
|
24
24
|
* Returns true when the error (or its wrapped cause) contains a 405 status code.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpToolkit.d.ts","sourceRoot":"","sources":["../../../src/McpToolkit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"McpToolkit.d.ts","sourceRoot":"","sources":["../../../src/McpToolkit.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;;;;;;;;AAGzC;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,uBAOvC;CAAG;AAUJ,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,KAAK,GAAG,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,IAAI,YAAa,iBAAiB,KAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,EAAE,kBAAkB,CA0DlE,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,KAAK,UAAW,OAAO,KAAG,OAGtC,CAAC"}
|