@pymodel/verdict-mcp 0.0.0-stage → 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 PyModel LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,134 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ # @pymodel/verdict-mcp
4
+
5
+ **Typed judgment tools for coding agents, over MCP.**
6
+
7
+ [![npm](https://img.shields.io/badge/npm-%40pymodel%2Fverdict--mcp-CB3837?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@pymodel/verdict-mcp)
8
+ [![node](https://img.shields.io/badge/node-%E2%89%A522-339933?style=flat-square&logo=node.js&logoColor=white)](https://nodejs.org)
9
+ [![license](https://img.shields.io/github/license/PyModel/verdict-mcp?style=flat-square)](https://github.com/PyModel/verdict-mcp/blob/main/LICENSE)
10
+
11
+ </div>
12
+
13
+ Verdict exposes twelve typed judgment tools over the Model Context Protocol: screen
14
+ untrusted text, verify claims against evidence, rank and classify by meaning, compare
15
+ passages, extract and audit fields, review patches, and gate completion claims.
16
+
17
+ The server is local-first. Tool calls go to a Jev-compatible endpoint you host:
18
+ `POST {model, state, questions}` → `{answers, usage, model}`. Judgments are advisory;
19
+ your agent or harness still owns policy.
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ npx -y @pymodel/verdict-mcp
25
+ ```
26
+
27
+ Or install the binary:
28
+
29
+ ```bash
30
+ npm install -g @pymodel/verdict-mcp
31
+ verdict-mcp
32
+ ```
33
+
34
+ Requires **Node.js 22 or newer**.
35
+
36
+ ### Local model with the Verdict app
37
+
38
+ [Verdict](https://github.com/PyModel/verdict) is a native macOS menu bar app that runs
39
+ Decider Flash v1.3 (PPLX 1.3 Flash) on Apple silicon and serves the Jev contract on
40
+ loopback. No API key is required. Use the port shown in its menu; it defaults to `8012`.
41
+
42
+ The app answers `/v1/systemone` and `/v1/decisions`, ignores the request's `model` field,
43
+ and reports `pplx-decider-flash-v1.3` in every response.
44
+
45
+ ## MCP client
46
+
47
+ ```json
48
+ {
49
+ "mcpServers": {
50
+ "verdict": {
51
+ "command": "npx",
52
+ "args": ["-y", "@pymodel/verdict-mcp"],
53
+ "env": {
54
+ "JEV_API_BASE_URL": "http://127.0.0.1:8012/v1/systemone"
55
+ }
56
+ }
57
+ }
58
+ }
59
+ ```
60
+
61
+ The server speaks MCP over stdio by default and exposes tools named `verdict_*`.
62
+
63
+ ## Tools
64
+
65
+ | Tool | What it answers |
66
+ | --- | --- |
67
+ | `verdict_screen` | Is this fetched or pasted text safe to put in context? |
68
+ | `verdict_verify` | Do these claims hold against this evidence? |
69
+ | `verdict_noul` | How likely is each stated proposition? |
70
+ | `verdict_find` | Which candidate answers the query — and does any candidate answer it? |
71
+ | `verdict_rerank` | How should every candidate be ordered by relevance? |
72
+ | `verdict_classify` | Which class from one shared catalog applies to each item? |
73
+ | `verdict_decide` | Which of 2–6 bounded options fits the evidence and priorities? |
74
+ | `verdict_compare` | Do two passages agree, contradict, or discuss different facts? |
75
+ | `verdict_extract` | Which regex candidate is the verbatim field value? |
76
+ | `verdict_audit` | Are these extracted values faithful to the source text? |
77
+ | `verdict_review` | Is this patch actually done, per the request? |
78
+ | `verdict_gate` | Does the patch pass review *and* do the completion claims verify? |
79
+
80
+ Full arguments, output shapes, limits, and failure modes:
81
+ [tool reference](https://github.com/PyModel/verdict-mcp/blob/main/packages/verdict-mcp/skills/verdict/reference/tools.md).
82
+
83
+ ## Configuration
84
+
85
+ | Variable | Purpose |
86
+ | --- | --- |
87
+ | `JEV_API_BASE_URL` | Required local endpoint URL |
88
+ | `JEV_API_KEY` | Optional bearer token for the local endpoint |
89
+ | `JEV_PROVIDER` | Force a provider: `local`, `typesafe`, `openrouter`, `cloudflare`, or `vercel` |
90
+ | `VERDICT_MCP_MODEL` | Model slug for providers that route by model; default `jev-latest`. The Verdict app ignores it. |
91
+ | `VERDICT_MCP_REQUEST_TIMEOUT_MS` | Whole-request deadline; default `60000` |
92
+ | `VERDICT_MCP_MAX_ATTEMPTS` | Attempts for 408, 409, 429, and 5xx; default `3` |
93
+ | `VERDICT_MCP_TRANSPORT` | Set to `http` to start the HTTP transport instead of stdio |
94
+
95
+ ## HTTP mode
96
+
97
+ ```bash
98
+ npx -y @pymodel/verdict-mcp --http
99
+ ```
100
+
101
+ The HTTP server listens on `PORT` (default `8080`) at `/mcp`, with a health check at
102
+ `/health`. If the port is taken (for example by the Verdict app), set `PORT` to a free
103
+ port; startup fails with a clear `already in use` message. `HOST` defaults to
104
+ `127.0.0.1`.
105
+
106
+ | Variable | Purpose |
107
+ | --- | --- |
108
+ | `VERDICT_MCP_AUTH_TOKEN` | Required when binding a non-loopback `HOST` |
109
+ | `VERDICT_MCP_MAX_CONCURRENCY` | In-flight request cap; default `16` |
110
+ | `VERDICT_MCP_PATH_TOKEN` | Set to `1` to also accept the token as `/mcp/<token>` |
111
+
112
+ The HTTP transport is stateless: no sessions, no `Mcp-Session-Id`, so replicas can sit
113
+ behind a plain load balancer.
114
+
115
+ ## Fail-closed behavior
116
+
117
+ - Unknown arguments are rejected, not dropped.
118
+ - A malformed model answer surface as `invalid_response`, never as a pass or an empty
119
+ result.
120
+ - Truncated review input can never return `auto`.
121
+ - A confident contradiction stops a gate; it is not averaged away.
122
+
123
+ ## Links
124
+
125
+ - [Repository](https://github.com/PyModel/verdict-mcp)
126
+ - [Agent skill](https://github.com/PyModel/verdict-mcp/blob/main/packages/verdict-mcp/skills/verdict/SKILL.md)
127
+ - [Contributing](https://github.com/PyModel/verdict-mcp/blob/main/CONTRIBUTING.md)
128
+ - [Security policy](https://github.com/PyModel/verdict-mcp/blob/main/SECURITY.md)
129
+ - [Changelog](https://github.com/PyModel/verdict-mcp/blob/main/CHANGELOG.md)
130
+
131
+ ## License
132
+
133
+ MIT © [PyModel LLC](https://pymodel.com). See
134
+ [LICENSE](https://github.com/PyModel/verdict-mcp/blob/main/LICENSE).
package/dist/http.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { type McpServer } from "@modelcontextprotocol/server";
2
+ export declare function serveHttp(factory: () => McpServer, env?: NodeJS.ProcessEnv): Promise<{
3
+ server: import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
4
+ url: string;
5
+ }>;
package/dist/http.js ADDED
@@ -0,0 +1,180 @@
1
+ // Opt-in stateless Streamable HTTP transport (`verdict-mcp --http`).
2
+ //
3
+ // Serves MCP 2026-07-28 per request and 2025-era clients through the SDK's
4
+ // stateless fallback: no sessions, no Mcp-Session-Id, nothing held between
5
+ // requests, so any number of replicas can sit behind a plain load balancer.
6
+ import { createServer as createNodeServer } from "node:http";
7
+ import { timingSafeEqual } from "node:crypto";
8
+ import { createMcpHandler } from "@modelcontextprotocol/server";
9
+ import { toNodeHandler } from "@modelcontextprotocol/node";
10
+ const LOOPBACK_DEFAULT = "127.0.0.1";
11
+ // Fixed-string rejection: never echo the rejected Host/Origin back (reflection
12
+ // of attacker-controlled values), unlike the SDK's guards.
13
+ const FORBIDDEN_BODY = JSON.stringify({ jsonrpc: "2.0", error: { code: -32000, message: "Forbidden" }, id: null });
14
+ function forbidden(res) {
15
+ res.writeHead(403, { "content-type": "application/json" }).end(FORBIDDEN_BODY);
16
+ }
17
+ function isLoopbackHost(host) {
18
+ if (!host)
19
+ return false;
20
+ let hostname = host.toLowerCase();
21
+ const bracketed = hostname.match(/^\[(.+)\](?::\d+)?$/);
22
+ if (bracketed)
23
+ hostname = bracketed[1];
24
+ else
25
+ hostname = hostname.replace(/:\d+$/, "");
26
+ return hostname === "127.0.0.1" || hostname === "::1" || hostname === "localhost";
27
+ }
28
+ function isLoopbackOrigin(origin) {
29
+ if (origin === undefined)
30
+ return true;
31
+ try {
32
+ return isLoopbackHost(new URL(origin).host);
33
+ }
34
+ catch {
35
+ return false;
36
+ }
37
+ }
38
+ export async function serveHttp(factory, env = process.env) {
39
+ // Loopback by default: binding a public interface is an explicit act.
40
+ const host = env.HOST || LOOPBACK_DEFAULT;
41
+ const port = Number(env.PORT || 8080);
42
+ if (!Number.isInteger(port) || port < 0 || port > 65535) {
43
+ throw new Error("PORT must be an integer between 0 and 65535");
44
+ }
45
+ const token = Buffer.from(env.VERDICT_MCP_AUTH_TOKEN ?? "");
46
+ const maxInFlight = Number(env.VERDICT_MCP_MAX_CONCURRENCY ?? 16);
47
+ // Opt-in for clients that can only be configured with a URL (claude.ai custom
48
+ // connectors, some cloud agents): the token may also arrive as /mcp/<token>.
49
+ const pathToken = env.VERDICT_MCP_PATH_TOKEN === "1";
50
+ // The server spends the operator's Jev key on every call; never expose it unauthenticated.
51
+ if (token.length === 0 && !isLoopbackHost(host)) {
52
+ throw new Error("VERDICT_MCP_AUTH_TOKEN is required when HTTP mode binds a non-loopback HOST");
53
+ }
54
+ if (pathToken && token.length === 0) {
55
+ throw new Error("VERDICT_MCP_PATH_TOKEN requires VERDICT_MCP_AUTH_TOKEN");
56
+ }
57
+ // The path form compares the segment raw, so a token containing characters
58
+ // a client may percent-encode could never match. Refuse at startup instead.
59
+ if (pathToken && /[^\w.\-~]/.test(env.VERDICT_MCP_AUTH_TOKEN ?? "")) {
60
+ throw new Error("VERDICT_MCP_PATH_TOKEN requires a URL-safe token (letters, digits, . _ - ~)");
61
+ }
62
+ if (!Number.isInteger(maxInFlight) || maxInFlight < 1) {
63
+ throw new Error("VERDICT_MCP_MAX_CONCURRENCY must be a positive integer");
64
+ }
65
+ const matches = (candidate) => {
66
+ const given = Buffer.from(candidate);
67
+ return given.length === token.length && timingSafeEqual(given, token);
68
+ };
69
+ const authorized = (header, fromPath) => {
70
+ if (token.length === 0)
71
+ return true;
72
+ // The path segment is compared raw, never URI-decoded: decoding throws on
73
+ // malformed escapes, and a throw here would take down the process.
74
+ if (fromPath !== undefined)
75
+ return matches(fromPath);
76
+ return matches(header?.startsWith("Bearer ") ? header.slice(7) : "");
77
+ };
78
+ // On loopback, reject foreign Host/Origin headers so a web page cannot reach
79
+ // the server through DNS rebinding (the spec's Origin-validation MUST).
80
+ const onLoopback = isLoopbackHost(host);
81
+ const logError = (error) => console.error(`[verdict-mcp] http: ${error.message}`);
82
+ const mcp = toNodeHandler(createMcpHandler(factory, {
83
+ // The tool list never changes: refuse subscriptions/listen in-band
84
+ // instead of letting a client park an idle SSE stream on a slot.
85
+ maxSubscriptions: 0,
86
+ onerror: logError,
87
+ }), { onerror: logError });
88
+ let inFlight = 0;
89
+ const server = createNodeServer((req, res) => {
90
+ const path = (req.url ?? "/").split("?")[0];
91
+ const fromPath = pathToken && path.startsWith("/mcp/") ? path.slice("/mcp/".length) : undefined;
92
+ if (path === "/health") {
93
+ res.writeHead(200, { "content-type": "text/plain" }).end("ok");
94
+ }
95
+ else if (path !== "/mcp" && fromPath === undefined) {
96
+ res.writeHead(404).end();
97
+ }
98
+ else if (onLoopback && (!isLoopbackHost(req.headers.host) || !isLoopbackOrigin(req.headers.origin))) {
99
+ forbidden(res);
100
+ }
101
+ else if (!authorized(req.headers.authorization, fromPath)) {
102
+ res.writeHead(401, { "www-authenticate": "Bearer" }).end();
103
+ }
104
+ else if (inFlight >= maxInFlight) {
105
+ // Backpressure: each in-flight request replays tools and may spend the
106
+ // operator's Jev key; shed load instead of queueing it.
107
+ res.writeHead(429, { "retry-after": "1" }).end();
108
+ }
109
+ else {
110
+ inFlight++;
111
+ // The token never travels past auth: rewrite the authenticated URL so
112
+ // the SDK's Request (and any diagnostics built from it) sees /mcp only.
113
+ if (fromPath !== undefined)
114
+ req.url = "/mcp";
115
+ void mcp(req, res)
116
+ .catch((error) => {
117
+ // toNodeHandler reports its own failures through onerror; a promise
118
+ // rejection here must not become an unhandled one that kills Node.
119
+ console.error(`[verdict-mcp] http: ${error?.message ?? error}`);
120
+ res.destroy();
121
+ })
122
+ .finally(() => inFlight--);
123
+ }
124
+ });
125
+ await new Promise((resolve, reject) => {
126
+ const onError = (error) => {
127
+ server.off("listening", onListening);
128
+ const message = error.code === "EADDRINUSE"
129
+ ? `port ${port} on ${host} is already in use; set PORT to a free port`
130
+ : `cannot listen on ${host}:${port}: ${error.message}`;
131
+ reject(new Error(message));
132
+ };
133
+ const onListening = () => {
134
+ server.off("error", onError);
135
+ resolve();
136
+ };
137
+ server.once("error", onError);
138
+ server.once("listening", onListening);
139
+ try {
140
+ server.listen(port, host);
141
+ }
142
+ catch (error) {
143
+ server.off("error", onError);
144
+ server.off("listening", onListening);
145
+ reject(error);
146
+ }
147
+ });
148
+ // Errors after startup (for example EMFILE) must be logged, not thrown as an
149
+ // unhandled 'error' event that takes the process down.
150
+ server.on("error", logError);
151
+ const { port: bound, address: boundAddress } = server.address();
152
+ // "localhost" must actually resolve to loopback; a poisoned resolver must not
153
+ // silently turn a loopback bind into a public one.
154
+ if (onLoopback && boundAddress !== "127.0.0.1" && boundAddress !== "::1" && boundAddress !== "::ffff:127.0.0.1") {
155
+ server.close();
156
+ throw new Error(`HOST ${host} resolved to non-loopback ${boundAddress}; refusing to serve`);
157
+ }
158
+ let shuttingDown = false;
159
+ const shutdown = () => {
160
+ // A second signal means the operator is done waiting: drop the remaining
161
+ // connections instead of extending the grace period.
162
+ if (shuttingDown) {
163
+ server.closeAllConnections();
164
+ process.exit(1);
165
+ }
166
+ shuttingDown = true;
167
+ server.close(() => process.exit(0));
168
+ // server.close() closes idle sockets but waits forever for an active
169
+ // request. Give in-flight work a bounded grace period, then force it down.
170
+ const force = setTimeout(() => {
171
+ server.closeAllConnections();
172
+ process.exit(0);
173
+ }, 5_000);
174
+ force.unref();
175
+ };
176
+ process.once("SIGTERM", shutdown);
177
+ process.once("SIGINT", shutdown);
178
+ return { server, url: `http://${host.includes(":") ? `[${host}]` : host}:${bound}/mcp` };
179
+ }
180
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,4EAA4E;AAC5E,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAkB,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAErC,+EAA+E;AAC/E,2DAA2D;AAC3D,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AACnH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AI,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;AAC3F,CAAC"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env node
2
+ // verdict-mcp CLI: boots the MCP server over stdio (default) or stateless HTTP.
3
+ //
4
+ // This entry is the `verdict-mcp` bin; running it starts a transport. It is NOT
5
+ // the package's import entry: `exports` maps the root import to
6
+ // dist/server.js, which exposes `createServer()` without booting anything,
7
+ // so importing the package from another process never opens stdio or a
8
+ // listener.
9
+ import { createRequire } from "node:module";
10
+ import { serveStdio } from "@modelcontextprotocol/server/stdio";
11
+ import { createServer, MODEL } from "./server.js";
12
+ const { version } = createRequire(import.meta.url)("../package.json");
13
+ const argv = process.argv.slice(2);
14
+ const HELP = `verdict-mcp ${version}
15
+
16
+ Local judgment tools for coding agents, over MCP.
17
+
18
+ Usage:
19
+ verdict-mcp [--http]
20
+
21
+ Options:
22
+ --http Serve stateless Streamable HTTP instead of stdio
23
+ -h, --help Show this help
24
+ -v, --version Show the version
25
+
26
+ Environment:
27
+ JEV_API_BASE_URL Required Jev-compatible endpoint
28
+ JEV_API_KEY Optional bearer token for the endpoint
29
+ JEV_PROVIDER local | typesafe | openrouter | cloudflare | vercel
30
+ VERDICT_MCP_MODEL Model slug (default: jev-latest)
31
+ VERDICT_MCP_TRANSPORT Set to http for the HTTP transport
32
+ VERDICT_MCP_AUTH_TOKEN Required for a non-loopback HTTP bind
33
+
34
+ Tools:
35
+ verdict_screen verdict_verify verdict_noul verdict_find
36
+ verdict_rerank verdict_classify verdict_decide verdict_compare
37
+ verdict_extract verdict_audit verdict_review verdict_gate`;
38
+ if (argv.includes("--version") || argv.includes("-v")) {
39
+ console.log(version);
40
+ }
41
+ else if (argv.includes("--help") || argv.includes("-h")) {
42
+ console.log(HELP);
43
+ }
44
+ else if (argv.includes("--http") || process.env.VERDICT_MCP_TRANSPORT === "http") {
45
+ const { serveHttp } = await import("./http.js");
46
+ const { url } = await serveHttp(createServer);
47
+ console.error(`[verdict-mcp] ready — model ${MODEL}, stateless HTTP at ${url}`);
48
+ }
49
+ else {
50
+ serveStdio(createServer);
51
+ console.error(`[verdict-mcp] ready — model ${MODEL}`);
52
+ }
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,gFAAgF;AAChF,EAAE;AACF,gFAAgF;AAChF,gEAAgE;AAChE,2EAA2E;AAC3E,uEAAuE;AACvE,YAAY;AACZ,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,EAAE,OAAO,EAAE,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,iBAAiB,CAAwB,CAAC;AAC7F,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEnC,MAAM,IAAI,GAAG,eAAe,OAAO;;;;;;;;;;;;;;;;;;;;;;;kEAuB+B,CAAC;AAEnE,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC;KAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC;KAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,q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