brainfile 0.19.0 → 0.21.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/README.md +18 -24
- package/dist/__tests__/helpers/mcp-wire.d.ts +45 -0
- package/dist/__tests__/helpers/mcp-wire.d.ts.map +1 -0
- package/dist/__tests__/helpers/mcp-wire.js +133 -0
- package/dist/__tests__/helpers/mcp-wire.js.map +1 -0
- package/dist/{chunk-YTFLC673.mjs → chunk-FOLBAGJS.mjs} +2483 -1075
- package/dist/cli.mjs +2526 -1656
- package/dist/commands/adr.d.ts +1 -9
- package/dist/commands/adr.d.ts.map +1 -1
- package/dist/commands/adr.js +11 -88
- package/dist/commands/adr.js.map +1 -1
- package/dist/commands/archive.d.ts +2 -5
- package/dist/commands/archive.d.ts.map +1 -1
- package/dist/commands/archive.js +43 -11
- package/dist/commands/archive.js.map +1 -1
- package/dist/commands/brief.d.ts +32 -0
- package/dist/commands/brief.d.ts.map +1 -0
- package/dist/commands/brief.js +161 -0
- package/dist/commands/brief.js.map +1 -0
- package/dist/commands/complete.js +1 -1
- package/dist/commands/complete.js.map +1 -1
- package/dist/commands/init.d.ts +14 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +115 -15
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/log.js +31 -18
- package/dist/commands/log.js.map +1 -1
- package/dist/commands/mcp.d.ts +9 -0
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +72 -17
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/merge-driver.d.ts +26 -0
- package/dist/commands/merge-driver.d.ts.map +1 -0
- package/dist/commands/merge-driver.js +195 -0
- package/dist/commands/merge-driver.js.map +1 -0
- package/dist/commands/migrate-tracked.d.ts +8 -0
- package/dist/commands/migrate-tracked.d.ts.map +1 -0
- package/dist/commands/migrate-tracked.js +428 -0
- package/dist/commands/migrate-tracked.js.map +1 -0
- package/dist/commands/migrate.d.ts +6 -0
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +19 -12
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/sync.d.ts +16 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +152 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/where.d.ts +21 -0
- package/dist/commands/where.d.ts.map +1 -0
- package/dist/commands/where.js +135 -0
- package/dist/commands/where.js.map +1 -0
- package/dist/mcp/helpers.d.ts +8 -0
- package/dist/mcp/helpers.d.ts.map +1 -1
- package/dist/mcp/helpers.js +44 -0
- package/dist/mcp/helpers.js.map +1 -1
- package/dist/mcp/schemas.d.ts +297 -0
- package/dist/mcp/schemas.d.ts.map +1 -0
- package/dist/mcp/schemas.js +328 -0
- package/dist/mcp/schemas.js.map +1 -0
- package/dist/mcp/tools/brief_tool.d.ts +14 -0
- package/dist/mcp/tools/brief_tool.d.ts.map +1 -0
- package/dist/mcp/tools/brief_tool.js +96 -0
- package/dist/mcp/tools/brief_tool.js.map +1 -0
- package/dist/mcp/tools/contract_tool.d.ts.map +1 -1
- package/dist/mcp/tools/contract_tool.js +43 -18
- package/dist/mcp/tools/contract_tool.js.map +1 -1
- package/dist/mcp/tools/get_task_tool.d.ts.map +1 -1
- package/dist/mcp/tools/get_task_tool.js +7 -2
- package/dist/mcp/tools/get_task_tool.js.map +1 -1
- package/dist/mcp/tools/list_tasks_tool.d.ts.map +1 -1
- package/dist/mcp/tools/list_tasks_tool.js +9 -3
- package/dist/mcp/tools/list_tasks_tool.js.map +1 -1
- package/dist/mcp/tools/search_tool.d.ts.map +1 -1
- package/dist/mcp/tools/search_tool.js +17 -4
- package/dist/mcp/tools/search_tool.js.map +1 -1
- package/dist/mcp/tools/subtask_tool.d.ts.map +1 -1
- package/dist/mcp/tools/subtask_tool.js +52 -17
- package/dist/mcp/tools/subtask_tool.js.map +1 -1
- package/dist/mcp/tools/task_add_tool.d.ts.map +1 -1
- package/dist/mcp/tools/task_add_tool.js +13 -7
- package/dist/mcp/tools/task_add_tool.js.map +1 -1
- package/dist/mcp/tools/task_complete_tool.d.ts.map +1 -1
- package/dist/mcp/tools/task_complete_tool.js +39 -10
- package/dist/mcp/tools/task_complete_tool.js.map +1 -1
- package/dist/mcp/tools/task_delete_tool.d.ts.map +1 -1
- package/dist/mcp/tools/task_delete_tool.js +12 -6
- package/dist/mcp/tools/task_delete_tool.js.map +1 -1
- package/dist/mcp/tools/task_move_tool.d.ts.map +1 -1
- package/dist/mcp/tools/task_move_tool.js +21 -11
- package/dist/mcp/tools/task_move_tool.js.map +1 -1
- package/dist/mcp/tools/task_patch_tool.d.ts.map +1 -1
- package/dist/mcp/tools/task_patch_tool.js +23 -10
- package/dist/mcp/tools/task_patch_tool.js.map +1 -1
- package/dist/schemas/board.json +1 -1
- package/dist/tui/theme.d.ts +98 -0
- package/dist/tui/theme.d.ts.map +1 -0
- package/dist/tui/theme.js +141 -0
- package/dist/tui/theme.js.map +1 -0
- package/dist/{tui-P56H4X7N.mjs → tui-M2KWIG2E.mjs} +1707 -2006
- package/dist/utils/board-autosync.d.ts +22 -0
- package/dist/utils/board-autosync.d.ts.map +1 -0
- package/dist/utils/board-autosync.js +166 -0
- package/dist/utils/board-autosync.js.map +1 -0
- package/dist/utils/board-commit-hooks.d.ts +12 -0
- package/dist/utils/board-commit-hooks.d.ts.map +1 -0
- package/dist/utils/board-commit-hooks.js +51 -0
- package/dist/utils/board-commit-hooks.js.map +1 -0
- package/dist/utils/board-repo.d.ts +108 -0
- package/dist/utils/board-repo.d.ts.map +1 -0
- package/dist/utils/board-repo.js +501 -0
- package/dist/utils/board-repo.js.map +1 -0
- package/dist/utils/board-sync.d.ts +111 -0
- package/dist/utils/board-sync.d.ts.map +1 -0
- package/dist/utils/board-sync.js +469 -0
- package/dist/utils/board-sync.js.map +1 -0
- package/dist/utils/brainfile-path.d.ts +11 -1
- package/dist/utils/brainfile-path.d.ts.map +1 -1
- package/dist/utils/brainfile-path.js +39 -2
- package/dist/utils/brainfile-path.js.map +1 -1
- package/dist/utils/cli-error.d.ts +20 -0
- package/dist/utils/cli-error.d.ts.map +1 -1
- package/dist/utils/cli-error.js +36 -0
- package/dist/utils/cli-error.js.map +1 -1
- package/package.json +3 -3
- package/dist/commands/rules.d.ts +0 -68
- package/dist/commands/rules.d.ts.map +0 -1
- package/dist/commands/rules.js +0 -322
- package/dist/commands/rules.js.map +0 -1
package/README.md
CHANGED
|
@@ -17,9 +17,9 @@ brainfile init
|
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
This creates the standard v2 structure:
|
|
20
|
-
- `.brainfile/brainfile.md` (Configuration,
|
|
20
|
+
- `.brainfile/brainfile.md` (Configuration: columns, types, agent instructions)
|
|
21
21
|
- `.brainfile/board/` (Active tasks)
|
|
22
|
-
- `.brainfile/logs/` (Completed task files)
|
|
22
|
+
- `.brainfile/logs/` (Completed task files and `ledger.jsonl`)
|
|
23
23
|
|
|
24
24
|
The board comes pre-configured with `To Do` and `In Progress` columns.
|
|
25
25
|
|
|
@@ -157,23 +157,17 @@ brainfile contract validate -t task-45
|
|
|
157
157
|
|
|
158
158
|
## ADR Promotion
|
|
159
159
|
|
|
160
|
-
Architecture Decision Records (ADRs) are first-class task files.
|
|
160
|
+
Architecture Decision Records (ADRs) are first-class task files. Promote an ADR to mark it accepted and archive it to `logs/`. Accepted ADRs show up in `brainfile brief`.
|
|
161
161
|
|
|
162
162
|
```bash
|
|
163
163
|
# 1. Create an ADR
|
|
164
164
|
brainfile add -t "Use Postgres for all user data" --type adr -c todo
|
|
165
165
|
|
|
166
|
-
# 2. Promote it
|
|
167
|
-
brainfile adr promote -t adr-1
|
|
166
|
+
# 2. Promote it
|
|
167
|
+
brainfile adr promote -t adr-1
|
|
168
168
|
```
|
|
169
169
|
|
|
170
|
-
|
|
171
|
-
- `always`: Strict rules (e.g., "Always use TypeScript")
|
|
172
|
-
- `never`: Prohibitions (e.g., "Never commit secrets")
|
|
173
|
-
- `prefer`: Guidelines (e.g., "Prefer functional components")
|
|
174
|
-
- `context`: informational context
|
|
175
|
-
|
|
176
|
-
Promoted rules are added to `.brainfile/brainfile.md`, and the promoted ADR file moves to `.brainfile/logs/`.
|
|
170
|
+
The ADR file moves to `.brainfile/logs/` with `status: promoted`. Project guidance belongs in `agent.instructions` (or `brainfile lint --fix` will fold a legacy `rules:` block there).
|
|
177
171
|
|
|
178
172
|
## TUI (Terminal UI)
|
|
179
173
|
|
|
@@ -184,22 +178,22 @@ brainfile # No arguments launches the TUI
|
|
|
184
178
|
brainfile tui # Explicit subcommand also works
|
|
185
179
|
```
|
|
186
180
|
|
|
187
|
-
|
|
188
|
-
- **Tasks (`1`)**: Kanban view of active tasks.
|
|
189
|
-
- **Rules (`2`)**: Active rules and configuration.
|
|
190
|
-
- **Logs (`3`)**: Completed task files.
|
|
181
|
+
Completed work is the `L` done view, not a column and not a stop on `t`. `e` opens the document in `$EDITOR`.
|
|
191
182
|
|
|
192
183
|
### Keyboard Shortcuts
|
|
193
184
|
| Key | Action |
|
|
194
185
|
|-----|--------|
|
|
195
|
-
| `
|
|
196
|
-
| `
|
|
197
|
-
| `enter` |
|
|
198
|
-
| `
|
|
199
|
-
| `
|
|
200
|
-
| `
|
|
201
|
-
|
|
|
202
|
-
|
|
|
186
|
+
| `j` / `k` | Move selection |
|
|
187
|
+
| `h` / `l` / `tab` | Cycle column |
|
|
188
|
+
| `enter` | Open detail |
|
|
189
|
+
| `t` | Cycle type |
|
|
190
|
+
| `L` | Toggle done view |
|
|
191
|
+
| `space` | Collapse parent / toggle subtask in detail |
|
|
192
|
+
| `a` | Add |
|
|
193
|
+
| `c` | Complete |
|
|
194
|
+
| `e` | Edit in `$EDITOR` |
|
|
195
|
+
| `/` | Filter |
|
|
196
|
+
| `?` | Help |
|
|
203
197
|
| `q` | Quit |
|
|
204
198
|
|
|
205
199
|
## AI Integration
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type Era = 'legacy' | 'modern';
|
|
2
|
+
export interface ToolResult {
|
|
3
|
+
content?: Array<{
|
|
4
|
+
type: string;
|
|
5
|
+
text?: string;
|
|
6
|
+
}>;
|
|
7
|
+
structuredContent?: unknown;
|
|
8
|
+
isError?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface AdvertisedTool {
|
|
11
|
+
name: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
inputSchema?: Record<string, unknown>;
|
|
14
|
+
outputSchema?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* An MCP client speaking raw JSON-RPC to a real server over an in-memory
|
|
18
|
+
* transport. No `@modelcontextprotocol/client` package is installed, so the
|
|
19
|
+
* wire protocol is driven by hand.
|
|
20
|
+
*/
|
|
21
|
+
export declare class WireClient {
|
|
22
|
+
private readonly era;
|
|
23
|
+
private nextId;
|
|
24
|
+
private readonly pending;
|
|
25
|
+
private readonly clientTransport;
|
|
26
|
+
private readonly handle;
|
|
27
|
+
private constructor();
|
|
28
|
+
/** Opens a connection in the given era and completes the handshake. */
|
|
29
|
+
static open(brainfilePath: string, era: Era): Promise<WireClient>;
|
|
30
|
+
/**
|
|
31
|
+
* The 2026 era carries a `_meta` envelope on every request; the 2025 era
|
|
32
|
+
* carries none and its wire stays byte-identical to a plain stdio server.
|
|
33
|
+
*/
|
|
34
|
+
private envelope;
|
|
35
|
+
private handshake;
|
|
36
|
+
request(method: string, params?: Record<string, unknown>, opts?: {
|
|
37
|
+
envelope?: boolean;
|
|
38
|
+
}): Promise<any>;
|
|
39
|
+
listTools(): Promise<AdvertisedTool[]>;
|
|
40
|
+
callTool(name: string, args?: Record<string, unknown>): Promise<ToolResult>;
|
|
41
|
+
/** The text of the first `type: 'text'` content block, if any. */
|
|
42
|
+
static text(result: ToolResult): string | undefined;
|
|
43
|
+
close(): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=mcp-wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mc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AQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAIrF,kEAAkE;IAClE,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS;IAI7C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WireClient = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Drives the REAL MCP server over a real transport, in-process.
|
|
6
|
+
*
|
|
7
|
+
* `FakeMcpServer` (./mcp.ts) captures handler functions and calls them
|
|
8
|
+
* directly, which is fine for handler logic but structurally cannot see any
|
|
9
|
+
* of the SDK behaviour this helper exists to test: zod input parsing,
|
|
10
|
+
* `outputSchema` validation, the era-specific wire codec, or the
|
|
11
|
+
* `structuredContent` projection. Those only happen inside `McpServer` +
|
|
12
|
+
* `serveStdio`.
|
|
13
|
+
*
|
|
14
|
+
* `serveStdio` owns the era decision for a connection (the opening exchange
|
|
15
|
+
* picks it and pins one server instance), and it accepts a caller-supplied
|
|
16
|
+
* transport — so an `InMemoryTransport` linked pair gets the genuine
|
|
17
|
+
* two-era code path without spawning a process or requiring a built bundle.
|
|
18
|
+
*/
|
|
19
|
+
const server_1 = require("@modelcontextprotocol/server");
|
|
20
|
+
const stdio_1 = require("@modelcontextprotocol/server/stdio");
|
|
21
|
+
const mcp_1 = require("../../commands/mcp");
|
|
22
|
+
/** Wire constants, matching @modelcontextprotocol/core's exported keys. */
|
|
23
|
+
const PROTOCOL_VERSION_META_KEY = 'io.modelcontextprotocol/protocolVersion';
|
|
24
|
+
const CLIENT_CAPABILITIES_META_KEY = 'io.modelcontextprotocol/clientCapabilities';
|
|
25
|
+
const MODERN_PROTOCOL_VERSION = '2026-07-28';
|
|
26
|
+
const LEGACY_PROTOCOL_VERSION = '2025-11-25';
|
|
27
|
+
/**
|
|
28
|
+
* An MCP client speaking raw JSON-RPC to a real server over an in-memory
|
|
29
|
+
* transport. No `@modelcontextprotocol/client` package is installed, so the
|
|
30
|
+
* wire protocol is driven by hand.
|
|
31
|
+
*/
|
|
32
|
+
class WireClient {
|
|
33
|
+
constructor(clientTransport, handle, era) {
|
|
34
|
+
this.era = era;
|
|
35
|
+
this.nextId = 1;
|
|
36
|
+
this.pending = new Map();
|
|
37
|
+
this.clientTransport = clientTransport;
|
|
38
|
+
this.handle = handle;
|
|
39
|
+
this.clientTransport.onmessage = (message) => {
|
|
40
|
+
if (message?.id === undefined)
|
|
41
|
+
return;
|
|
42
|
+
const waiter = this.pending.get(message.id);
|
|
43
|
+
if (!waiter)
|
|
44
|
+
return;
|
|
45
|
+
this.pending.delete(message.id);
|
|
46
|
+
if (message.error) {
|
|
47
|
+
waiter.reject(new Error(`${message.error.code}: ${message.error.message}`));
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
waiter.resolve(message.result);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** Opens a connection in the given era and completes the handshake. */
|
|
55
|
+
static async open(brainfilePath, era) {
|
|
56
|
+
const [clientTransport, serverTransport] = server_1.InMemoryTransport.createLinkedPair();
|
|
57
|
+
const handle = (0, stdio_1.serveStdio)(() => (0, mcp_1.createBrainfileMcpServer)(brainfilePath), {
|
|
58
|
+
transport: serverTransport,
|
|
59
|
+
});
|
|
60
|
+
const client = new WireClient(clientTransport, handle, era);
|
|
61
|
+
await clientTransport.start();
|
|
62
|
+
await client.handshake();
|
|
63
|
+
return client;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The 2026 era carries a `_meta` envelope on every request; the 2025 era
|
|
67
|
+
* carries none and its wire stays byte-identical to a plain stdio server.
|
|
68
|
+
*/
|
|
69
|
+
envelope() {
|
|
70
|
+
if (this.era !== 'modern')
|
|
71
|
+
return undefined;
|
|
72
|
+
return {
|
|
73
|
+
[PROTOCOL_VERSION_META_KEY]: MODERN_PROTOCOL_VERSION,
|
|
74
|
+
[CLIENT_CAPABILITIES_META_KEY]: {},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
async handshake() {
|
|
78
|
+
if (this.era === 'legacy') {
|
|
79
|
+
await this.request('initialize', {
|
|
80
|
+
protocolVersion: LEGACY_PROTOCOL_VERSION,
|
|
81
|
+
capabilities: {},
|
|
82
|
+
clientInfo: { name: 'wire-test', version: '0.0.0' },
|
|
83
|
+
}, { envelope: false });
|
|
84
|
+
await this.clientTransport.send({
|
|
85
|
+
jsonrpc: '2.0',
|
|
86
|
+
method: 'notifications/initialized',
|
|
87
|
+
params: {},
|
|
88
|
+
});
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
await this.request('server/discover', {
|
|
92
|
+
protocolVersions: [MODERN_PROTOCOL_VERSION],
|
|
93
|
+
clientInfo: { name: 'wire-test', version: '0.0.0' },
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
async request(method, params = {}, opts = {}) {
|
|
97
|
+
const id = this.nextId++;
|
|
98
|
+
const env = opts.envelope === false ? undefined : this.envelope();
|
|
99
|
+
const message = {
|
|
100
|
+
jsonrpc: '2.0',
|
|
101
|
+
id,
|
|
102
|
+
method,
|
|
103
|
+
params: env ? { ...params, _meta: env } : params,
|
|
104
|
+
};
|
|
105
|
+
const result = new Promise((resolve, reject) => {
|
|
106
|
+
this.pending.set(id, { resolve, reject });
|
|
107
|
+
setTimeout(() => {
|
|
108
|
+
if (this.pending.has(id)) {
|
|
109
|
+
this.pending.delete(id);
|
|
110
|
+
reject(new Error(`timeout waiting for ${method}`));
|
|
111
|
+
}
|
|
112
|
+
}, 15000).unref?.();
|
|
113
|
+
});
|
|
114
|
+
await this.clientTransport.send(message);
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
async listTools() {
|
|
118
|
+
const result = await this.request('tools/list', {});
|
|
119
|
+
return result.tools ?? [];
|
|
120
|
+
}
|
|
121
|
+
async callTool(name, args = {}) {
|
|
122
|
+
return this.request('tools/call', { name, arguments: args });
|
|
123
|
+
}
|
|
124
|
+
/** The text of the first `type: 'text'` content block, if any. */
|
|
125
|
+
static text(result) {
|
|
126
|
+
return result.content?.find((b) => b.type === 'text')?.text;
|
|
127
|
+
}
|
|
128
|
+
async close() {
|
|
129
|
+
await this.handle.close();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.WireClient = WireClient;
|
|
133
|
+
//# sourceMappingURL=mcp-wire.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-wire.js","sourceRoot":"","sources":["../../../src/__tests__/helpers/mcp-wire.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,yDAAiE;AACjE,8DAAgE;AAChE,4CAA8D;AAI9D,2EAA2E;AAC3E,MAAM,yBAAyB,GAAG,yCAAyC,CAAC;AAC5E,MAAM,4BAA4B,GAAG,4CAA4C,CAAC;AAClF,MAAM,uBAAuB,GAAG,YAAY,CAAC;AAC7C,MAAM,uBAAuB,GAAG,YAAY,CAAC;AAe7C;;;;GAIG;AACH,MAAa,UAAU;IASrB,YACE,eAAkC,EAClC,MAAkC,EACjB,GAAQ;QAAR,QAAG,GAAH,GAAG,CAAK;QAXnB,WAAM,GAAG,CAAC,CAAC;QACF,YAAO,GAAG,IAAI,GAAG,EAG/B,CAAC;QASF,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,eAAe,CAAC,SAAS,GAAG,CAAC,OAAY,EAAE,EAAE;YAChD,IAAI,OAAO,EAAE,EAAE,KAAK,SAAS;gBAAE,OAAO;YACtC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAC5C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