@evermore.work/adapter-opencode-local 2026.509.0-canary.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/dist/cli/format-event.d.ts +2 -0
- package/dist/cli/format-event.d.ts.map +1 -0
- package/dist/cli/format-event.js +115 -0
- package/dist/cli/format-event.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/server/execute.d.ts +3 -0
- package/dist/server/execute.d.ts.map +1 -0
- package/dist/server/execute.js +520 -0
- package/dist/server/execute.js.map +1 -0
- package/dist/server/execute.remote.test.d.ts +2 -0
- package/dist/server/execute.remote.test.d.ts.map +1 -0
- package/dist/server/execute.remote.test.js +317 -0
- package/dist/server/execute.remote.test.js.map +1 -0
- package/dist/server/index.d.ts +8 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +63 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/models.d.ts +22 -0
- package/dist/server/models.d.ts.map +1 -0
- package/dist/server/models.js +171 -0
- package/dist/server/models.js.map +1 -0
- package/dist/server/models.test.d.ts +2 -0
- package/dist/server/models.test.d.ts.map +1 -0
- package/dist/server/models.test.js +29 -0
- package/dist/server/models.test.js.map +1 -0
- package/dist/server/parse.d.ts +14 -0
- package/dist/server/parse.d.ts.map +1 -0
- package/dist/server/parse.js +99 -0
- package/dist/server/parse.js.map +1 -0
- package/dist/server/parse.test.d.ts +2 -0
- package/dist/server/parse.test.d.ts.map +1 -0
- package/dist/server/parse.test.js +73 -0
- package/dist/server/parse.test.js.map +1 -0
- package/dist/server/runtime-config.d.ts +12 -0
- package/dist/server/runtime-config.d.ts.map +1 -0
- package/dist/server/runtime-config.js +87 -0
- package/dist/server/runtime-config.js.map +1 -0
- package/dist/server/runtime-config.test.d.ts +2 -0
- package/dist/server/runtime-config.test.d.ts.map +1 -0
- package/dist/server/runtime-config.test.js +60 -0
- package/dist/server/runtime-config.test.js.map +1 -0
- package/dist/server/skills.d.ts +8 -0
- package/dist/server/skills.d.ts.map +1 -0
- package/dist/server/skills.js +73 -0
- package/dist/server/skills.js.map +1 -0
- package/dist/server/test.d.ts +3 -0
- package/dist/server/test.d.ts.map +1 -0
- package/dist/server/test.js +358 -0
- package/dist/server/test.js.map +1 -0
- package/dist/ui/build-config.d.ts +3 -0
- package/dist/ui/build-config.d.ts.map +1 -0
- package/dist/ui/build-config.js +84 -0
- package/dist/ui/build-config.js.map +1 -0
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +3 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/parse-stdout.d.ts +3 -0
- package/dist/ui/parse-stdout.d.ts.map +1 -0
- package/dist/ui/parse-stdout.js +141 -0
- package/dist/ui/parse-stdout.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-event.d.ts","sourceRoot":"","sources":["../../src/cli/format-event.ts"],"names":[],"mappings":"AAyCA,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CA+E3E"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import pc from "picocolors";
|
|
2
|
+
function safeJsonParse(text) {
|
|
3
|
+
try {
|
|
4
|
+
return JSON.parse(text);
|
|
5
|
+
}
|
|
6
|
+
catch {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function asRecord(value) {
|
|
11
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
12
|
+
return null;
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
function asString(value, fallback = "") {
|
|
16
|
+
return typeof value === "string" ? value : fallback;
|
|
17
|
+
}
|
|
18
|
+
function asNumber(value, fallback = 0) {
|
|
19
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
20
|
+
}
|
|
21
|
+
function errorText(value) {
|
|
22
|
+
if (typeof value === "string")
|
|
23
|
+
return value;
|
|
24
|
+
const rec = asRecord(value);
|
|
25
|
+
if (!rec)
|
|
26
|
+
return "";
|
|
27
|
+
const data = asRecord(rec.data);
|
|
28
|
+
const message = asString(rec.message) ||
|
|
29
|
+
asString(data?.message) ||
|
|
30
|
+
asString(rec.name) ||
|
|
31
|
+
"";
|
|
32
|
+
if (message)
|
|
33
|
+
return message;
|
|
34
|
+
try {
|
|
35
|
+
return JSON.stringify(rec);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return "";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export function printOpenCodeStreamEvent(raw, _debug) {
|
|
42
|
+
const line = raw.trim();
|
|
43
|
+
if (!line)
|
|
44
|
+
return;
|
|
45
|
+
const parsed = asRecord(safeJsonParse(line));
|
|
46
|
+
if (!parsed) {
|
|
47
|
+
console.log(line);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const type = asString(parsed.type);
|
|
51
|
+
if (type === "step_start") {
|
|
52
|
+
const sessionId = asString(parsed.sessionID);
|
|
53
|
+
console.log(pc.blue(`step started${sessionId ? ` (session: ${sessionId})` : ""}`));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (type === "text") {
|
|
57
|
+
const part = asRecord(parsed.part);
|
|
58
|
+
const text = asString(part?.text).trim();
|
|
59
|
+
if (text)
|
|
60
|
+
console.log(pc.green(`assistant: ${text}`));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (type === "reasoning") {
|
|
64
|
+
const part = asRecord(parsed.part);
|
|
65
|
+
const text = asString(part?.text).trim();
|
|
66
|
+
if (text)
|
|
67
|
+
console.log(pc.gray(`thinking: ${text}`));
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (type === "tool_use") {
|
|
71
|
+
const part = asRecord(parsed.part);
|
|
72
|
+
const tool = asString(part?.tool, "tool");
|
|
73
|
+
const callID = asString(part?.callID);
|
|
74
|
+
const state = asRecord(part?.state);
|
|
75
|
+
const status = asString(state?.status);
|
|
76
|
+
const isError = status === "error";
|
|
77
|
+
const metadata = asRecord(state?.metadata);
|
|
78
|
+
console.log(pc.yellow(`tool_call: ${tool}${callID ? ` (${callID})` : ""}`));
|
|
79
|
+
if (status) {
|
|
80
|
+
const metaParts = [`status=${status}`];
|
|
81
|
+
if (metadata) {
|
|
82
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
83
|
+
if (value !== undefined && value !== null)
|
|
84
|
+
metaParts.push(`${key}=${value}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
console.log((isError ? pc.red : pc.gray)(`tool_result ${metaParts.join(" ")}`));
|
|
88
|
+
}
|
|
89
|
+
const output = (asString(state?.output) || asString(state?.error)).trim();
|
|
90
|
+
if (output)
|
|
91
|
+
console.log((isError ? pc.red : pc.gray)(output));
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (type === "step_finish") {
|
|
95
|
+
const part = asRecord(parsed.part);
|
|
96
|
+
const tokens = asRecord(part?.tokens);
|
|
97
|
+
const cache = asRecord(tokens?.cache);
|
|
98
|
+
const input = asNumber(tokens?.input, 0);
|
|
99
|
+
const output = asNumber(tokens?.output, 0) + asNumber(tokens?.reasoning, 0);
|
|
100
|
+
const cached = asNumber(cache?.read, 0);
|
|
101
|
+
const cost = asNumber(part?.cost, 0);
|
|
102
|
+
const reason = asString(part?.reason, "step");
|
|
103
|
+
console.log(pc.blue(`step finished: reason=${reason}`));
|
|
104
|
+
console.log(pc.blue(`tokens: in=${input} out=${output} cached=${cached} cost=$${cost.toFixed(6)}`));
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (type === "error") {
|
|
108
|
+
const message = errorText(parsed.error ?? parsed.message);
|
|
109
|
+
if (message)
|
|
110
|
+
console.log(pc.red(`error: ${message}`));
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
console.log(line);
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=format-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-event.js","sourceRoot":"","sources":["../../src/cli/format-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,SAAS,aAAa,CAAC,IAAY;IACjC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACrF,OAAO,KAAgC,CAAC;AAC1C,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc,EAAE,QAAQ,GAAG,EAAE;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AACtD,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc,EAAE,QAAQ,GAAG,CAAC;IAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AAChF,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5B,IAAI,CAAC,GAAG;Q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M,GAAG,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;QAC5E,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACxC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACrC,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,yBAAyB,MAAM,EAAE,CAAC,CAAC,CAAC;QACxD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,KAAK,QAAQ,MAAM,WAAW,MAAM,UAAU,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACpG,OAAO;IACT,CAAC;IAED,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAI,OAAO;YAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC,CAAC;QACtD,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AdapterModelProfileDefinition } from "@evermore.work/adapter-utils";
|
|
2
|
+
export declare const type = "opencode_local";
|
|
3
|
+
export declare const label = "OpenCode (local)";
|
|
4
|
+
export declare const SANDBOX_INSTALL_COMMAND = "npm install -g opencode-ai";
|
|
5
|
+
export declare const DEFAULT_OPENCODE_LOCAL_MODEL = "openai/gpt-5.2-codex";
|
|
6
|
+
export declare function isValidOpenCodeModelId(value: unknown): value is string;
|
|
7
|
+
export declare const models: Array<{
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const modelProfiles: AdapterModelProfileDefinition[];
|
|
12
|
+
export declare const agentConfigurationDoc = "# opencode_local agent configuration\n\nAdapter: opencode_local\n\nUse when:\n- You want Evermore to run OpenCode locally as the agent runtime\n- You want provider/model routing in OpenCode format (provider/model)\n- You want OpenCode session resume across heartbeats via --session\n\nDon't use when:\n- You need webhook-style external invocation (use openclaw_gateway or http)\n- You only need one-shot shell commands (use process)\n- OpenCode CLI is not installed on the machine\n\nCore fields:\n- cwd (string, optional): default absolute working directory fallback for the agent process (created if missing when possible)\n- instructionsFilePath (string, optional): absolute path to a markdown instructions file prepended to the run prompt\n- model (string, required): OpenCode model id in provider/model format (for example anthropic/claude-sonnet-4-5)\n- variant (string, optional): provider-specific reasoning/profile variant passed as --variant (for example minimal|low|medium|high|xhigh|max)\n- dangerouslySkipPermissions (boolean, optional): inject a runtime OpenCode config that allows `external_directory` access without interactive prompts; defaults to true for unattended Evermore runs\n- promptTemplate (string, optional): run prompt template\n- command (string, optional): defaults to \"opencode\"\n- extraArgs (string[], optional): additional CLI args\n- env (object, optional): KEY=VALUE environment variables\n\nOperational fields:\n- timeoutSec (number, optional): run timeout in seconds\n- graceSec (number, optional): SIGTERM grace period in seconds\n\nNotes:\n- OpenCode supports multiple providers and models. Use `opencode models` to list available options in provider/model format.\n- Evermore requires an explicit `model` value for `opencode_local` agents.\n- Runs are executed with: opencode run --format json ...\n- Sessions are resumed with --session when stored session cwd matches current cwd.\n- The adapter sets OPENCODE_DISABLE_PROJECT_CONFIG=true to prevent OpenCode from writing an opencode.json config file into the project working directory. Model selection is passed via the --model CLI flag instead.\n- When `dangerouslySkipPermissions` is enabled, Evermore injects a temporary runtime config with `permission.external_directory=allow` so headless runs do not stall on approval prompts.\n";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAElF,eAAO,MAAM,IAAI,mBAAmB,CAAC;AACrC,eAAO,MAAM,KAAK,qBAAqB,CAAC;AAExC,eAAO,MAAM,uBAAuB,+BAA+B,CAAC;AAEpE,eAAO,MAAM,4BAA4B,yBAAyB,CAAC;AAEnE,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAKtE;AAED,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAMvD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,6BAA6B,EAWxD,CAAC;AAEF,eAAO,MAAM,qBAAqB,uyEAyCjC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export const type = "opencode_local";
|
|
2
|
+
export const label = "OpenCode (local)";
|
|
3
|
+
export const SANDBOX_INSTALL_COMMAND = "npm install -g opencode-ai";
|
|
4
|
+
export const DEFAULT_OPENCODE_LOCAL_MODEL = "openai/gpt-5.2-codex";
|
|
5
|
+
export function isValidOpenCodeModelId(value) {
|
|
6
|
+
if (typeof value !== "string")
|
|
7
|
+
return false;
|
|
8
|
+
const trimmed = value.trim();
|
|
9
|
+
const slashIndex = trimmed.indexOf("/");
|
|
10
|
+
return Boolean(trimmed) && slashIndex > 0 && slashIndex !== trimmed.length - 1;
|
|
11
|
+
}
|
|
12
|
+
export const models = [
|
|
13
|
+
{ id: DEFAULT_OPENCODE_LOCAL_MODEL, label: DEFAULT_OPENCODE_LOCAL_MODEL },
|
|
14
|
+
{ id: "openai/gpt-5.4", label: "openai/gpt-5.4" },
|
|
15
|
+
{ id: "openai/gpt-5.2", label: "openai/gpt-5.2" },
|
|
16
|
+
{ id: "openai/gpt-5.1-codex-max", label: "openai/gpt-5.1-codex-max" },
|
|
17
|
+
{ id: "openai/gpt-5.1-codex-mini", label: "openai/gpt-5.1-codex-mini" },
|
|
18
|
+
];
|
|
19
|
+
export const modelProfiles = [
|
|
20
|
+
{
|
|
21
|
+
key: "cheap",
|
|
22
|
+
label: "Cheap",
|
|
23
|
+
description: "Use OpenCode's known Codex mini model as the budget lane.",
|
|
24
|
+
adapterConfig: {
|
|
25
|
+
model: "openai/gpt-5.1-codex-mini",
|
|
26
|
+
variant: "low",
|
|
27
|
+
},
|
|
28
|
+
source: "adapter_default",
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
export const agentConfigurationDoc = `# opencode_local agent configuration
|
|
32
|
+
|
|
33
|
+
Adapter: opencode_local
|
|
34
|
+
|
|
35
|
+
Use when:
|
|
36
|
+
- You want Evermore to run OpenCode locally as the agent runtime
|
|
37
|
+
- You want provider/model routing in OpenCode format (provider/model)
|
|
38
|
+
- You want OpenCode session resume across heartbeats via --session
|
|
39
|
+
|
|
40
|
+
Don't use when:
|
|
41
|
+
- You need webhook-style external invocation (use openclaw_gateway or http)
|
|
42
|
+
- You only need one-shot shell commands (use process)
|
|
43
|
+
- OpenCode CLI is not installed on the machine
|
|
44
|
+
|
|
45
|
+
Core fields:
|
|
46
|
+
- cwd (string, optional): default absolute working directory fallback for the agent process (created if missing when possible)
|
|
47
|
+
- instructionsFilePath (string, optional): absolute path to a markdown instructions file prepended to the run prompt
|
|
48
|
+
- model (string, required): OpenCode model id in provider/model format (for example anthropic/claude-sonnet-4-5)
|
|
49
|
+
- variant (string, optional): provider-specific reasoning/profile variant passed as --variant (for example minimal|low|medium|high|xhigh|max)
|
|
50
|
+
- dangerouslySkipPermissions (boolean, optional): inject a runtime OpenCode config that allows \`external_directory\` access without interactive prompts; defaults to true for unattended Evermore runs
|
|
51
|
+
- promptTemplate (string, optional): run prompt template
|
|
52
|
+
- command (string, optional): defaults to "opencode"
|
|
53
|
+
- extraArgs (string[], optional): additional CLI args
|
|
54
|
+
- env (object, optional): KEY=VALUE environment variables
|
|
55
|
+
|
|
56
|
+
Operational fields:
|
|
57
|
+
- timeoutSec (number, optional): run timeout in seconds
|
|
58
|
+
- graceSec (number, optional): SIGTERM grace period in seconds
|
|
59
|
+
|
|
60
|
+
Notes:
|
|
61
|
+
- OpenCode supports multiple providers and models. Use \
|
|
62
|
+
\`opencode models\` to list available options in provider/model format.
|
|
63
|
+
- Evermore requires an explicit \`model\` value for \`opencode_local\` agents.
|
|
64
|
+
- Runs are executed with: opencode run --format json ...
|
|
65
|
+
- Sessions are resumed with --session when stored session cwd matches current cwd.
|
|
66
|
+
- The adapter sets OPENCODE_DISABLE_PROJECT_CONFIG=true to prevent OpenCode from \
|
|
67
|
+
writing an opencode.json config file into the project working directory. Model \
|
|
68
|
+
selection is passed via the --model CLI flag instead.
|
|
69
|
+
- When \`dangerouslySkipPermissions\` is enabled, Evermore injects a temporary \
|
|
70
|
+
runtime config with \`permission.external_directory=allow\` so headless runs do \
|
|
71
|
+
not stall on approval prompts.
|
|
72
|
+
`;
|
|
73
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,IAAI,GAAG,gBAAgB,CAAC;AACrC,MAAM,CAAC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