@panproto/mcp-server 0.2.0 → 0.22.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.
- package/README.md +12 -59
- package/dist/cli.d.ts +0 -20
- package/dist/cli.js +2 -35
- package/dist/cli.js.map +1 -1
- package/dist/resources/protocols.js +0 -20
- package/dist/resources/protocols.js.map +1 -1
- package/dist/server.js +1 -3
- package/dist/server.js.map +1 -1
- package/dist/tools/convert.js +36 -49
- package/dist/tools/convert.js.map +1 -1
- package/dist/tools/diff.js +17 -21
- package/dist/tools/diff.js.map +1 -1
- package/dist/tools/expr.js +4 -16
- package/dist/tools/expr.js.map +1 -1
- package/dist/tools/lens.js +21 -67
- package/dist/tools/lens.js.map +1 -1
- package/dist/tools/migration.js +28 -56
- package/dist/tools/migration.js.map +1 -1
- package/dist/tools/parse.js +18 -19
- package/dist/tools/parse.js.map +1 -1
- package/dist/tools/schema.js +15 -37
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/vcs.js +23 -46
- package/dist/tools/vcs.js.map +1 -1
- package/package.json +1 -1
- package/dist/tools/enrich.d.ts +0 -2
- package/dist/tools/enrich.js +0 -24
- package/dist/tools/enrich.js.map +0 -1
package/README.md
CHANGED
|
@@ -40,75 +40,28 @@ Add to `.vscode/settings.json`:
|
|
|
40
40
|
}
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
## Tools (
|
|
43
|
+
## Tools (18)
|
|
44
44
|
|
|
45
|
-
### Schema
|
|
46
45
|
| Tool | Description |
|
|
47
46
|
|------|-------------|
|
|
48
47
|
| `panproto_validate` | Validate a schema against a protocol |
|
|
49
48
|
| `panproto_normalize` | Canonicalize a schema |
|
|
50
|
-
| `panproto_scaffold` | Generate
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
|
56
|
-
|
|
57
|
-
| `
|
|
58
|
-
| `
|
|
59
|
-
| `
|
|
60
|
-
| `
|
|
61
|
-
|
|
62
|
-
### Diff
|
|
63
|
-
| Tool | Description |
|
|
64
|
-
|------|-------------|
|
|
65
|
-
| `panproto_diff` | Structural diff with rename detection |
|
|
66
|
-
| `panproto_classify` | Classify change compatibility |
|
|
67
|
-
|
|
68
|
-
### Lens
|
|
69
|
-
| Tool | Description |
|
|
70
|
-
|------|-------------|
|
|
71
|
-
| `panproto_lens_generate` | Auto-generate a protolens chain |
|
|
72
|
-
| `panproto_lens_apply` | Apply lens (forward or backward) |
|
|
73
|
-
| `panproto_lens_verify` | Verify round-trip laws |
|
|
74
|
-
| `panproto_lens_compose` | Compose two chains |
|
|
75
|
-
| `panproto_lens_inspect` | Inspect chain steps and effects |
|
|
76
|
-
|
|
77
|
-
### Data
|
|
78
|
-
| Tool | Description |
|
|
79
|
-
|------|-------------|
|
|
80
|
-
| `panproto_convert` | Convert data between schemas |
|
|
81
|
-
| `panproto_batch_migrate` | Migrate a directory via VCS history |
|
|
82
|
-
| `panproto_data_status` | Report data staleness |
|
|
83
|
-
|
|
84
|
-
### Parse
|
|
85
|
-
| Tool | Description |
|
|
86
|
-
|------|-------------|
|
|
49
|
+
| `panproto_scaffold` | Generate a skeleton schema |
|
|
50
|
+
| `panproto_check_existence` | Check migration validity |
|
|
51
|
+
| `panproto_compile` | Compile a migration |
|
|
52
|
+
| `panproto_lift` | Apply migration to a record |
|
|
53
|
+
| `panproto_diff` | Structural diff between schemas |
|
|
54
|
+
| `panproto_classify` | Classify schema change compatibility |
|
|
55
|
+
| `panproto_lens_generate` | Auto-generate a lens |
|
|
56
|
+
| `panproto_lens_apply` | Apply a lens to data |
|
|
57
|
+
| `panproto_lens_verify` | Verify lens round-trip laws |
|
|
58
|
+
| `panproto_convert` | Convert data between protocols |
|
|
59
|
+
| `panproto_convert_schema` | Translate a schema between protocols |
|
|
87
60
|
| `panproto_parse_file` | Parse source file (248 languages) |
|
|
88
|
-
| `panproto_parse_project` | Parse directory into project schema |
|
|
89
61
|
| `panproto_parse_emit` | Round-trip parse and emit |
|
|
90
|
-
|
|
91
|
-
### Expression
|
|
92
|
-
| Tool | Description |
|
|
93
|
-
|------|-------------|
|
|
94
62
|
| `panproto_eval_expr` | Evaluate an expression |
|
|
95
|
-
| `panproto_parse_expr` | Parse expression to AST |
|
|
96
|
-
| `panproto_fmt_expr` | Pretty-print expression |
|
|
97
|
-
|
|
98
|
-
### VCS
|
|
99
|
-
| Tool | Description |
|
|
100
|
-
|------|-------------|
|
|
101
63
|
| `panproto_vcs_status` | Show VCS status |
|
|
102
64
|
| `panproto_vcs_log` | Show commit history |
|
|
103
|
-
| `panproto_vcs_diff` | Diff schema versions |
|
|
104
|
-
| `panproto_vcs_blame` | Attribute elements to commits |
|
|
105
|
-
|
|
106
|
-
### Enrichment
|
|
107
|
-
| Tool | Description |
|
|
108
|
-
|------|-------------|
|
|
109
|
-
| `panproto_enrich_add_default` | Add default value to a vertex |
|
|
110
|
-
| `panproto_enrich_add_coercion` | Add type coercion expression |
|
|
111
|
-
| `panproto_enrich_list` | List all enrichments |
|
|
112
65
|
|
|
113
66
|
## Resources (3)
|
|
114
67
|
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,29 +1,9 @@
|
|
|
1
1
|
interface ExecOptions {
|
|
2
2
|
cwd?: string;
|
|
3
|
-
timeout?: number;
|
|
4
3
|
}
|
|
5
4
|
/**
|
|
6
5
|
* Execute the panproto CLI (`schema` command) and return stdout.
|
|
7
6
|
* Throws on non-zero exit with stderr as the error message.
|
|
8
7
|
*/
|
|
9
8
|
export declare function execCli(...argsAndOptions: Array<string | ExecOptions>): Promise<string>;
|
|
10
|
-
/** Content helper for tool responses. */
|
|
11
|
-
export declare function textContent(text: string): {
|
|
12
|
-
content: {
|
|
13
|
-
type: "text";
|
|
14
|
-
text: string;
|
|
15
|
-
}[];
|
|
16
|
-
};
|
|
17
|
-
/** Wrap a tool handler with consistent error handling. */
|
|
18
|
-
export declare function withErrorBoundary<T>(fn: (args: T) => Promise<{
|
|
19
|
-
content: Array<{
|
|
20
|
-
type: "text";
|
|
21
|
-
text: string;
|
|
22
|
-
}>;
|
|
23
|
-
}>): (args: T) => Promise<{
|
|
24
|
-
content: Array<{
|
|
25
|
-
type: "text";
|
|
26
|
-
text: string;
|
|
27
|
-
}>;
|
|
28
|
-
}>;
|
|
29
9
|
export {};
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { execFile } from "node:child_process";
|
|
2
2
|
import { promisify } from "node:util";
|
|
3
3
|
const execFileAsync = promisify(execFile);
|
|
4
|
-
const DEBUG = process.env.DEBUG?.includes("panproto") ?? false;
|
|
5
4
|
/**
|
|
6
5
|
* Execute the panproto CLI (`schema` command) and return stdout.
|
|
7
6
|
* Throws on non-zero exit with stderr as the error message.
|
|
@@ -17,49 +16,17 @@ export async function execCli(...argsAndOptions) {
|
|
|
17
16
|
Object.assign(options, item);
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
|
-
if (DEBUG) {
|
|
21
|
-
console.error(`[panproto] schema ${args.join(" ")}`);
|
|
22
|
-
}
|
|
23
19
|
try {
|
|
24
20
|
const { stdout } = await execFileAsync("schema", args, {
|
|
25
21
|
cwd: options.cwd,
|
|
26
|
-
timeout:
|
|
22
|
+
timeout: 30_000,
|
|
27
23
|
maxBuffer: 10 * 1024 * 1024,
|
|
28
24
|
});
|
|
29
25
|
return stdout.trim();
|
|
30
26
|
}
|
|
31
27
|
catch (error) {
|
|
32
|
-
const message = extractErrorMessage(error);
|
|
33
|
-
if (DEBUG) {
|
|
34
|
-
console.error(`[panproto] error: ${message}`);
|
|
35
|
-
}
|
|
36
|
-
throw new Error(message);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function extractErrorMessage(error) {
|
|
40
|
-
if (error instanceof Error) {
|
|
41
28
|
const execError = error;
|
|
42
|
-
|
|
43
|
-
return execError.stderr.trim();
|
|
44
|
-
}
|
|
45
|
-
return execError.message;
|
|
29
|
+
throw new Error(execError.stderr?.trim() || execError.message || "CLI execution failed");
|
|
46
30
|
}
|
|
47
|
-
return "CLI execution failed";
|
|
48
|
-
}
|
|
49
|
-
/** Content helper for tool responses. */
|
|
50
|
-
export function textContent(text) {
|
|
51
|
-
return { content: [{ type: "text", text }] };
|
|
52
|
-
}
|
|
53
|
-
/** Wrap a tool handler with consistent error handling. */
|
|
54
|
-
export function withErrorBoundary(fn) {
|
|
55
|
-
return async (args) => {
|
|
56
|
-
try {
|
|
57
|
-
return await fn(args);
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
const message = error instanceof Error ? error.message : "Unknown error";
|
|
61
|
-
return textContent(`Error: ${message}`);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
31
|
}
|
|
65
32
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAM1C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,GAAG,cAA2C;IAE9C,MAAM,OAAO,GAAgB,EAAE,CAAC;IAChC,MAAM,IAAI,GAAa,EAAE,CAAC;IAE1B,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;QAClC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE;YACrD,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,OAAO,EAAE,MAAM;YACf,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;SAC5B,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,SAAS,GAAG,KAA8C,CAAC;QACjE,MAAM,IAAI,KAAK,CACb,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC,OAAO,IAAI,sBAAsB,CACxE,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { execCli } from "../cli.js";
|
|
2
|
-
import { CODEC_CATALOG } from "./codecs.js";
|
|
3
|
-
import { GRAMMAR_CATALOG } from "./grammars.js";
|
|
4
2
|
export function registerResources(server) {
|
|
5
3
|
server.resource("protocols", "panproto://protocols", async () => {
|
|
6
4
|
try {
|
|
@@ -27,24 +25,6 @@ export function registerResources(server) {
|
|
|
27
25
|
};
|
|
28
26
|
}
|
|
29
27
|
});
|
|
30
|
-
server.resource("codecs", "panproto://codecs", async () => ({
|
|
31
|
-
contents: [
|
|
32
|
-
{
|
|
33
|
-
uri: "panproto://codecs",
|
|
34
|
-
mimeType: "text/plain",
|
|
35
|
-
text: CODEC_CATALOG,
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
}));
|
|
39
|
-
server.resource("grammars", "panproto://grammars", async () => ({
|
|
40
|
-
contents: [
|
|
41
|
-
{
|
|
42
|
-
uri: "panproto://grammars",
|
|
43
|
-
mimeType: "text/plain",
|
|
44
|
-
text: GRAMMAR_CATALOG,
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
}));
|
|
48
28
|
}
|
|
49
29
|
const PROTOCOL_LIST = `panproto supports 50 semantic protocol definitions:
|
|
50
30
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocols.js","sourceRoot":"","sources":["../../src/resources/protocols.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"protocols.js","sourceRoot":"","sources":["../../src/resources/protocols.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,UAAU,iBAAiB,CAAC,MAAiB;IACjD,MAAM,CAAC,QAAQ,CACb,WAAW,EACX,sBAAsB,EACtB,KAAK,IAAI,EAAE;QACT,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;YAC7D,OAAO;gBACL,QAAQ,EAAE;oBACR;wBACE,GAAG,EAAE,sBAAsB;wBAC3B,QAAQ,EAAE,YAAY;wBACtB,IAAI,EAAE,0DAA0D,MAAM,EAAE;qBACzE;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;gBACL,QAAQ,EAAE;oBACR;wBACE,GAAG,EAAE,sBAAsB;wBAC3B,QAAQ,EAAE,YAAY;wBACtB,IAAI,EAAE,aAAa;qBACpB;iBACF;aACF,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC;AAED,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;oHAiB8F,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -8,13 +8,12 @@ import { registerConvertTools } from "./tools/convert.js";
|
|
|
8
8
|
import { registerParseTools } from "./tools/parse.js";
|
|
9
9
|
import { registerExprTools } from "./tools/expr.js";
|
|
10
10
|
import { registerVcsTools } from "./tools/vcs.js";
|
|
11
|
-
import { registerEnrichTools } from "./tools/enrich.js";
|
|
12
11
|
import { registerResources } from "./resources/protocols.js";
|
|
13
12
|
import { registerPrompts } from "./prompts/migration-plan.js";
|
|
14
13
|
export async function createServer() {
|
|
15
14
|
const server = new McpServer({
|
|
16
15
|
name: "panproto",
|
|
17
|
-
version: "0.
|
|
16
|
+
version: "0.22.1",
|
|
18
17
|
});
|
|
19
18
|
// Register all tool groups
|
|
20
19
|
registerSchemaTools(server);
|
|
@@ -25,7 +24,6 @@ export async function createServer() {
|
|
|
25
24
|
registerParseTools(server);
|
|
26
25
|
registerExprTools(server);
|
|
27
26
|
registerVcsTools(server);
|
|
28
|
-
registerEnrichTools(server);
|
|
29
27
|
// Register resources and prompts
|
|
30
28
|
registerResources(server);
|
|
31
29
|
registerPrompts(server);
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,
|
|
1
|
+
{"version":3,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,CAAC,MAAM,CAAC,CAAC;IAExB,OAAO;QACL,MAAM,EAAE,KAAK,IAAI,EAAE;YACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;YAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAClC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/convert.js
CHANGED
|
@@ -1,55 +1,42 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { execCli
|
|
2
|
+
import { execCli } from "../cli.js";
|
|
3
3
|
export function registerConvertTools(server) {
|
|
4
|
-
server.tool("panproto_convert", "Convert data between
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
4
|
+
server.tool("panproto_convert", "Convert data between protocols (e.g., Avro to JSON Schema)", {
|
|
5
|
+
src_protocol: z.string().describe("Source protocol name"),
|
|
6
|
+
tgt_protocol: z.string().describe("Target protocol name"),
|
|
7
|
+
data: z.string().describe("Path to data file"),
|
|
8
|
+
src_schema: z
|
|
9
|
+
.string()
|
|
10
|
+
.optional()
|
|
11
|
+
.describe("Path to source schema (optional)"),
|
|
12
|
+
tgt_schema: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("Path to target schema (optional)"),
|
|
16
|
+
}, async ({ src_protocol, tgt_protocol, data, src_schema, tgt_schema }) => {
|
|
17
|
+
const args = [
|
|
18
|
+
"data",
|
|
19
|
+
"convert",
|
|
20
|
+
"--src-protocol",
|
|
21
|
+
src_protocol,
|
|
22
|
+
"--tgt-protocol",
|
|
23
|
+
tgt_protocol,
|
|
24
|
+
];
|
|
25
|
+
if (src_schema)
|
|
26
|
+
args.push("--src-schema", src_schema);
|
|
27
|
+
if (tgt_schema)
|
|
28
|
+
args.push("--tgt-schema", tgt_schema);
|
|
24
29
|
args.push(data);
|
|
25
30
|
const result = await execCli(...args);
|
|
26
|
-
return
|
|
27
|
-
})
|
|
28
|
-
server.tool("
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (protocol)
|
|
37
|
-
args.push("--protocol", protocol);
|
|
38
|
-
if (dry_run)
|
|
39
|
-
args.push("--dry-run");
|
|
40
|
-
if (backward)
|
|
41
|
-
args.push("--backward");
|
|
42
|
-
if (output)
|
|
43
|
-
args.push("-o", output);
|
|
44
|
-
args.push(data_dir);
|
|
45
|
-
const result = await execCli(...args, { timeout: 120_000 });
|
|
46
|
-
return textContent(result);
|
|
47
|
-
}));
|
|
48
|
-
server.tool("panproto_data_status", "Report data staleness relative to the current schema version", {
|
|
49
|
-
data_dir: z.string().describe("Directory containing data files"),
|
|
50
|
-
}, withErrorBoundary(async ({ data_dir }) => {
|
|
51
|
-
const result = await execCli("data", "status", data_dir);
|
|
52
|
-
return textContent(result);
|
|
53
|
-
}));
|
|
31
|
+
return { content: [{ type: "text", text: result }] };
|
|
32
|
+
});
|
|
33
|
+
server.tool("panproto_convert_schema", "Translate a schema between protocols", {
|
|
34
|
+
src_protocol: z.string().describe("Source protocol name"),
|
|
35
|
+
tgt_protocol: z.string().describe("Target protocol name"),
|
|
36
|
+
schema: z.string().describe("Path to schema file"),
|
|
37
|
+
}, async ({ src_protocol, tgt_protocol, schema }) => {
|
|
38
|
+
const result = await execCli("data", "convert", "--src-protocol", src_protocol, "--tgt-protocol", tgt_protocol, "--schema-only", schema);
|
|
39
|
+
return { content: [{ type: "text", text: result }] };
|
|
40
|
+
});
|
|
54
41
|
}
|
|
55
42
|
//# sourceMappingURL=convert.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.js","sourceRoot":"","sources":["../../src/tools/convert.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"convert.js","sourceRoot":"","sources":["../../src/tools/convert.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,UAAU,oBAAoB,CAAC,MAAiB;IACpD,MAAM,CAAC,IAAI,CACT,kBAAkB,EAClB,4DAA4D,EAC5D;QACE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACzD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACzD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC;QAC9C,UAAU,EAAE,CAAC;aACV,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,kCAAkC,CAAC;QAC/C,UAAU,EAAE,CAAC;aACV,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,kCAAkC,CAAC;KAChD,EACD,KAAK,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE;QACrE,MAAM,IAAI,GAAG;YACX,MAAM;YACN,SAAS;YACT,gBAAgB;YAChB,YAAY;YACZ,gBAAgB;YAChB,YAAY;SACb,CAAC;QACF,IAAI,UAAU;YAAE,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;QACtD,IAAI,UAAU;YAAE,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;QACtC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAChE,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,yBAAyB,EACzB,sCAAsC,EACtC;QACE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACzD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACzD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;KACnD,EACD,KAAK,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE;QAC/C,MAAM,MAAM,GAAG,MAAM,OAAO,CAC1B,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,MAAM,CACP,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAChE,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/diff.js
CHANGED
|
@@ -1,30 +1,26 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { execCli
|
|
2
|
+
import { execCli } from "../cli.js";
|
|
3
3
|
export function registerDiffTools(server) {
|
|
4
|
-
server.tool("panproto_diff", "Compute structural diff between two schemas
|
|
4
|
+
server.tool("panproto_diff", "Compute structural diff between two schemas", {
|
|
5
5
|
src: z.string().describe("Path to source schema"),
|
|
6
6
|
tgt: z.string().describe("Path to target schema"),
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
const args = ["diff", src, tgt];
|
|
12
|
-
if (stat)
|
|
13
|
-
args.push("--stat");
|
|
14
|
-
if (detect_renames)
|
|
15
|
-
args.push("--detect-renames");
|
|
16
|
-
if (theory)
|
|
17
|
-
args.push("--theory");
|
|
18
|
-
const result = await execCli(...args);
|
|
19
|
-
return textContent(result);
|
|
20
|
-
}));
|
|
7
|
+
}, async ({ src, tgt }) => {
|
|
8
|
+
const result = await execCli("diff", "--src", src, "--tgt", tgt);
|
|
9
|
+
return { content: [{ type: "text", text: result }] };
|
|
10
|
+
});
|
|
21
11
|
server.tool("panproto_classify", "Classify a schema change as compatible, backward-compatible, or breaking", {
|
|
22
12
|
src: z.string().describe("Path to source schema"),
|
|
23
13
|
tgt: z.string().describe("Path to target schema"),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
})
|
|
14
|
+
protocol: z
|
|
15
|
+
.string()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("Protocol name (for protocol-aware classification)"),
|
|
18
|
+
}, async ({ src, tgt, protocol }) => {
|
|
19
|
+
const args = ["check", "--src", src, "--tgt", tgt];
|
|
20
|
+
if (protocol)
|
|
21
|
+
args.push("--protocol", protocol);
|
|
22
|
+
const result = await execCli(...args);
|
|
23
|
+
return { content: [{ type: "text", text: result }] };
|
|
24
|
+
});
|
|
29
25
|
}
|
|
30
26
|
//# sourceMappingURL=diff.js.map
|
package/dist/tools/diff.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/tools/diff.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/tools/diff.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,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I,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAChE,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/expr.js
CHANGED
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { execCli
|
|
2
|
+
import { execCli } from "../cli.js";
|
|
3
3
|
export function registerExprTools(server) {
|
|
4
4
|
server.tool("panproto_eval_expr", "Evaluate a panproto expression (pure functional lambda calculus with ~50 builtins)", {
|
|
5
5
|
expr: z
|
|
6
6
|
.string()
|
|
7
7
|
.describe('Expression to evaluate (e.g., "2 + 3 * 4" or "\\\\x -> x + 1")'),
|
|
8
|
-
},
|
|
8
|
+
}, async ({ expr }) => {
|
|
9
9
|
const result = await execCli("expr", "eval", expr);
|
|
10
|
-
return
|
|
11
|
-
})
|
|
12
|
-
server.tool("panproto_parse_expr", "Parse an expression and print its AST (useful for debugging expression syntax)", {
|
|
13
|
-
source: z.string().describe("Expression source to parse"),
|
|
14
|
-
}, withErrorBoundary(async ({ source }) => {
|
|
15
|
-
const result = await execCli("expr", "parse", source);
|
|
16
|
-
return textContent(result);
|
|
17
|
-
}));
|
|
18
|
-
server.tool("panproto_fmt_expr", "Parse an expression and pretty-print it in canonical form", {
|
|
19
|
-
source: z.string().describe("Expression source to format"),
|
|
20
|
-
}, withErrorBoundary(async ({ source }) => {
|
|
21
|
-
const result = await execCli("expr", "fmt", source);
|
|
22
|
-
return textContent(result);
|
|
23
|
-
}));
|
|
10
|
+
return { content: [{ type: "text", text: result }] };
|
|
11
|
+
});
|
|
24
12
|
}
|
|
25
13
|
//# sourceMappingURL=expr.js.map
|
package/dist/tools/expr.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expr.js","sourceRoot":"","sources":["../../src/tools/expr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"expr.js","sourceRoot":"","sources":["../../src/tools/expr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,UAAU,iBAAiB,CAAC,MAAiB;IACjD,MAAM,CAAC,IAAI,CACT,oBAAoB,EACpB,oFAAoF,EACpF;QACE,IAAI,EAAE,CAAC;aACJ,MAAM,EAAE;aACR,QAAQ,CAAC,gEAAgE,CAAC;KAC9E,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACjB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QACnD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAChE,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/lens.js
CHANGED
|
@@ -1,72 +1,26 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { execCli
|
|
2
|
+
import { execCli } from "../cli.js";
|
|
3
3
|
export function registerLensTools(server) {
|
|
4
|
-
server.tool("panproto_lens_generate", "Auto-generate a bidirectional
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return textContent(result);
|
|
19
|
-
}));
|
|
20
|
-
server.tool("panproto_lens_apply", "Apply a protolens chain to data (forward or backward direction)", {
|
|
21
|
-
chain: z.string().describe("Path to protolens chain JSON file"),
|
|
22
|
-
data: z.string().describe("Path to data record"),
|
|
23
|
-
protocol: z.string().describe("Protocol name"),
|
|
24
|
-
direction: z.enum(["forward", "backward"]).optional().describe("Direction (default: forward)"),
|
|
25
|
-
complement: z.string().optional().describe("Path to complement data (for backward apply)"),
|
|
26
|
-
schema: z.string().optional().describe("Schema for chain instantiation"),
|
|
27
|
-
}, withErrorBoundary(async ({ chain, data, protocol, direction, complement, schema }) => {
|
|
28
|
-
const args = ["lens", "apply", "--protocol", protocol];
|
|
29
|
-
if (direction)
|
|
30
|
-
args.push("--direction", direction);
|
|
31
|
-
if (complement)
|
|
32
|
-
args.push("--complement", complement);
|
|
33
|
-
if (schema)
|
|
34
|
-
args.push("--schema", schema);
|
|
35
|
-
args.push(chain, data);
|
|
36
|
-
const result = await execCli(...args);
|
|
37
|
-
return textContent(result);
|
|
38
|
-
}));
|
|
4
|
+
server.tool("panproto_lens_generate", "Auto-generate a bidirectional lens between two schemas", {
|
|
5
|
+
src: z.string().describe("Path to source schema"),
|
|
6
|
+
tgt: z.string().describe("Path to target schema"),
|
|
7
|
+
}, async ({ src, tgt }) => {
|
|
8
|
+
const result = await execCli("lens", "generate", src, tgt);
|
|
9
|
+
return { content: [{ type: "text", text: result }] };
|
|
10
|
+
});
|
|
11
|
+
server.tool("panproto_lens_apply", "Apply a lens to data (get direction: project source to target)", {
|
|
12
|
+
lens: z.string().describe("Path to lens file"),
|
|
13
|
+
record: z.string().describe("Path to data record"),
|
|
14
|
+
}, async ({ lens, record }) => {
|
|
15
|
+
const result = await execCli("lens", "apply", lens, record);
|
|
16
|
+
return { content: [{ type: "text", text: result }] };
|
|
17
|
+
});
|
|
39
18
|
server.tool("panproto_lens_verify", "Verify lens round-trip laws (GetPut and PutGet) on test data", {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
args.push("--schema", schema);
|
|
47
|
-
args.push(data);
|
|
48
|
-
const result = await execCli(...args);
|
|
49
|
-
return textContent(result);
|
|
50
|
-
}));
|
|
51
|
-
server.tool("panproto_lens_compose", "Compose two protolens chains or schemas into a single chain", {
|
|
52
|
-
chain1: z.string().describe("Path to first chain or schema"),
|
|
53
|
-
chain2: z.string().describe("Path to second chain or schema"),
|
|
54
|
-
protocol: z.string().describe("Protocol name"),
|
|
55
|
-
json: z.boolean().optional().describe("Output as JSON"),
|
|
56
|
-
}, withErrorBoundary(async ({ chain1, chain2, protocol, json }) => {
|
|
57
|
-
const args = ["lens", "compose", "--protocol", protocol];
|
|
58
|
-
if (json)
|
|
59
|
-
args.push("--json");
|
|
60
|
-
args.push(chain1, chain2);
|
|
61
|
-
const result = await execCli(...args);
|
|
62
|
-
return textContent(result);
|
|
63
|
-
}));
|
|
64
|
-
server.tool("panproto_lens_inspect", "Inspect a protolens chain showing each step, preconditions, and effects", {
|
|
65
|
-
chain: z.string().describe("Path to protolens chain JSON"),
|
|
66
|
-
protocol: z.string().describe("Protocol name"),
|
|
67
|
-
}, withErrorBoundary(async ({ chain, protocol }) => {
|
|
68
|
-
const result = await execCli("lens", "inspect", "--protocol", protocol, chain);
|
|
69
|
-
return textContent(result);
|
|
70
|
-
}));
|
|
19
|
+
lens: z.string().describe("Path to lens file"),
|
|
20
|
+
instance: z.string().describe("Path to test instance"),
|
|
21
|
+
}, async ({ lens, instance }) => {
|
|
22
|
+
const result = await execCli("lens", "verify", lens, "--instance", instance);
|
|
23
|
+
return { content: [{ type: "text", text: result }] };
|
|
24
|
+
});
|
|
71
25
|
}
|
|
72
26
|
//# sourceMappingURL=lens.js.map
|
package/dist/tools/lens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lens.js","sourceRoot":"","sources":["../../src/tools/lens.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"lens.js","sourceRoot":"","sources":["../../src/tools/lens.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MA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,uBAAuB,CAAC;KACvD,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC3B,MAAM,MAAM,GAAG,MAAM,OAAO,CAC1B,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,YAAY,EACZ,QAAQ,CACT,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAChE,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/migration.js
CHANGED
|
@@ -1,64 +1,36 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { execCli
|
|
2
|
+
import { execCli } from "../cli.js";
|
|
3
3
|
export function registerMigrationTools(server) {
|
|
4
|
-
server.tool("panproto_check_existence", "Check if a migration between two schemas
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
server.tool("panproto_check_existence", "Check if a migration between two schemas is valid", {
|
|
5
|
+
src_schema: z.string().describe("Path to source schema"),
|
|
6
|
+
tgt_schema: z.string().describe("Path to target schema"),
|
|
7
|
+
migration: z
|
|
8
|
+
.string()
|
|
9
|
+
.optional()
|
|
10
|
+
.describe("Path to migration file (optional, auto-discovers if omitted)"),
|
|
11
|
+
}, async ({ src_schema, tgt_schema, migration }) => {
|
|
12
|
+
const args = ["check", "--src", src_schema, "--tgt", tgt_schema];
|
|
13
|
+
if (migration)
|
|
14
|
+
args.push("--mapping", migration);
|
|
13
15
|
const result = await execCli(...args);
|
|
14
|
-
return
|
|
15
|
-
})
|
|
16
|
-
server.tool("
|
|
17
|
-
|
|
16
|
+
return { content: [{ type: "text", text: result }] };
|
|
17
|
+
});
|
|
18
|
+
server.tool("panproto_compile", "Compile a migration for fast per-record application", {
|
|
19
|
+
src_schema: z.string().describe("Path to source schema"),
|
|
20
|
+
tgt_schema: z.string().describe("Path to target schema"),
|
|
21
|
+
migration: z.string().describe("Path to migration file"),
|
|
22
|
+
}, async ({ src_schema, tgt_schema, migration }) => {
|
|
23
|
+
const result = await execCli("check", "--src", src_schema, "--tgt", tgt_schema, "--mapping", migration, "--compile");
|
|
24
|
+
return { content: [{ type: "text", text: result }] };
|
|
25
|
+
});
|
|
26
|
+
server.tool("panproto_lift", "Apply a compiled migration to a data record", {
|
|
27
|
+
migration: z.string().describe("Path to migration file"),
|
|
18
28
|
src_schema: z.string().describe("Path to source schema"),
|
|
19
29
|
tgt_schema: z.string().describe("Path to target schema"),
|
|
20
30
|
record: z.string().describe("Path to the data record"),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"--src-schema", src_schema, "--tgt-schema", tgt_schema,
|
|
26
|
-
];
|
|
27
|
-
if (direction)
|
|
28
|
-
args.push("--direction", direction);
|
|
29
|
-
args.push(record);
|
|
30
|
-
const result = await execCli(...args);
|
|
31
|
-
return textContent(result);
|
|
32
|
-
}));
|
|
33
|
-
server.tool("panproto_auto_migrate", "Automatically discover a migration morphism between two schemas via CSP search", {
|
|
34
|
-
old_schema: z.string().describe("Path to old/source schema"),
|
|
35
|
-
new_schema: z.string().describe("Path to new/target schema"),
|
|
36
|
-
json: z.boolean().optional().describe("Output as JSON"),
|
|
37
|
-
monic: z.boolean().optional().describe("Require injective vertex mapping"),
|
|
38
|
-
}, withErrorBoundary(async ({ old_schema, new_schema, json, monic }) => {
|
|
39
|
-
const args = ["auto-migrate"];
|
|
40
|
-
if (json)
|
|
41
|
-
args.push("--json");
|
|
42
|
-
if (monic)
|
|
43
|
-
args.push("--monic");
|
|
44
|
-
args.push(old_schema, new_schema);
|
|
45
|
-
const result = await execCli(...args);
|
|
46
|
-
return textContent(result);
|
|
47
|
-
}));
|
|
48
|
-
server.tool("panproto_integrate", "Compute the pushout (integration) of two schemas, merging them into one", {
|
|
49
|
-
left: z.string().describe("Path to left schema"),
|
|
50
|
-
right: z.string().describe("Path to right schema"),
|
|
51
|
-
auto_overlap: z.boolean().optional().describe("Auto-discover overlap between schemas"),
|
|
52
|
-
json: z.boolean().optional().describe("Output as JSON"),
|
|
53
|
-
}, withErrorBoundary(async ({ left, right, auto_overlap, json }) => {
|
|
54
|
-
const args = ["integrate"];
|
|
55
|
-
if (auto_overlap)
|
|
56
|
-
args.push("--auto-overlap");
|
|
57
|
-
if (json)
|
|
58
|
-
args.push("--json");
|
|
59
|
-
args.push(left, right);
|
|
60
|
-
const result = await execCli(...args);
|
|
61
|
-
return textContent(result);
|
|
62
|
-
}));
|
|
31
|
+
}, async ({ migration, src_schema, tgt_schema, record }) => {
|
|
32
|
+
const result = await execCli("lift", "--migration", migration, "--src-schema", src_schema, "--tgt-schema", tgt_schema, record);
|
|
33
|
+
return { content: [{ type: "text", text: result }] };
|
|
34
|
+
});
|
|
63
35
|
}
|
|
64
36
|
//# sourceMappingURL=migration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.js","sourceRoot":"","sources":["../../src/tools/migration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"migration.js","sourceRoot":"","sources":["../../src/tools/migration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,UAAU,sBAAsB,CAAC,MAAiB;IACtD,MAAM,CAAC,IAAI,CACT,0BAA0B,EAC1B,mDAAmD,EACnD;QACE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;QACxD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;QACxD,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,Q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,CAAC,wBAAwB,CAAC;QACxD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;QACxD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;QACxD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;KACvD,EACD,KAAK,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE;QACtD,MAAM,MAAM,GAAG,MAAM,OAAO,CAC1B,MAAM,EACN,aAAa,EACb,SAAS,EACT,cAAc,EACd,UAAU,EACV,cAAc,EACd,UAAU,EACV,MAAM,CACP,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAChE,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/parse.js
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { execCli
|
|
2
|
+
import { execCli } from "../cli.js";
|
|
3
3
|
export function registerParseTools(server) {
|
|
4
|
-
server.tool("panproto_parse_file", "Parse a source file into a panproto schema representation (248 languages supported
|
|
4
|
+
server.tool("panproto_parse_file", "Parse a source file into a panproto schema representation (248 languages supported)", {
|
|
5
5
|
file_path: z.string().describe("Path to the source file"),
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
server.tool("panproto_parse_emit", "Round-trip parse and emit a source file (parse then reconstruct to verify fidelity)", {
|
|
6
|
+
language: z
|
|
7
|
+
.string()
|
|
8
|
+
.optional()
|
|
9
|
+
.describe("Language override (auto-detected from extension if omitted)"),
|
|
10
|
+
}, async ({ file_path, language }) => {
|
|
11
|
+
const args = ["parse", "file"];
|
|
12
|
+
if (language)
|
|
13
|
+
args.push("--language", language);
|
|
14
|
+
args.push(file_path);
|
|
15
|
+
const result = await execCli(...args);
|
|
16
|
+
return { content: [{ type: "text", text: result }] };
|
|
17
|
+
});
|
|
18
|
+
server.tool("panproto_parse_emit", "Round-trip parse and emit a source file (parse then reconstruct)", {
|
|
20
19
|
file_path: z.string().describe("Path to the source file"),
|
|
21
|
-
},
|
|
20
|
+
}, async ({ file_path }) => {
|
|
22
21
|
const result = await execCli("parse", "emit", file_path);
|
|
23
|
-
return
|
|
24
|
-
})
|
|
22
|
+
return { content: [{ type: "text", text: result }] };
|
|
23
|
+
});
|
|
25
24
|
}
|
|
26
25
|
//# sourceMappingURL=parse.js.map
|
package/dist/tools/parse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/tools/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/tools/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,MAAM,CAAC,IAAI,CACT,qBAAqB,EACrB,qFAAqF,EACrF;QACE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;QACzD,QAAQ,EAAE,CAAC;aACR,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,6DAA6D,CAAC;KAC3E,EACD,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;QAChC,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC/B,IAAI,QAAQ;YAAE,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;QACtC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAChE,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,qBAAqB,EACrB,kEAAkE,EAClE;QACE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;KAC1D,EACD,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;QACtB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QACzD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAChE,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/schema.js
CHANGED
|
@@ -1,48 +1,26 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { execCli
|
|
2
|
+
import { execCli } from "../cli.js";
|
|
3
3
|
export function registerSchemaTools(server) {
|
|
4
4
|
server.tool("panproto_validate", "Validate a schema file against a protocol's rules", {
|
|
5
5
|
schema_path: z.string().describe("Path to the schema file"),
|
|
6
6
|
protocol: z.string().describe("Protocol name (e.g., atproto, openapi, avro)"),
|
|
7
|
-
},
|
|
7
|
+
}, async ({ schema_path, protocol }) => {
|
|
8
8
|
const result = await execCli("validate", "--protocol", protocol, schema_path);
|
|
9
|
-
return
|
|
10
|
-
})
|
|
11
|
-
server.tool("panproto_normalize", "Canonicalize a schema by collapsing reference chains
|
|
9
|
+
return { content: [{ type: "text", text: result }] };
|
|
10
|
+
});
|
|
11
|
+
server.tool("panproto_normalize", "Canonicalize a schema by collapsing reference chains", {
|
|
12
12
|
schema_path: z.string().describe("Path to the schema file"),
|
|
13
13
|
protocol: z.string().describe("Protocol name"),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
args.push(schema_path);
|
|
20
|
-
const result = await execCli(...args);
|
|
21
|
-
return textContent(result);
|
|
22
|
-
}));
|
|
23
|
-
server.tool("panproto_scaffold", "Generate minimal test data from a protocol theory using free model construction", {
|
|
14
|
+
}, async ({ schema_path, protocol }) => {
|
|
15
|
+
const result = await execCli("normalize", "--protocol", protocol, schema_path);
|
|
16
|
+
return { content: [{ type: "text", text: result }] };
|
|
17
|
+
});
|
|
18
|
+
server.tool("panproto_scaffold", "Generate a skeleton schema for a protocol", {
|
|
24
19
|
protocol: z.string().describe("Protocol name"),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
args.push("--json");
|
|
31
|
-
args.push(schema_path);
|
|
32
|
-
const result = await execCli(...args);
|
|
33
|
-
return textContent(result);
|
|
34
|
-
}));
|
|
35
|
-
server.tool("panproto_typecheck", "Type-check a migration morphism at the GAT level", {
|
|
36
|
-
src: z.string().describe("Path to source schema"),
|
|
37
|
-
tgt: z.string().describe("Path to target schema"),
|
|
38
|
-
migration: z.string().describe("Path to migration mapping file"),
|
|
39
|
-
}, withErrorBoundary(async ({ src, tgt, migration }) => {
|
|
40
|
-
const result = await execCli("typecheck", "--src", src, "--tgt", tgt, "--migration", migration);
|
|
41
|
-
return textContent(result);
|
|
42
|
-
}));
|
|
43
|
-
server.tool("panproto_health", "Check that the panproto CLI is installed and report its version", {}, withErrorBoundary(async () => {
|
|
44
|
-
const version = await execCli("--version");
|
|
45
|
-
return textContent(`OK: ${version}`);
|
|
46
|
-
}));
|
|
20
|
+
name: z.string().describe("Schema name"),
|
|
21
|
+
}, async ({ protocol, name }) => {
|
|
22
|
+
const result = await execCli("scaffold", "--protocol", protocol, `${name}.json`);
|
|
23
|
+
return { content: [{ type: "text", text: result }] };
|
|
24
|
+
});
|
|
47
25
|
}
|
|
48
26
|
//# sourceMappingURL=schema.js.map
|
package/dist/tools/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/tools/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/tools/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,UAAU,mBAAmB,CAAC,MAAiB;IACnD,MAAM,CAAC,IAAI,CACT,mBAAmB,EACnB,mDAAmD,EACnD;QACE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;QAC3D,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8CAA8C,CAAC;KAC9E,EACD,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,EAAE;QAClC,MAAM,MAAM,GAAG,MAAM,OAAO,CAC1B,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,WAAW,CACZ,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAChE,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,oBAAoB,EACpB,sDAAsD,EACtD;QACE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;QAC3D,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;KAC/C,EACD,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,EAAE;QAClC,MAAM,MAAM,GAAG,MAAM,OAAO,CAC1B,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,WAAW,CACZ,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAChE,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,mBAAmB,EACnB,2CAA2C,EAC3C;QACE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;QAC9C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC;KACzC,EACD,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE;QAC3B,MAAM,MAAM,GAAG,MAAM,OAAO,CAC1B,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,GAAG,IAAI,OAAO,CACf,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAChE,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/vcs.js
CHANGED
|
@@ -1,54 +1,31 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { execCli
|
|
2
|
+
import { execCli } from "../cli.js";
|
|
3
3
|
export function registerVcsTools(server) {
|
|
4
|
-
server.tool("panproto_vcs_status", "Show panproto VCS status (staged, modified, untracked schema files)", {
|
|
5
|
-
repo_path: z
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
server.tool("panproto_vcs_status", "Show the current panproto VCS status (staged, modified, untracked schema files)", {
|
|
5
|
+
repo_path: z
|
|
6
|
+
.string()
|
|
7
|
+
.optional()
|
|
8
|
+
.describe("Path to the panproto repository (default: current directory)"),
|
|
9
|
+
}, async ({ repo_path }) => {
|
|
10
|
+
const args = ["status"];
|
|
11
|
+
const result = await execCli(...args, { cwd: repo_path });
|
|
12
|
+
return { content: [{ type: "text", text: result }] };
|
|
13
|
+
});
|
|
14
|
+
server.tool("panproto_vcs_log", "Show schema commit history", {
|
|
15
|
+
repo_path: z
|
|
16
|
+
.string()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe("Path to the panproto repository (default: current directory)"),
|
|
19
|
+
limit: z
|
|
20
|
+
.number()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Maximum number of commits to show"),
|
|
23
|
+
}, async ({ repo_path, limit }) => {
|
|
16
24
|
const args = ["log"];
|
|
17
25
|
if (limit)
|
|
18
26
|
args.push("-n", String(limit));
|
|
19
|
-
if (oneline)
|
|
20
|
-
args.push("--oneline");
|
|
21
|
-
if (graph)
|
|
22
|
-
args.push("--graph");
|
|
23
|
-
const result = await execCli(...args, { cwd: repo_path });
|
|
24
|
-
return textContent(result);
|
|
25
|
-
}));
|
|
26
|
-
server.tool("panproto_vcs_diff", "Diff two schema versions or show staged changes in the VCS", {
|
|
27
|
-
repo_path: z.string().optional().describe("Path to panproto repository (default: cwd)"),
|
|
28
|
-
old_ref: z.string().optional().describe("Old ref or schema path"),
|
|
29
|
-
new_ref: z.string().optional().describe("New ref or schema path"),
|
|
30
|
-
staged: z.boolean().optional().describe("Diff staged changes against HEAD"),
|
|
31
|
-
stat: z.boolean().optional().describe("Show diffstat summary"),
|
|
32
|
-
}, withErrorBoundary(async ({ repo_path, old_ref, new_ref, staged, stat }) => {
|
|
33
|
-
const args = ["diff"];
|
|
34
|
-
if (staged)
|
|
35
|
-
args.push("--staged");
|
|
36
|
-
if (stat)
|
|
37
|
-
args.push("--stat");
|
|
38
|
-
if (old_ref)
|
|
39
|
-
args.push(old_ref);
|
|
40
|
-
if (new_ref)
|
|
41
|
-
args.push(new_ref);
|
|
42
27
|
const result = await execCli(...args, { cwd: repo_path });
|
|
43
|
-
return
|
|
44
|
-
})
|
|
45
|
-
server.tool("panproto_vcs_blame", "Show which commit introduced a specific schema element", {
|
|
46
|
-
element_type: z.enum(["vertex", "edge", "constraint"]).describe("Element type"),
|
|
47
|
-
element_id: z.string().describe('Element identifier (vertex ID, edge "src->tgt", or "vertex:sort")'),
|
|
48
|
-
repo_path: z.string().optional().describe("Path to panproto repository (default: cwd)"),
|
|
49
|
-
}, withErrorBoundary(async ({ element_type, element_id, repo_path }) => {
|
|
50
|
-
const result = await execCli("blame", "--element-type", element_type, element_id, { cwd: repo_path });
|
|
51
|
-
return textContent(result);
|
|
52
|
-
}));
|
|
28
|
+
return { content: [{ type: "text", text: result }] };
|
|
29
|
+
});
|
|
53
30
|
}
|
|
54
31
|
//# sourceMappingURL=vcs.js.map
|
package/dist/tools/vcs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vcs.js","sourceRoot":"","sources":["../../src/tools/vcs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"vcs.js","sourceRoot":"","sources":["../../src/tools/vcs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,MAAM,CAAC,IAAI,CACT,qBAAqB,EACrB,iFAAiF,EACjF;QACE,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,8DAA8D,CAAC;KAC5E,EACD,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;QACtB,MAAM,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;QACxB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;QAC1D,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAChE,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,kBAAkB,EAClB,4BAA4B,EAC5B;QACE,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,8DAA8D,CAAC;QAC3E,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,mCAAmC,CAAC;KACjD,EACD,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE;QAC7B,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;QACrB,IAAI,KAAK;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1C,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;QAC1D,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAChE,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
package/dist/tools/enrich.d.ts
DELETED
package/dist/tools/enrich.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { execCli, textContent, withErrorBoundary } from "../cli.js";
|
|
3
|
-
export function registerEnrichTools(server) {
|
|
4
|
-
server.tool("panproto_enrich_add_default", "Add a default value expression to a schema vertex", {
|
|
5
|
-
vertex: z.string().describe("Vertex ID to add the default to"),
|
|
6
|
-
expr: z.string().describe("Default value expression as JSON"),
|
|
7
|
-
}, withErrorBoundary(async ({ vertex, expr }) => {
|
|
8
|
-
const result = await execCli("enrich", "add-default", vertex, "--expr", expr);
|
|
9
|
-
return textContent(result);
|
|
10
|
-
}));
|
|
11
|
-
server.tool("panproto_enrich_add_coercion", "Add a coercion expression between two vertex kinds", {
|
|
12
|
-
from: z.string().describe("Source vertex kind"),
|
|
13
|
-
to: z.string().describe("Target vertex kind"),
|
|
14
|
-
expr: z.string().describe("Coercion expression as JSON"),
|
|
15
|
-
}, withErrorBoundary(async ({ from, to, expr }) => {
|
|
16
|
-
const result = await execCli("enrich", "add-coercion", from, to, "--expr", expr);
|
|
17
|
-
return textContent(result);
|
|
18
|
-
}));
|
|
19
|
-
server.tool("panproto_enrich_list", "List all enrichments on the HEAD schema", {}, withErrorBoundary(async () => {
|
|
20
|
-
const result = await execCli("enrich", "list");
|
|
21
|
-
return textContent(result);
|
|
22
|
-
}));
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=enrich.js.map
|
package/dist/tools/enrich.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enrich.js","sourceRoot":"","sources":["../../src/tools/enrich.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEpE,MAAM,UAAU,mBAAmB,CAAC,MAAiB;IACnD,MAAM,CAAC,IAAI,CACT,6BAA6B,EAC7B,mDAAmD,EACnD;QACE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;QAC9D,IAAI,EAAE,CAAC,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