@cortexkit/aft-bridge 0.18.5
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/README.md +33 -0
- package/dist/active-logger.d.ts +22 -0
- package/dist/active-logger.d.ts.map +1 -0
- package/dist/bridge.d.ts +146 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/downloader.d.ts +35 -0
- package/dist/downloader.d.ts.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1387 -0
- package/dist/logger.d.ts +28 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/onnx-runtime.d.ts +53 -0
- package/dist/onnx-runtime.d.ts.map +1 -0
- package/dist/platform.d.ts +21 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/pool.d.ts +66 -0
- package/dist/pool.d.ts.map +1 -0
- package/dist/protocol.d.ts +94 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/resolver.d.ts +40 -0
- package/dist/resolver.d.ts.map +1 -0
- package/package.json +35 -0
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @cortexkit/aft-bridge
|
|
2
|
+
|
|
3
|
+
Shared NDJSON transport, binary resolution, and ONNX runtime helpers used by AFT
|
|
4
|
+
agent-host plugins (OpenCode, Pi, and future MCP-based hosts).
|
|
5
|
+
|
|
6
|
+
This package is **not** intended for direct end-user consumption — it powers
|
|
7
|
+
[`@cortexkit/aft-opencode`](https://www.npmjs.com/package/@cortexkit/aft-opencode)
|
|
8
|
+
and [`@cortexkit/aft-pi`](https://www.npmjs.com/package/@cortexkit/aft-pi).
|
|
9
|
+
|
|
10
|
+
## What it owns
|
|
11
|
+
|
|
12
|
+
- **Transport** — `BinaryBridge` (one persistent `aft` child process), `BridgePool`
|
|
13
|
+
(one bridge per canonical project root), wire envelope and push-frame types.
|
|
14
|
+
- **Binary resolution** — versioned cache, npm platform package lookup, PATH /
|
|
15
|
+
cargo fallback, GitHub release download with SHA-256 verification.
|
|
16
|
+
- **ONNX runtime** — auto-download for supported targets, install detection and
|
|
17
|
+
version probing, manual-install hints for unsupported platforms.
|
|
18
|
+
|
|
19
|
+
## What it does not own
|
|
20
|
+
|
|
21
|
+
Host-specific behaviour stays in the plugin packages:
|
|
22
|
+
|
|
23
|
+
- Configuration loading (each host has its own conventions and config paths).
|
|
24
|
+
- Permission UX (`ctx.ask()` and prompt rendering belong to the host SDK).
|
|
25
|
+
- Tool registration and rendering.
|
|
26
|
+
- Notifications, slash commands, and TUI integration.
|
|
27
|
+
- Session-ID lookup and per-request session injection.
|
|
28
|
+
|
|
29
|
+
## Versioning
|
|
30
|
+
|
|
31
|
+
Released in lock-step with `@cortexkit/aft-opencode` and `@cortexkit/aft-pi`.
|
|
32
|
+
The bridge protocol is versioned end-to-end: a plugin running an older bridge
|
|
33
|
+
package will detect a newer `aft` binary and refuse to talk to it.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal helper that lets shared modules call simple `log/warn/error`
|
|
3
|
+
* functions without threading a {@link Logger} through every signature.
|
|
4
|
+
*
|
|
5
|
+
* The host (OpenCode plugin, Pi plugin) calls {@link setActiveLogger} once at
|
|
6
|
+
* startup before constructing any {@link BridgePool}. Internal callers use
|
|
7
|
+
* {@link log}/{@link warn}/{@link error} which forward to the active logger.
|
|
8
|
+
*
|
|
9
|
+
* If no logger has been set, calls fall back to `console.error` so we never
|
|
10
|
+
* silently drop diagnostics.
|
|
11
|
+
*/
|
|
12
|
+
import type { Logger, LogMeta } from "./logger.js";
|
|
13
|
+
export declare function setActiveLogger(logger: Logger): void;
|
|
14
|
+
export declare function getActiveLogger(): Logger | undefined;
|
|
15
|
+
export declare function getLogFilePath(): string | undefined;
|
|
16
|
+
export declare function log(message: string, meta?: LogMeta): void;
|
|
17
|
+
export declare function warn(message: string, meta?: LogMeta): void;
|
|
18
|
+
export declare function error(message: string, meta?: LogMeta): void;
|
|
19
|
+
export declare function sessionLog(sessionId: string | undefined, message: string): void;
|
|
20
|
+
export declare function sessionWarn(sessionId: string | undefined, message: string): void;
|
|
21
|
+
export declare function sessionError(sessionId: string | undefined, message: string): void;
|
|
22
|
+
//# sourceMappingURL=active-logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"active-logger.d.ts","sourceRoot":"","sources":["../src/active-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAInD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEpD;AAED,wBAAgB,eAAe,IAAI,MAAM,GAAG,SAAS,CAEpD;AAED,wBAAgB,cAAc,IAAI,MAAM,GAAG,SAAS,CAEnD;AAED,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAMzD;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAM1D;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAM3D;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAE/E;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAEhF;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAEjF"}
|
package/dist/bridge.d.ts
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { BgCompletion } from "./protocol.js";
|
|
2
|
+
/**
|
|
3
|
+
* Compare two semver version strings (major.minor.patch plus pre-release).
|
|
4
|
+
* Returns: negative if a < b, 0 if equal, positive if a > b.
|
|
5
|
+
*/
|
|
6
|
+
export declare function compareSemver(a: string, b: string): number;
|
|
7
|
+
/** Single configure-time warning produced by the Rust side. */
|
|
8
|
+
export interface ConfigureWarning {
|
|
9
|
+
code?: string;
|
|
10
|
+
message: string;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
/** Context passed to {@link BridgeOptions.onConfigureWarnings} after the first successful configure. */
|
|
14
|
+
export interface ConfigureWarningsContext {
|
|
15
|
+
projectRoot: string;
|
|
16
|
+
sessionId?: string | null;
|
|
17
|
+
client?: unknown;
|
|
18
|
+
warnings: ConfigureWarning[];
|
|
19
|
+
}
|
|
20
|
+
export interface BridgeOptions {
|
|
21
|
+
/** Request timeout in milliseconds. Default: 30000 */
|
|
22
|
+
timeoutMs?: number;
|
|
23
|
+
/** Maximum restart attempts before giving up. Default: 3 */
|
|
24
|
+
maxRestarts?: number;
|
|
25
|
+
/** Minimum binary version required (semver). If the binary is older, onVersionMismatch is called. */
|
|
26
|
+
minVersion?: string;
|
|
27
|
+
/** Called when binary version is older than minVersion. Receives (binaryVersion, minVersion). */
|
|
28
|
+
onVersionMismatch?: (binaryVersion: string, minVersion: string) => void;
|
|
29
|
+
/** Called after the first successful configure returns user-visible warnings. */
|
|
30
|
+
onConfigureWarnings?: (context: ConfigureWarningsContext) => void | Promise<void>;
|
|
31
|
+
/** Called for server-pushed background bash completions. */
|
|
32
|
+
onBashCompletion?: (completion: BashCompletedPayload, bridge: BinaryBridge) => void | Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Prefix for user-facing error messages thrown by the bridge (e.g. timeout,
|
|
35
|
+
* stdin-write, configure-failure errors). Hosts pass their own tag so the
|
|
36
|
+
* agent and operators see consistent attribution. Defaults to `[aft-bridge]`.
|
|
37
|
+
*/
|
|
38
|
+
errorPrefix?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface BashCompletedPayload extends BgCompletion {
|
|
41
|
+
type: "bash_completed";
|
|
42
|
+
session_id: string;
|
|
43
|
+
}
|
|
44
|
+
export interface BridgeRequestOptions {
|
|
45
|
+
onProgress?: (chunk: {
|
|
46
|
+
kind: "stdout" | "stderr";
|
|
47
|
+
text: string;
|
|
48
|
+
}) => void;
|
|
49
|
+
/** Per-call transport timeout in milliseconds. Defaults to the bridge-wide timeout. */
|
|
50
|
+
transportTimeoutMs?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Skip the "kill the child process on timeout" behavior for this request.
|
|
53
|
+
*
|
|
54
|
+
* The default (false) treats a transport-level timeout as evidence the bridge
|
|
55
|
+
* is wedged — Rust normally responds well within the budget, so silence past
|
|
56
|
+
* the deadline almost always means a stuck child. Killing forces a clean
|
|
57
|
+
* respawn on the next call.
|
|
58
|
+
*
|
|
59
|
+
* Some commands enforce their own timeouts on the Rust side (notably `bash`,
|
|
60
|
+
* which uses a watchdog thread to terminate the child shell and return a
|
|
61
|
+
* timeout response). For those, a transport timeout means the response was
|
|
62
|
+
* lost or queued behind something else — the bridge itself is still healthy
|
|
63
|
+
* and should keep its warm state (LSP servers, semantic index, callers
|
|
64
|
+
* cache, undo history). Pass `keepBridgeOnTimeout: true` to reject the
|
|
65
|
+
* request without tearing down the bridge.
|
|
66
|
+
*/
|
|
67
|
+
keepBridgeOnTimeout?: boolean;
|
|
68
|
+
}
|
|
69
|
+
interface SendOptions extends BridgeRequestOptions {
|
|
70
|
+
timeoutMs?: number;
|
|
71
|
+
configureWarningClient?: unknown;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Manages a persistent `aft` child process, communicating via NDJSON over
|
|
75
|
+
* stdin/stdout. Lazy-spawns on first `send()` call. Handles crash detection
|
|
76
|
+
* with exponential backoff auto-restart.
|
|
77
|
+
*/
|
|
78
|
+
export declare class BinaryBridge {
|
|
79
|
+
private static readonly RESTART_RESET_MS;
|
|
80
|
+
/** How many recent stderr lines to keep for crash diagnostics. */
|
|
81
|
+
private static readonly STDERR_TAIL_MAX;
|
|
82
|
+
private binaryPath;
|
|
83
|
+
private cwd;
|
|
84
|
+
private process;
|
|
85
|
+
private pending;
|
|
86
|
+
private nextId;
|
|
87
|
+
private stdoutBuffer;
|
|
88
|
+
/** Ring buffer of the last N stderr lines, cleared on every spawn. */
|
|
89
|
+
private stderrTail;
|
|
90
|
+
private _restartCount;
|
|
91
|
+
private _shuttingDown;
|
|
92
|
+
private timeoutMs;
|
|
93
|
+
private maxRestarts;
|
|
94
|
+
private configured;
|
|
95
|
+
private _configurePromise;
|
|
96
|
+
private configOverrides;
|
|
97
|
+
private minVersion;
|
|
98
|
+
private onVersionMismatch;
|
|
99
|
+
private onConfigureWarnings;
|
|
100
|
+
private onBashCompletion;
|
|
101
|
+
/** Notification clients keyed by session_id for async configure warning pushes. */
|
|
102
|
+
private configureWarningClients;
|
|
103
|
+
private restartResetTimer;
|
|
104
|
+
private errorPrefix;
|
|
105
|
+
constructor(binaryPath: string, cwd: string, options?: BridgeOptions, configOverrides?: Record<string, unknown>);
|
|
106
|
+
/** Number of times the binary has been restarted after a crash. */
|
|
107
|
+
get restartCount(): number;
|
|
108
|
+
/** Whether the child process is currently alive. */
|
|
109
|
+
isAlive(): boolean;
|
|
110
|
+
hasPendingRequests(): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Send a command to the binary and return the parsed response.
|
|
113
|
+
* Lazy-spawns the binary on first call.
|
|
114
|
+
*/
|
|
115
|
+
send(command: string, params?: Record<string, unknown>, options?: SendOptions): Promise<Record<string, unknown>>;
|
|
116
|
+
private deliverConfigureWarnings;
|
|
117
|
+
/**
|
|
118
|
+
* Handle the `configure_warnings` push frame the Rust binary emits after
|
|
119
|
+
* configure has returned. The frame carries the warnings produced by the
|
|
120
|
+
* deferred file walk + missing-binary detection. Forwards to the same
|
|
121
|
+
* `onConfigureWarnings` handler used for synchronous warnings so plugins
|
|
122
|
+
* don't need to know about the async path.
|
|
123
|
+
*/
|
|
124
|
+
private handleConfigureWarningsFrame;
|
|
125
|
+
/** Kill the child process and reject all pending requests. */
|
|
126
|
+
shutdown(): Promise<void>;
|
|
127
|
+
/** Query binary version and compare against minVersion. Calls onVersionMismatch if outdated. */
|
|
128
|
+
private checkVersion;
|
|
129
|
+
private ensureSpawned;
|
|
130
|
+
private spawnProcess;
|
|
131
|
+
private pushStderrLine;
|
|
132
|
+
/**
|
|
133
|
+
* Format the current stderr tail for inclusion in error messages. Returns
|
|
134
|
+
* empty string when nothing has been captured (e.g., silent SIGKILL from
|
|
135
|
+
* macOS amfid) so the caller can safely concatenate unconditionally.
|
|
136
|
+
*/
|
|
137
|
+
private formatStderrTail;
|
|
138
|
+
private onStdoutData;
|
|
139
|
+
private handleTimeout;
|
|
140
|
+
private handleCrash;
|
|
141
|
+
private rejectAllPending;
|
|
142
|
+
private scheduleRestartCountReset;
|
|
143
|
+
private clearRestartResetTimer;
|
|
144
|
+
}
|
|
145
|
+
export {};
|
|
146
|
+
//# sourceMappingURL=bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAgBlD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAkC1D;AA6CD,+DAA+D;AAC/D,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,wGAAwG;AACxG,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,gBAAgB,EAAE,C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OAMG;YACW,4BAA4B;IAgB1C,8DAA8D;IACxD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IA4B/B,gGAAgG;YAClF,YAAY;IAoB1B,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,YAAY;IAkHpB,OAAO,CAAC,cAAc;IAOtB;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,YAAY;IAuEpB,OAAO,CAAC,aAAa;IAmCrB,OAAO,CAAC,WAAW;IAoDnB,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,yBAAyB;IAQjC,OAAO,CAAC,sBAAsB;CAM/B"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-download the AFT binary from GitHub releases.
|
|
3
|
+
*
|
|
4
|
+
* Resolution order (in resolver.ts):
|
|
5
|
+
* 1. Cached binary in ~/.cache/aft/bin/
|
|
6
|
+
* 2. npm platform package (@cortexkit/aft-darwin-arm64, etc.)
|
|
7
|
+
* 3. PATH lookup (which aft)
|
|
8
|
+
* 4. ~/.cargo/bin/aft
|
|
9
|
+
* 5. Auto-download from GitHub releases (this module)
|
|
10
|
+
*
|
|
11
|
+
* Cache dir respects XDG_CACHE_HOME on Linux/macOS and LOCALAPPDATA on Windows.
|
|
12
|
+
*/
|
|
13
|
+
/** Get the cache directory, respecting XDG_CACHE_HOME / LOCALAPPDATA. */
|
|
14
|
+
export declare function getCacheDir(): string;
|
|
15
|
+
/** Binary name for the current platform. */
|
|
16
|
+
export declare function getBinaryName(): string;
|
|
17
|
+
/** Return the cached binary path if it exists, otherwise null.
|
|
18
|
+
* Checks the version-specific cache directory only.
|
|
19
|
+
* The legacy flat cache (~/.cache/aft/bin/aft) is intentionally NOT checked
|
|
20
|
+
* because it can be overwritten by other instances, corrupting running processes. */
|
|
21
|
+
export declare function getCachedBinaryPath(version?: string): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Download the AFT binary for the current platform from GitHub releases.
|
|
24
|
+
*
|
|
25
|
+
* @param version - Git tag to download from (e.g. "v0.1.0"). If omitted,
|
|
26
|
+
* fetches the latest release tag via the GitHub API.
|
|
27
|
+
* @returns Absolute path to the downloaded binary, or null on failure.
|
|
28
|
+
*/
|
|
29
|
+
export declare function downloadBinary(version?: string): Promise<string | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Ensure the AFT binary is available: check cache, then download if needed.
|
|
32
|
+
* This is the main entry point called by the resolver.
|
|
33
|
+
*/
|
|
34
|
+
export declare function ensureBinary(version?: string): Promise<string | null>;
|
|
35
|
+
//# sourceMappingURL=downloader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"downloader.d.ts","sourceRoot":"","sources":["../src/downloader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH,yEAAyE;AACzE,wBAAgB,WAAW,IAAI,MAAM,CASpC;AAED,4CAA4C;AAC5C,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;;sFAGsF;AACtF,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAInE;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgH7E;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgB3E"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @cortexkit/aft-bridge
|
|
3
|
+
*
|
|
4
|
+
* Shared transport, binary resolution, and ONNX runtime helpers for AFT
|
|
5
|
+
* agent-host plugins. Public surface intentionally narrow — host policies
|
|
6
|
+
* (config loading, permission UX, tool registration, notifications) stay in
|
|
7
|
+
* each host plugin.
|
|
8
|
+
*/
|
|
9
|
+
export { setActiveLogger } from "./active-logger.js";
|
|
10
|
+
export type { BashCompletedPayload, BridgeOptions, BridgeRequestOptions, ConfigureWarning, ConfigureWarningsContext, } from "./bridge.js";
|
|
11
|
+
export { BinaryBridge, compareSemver } from "./bridge.js";
|
|
12
|
+
export { downloadBinary, ensureBinary, getBinaryName, getCacheDir, getCachedBinaryPath, } from "./downloader.js";
|
|
13
|
+
export type { Logger, LogMeta } from "./logger.js";
|
|
14
|
+
export { cleanupOnnxRuntime, ensureOnnxRuntime, getManualInstallHint, isOrtAutoDownloadSupported, } from "./onnx-runtime.js";
|
|
15
|
+
export { PLATFORM_ARCH_MAP, PLATFORM_ASSET_MAP } from "./platform.js";
|
|
16
|
+
export type { PoolOptions } from "./pool.js";
|
|
17
|
+
export { BridgePool } from "./pool.js";
|
|
18
|
+
export type { AftErrorResponse, AftPushFrame, AftRequestEnvelope, AftResponse, AftSuccessResponse, BashCompletedFrame, BgCompletion, ConfigureWarningFrame, PermissionAskFrame, ProgressFrame, } from "./protocol.js";
|
|
19
|
+
export { findBinary, findBinarySync, platformKey } from "./resolver.js";
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EACV,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,EACL,cAAc,EACd,YAAY,EACZ,aAAa,EACb,WAAW,EACX,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACtE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|