@cleocode/adapters 2026.10.27 → 2026.11.1-canary.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +2 -0
  2. package/dist/.source-stamp.json +4 -0
  3. package/dist/index.js +2676 -1895
  4. package/dist/index.js.map +3 -3
  5. package/dist/manifests.d.ts +25 -0
  6. package/dist/manifests.d.ts.map +1 -0
  7. package/dist/manifests.js +28 -0
  8. package/dist/manifests.js.map +6 -0
  9. package/dist/orca-execution.d.ts +89 -0
  10. package/dist/orca-execution.d.ts.map +1 -0
  11. package/dist/orca-execution.js +794 -0
  12. package/dist/orca-execution.js.map +6 -0
  13. package/dist/providers/claude-code/index.js +46710 -0
  14. package/dist/providers/claude-code/index.js.map +6 -0
  15. package/dist/providers/claude-code/lead-mcp.d.ts +99 -0
  16. package/dist/providers/claude-code/lead-mcp.d.ts.map +1 -0
  17. package/dist/providers/claude-code/lead-session.d.ts +133 -0
  18. package/dist/providers/claude-code/lead-session.d.ts.map +1 -0
  19. package/dist/providers/claude-code/spawn.d.ts +39 -0
  20. package/dist/providers/claude-code/spawn.d.ts.map +1 -1
  21. package/dist/providers/claude-sdk/index.js +44549 -0
  22. package/dist/providers/claude-sdk/index.js.map +6 -0
  23. package/dist/providers/claude-sdk/spawn.d.ts +6 -0
  24. package/dist/providers/claude-sdk/spawn.d.ts.map +1 -1
  25. package/dist/providers/codex/index.js +19315 -0
  26. package/dist/providers/codex/index.js.map +6 -0
  27. package/dist/providers/codex/spawn.d.ts +2 -0
  28. package/dist/providers/codex/spawn.d.ts.map +1 -1
  29. package/dist/providers/cursor/index.js +637 -0
  30. package/dist/providers/cursor/index.js.map +6 -0
  31. package/dist/providers/cursor/spawn.d.ts +2 -0
  32. package/dist/providers/cursor/spawn.d.ts.map +1 -1
  33. package/dist/providers/gemini-cli/index.js +18877 -0
  34. package/dist/providers/gemini-cli/index.js.map +6 -0
  35. package/dist/providers/gemini-cli/spawn.d.ts +2 -0
  36. package/dist/providers/gemini-cli/spawn.d.ts.map +1 -1
  37. package/dist/providers/kimi/index.js +18806 -0
  38. package/dist/providers/kimi/index.js.map +6 -0
  39. package/dist/providers/kimi/spawn.d.ts +2 -0
  40. package/dist/providers/kimi/spawn.d.ts.map +1 -1
  41. package/dist/providers/openai-sdk/adapter.d.ts +1 -1
  42. package/dist/providers/openai-sdk/index.d.ts +0 -1
  43. package/dist/providers/openai-sdk/index.d.ts.map +1 -1
  44. package/dist/providers/openai-sdk/index.js +44190 -0
  45. package/dist/providers/openai-sdk/index.js.map +6 -0
  46. package/dist/providers/openai-sdk/spawn.d.ts +4 -2
  47. package/dist/providers/openai-sdk/spawn.d.ts.map +1 -1
  48. package/dist/providers/openai-sdk/tracing.d.ts +8 -82
  49. package/dist/providers/openai-sdk/tracing.d.ts.map +1 -1
  50. package/dist/providers/opencode/index.js +19317 -0
  51. package/dist/providers/opencode/index.js.map +6 -0
  52. package/dist/providers/opencode/spawn.d.ts +2 -0
  53. package/dist/providers/opencode/spawn.d.ts.map +1 -1
  54. package/dist/providers/pi/index.js +18453 -0
  55. package/dist/providers/pi/index.js.map +6 -0
  56. package/dist/providers/pi/spawn.d.ts +2 -0
  57. package/dist/providers/pi/spawn.d.ts.map +1 -1
  58. package/dist/providers/shared/lead-tool-strip.d.ts +52 -0
  59. package/dist/providers/shared/lead-tool-strip.d.ts.map +1 -0
  60. package/dist/registry.d.ts +2 -55
  61. package/dist/registry.d.ts.map +1 -1
  62. package/package.json +14 -6
  63. package/src/__tests__/harness-interop.test.ts +0 -7
  64. package/src/__tests__/orca-execution-fixture.ts +380 -0
  65. package/src/__tests__/orca-execution.test.ts +1357 -0
  66. package/src/__tests__/orca-plugin-panel.test.ts +661 -0
  67. package/src/__tests__/orca-plugin.test.ts +660 -0
  68. package/src/manifests.ts +55 -0
  69. package/src/orca-execution.ts +1136 -0
  70. package/src/providers/claude-code/__tests__/lead-mcp.test.ts +348 -0
  71. package/src/providers/claude-code/__tests__/worker-exit-settings.test.ts +32 -0
  72. package/src/providers/claude-code/lead-mcp.ts +244 -0
  73. package/src/providers/claude-code/lead-session.ts +241 -0
  74. package/src/providers/claude-code/spawn.ts +180 -11
  75. package/src/providers/claude-sdk/__tests__/spawn.test.ts +63 -3
  76. package/src/providers/claude-sdk/spawn.ts +28 -1
  77. package/src/providers/codex/spawn.ts +5 -0
  78. package/src/providers/cursor/spawn.ts +3 -0
  79. package/src/providers/gemini-cli/spawn.ts +5 -0
  80. package/src/providers/kimi/spawn.ts +5 -0
  81. package/src/providers/openai-sdk/__tests__/openai-sdk-spawn.test.ts +0 -80
  82. package/src/providers/openai-sdk/adapter.ts +1 -1
  83. package/src/providers/openai-sdk/index.ts +0 -1
  84. package/src/providers/openai-sdk/manifest.json +1 -1
  85. package/src/providers/openai-sdk/spawn.ts +10 -16
  86. package/src/providers/openai-sdk/tracing.ts +8 -169
  87. package/src/providers/opencode/spawn.ts +5 -0
  88. package/src/providers/pi/spawn.ts +5 -0
  89. package/src/providers/shared/__tests__/lead-tool-strip.test.ts +126 -0
  90. package/src/providers/shared/lead-tool-strip.ts +76 -0
  91. package/src/registry.ts +2 -78
  92. package/dist/providers/shared/conduit-trace-writer.d.ts +0 -72
  93. package/dist/providers/shared/conduit-trace-writer.d.ts.map +0 -1
  94. package/src/providers/shared/conduit-trace-writer.ts +0 -101
@@ -0,0 +1,99 @@
1
+ /**
2
+ * MCP isolation for a no-hands lead on Claude Code (T14423).
3
+ *
4
+ * The tool strip (T14357) removes Bash, Edit and Write, but any user MCP
5
+ * server with shell or file tools would hand them back. A lead therefore
6
+ * starts with `--strict-mcp-config` and a config naming at most two servers:
7
+ * the lead command runner (`cleo orchestrate lead-runner`) and the user's
8
+ * AgentMBX server, so the lead can still read worker mail.
9
+ *
10
+ * The mbx entry comes ONLY from the user-level `mcpServers` of
11
+ * `~/.claude.json`, never from the repository (`.mcp.json`) or its project
12
+ * entry: `--mcp-config` skips Claude Code's project-server approval and
13
+ * `--allowedTools mcp__mbx` pre-approves every tool on the server, so a
14
+ * repository could otherwise plant any command as `mbx`. The entry must also
15
+ * run the `agentmbx` binary from an absolute path outside the project, with
16
+ * arguments starting `mcp`; anything else is refused with a warning.
17
+ *
18
+ * @task T14423
19
+ * @epic T14351
20
+ */
21
+ import type { LeadMcpReport } from '@cleocode/contracts';
22
+ /** One Claude Code MCP server entry, kept verbatim. */
23
+ export type McpServerEntry = Readonly<Record<string, unknown>>;
24
+ /** A lead's MCP setup: the `--mcp-config` value and the report of what loads. */
25
+ export interface LeadMcpSetup {
26
+ /** Value for `--mcp-config`: a file path or an inline JSON string. */
27
+ readonly config: string;
28
+ /** What the lead loads. */
29
+ readonly report: LeadMcpReport;
30
+ }
31
+ /** Outcome of {@link resolveMbxMcpServer}. */
32
+ export type MbxResolution = {
33
+ readonly kind: 'found';
34
+ readonly entry: McpServerEntry;
35
+ } | {
36
+ readonly kind: 'not-configured';
37
+ } | {
38
+ readonly kind: 'refused';
39
+ readonly reason: string;
40
+ };
41
+ /**
42
+ * The user's AgentMBX MCP server, from the user-level `mcpServers` of
43
+ * `~/.claude.json` only (named `mbx`). Project and local scopes are never
44
+ * read: a repository must not be able to plant the lead's mailbox server.
45
+ *
46
+ * @param projectDir - Directory the lead runs in (an mbx binary inside it is refused).
47
+ * @param claudeJsonPath - Claude Code user config. @defaultValue `~/.claude.json`
48
+ * @returns The entry verbatim, `not-configured`, or `refused` with the reason.
49
+ * @task T14423
50
+ */
51
+ export declare function resolveMbxMcpServer(projectDir: string, claudeJsonPath?: string): MbxResolution;
52
+ /**
53
+ * The lead's MCP config: the runner and, when given, the mbx server. Nothing else.
54
+ *
55
+ * @param mbx - The validated mbx entry, or `null`.
56
+ * @param identityEnv - The lead's CLEO identity variables, passed to the runner.
57
+ * @param cleoBin - The `cleo` binary (absolute when resolved at spawn time).
58
+ * @returns The `{ mcpServers }` object passed to `claude --mcp-config`.
59
+ * @task T14423
60
+ */
61
+ export declare function buildLeadMcpConfig(mbx: McpServerEntry | null, identityEnv?: Readonly<Record<string, string>>, cleoBin?: string): {
62
+ mcpServers: Record<string, McpServerEntry>;
63
+ };
64
+ /**
65
+ * Tools the lead may call: the runner's one tool and, when mbx is loaded,
66
+ * every mbx tool (`mcp__mbx`).
67
+ *
68
+ * @param report - What the lead loads.
69
+ * @returns The `--allowedTools` list.
70
+ * @task T14423
71
+ */
72
+ export declare function leadAllowedTools(report: LeadMcpReport): string[];
73
+ /**
74
+ * Runner-only setup passed inline, used when no config file was written.
75
+ *
76
+ * @returns A {@link LeadMcpSetup} with the runner alone.
77
+ * @task T14423
78
+ */
79
+ export declare function runnerOnlyLeadMcp(): LeadMcpSetup;
80
+ /** File name of the lead's MCP config inside the spawn's private temp directory. */
81
+ export declare const LEAD_MCP_FILE = "lead-mcp.json";
82
+ /**
83
+ * Write the lead's MCP config file (mode 0600: the mbx entry may carry env
84
+ * secrets) into a spawn's private temp directory. The lead's `SessionStart`
85
+ * hook deletes it once Claude Code has loaded it (see `leadSessionSettings`).
86
+ *
87
+ * @param dir - The spawn's private temp directory.
88
+ * @param projectDir - Directory the lead runs in.
89
+ * @param opts - The lead's CLEO identity env, the Claude Code user config path
90
+ * (default `~/.claude.json`) and the absolute `cleo` binary (default `cleo`).
91
+ * @returns The file path and what the lead loads.
92
+ * @task T14423
93
+ */
94
+ export declare function prepareLeadMcp(dir: string, projectDir: string, opts?: {
95
+ readonly identityEnv?: Readonly<Record<string, string>>;
96
+ readonly claudeJsonPath?: string;
97
+ readonly cleoBin?: string;
98
+ }): Promise<LeadMcpSetup>;
99
+ //# sourceMappingURL=lead-mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lead-mcp.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-code/lead-mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOzD,uDAAuD;AACvD,MAAM,M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AW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACxD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CACtB,GACL,OAAO,CAAC,YAAY,CAAC,CAcvB"}
@@ -0,0 +1,133 @@
1
+ /**
2
+ * The no-hands lead's Claude Code session (T14363): argv for both modes, the
3
+ * session hooks, and the interactive run.
4
+ *
5
+ * - `interactive` (default): no `--print`; the lead opens in the caller's
6
+ * terminal (stdio inherited, not detached) and asks the owner with
7
+ * `AskUserQuestion`, its only built-in tool.
8
+ * - `detached`: `--print`, no built-in tool at all; owner decisions go to the
9
+ * owner's AgentMBX mailbox (the prompt says how).
10
+ *
11
+ * In both, tools are an allow list (T14423): only the runner, mbx and (when
12
+ * interactive) `AskUserQuestion`; Manual mode for interactive owner answers,
13
+ * `dontAsk` for detached runs, no settings sources, and denied tools as a second layer.
14
+ *
15
+ * `cleo` and `agentmbx` in hooks and the runner entry are absolute paths
16
+ * resolved at spawn time from the absolute entries of PATH, never relative
17
+ * entries that would resolve inside the project.
18
+ *
19
+ * @task T14363
20
+ * @epic T14351
21
+ */
22
+ import type { LeadMode, SpawnContext } from '@cleocode/contracts';
23
+ import { type LeadMcpSetup } from './lead-mcp.js';
24
+ /** The first user turn of a lead: its instructions are the appended system prompt. */
25
+ export declare const LEAD_KICKOFF_PROMPT = "You are the no-hands lead. Your full instructions are in your system prompt: follow them, using only your allowed tools.";
26
+ /**
27
+ * The lead's pre-assigned provider session id (`options.leadSessionId`), when it
28
+ * is a UUID; `undefined` otherwise.
29
+ *
30
+ * @param options - Spawn context options.
31
+ * @returns The session id, or undefined.
32
+ * @task T14363
33
+ */
34
+ export declare function leadSessionId(options: SpawnContext['options']): string | undefined;
35
+ /**
36
+ * The lead's mode (`options.leadMode`); anything but `detached` is interactive.
37
+ *
38
+ * @param options - Spawn context options.
39
+ * @returns The mode.
40
+ * @task T14363
41
+ */
42
+ export declare function leadModeOf(options: SpawnContext['options']): LeadMode;
43
+ /**
44
+ * Resolve a binary to an absolute path from the ABSOLUTE entries of PATH only,
45
+ * so a relative entry (`.`, `node_modules/.bin`) can never pick a binary out
46
+ * of the project the lead runs in.
47
+ *
48
+ * @param name - Binary name, e.g. `cleo`.
49
+ * @param env - Environment. @defaultValue `process.env`
50
+ * @returns The absolute path, or `null` when not found.
51
+ * @task T14363
52
+ */
53
+ export declare function resolveAbsoluteBinary(name: string, env?: NodeJS.ProcessEnv): string | null;
54
+ /** Absolute binaries the lead's hooks call; `null` when not found. */
55
+ export interface LeadBinaries {
56
+ readonly cleo: string | null;
57
+ readonly agentmbx: string | null;
58
+ }
59
+ /**
60
+ * Claude Code settings for a lead, passed with `--settings` (which still
61
+ * applies under `--setting-sources ""`):
62
+ *
63
+ * - `SessionStart` deletes the MCP config file: Claude Code has read it, and
64
+ * it may hold the mbx server's env secrets.
65
+ * - `SessionEnd` removes the spawn's temp directory, ends the lead's CLEO
66
+ * session (releasing its epic claim) and releases the lead mailbox held
67
+ * for this session. A lead killed before its hooks run is reaped by the
68
+ * next `cleo orchestrate lead` or `cleo orchestrate status`.
69
+ *
70
+ * @param input - Temp dir, MCP file, the lead's session id and absolute binaries.
71
+ * @returns The settings JSON.
72
+ * @task T14363
73
+ */
74
+ export declare function leadSessionSettings(input: {
75
+ readonly dir: string;
76
+ readonly mcpFile: string;
77
+ readonly sessionId?: string;
78
+ readonly binaries: LeadBinaries;
79
+ }): string;
80
+ /**
81
+ * The lead's `claude` argv. An allow list, layered:
82
+ *
83
+ * - `--restricted --tools <built-ins>`: interactive gets `AskUserQuestion`
84
+ * only; detached gets no built-in tool at all;
85
+ * - `--mcp-config <file> --strict-mcp-config`: only the runner and a
86
+ * validated mbx; `--allowedTools` names exactly the allowed tools;
87
+ * - Manual (`default`) permission mode permits interactive owner answers;
88
+ * `dontAsk` denies them even when `AskUserQuestion` is explicitly allowed;
89
+ * - `--setting-sources ""` excludes user/project permission settings;
90
+ * - `--disallowedTools <denied>` as a second layer, excluding the retired
91
+ * `MultiEdit` name (already absent under `--tools`).
92
+ *
93
+ * Interactive drops `--print` and `--output-format`; detached keeps both.
94
+ * The prompt file is the appended system prompt (the lead cannot Read
95
+ * files); the user turn is {@link LEAD_KICKOFF_PROMPT}.
96
+ *
97
+ * @param input - Mode, denied tools, MCP setup, prompt file, session id, extra settings args.
98
+ * @returns Argument list for the `claude` binary.
99
+ * @task T14363
100
+ */
101
+ export declare function buildLeadArgs(input: {
102
+ readonly mode: LeadMode;
103
+ readonly denied: readonly string[];
104
+ readonly leadMcp: LeadMcpSetup;
105
+ readonly promptFile: string;
106
+ readonly sessionId?: string;
107
+ readonly settingsArgs?: readonly string[];
108
+ }): string[];
109
+ /** Outcome of {@link runInteractiveLead}. */
110
+ export interface InteractiveLeadExit {
111
+ /** The lead's pid while it ran. */
112
+ readonly pid: number | undefined;
113
+ /** Exit code; `null` when killed by a signal. */
114
+ readonly exitCode: number | null;
115
+ }
116
+ /**
117
+ * Run an interactive lead in the caller's terminal: stdio inherited, not
118
+ * detached, awaited until the owner ends the session.
119
+ *
120
+ * @param command - The `claude` binary.
121
+ * @param args - From {@link buildLeadArgs} with mode `interactive`.
122
+ * @param opts - Working directory, environment and a started-pid callback.
123
+ * @returns The pid and exit code once the session ends.
124
+ * @throws When stdin or stdout is not a terminal; use `--detached` instead.
125
+ * @task T14363
126
+ */
127
+ export declare function runInteractiveLead(command: string, args: readonly string[], opts: {
128
+ readonly cwd?: string;
129
+ readonly env?: NodeJS.ProcessEnv;
130
+ /** Called with the lead's pid once it started (the lead record names it). */
131
+ readonly onStart?: (pid: number) => void;
132
+ }): Promise<InteractiveLeadExit>;
133
+ //# sourceMappingURL=lead-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lead-session.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-code/lead-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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AAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C,GAAG,MAAM,EAAE,CA8BX;AAED,6CAA6C;AAC7C,MAAM,WAAW,mBAAmB;IAClC,mCAAmC;IACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,IAAI,EAAE;IACJ,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACjC,6EAA6E;IAC7E,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C,GACA,OAAO,CAAC,mBAAmB,CAAC,CAmB9B"}
@@ -11,8 +11,45 @@
11
11
  *
12
12
  * @task T5240
13
13
  * @task T11998 — per-session scope/pgid suite containment
14
+ * @task T14357 — lead spawns strip denied tools via --disallowedTools
14
15
  */
15
16
  import type { AdapterSpawnProvider, SpawnContext, SpawnResult } from '@cleocode/contracts';
17
+ import { type LeadMcpSetup } from './lead-mcp.js';
18
+ /**
19
+ * Instance id CLEO pre-assigned to a tracked worker (`options.workerInstanceId`,
20
+ * set only under `orchestrate.leadWorker.v1`), when it is shell-safe.
21
+ *
22
+ * @param options - Spawn context options.
23
+ * @returns The id, or undefined when the spawn is not tracked.
24
+ */
25
+ export declare function trackedWorkerInstanceId(options: SpawnContext['options']): string | undefined;
26
+ /**
27
+ * Claude Code settings that make a spawned worker report its own exit: a
28
+ * `SessionEnd` hook running `cleo orchestrate worker-exit` for this instance,
29
+ * which closes the worker record and fires SubagentStop once (T14359).
30
+ *
31
+ * @param instanceId - Spawn instance id the worker record is keyed by.
32
+ * @returns The settings JSON passed to `claude --settings`.
33
+ */
34
+ export declare function workerExitSettings(instanceId: string): string;
35
+ /**
36
+ * Build the `claude` CLI argv for a spawn.
37
+ *
38
+ * - `--print`: non-interactive batch mode (process prompt, output response, exit)
39
+ * - `--output-format json`: structured output for parsing
40
+ * - Worker: `--dangerously-skip-permissions` allows every tool call without approval.
41
+ * - Lead (`context.leadDeniedTools` set): an allow list built by
42
+ * `buildLeadArgs` (lead-session.ts) for the lead's mode, interactive or
43
+ * detached (T14363, T14423).
44
+ *
45
+ * @param context - Spawn context.
46
+ * @param promptFile - Path of the prompt file passed as the final argument.
47
+ * @param settingsArgs - Extra `--settings <file>` args (a tracked worker's exit hook, T14359).
48
+ * @param leadMcp - A lead's MCP setup (from `prepareLeadMcp`). @defaultValue the runner alone, inline
49
+ * @returns Argument list for the `claude` binary.
50
+ * @task T14357
51
+ */
52
+ export declare function buildClaudeArgs(context: SpawnContext, promptFile: string, settingsArgs?: readonly string[], leadMcp?: LeadMcpSetup): string[];
16
53
  /**
17
54
  * Spawn provider for Claude Code.
18
55
  *
@@ -29,6 +66,8 @@ import type { AdapterSpawnProvider, SpawnContext, SpawnResult } from '@cleocode/
29
66
  * in-memory map and verified via `kill(pid, 0)` liveness checks.
30
67
  */
31
68
  export declare class ClaudeCodeSpawnProvider implements AdapterSpawnProvider {
69
+ /** Lead spawns lose their denied tools through `--disallowedTools` (T14357). */
70
+ readonly leadToolStrip: "enforced";
32
71
  /** Map of instance IDs to tracked process info. */
33
72
  private processMap;
34
73
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-code/spawn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EACV,oBAAoB,EAEpB,YAAY,EACZ,WAAW,EACZ,MAAM,qBAAqB,CAAC;AA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