@gblin-protocol/mcp-server 0.4.3 → 0.5.1

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.
Files changed (63) hide show
  1. package/AGENTS.md +49 -20
  2. package/README.md +111 -11
  3. package/dist/abi.d.ts +27 -0
  4. package/dist/abi.d.ts.map +1 -1
  5. package/dist/abi.js +1 -0
  6. package/dist/abi.js.map +1 -1
  7. package/dist/actions.d.ts +306 -0
  8. package/dist/actions.d.ts.map +1 -0
  9. package/dist/actions.js +749 -0
  10. package/dist/actions.js.map +1 -0
  11. package/dist/auction.d.ts.map +1 -1
  12. package/dist/auction.js +5 -4
  13. package/dist/auction.js.map +1 -1
  14. package/dist/config.d.ts +20 -3
  15. package/dist/config.d.ts.map +1 -1
  16. package/dist/config.js +23 -6
  17. package/dist/config.js.map +1 -1
  18. package/dist/helpers.d.ts +6 -0
  19. package/dist/helpers.d.ts.map +1 -1
  20. package/dist/helpers.js +37 -13
  21. package/dist/helpers.js.map +1 -1
  22. package/dist/index.d.ts +3 -4
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +38 -19
  25. package/dist/index.js.map +1 -1
  26. package/dist/output-schemas.d.ts +18 -0
  27. package/dist/output-schemas.d.ts.map +1 -0
  28. package/dist/output-schemas.js +243 -0
  29. package/dist/output-schemas.js.map +1 -0
  30. package/dist/payments.d.ts +170 -0
  31. package/dist/payments.d.ts.map +1 -0
  32. package/dist/payments.js +524 -0
  33. package/dist/payments.js.map +1 -0
  34. package/dist/paywall.d.ts +10 -1
  35. package/dist/paywall.d.ts.map +1 -1
  36. package/dist/paywall.js +1 -1
  37. package/dist/paywall.js.map +1 -1
  38. package/dist/prompts.d.ts +33 -0
  39. package/dist/prompts.d.ts.map +1 -0
  40. package/dist/prompts.js +139 -0
  41. package/dist/prompts.js.map +1 -0
  42. package/dist/receipts.d.ts +2 -1
  43. package/dist/receipts.d.ts.map +1 -1
  44. package/dist/receipts.js +16 -12
  45. package/dist/receipts.js.map +1 -1
  46. package/dist/resources.d.ts +17 -0
  47. package/dist/resources.d.ts.map +1 -0
  48. package/dist/resources.js +146 -0
  49. package/dist/resources.js.map +1 -0
  50. package/dist/shared.d.ts +35 -0
  51. package/dist/shared.d.ts.map +1 -0
  52. package/dist/shared.js +68 -0
  53. package/dist/shared.js.map +1 -0
  54. package/dist/tools.d.ts +106 -19
  55. package/dist/tools.d.ts.map +1 -1
  56. package/dist/tools.js +124 -117
  57. package/dist/tools.js.map +1 -1
  58. package/dist/version.d.ts +2 -0
  59. package/dist/version.d.ts.map +1 -0
  60. package/dist/version.js +3 -0
  61. package/dist/version.js.map +1 -0
  62. package/llms.txt +24 -2
  63. package/package.json +8 -3
@@ -0,0 +1,243 @@
1
+ /**
2
+ * GBLIN MCP — output schemas.
3
+ *
4
+ * Every tool that returns a JSON object declares its shape here, so a client can validate the
5
+ * `structuredContent` of a successful result and generate types from it. Error results carry
6
+ * `isError: true` and no structured content, so they are outside these schemas.
7
+ *
8
+ * The `required` list of each schema is the contract: fields a successful call always returns.
9
+ * Other fields are described but optional, and `additionalProperties` stays open, so adding a
10
+ * field later is not a breaking change. Removing or retyping a required field is.
11
+ *
12
+ * seal_action_demo has no schema: its result is the hosted log's receipt, whose shape is published
13
+ * by the log itself (see get_receipt for the fields a reader can rely on).
14
+ */
15
+ const str = (description) => ({ type: "string", ...(description ? { description } : {}) });
16
+ const num = (description) => ({ type: "number", ...(description ? { description } : {}) });
17
+ const bool = (description) => ({ type: "boolean", ...(description ? { description } : {}) });
18
+ const obj = (description) => ({ type: "object", ...(description ? { description } : {}) });
19
+ const arr = (description, items) => ({
20
+ type: "array",
21
+ ...(items ? { items } : {}),
22
+ ...(description ? { description } : {}),
23
+ });
24
+ /** A field that is an object when present and `null` when there is nothing to report. */
25
+ const objOrNull = (description) => ({ type: ["object", "null"], description });
26
+ function schema(required, properties) {
27
+ for (const key of required) {
28
+ if (!(key in properties))
29
+ throw new Error(`output schema: required field "${key}" is not described`);
30
+ }
31
+ return { type: "object", properties, required, additionalProperties: true };
32
+ }
33
+ const STEP = obj("One transaction to send, in order: target, calldata, value in wei, and gas when the step needs an explicit limit.");
34
+ export const OUTPUT_SCHEMAS = {
35
+ get_treasury_state: schema(["nav_usd", "eth_price_usd", "nav_reliable", "management_fee_bps_per_year", "auction_open", "crash_shield_active", "basket"], {
36
+ nav_usd: num("Net asset value of one GBLIN share in USD."),
37
+ eth_price_usd: num("ETH price in USD from the oracle."),
38
+ nav_reliable: bool("False when a price feed is stale or a basket asset cannot be read; do not trade on the NAV then."),
39
+ management_fee_bps_per_year: num("Management fee in basis points per year, read from the contract."),
40
+ auction_open: bool("True while a rebalancing auction is running."),
41
+ crash_shield_active: bool("True when the crash shield has cut the weight of a falling asset."),
42
+ slippage_buffer_pct: num(),
43
+ slippage_reason: str(),
44
+ basket: arr("Assets in the basket with base and dynamic weights.", obj()),
45
+ meta: obj(),
46
+ }),
47
+ quote_safe_swap: schema(["direction", "slippage_buffer_bps", "next_step"], {
48
+ direction: { type: "string", enum: ["buy", "sell"] },
49
+ amount_in_eth: str("Buy only."),
50
+ expected_gblin_out: str("Buy only."),
51
+ safe_min_gblin_out: str("Buy only. Pass as minOut."),
52
+ amount_in_gblin: str("Sell only."),
53
+ expected_eth_out: str("Sell only."),
54
+ safe_min_eth_out: str("Sell only. Pass as minEthOut."),
55
+ fees: obj(),
56
+ slippage_buffer_bps: num(),
57
+ slippage_reason: str(),
58
+ will_revert_with_zero_tolerance: bool(),
59
+ cooldown_note: str(),
60
+ next_step: str(),
61
+ }),
62
+ swap_gblin_to_usdc_jit: schema(["action", "steps", "expected", "gas_hint"], {
63
+ action: str("Always sequential_txs: send the steps one after the other."),
64
+ steps: arr("Transactions to send in order.", STEP),
65
+ params: obj(),
66
+ expected: obj("Shares spent, ETH and USDC expected, and the minimums applied."),
67
+ compatibility: obj(),
68
+ gas_hint: num("Gas limit to set on the Zap step."),
69
+ gas_hint_note: str(),
70
+ }),
71
+ invest_usdc_to_gblin: schema(["action", "steps", "expected", "gas_hint"], {
72
+ action: str("Always sequential_txs: send the steps one after the other."),
73
+ steps: arr("Transactions to send in order.", STEP),
74
+ gas_hint: num("Gas limit to set on the Zap step."),
75
+ gas_hint_note: str(),
76
+ expected: obj("Shares expected and the minimum applied."),
77
+ security: obj(),
78
+ }),
79
+ analyze_treasury_health: schema(["wallet", "balances", "gas_health", "cooldown", "recommendation"], {
80
+ wallet: str(),
81
+ balances: obj(),
82
+ ratios: obj(),
83
+ gas_health: obj("Whether the wallet holds enough ETH for the next transactions."),
84
+ cooldown: obj("Whether the redemption cooldown is active and for how long."),
85
+ recommendation: obj("hold, rebalance_to_gblin or rebalance_to_usdc, with the reason."),
86
+ }),
87
+ get_governance_state: schema(["vault", "owner", "owner_is_timelock", "owner_is_renounced", "timelock"], {
88
+ vault: str(),
89
+ lens: str(),
90
+ owner: str(),
91
+ owner_is_timelock: bool(),
92
+ owner_is_renounced: bool(),
93
+ fee_recipient: str(),
94
+ trust_summary: str(),
95
+ timelock: obj("Address and minimum delay of the timelock, read on chain."),
96
+ pending_handover: objOrNull("A pending ownership transfer, or null."),
97
+ pending_timelock_operation: objOrNull("A scheduled timelock operation affecting ownership, or null."),
98
+ verification: obj(),
99
+ }),
100
+ share_skill_with_peer: schema(["text"], {
101
+ text: str("A ready-to-send description of the GBLIN skill."),
102
+ }),
103
+ get_auction_state: schema(["vault", "navReliable", "auctionOpen", "premiumBps", "rows"], {
104
+ vault: str(),
105
+ lens: str(),
106
+ navReliable: bool(),
107
+ auctionOpen: bool(),
108
+ premiumBps: num("Current premium over the oracle price, in basis points; negative is a discount."),
109
+ curve: obj(),
110
+ openedAt: { type: ["number", "string", "null"], description: "When the auction opened, or null when closed." },
111
+ worstGapEth: str(),
112
+ totalValueEth: str(),
113
+ rows: arr("One entry per basket asset: side, gap from target and amount a bidder can fill.", obj()),
114
+ best: objOrNull("The row with the largest gap, or null."),
115
+ howToBid: str(),
116
+ note: str(),
117
+ }),
118
+ get_market_risk_regime: schema(["regime", "severity_pct", "shield_active", "defensive_cash_pct"], {
119
+ regime: { type: "string", enum: ["calm", "elevated", "crash"] },
120
+ risk_posture: str(),
121
+ severity_pct: num(),
122
+ shield_active: bool(),
123
+ defensive_cash_pct: num(),
124
+ assets: arr(undefined, obj()),
125
+ source: str(),
126
+ verify: str(),
127
+ meta: obj(),
128
+ }),
129
+ verify_risk_attestation: schema(["valid", "checks"], {
130
+ valid: bool("True only if every check passed."),
131
+ checks: obj("Each check by name, with its result."),
132
+ attested: obj(),
133
+ live: obj(),
134
+ recomputed_attestation_id: str(),
135
+ guidance: str(),
136
+ source: str(),
137
+ }),
138
+ get_receipt: schema(["index", "payload", "signature", "inclusion_proof"], {
139
+ format: str(),
140
+ payload: obj("The sealed record as signed."),
141
+ leaf: str(),
142
+ index: num(),
143
+ tree_size: num(),
144
+ root: str(),
145
+ signature: str(),
146
+ verifier_key: str(),
147
+ inclusion_proof: arr("Sibling hashes from the leaf to the root (RFC 6962).", { type: "string" }),
148
+ checkpoint: str(),
149
+ anchor: obj(),
150
+ provenance: obj(),
151
+ canonical_sha256: str(),
152
+ canonicalization: obj("The canonical JSON form the leaf is hashed from."),
153
+ verify: str("How to verify this receipt."),
154
+ note: str(),
155
+ human_page: str(),
156
+ verify_offline: str(),
157
+ }),
158
+ how_to_seal_paid: schema(["endpoint", "price", "flow"], {
159
+ endpoint: str(),
160
+ price: str(),
161
+ flow: str(),
162
+ body_schema: obj(),
163
+ receipt: str(),
164
+ read_free: str(),
165
+ verify_offline: str(),
166
+ note: str(),
167
+ }),
168
+ prepare_gblin_payment: schema(["authorization", "method", "typed_data", "digest", "x402_payload"], {
169
+ authorization: obj("from, to, value, validAfter, validBefore, nonce."),
170
+ method: { type: "string", enum: ["receive", "transfer"] },
171
+ typed_data: obj("The EIP-712 message to sign with eth_signTypedData_v4."),
172
+ digest: str("The EIP-712 digest of typed_data."),
173
+ amount: obj(),
174
+ payer_balance: obj(),
175
+ next_steps: arr(undefined, { type: "string" }),
176
+ submit: obj(),
177
+ x402_payload: obj("The x402 exact-scheme payment payload, with the signature left to fill."),
178
+ x402_accepts_for_sellers: obj(),
179
+ relay: obj("With relay: true, the fee authorization to sign and where to send both."),
180
+ warnings: arr(undefined, { type: "string" }),
181
+ }),
182
+ prepare_action: schema(["action", "steps"], {
183
+ action: str(),
184
+ wallet: str(),
185
+ steps: arr("Transactions to send in order.", STEP),
186
+ expected: obj("What the operation should deliver, with the minimums applied."),
187
+ warnings: arr(undefined, { type: "string" }),
188
+ next: str(),
189
+ }),
190
+ preview_steps: schema(["would_succeed", "steps", "balance_changes"], {
191
+ would_succeed: bool("True only if every step succeeds in the simulation."),
192
+ from: str(),
193
+ block: num("The block the simulation ran on."),
194
+ steps: arr("Per step: success, gas used, whether the given limit is enough, recommended limit, revert reason.", obj()),
195
+ first_failing_step: { type: ["number", "null"] },
196
+ balance_changes: arr("Net token and ETH movements for the wallet.", obj()),
197
+ note: str(),
198
+ }),
199
+ get_transaction_status: schema(["hash", "status"], {
200
+ hash: str(),
201
+ status: { type: "string", enum: ["pending", "not_found", "success", "reverted"] },
202
+ block: num(),
203
+ confirmations: num(),
204
+ from: str(),
205
+ to: { type: ["string", "null"] },
206
+ gas_used: num(),
207
+ gas_limit: { type: ["number", "null"] },
208
+ fee_eth: str(),
209
+ balance_changes: arr(undefined, obj()),
210
+ revert: obj(),
211
+ explorer: str(),
212
+ note: str(),
213
+ }),
214
+ get_nav_history: schema(["interval", "points", "series"], {
215
+ interval: { type: "string", enum: ["hour", "day"] },
216
+ points: num(),
217
+ series: arr("Oldest first: time, block, NAV in ETH and USD, ETH/USD and BTC/USD.", obj()),
218
+ summary: objOrNull("Change of NAV, ETH and BTC over the window, and the NAV's largest drawdown."),
219
+ note: str(),
220
+ method: str(),
221
+ }),
222
+ relay_gblin_payment: schema(["relay", "status", "transaction"], {
223
+ relay: str("The relay that carried the payment."),
224
+ status: { type: "string", enum: ["settled", "reverted", "submitted"] },
225
+ transaction: str("The transaction hash."),
226
+ explorer: str(),
227
+ payment: obj(),
228
+ fee: obj(),
229
+ block: num(),
230
+ note: str(),
231
+ }),
232
+ verify_gblin_authorization: schema(["would_settle", "method", "checks", "failures"], {
233
+ would_settle: bool("True only if the token would accept this authorization now."),
234
+ method: { type: "string", enum: ["receive", "transfer"] },
235
+ digest: str(),
236
+ checks: obj(),
237
+ failures: arr("Reasons it would not settle; empty when it would.", { type: "string" }),
238
+ amount: obj(),
239
+ submit: objOrNull("Calldata and who may submit it, or null when it would not settle."),
240
+ source: str(),
241
+ }),
242
+ };
243
+ //# sourceMappingURL=output-schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-schemas.js","sourceRoot":"","sources":["../src/output-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,MAAM,GAAG,GAAG,CAAC,WAAoB,EAAc,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAChH,MAAM,GAAG,GAAG,CAAC,WAAoB,EAAc,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAChH,MAAM,IAAI,GAAG,CAAC,WAAoB,EAAc,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAClH,MAAM,GAAG,GAAG,CAAC,WAAoB,EAAc,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,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mEAAmE,CAAC;QACtF,MAAM,EAAE,GAAG,EAAE;KACd,CAAC;CACH,CAAC"}
@@ -0,0 +1,170 @@
1
+ /**
2
+ * GBLIN MCP — paying in GBLIN with a signature (EIP-3009).
3
+ *
4
+ * The vault's share token implements EIP-3009, the same mechanism USDC uses: the holder signs an
5
+ * authorization and anybody can carry it on chain, so the holder never needs ETH for gas. These two
6
+ * tools cover the two halves of that exchange.
7
+ *
8
+ * prepare_gblin_payment → builds the EIP-712 message to sign, the calldata that carries it,
9
+ * and the x402 payment payload for a paid HTTP endpoint.
10
+ * verify_gblin_authorization → checks a signed authorization against the chain before anyone
11
+ * spends gas submitting it.
12
+ * relay_gblin_payment → hands a signed payment and a signed relay fee to GBLIN's relay, which
13
+ * carries both in one transaction for a payer that holds no ETH.
14
+ *
15
+ * Neither tool holds, asks for or transmits a private key. The signature is produced by the caller's
16
+ * own wallet from the typed data returned here.
17
+ *
18
+ * Shapes follow the x402 "exact" scheme so an authorization built here is accepted by any x402
19
+ * facilitator, not only by GBLIN's own endpoints.
20
+ */
21
+ import { type Address, type Hex } from "viem";
22
+ export interface Eip712Domain {
23
+ name: string;
24
+ version: string;
25
+ chainId: number;
26
+ verifyingContract: Address;
27
+ }
28
+ /**
29
+ * Reads the EIP-712 domain from the token itself (EIP-5267) instead of assuming it.
30
+ * The domain is part of what a signature commits to: a wrong name or version produces a signature
31
+ * that every verifier rejects, and the failure only shows up at settlement.
32
+ */
33
+ export declare function getTokenDomain(): Promise<Eip712Domain>;
34
+ export interface Authorization {
35
+ from: Address;
36
+ to: Address;
37
+ value: string;
38
+ validAfter: string;
39
+ validBefore: string;
40
+ nonce: Hex;
41
+ }
42
+ export declare const PREPARE_PAYMENT_TOOL: {
43
+ name: string;
44
+ description: string;
45
+ inputSchema: {
46
+ type: "object";
47
+ properties: {
48
+ from: {
49
+ type: string;
50
+ description: string;
51
+ };
52
+ to: {
53
+ type: string;
54
+ description: string;
55
+ };
56
+ amount_gblin: {
57
+ type: string;
58
+ description: string;
59
+ };
60
+ amount_usd: {
61
+ type: string;
62
+ description: string;
63
+ };
64
+ method: {
65
+ type: string;
66
+ enum: string[];
67
+ description: string;
68
+ };
69
+ valid_for_seconds: {
70
+ type: string;
71
+ description: string;
72
+ };
73
+ relay: {
74
+ type: string;
75
+ description: string;
76
+ };
77
+ };
78
+ required: string[];
79
+ additionalProperties: boolean;
80
+ };
81
+ annotations: {
82
+ title: string;
83
+ readOnlyHint: boolean;
84
+ destructiveHint: boolean;
85
+ idempotentHint: boolean;
86
+ openWorldHint: boolean;
87
+ };
88
+ };
89
+ export declare function handlePreparePayment(args: Record<string, unknown>): Promise<unknown>;
90
+ export declare const RELAY_PAYMENT_TOOL: {
91
+ name: string;
92
+ description: string;
93
+ inputSchema: {
94
+ type: "object";
95
+ properties: {
96
+ payment: {
97
+ type: string;
98
+ description: string;
99
+ properties: {
100
+ authorization: {
101
+ type: string;
102
+ };
103
+ signature: {
104
+ type: string;
105
+ pattern: string;
106
+ };
107
+ };
108
+ required: string[];
109
+ };
110
+ fee: {
111
+ type: string;
112
+ description: string;
113
+ properties: {
114
+ authorization: {
115
+ type: string;
116
+ };
117
+ signature: {
118
+ type: string;
119
+ pattern: string;
120
+ };
121
+ };
122
+ required: string[];
123
+ };
124
+ };
125
+ required: string[];
126
+ additionalProperties: boolean;
127
+ };
128
+ annotations: {
129
+ title: string;
130
+ readOnlyHint: boolean;
131
+ destructiveHint: boolean;
132
+ idempotentHint: boolean;
133
+ openWorldHint: boolean;
134
+ };
135
+ };
136
+ export declare function handleRelayPayment(args: Record<string, unknown>): Promise<unknown>;
137
+ export declare const VERIFY_AUTHORIZATION_TOOL: {
138
+ name: string;
139
+ description: string;
140
+ inputSchema: {
141
+ type: "object";
142
+ properties: {
143
+ authorization: {
144
+ type: string;
145
+ description: string;
146
+ additionalProperties: boolean;
147
+ };
148
+ signature: {
149
+ type: string;
150
+ description: string;
151
+ };
152
+ method: {
153
+ type: string;
154
+ enum: string[];
155
+ description: string;
156
+ };
157
+ };
158
+ required: string[];
159
+ additionalProperties: boolean;
160
+ };
161
+ annotations: {
162
+ title: string;
163
+ readOnlyHint: boolean;
164
+ destructiveHint: boolean;
165
+ idempotentHint: boolean;
166
+ openWorldHint: boolean;
167
+ };
168
+ };
169
+ export declare function handleVerifyAuthorization(args: Record<string, unknown>): Promise<unknown>;
170
+ //# sourceMappingURL=payments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../src/payments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,EAQL,KAAK,OAAO,EACZ,KAAK,GAAG,EACT,MAAM,MAAM,CAAC;AAyCd,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAID;;;;GAIG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,YAAY,CAAC,CAc5D;AAqBD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,GAAG,CAAC;CACZ;AA6CD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoChC,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAkJ1F;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8B9B,CAAC;AAEF,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,M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