@onepointfour-packs/flaredeck-agent 0.1.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.md +14 -0
- package/README.md +102 -0
- package/dist/agent.d.ts +104 -0
- package/dist/agent.js +329 -0
- package/dist/agent.js.map +1 -0
- package/dist/approval.d.ts +72 -0
- package/dist/approval.js +161 -0
- package/dist/approval.js.map +1 -0
- package/dist/approvals.d.ts +2 -0
- package/dist/approvals.js +148 -0
- package/dist/approvals.js.map +1 -0
- package/dist/auth.d.ts +79 -0
- package/dist/auth.js +181 -0
- package/dist/auth.js.map +1 -0
- package/dist/automode.d.ts +33 -0
- package/dist/automode.js +69 -0
- package/dist/automode.js.map +1 -0
- package/dist/branches.d.ts +25 -0
- package/dist/branches.js +81 -0
- package/dist/branches.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +12 -0
- package/dist/cli.js.map +1 -0
- package/dist/codesearch.d.ts +27 -0
- package/dist/codesearch.js +111 -0
- package/dist/codesearch.js.map +1 -0
- package/dist/concurrency.d.ts +14 -0
- package/dist/concurrency.js +52 -0
- package/dist/concurrency.js.map +1 -0
- package/dist/config.d.ts +106 -0
- package/dist/config.js +119 -0
- package/dist/config.js.map +1 -0
- package/dist/engine-antigravity.d.ts +23 -0
- package/dist/engine-antigravity.js +357 -0
- package/dist/engine-antigravity.js.map +1 -0
- package/dist/engine-claude.d.ts +18 -0
- package/dist/engine-claude.js +64 -0
- package/dist/engine-claude.js.map +1 -0
- package/dist/engine.d.ts +122 -0
- package/dist/engine.js +36 -0
- package/dist/engine.js.map +1 -0
- package/dist/env.d.ts +1 -0
- package/dist/env.js +10 -0
- package/dist/env.js.map +1 -0
- package/dist/environment.d.ts +39 -0
- package/dist/environment.js +100 -0
- package/dist/environment.js.map +1 -0
- package/dist/flaredeck-check.d.ts +21 -0
- package/dist/flaredeck-check.js +12 -0
- package/dist/flaredeck-check.js.map +1 -0
- package/dist/flaredeck-proxy.d.ts +60 -0
- package/dist/flaredeck-proxy.js +186 -0
- package/dist/flaredeck-proxy.js.map +1 -0
- package/dist/flaredeck.d.ts +132 -0
- package/dist/flaredeck.js +106 -0
- package/dist/flaredeck.js.map +1 -0
- package/dist/gemini.d.ts +21 -0
- package/dist/gemini.js +59 -0
- package/dist/gemini.js.map +1 -0
- package/dist/gitguard.d.ts +2 -0
- package/dist/gitguard.js +90 -0
- package/dist/gitguard.js.map +1 -0
- package/dist/github.d.ts +38 -0
- package/dist/github.js +153 -0
- package/dist/github.js.map +1 -0
- package/dist/githubauth.d.ts +21 -0
- package/dist/githubauth.js +90 -0
- package/dist/githubauth.js.map +1 -0
- package/dist/intake.d.ts +124 -0
- package/dist/intake.js +383 -0
- package/dist/intake.js.map +1 -0
- package/dist/jam.d.ts +45 -0
- package/dist/jam.js +385 -0
- package/dist/jam.js.map +1 -0
- package/dist/jev.d.ts +31 -0
- package/dist/jev.js +75 -0
- package/dist/jev.js.map +1 -0
- package/dist/jevguard.d.ts +28 -0
- package/dist/jevguard.js +213 -0
- package/dist/jevguard.js.map +1 -0
- package/dist/mailbox.d.ts +22 -0
- package/dist/mailbox.js +51 -0
- package/dist/mailbox.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +764 -0
- package/dist/main.js.map +1 -0
- package/dist/markdown.d.ts +5 -0
- package/dist/markdown.js +81 -0
- package/dist/markdown.js.map +1 -0
- package/dist/oauth.d.ts +30 -0
- package/dist/oauth.js +216 -0
- package/dist/oauth.js.map +1 -0
- package/dist/permissions.d.ts +43 -0
- package/dist/permissions.js +57 -0
- package/dist/permissions.js.map +1 -0
- package/dist/preflight.d.ts +71 -0
- package/dist/preflight.js +116 -0
- package/dist/preflight.js.map +1 -0
- package/dist/providers.d.ts +26 -0
- package/dist/providers.js +27 -0
- package/dist/providers.js.map +1 -0
- package/dist/repopicker.d.ts +3 -0
- package/dist/repopicker.js +111 -0
- package/dist/repopicker.js.map +1 -0
- package/dist/runs.d.ts +59 -0
- package/dist/runs.js +211 -0
- package/dist/runs.js.map +1 -0
- package/dist/sandbox.d.ts +13 -0
- package/dist/sandbox.js +110 -0
- package/dist/sandbox.js.map +1 -0
- package/dist/schedules.d.ts +11 -0
- package/dist/schedules.js +85 -0
- package/dist/schedules.js.map +1 -0
- package/dist/secretguard.d.ts +4 -0
- package/dist/secretguard.js +115 -0
- package/dist/secretguard.js.map +1 -0
- package/dist/secrets.d.ts +27 -0
- package/dist/secrets.js +51 -0
- package/dist/secrets.js.map +1 -0
- package/dist/serve.d.ts +17 -0
- package/dist/serve.js +1206 -0
- package/dist/serve.js.map +1 -0
- package/dist/status.d.ts +73 -0
- package/dist/status.js +98 -0
- package/dist/status.js.map +1 -0
- package/dist/stream.d.ts +91 -0
- package/dist/stream.js +103 -0
- package/dist/stream.js.map +1 -0
- package/dist/streamtoken.d.ts +2 -0
- package/dist/streamtoken.js +30 -0
- package/dist/streamtoken.js.map +1 -0
- package/dist/team.d.ts +61 -0
- package/dist/team.js +136 -0
- package/dist/team.js.map +1 -0
- package/dist/ui.d.ts +110 -0
- package/dist/ui.js +348 -0
- package/dist/ui.js.map +1 -0
- package/dist/updater.d.ts +15 -0
- package/dist/updater.js +178 -0
- package/dist/updater.js.map +1 -0
- package/dist/workspace.d.ts +115 -0
- package/dist/workspace.js +247 -0
- package/dist/workspace.js.map +1 -0
- package/dist/worktree.d.ts +42 -0
- package/dist/worktree.js +140 -0
- package/dist/worktree.js.map +1 -0
- package/package.json +52 -0
- package/python/sidecar.py +178 -0
package/dist/config.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
export const DEFAULTS = {
|
|
5
|
+
mcpServerName: 'flaredeck',
|
|
6
|
+
mcpUrl: 'https://mcp.flaredeck.app/mcp',
|
|
7
|
+
agentServiceUrl: 'https://flaredeck-agent-861259873190.us-central1.run.app',
|
|
8
|
+
};
|
|
9
|
+
const configDir = () => join(process.env['XDG_CONFIG_HOME'] || join(homedir(), '.config'), 'flaredeck-agent');
|
|
10
|
+
/** A readable, collision-free file name for a checkout path. */
|
|
11
|
+
const slug = (repo) => repo.replace(/\/+$/, '').replace(/[^\w.-]+/g, '-').replace(/^-+/, '').slice(-90) || 'default';
|
|
12
|
+
/**
|
|
13
|
+
* Config per REPO, not per machine.
|
|
14
|
+
*
|
|
15
|
+
* One machine runs several agents — a worker on one project, a lead on another, or simply two
|
|
16
|
+
* checkouts. With a single file they shared an identity: starting the agent in a second repo
|
|
17
|
+
* picked up the first one's account and listened on its queue, which looks like it is working
|
|
18
|
+
* and is entirely the wrong agent.
|
|
19
|
+
*
|
|
20
|
+
* Keyed by path, so `cd` into a repo and run it and you get that repo's agent.
|
|
21
|
+
*/
|
|
22
|
+
export const configPath = (repo) => join(configDir(), 'repos', `${slug(repo)}.json`);
|
|
23
|
+
/** Where a single machine-wide config used to live, before agents were per repo. */
|
|
24
|
+
const legacyPath = () => join(configDir(), 'config.json');
|
|
25
|
+
export function loadConfig(repo = process.cwd()) {
|
|
26
|
+
try {
|
|
27
|
+
const raw = JSON.parse(readFileSync(readableConfig(repo), 'utf8'));
|
|
28
|
+
return {
|
|
29
|
+
repo: raw.repo ?? process.cwd(),
|
|
30
|
+
...(raw.repos?.length ? { repos: raw.repos } : {}),
|
|
31
|
+
mcpServerName: raw.mcpServerName ?? DEFAULTS.mcpServerName,
|
|
32
|
+
mcpUrl: raw.mcpUrl ?? DEFAULTS.mcpUrl,
|
|
33
|
+
...(raw.tenantId ? { tenantId: raw.tenantId } : {}),
|
|
34
|
+
...(raw.apiKey ? { apiKey: raw.apiKey } : {}),
|
|
35
|
+
...(raw.oauth ? { oauth: raw.oauth } : {}),
|
|
36
|
+
...(raw.github ? { github: raw.github } : {}),
|
|
37
|
+
...(raw.baseBranch ? { baseBranch: raw.baseBranch } : {}),
|
|
38
|
+
...(raw.runs ? { runs: raw.runs } : {}),
|
|
39
|
+
agentServiceUrl: raw.agentServiceUrl ?? DEFAULTS.agentServiceUrl,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* This repo's config, falling back to the old machine-wide one when it names this same repo —
|
|
48
|
+
* so an existing setup keeps working and is written to the new place on its next save.
|
|
49
|
+
*/
|
|
50
|
+
function readableConfig(repo) {
|
|
51
|
+
const mine = configPath(repo);
|
|
52
|
+
if (existsSync(mine))
|
|
53
|
+
return mine;
|
|
54
|
+
try {
|
|
55
|
+
const legacy = JSON.parse(readFileSync(legacyPath(), 'utf8'));
|
|
56
|
+
if (legacy?.repo === repo)
|
|
57
|
+
return legacyPath();
|
|
58
|
+
}
|
|
59
|
+
catch { /* no legacy config */ }
|
|
60
|
+
return mine;
|
|
61
|
+
}
|
|
62
|
+
export function saveConfig(config) {
|
|
63
|
+
const path = configPath(config.repo);
|
|
64
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
65
|
+
// 0600: the file holds an API key that can comment on and move cards across the whole tenant.
|
|
66
|
+
// `mode` on writeFileSync only applies when the file is CREATED, so an existing one keeps
|
|
67
|
+
// whatever it had — chmod every time instead of trusting the first write.
|
|
68
|
+
writeFileSync(path, `${JSON.stringify(config, null, 2)}\n`, { encoding: 'utf8', mode: 0o600 });
|
|
69
|
+
chmodSync(path, 0o600);
|
|
70
|
+
return path;
|
|
71
|
+
}
|
|
72
|
+
/** Forget this repo's agent, so the next login is a clean choice of account. */
|
|
73
|
+
/**
|
|
74
|
+
* A PERSON's FlareDeck login on this machine — not any agent's. Kept apart from the repo
|
|
75
|
+
* configs because it answers for the agents rather than acting as one: the approvals inbox
|
|
76
|
+
* decides as this account, and the server refuses a verdict from an agent account.
|
|
77
|
+
*/
|
|
78
|
+
const mePath = () => join(configDir(), 'me.json');
|
|
79
|
+
export function loadMe() {
|
|
80
|
+
try {
|
|
81
|
+
const raw = JSON.parse(readFileSync(mePath(), 'utf8'));
|
|
82
|
+
return raw?.accessToken ? raw : null;
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export function saveMe(tokens) {
|
|
89
|
+
const path = mePath();
|
|
90
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
91
|
+
writeFileSync(path, `${JSON.stringify(tokens, null, 2)}\n`, { encoding: 'utf8', mode: 0o600 });
|
|
92
|
+
chmodSync(path, 0o600);
|
|
93
|
+
return path;
|
|
94
|
+
}
|
|
95
|
+
export function forgetConfig(repo) {
|
|
96
|
+
let removed = false;
|
|
97
|
+
for (const path of [configPath(repo), legacyPath()]) {
|
|
98
|
+
try {
|
|
99
|
+
// Only the legacy file that belongs to THIS repo: a machine-wide config from before
|
|
100
|
+
// agents were per repo may be another checkout's, and deleting it would be a surprise.
|
|
101
|
+
if (path === legacyPath()) {
|
|
102
|
+
const legacy = JSON.parse(readFileSync(path, 'utf8'));
|
|
103
|
+
if (legacy?.repo !== repo)
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (existsSync(path)) {
|
|
107
|
+
rmSync(path);
|
|
108
|
+
removed = true;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch { /* nothing there */ }
|
|
112
|
+
}
|
|
113
|
+
return removed;
|
|
114
|
+
}
|
|
115
|
+
/** Config with defaults filled in — for commands that can run before `login` has written one. */
|
|
116
|
+
export function configOrDefaults(repo = process.cwd()) {
|
|
117
|
+
return loadConfig(repo) ?? { repo, ...DEFAULTS };
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,E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,MAAM,UAAU,gBAAgB,CAAC,OAAe,OAAO,CAAC,GAAG,EAAE;IAC3D,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Engine, EngineCapabilities, EngineRun, RunContext } from './engine.js';
|
|
2
|
+
export declare class AntigravityEngine implements Engine {
|
|
3
|
+
readonly name = "antigravity";
|
|
4
|
+
/**
|
|
5
|
+
* Measured against the SDK, not assumed. PreToolCallDecideHook is a DecideHook — it can deny a
|
|
6
|
+
* call and rewrite its arguments. PostToolCallHook is an InspectHook: it SEES a tool result and
|
|
7
|
+
* cannot change it, so a secret that comes back in output can be noticed and never redacted.
|
|
8
|
+
* That is why this is declared rather than hoped for: the harness reads it and refuses to hand
|
|
9
|
+
* this engine a secret, instead of handing one over and finding out afterwards.
|
|
10
|
+
*/
|
|
11
|
+
readonly capabilities: EngineCapabilities;
|
|
12
|
+
run(brief: string, ctx: RunContext): EngineRun;
|
|
13
|
+
}
|
|
14
|
+
export declare function pythonWithSdk(log: (text: string) => void): string;
|
|
15
|
+
/**
|
|
16
|
+
* How this machine talks to Gemini — worked out, never asked for.
|
|
17
|
+
*
|
|
18
|
+
* In order: an explicit Vertex setting, then the Gemini key the harness already keeps for intake
|
|
19
|
+
* briefs, then Google's application-default credentials, which are on any machine that has run
|
|
20
|
+
* `gcloud auth application-default login` — which is to say, any machine that deploys this
|
|
21
|
+
* project. Three ways to already be set up, and a prompt only ever appears if none of them hold.
|
|
22
|
+
*/
|
|
23
|
+
export declare function geminiEnv(): Record<string, string>;
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { execFileSync, spawn } from 'node:child_process';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { createServer } from 'node:http';
|
|
5
|
+
import { createInterface } from 'node:readline';
|
|
6
|
+
import { dirname, join, resolve } from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
import { CouldNotWork } from './engine.js';
|
|
9
|
+
import { judgeCommand } from './jevguard.js';
|
|
10
|
+
import { FLAREDECK_READ_TOOLS } from './permissions.js';
|
|
11
|
+
/**
|
|
12
|
+
* The writes an agent makes in the ordinary course of working its own card: saying what it did,
|
|
13
|
+
* leaving a handover, moving the card it holds, asking for a person when it is stuck. None of
|
|
14
|
+
* these can reach another agent's work or anything outside FlareDeck, so none is worth a person's
|
|
15
|
+
* attention. Anything NOT listed — production runs, publishing, the shell — still goes to the
|
|
16
|
+
* decider, which is the whole point of having one.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Antigravity's own tools for working in the checkout. Reading, searching and editing files there
|
|
20
|
+
* is the work itself; `run_command` is deliberately NOT here — it is the one that can reach past
|
|
21
|
+
* the workspace, and it is judged separately.
|
|
22
|
+
*/
|
|
23
|
+
const WORKSPACE_TOOLS = [
|
|
24
|
+
'view_file',
|
|
25
|
+
'find_file',
|
|
26
|
+
'search_directory',
|
|
27
|
+
'list_directory',
|
|
28
|
+
'create_file',
|
|
29
|
+
'edit_file',
|
|
30
|
+
'read_url_content',
|
|
31
|
+
'ask_question',
|
|
32
|
+
'finish',
|
|
33
|
+
];
|
|
34
|
+
const FLAREDECK_WORK_TOOLS = [
|
|
35
|
+
'create-card-comment',
|
|
36
|
+
'set-card-notes',
|
|
37
|
+
'set-card-meta',
|
|
38
|
+
'update-card-status',
|
|
39
|
+
'mark-card-done',
|
|
40
|
+
'mark-comments-actioned',
|
|
41
|
+
'set-needs-human',
|
|
42
|
+
'clear-needs-human',
|
|
43
|
+
'claim-card',
|
|
44
|
+
'release-card',
|
|
45
|
+
'add-timesheet-entry',
|
|
46
|
+
];
|
|
47
|
+
import { loadProviders } from './providers.js';
|
|
48
|
+
/**
|
|
49
|
+
* Gemini, through the Antigravity SDK.
|
|
50
|
+
*
|
|
51
|
+
* The SDK is Python with a compiled runtime binary, so it cannot be a library call from a
|
|
52
|
+
* TypeScript harness — it runs as a child process speaking JSON Lines. What matters is which side
|
|
53
|
+
* owns the decisions: the sidecar owns none. Every tool call it is about to make comes back here
|
|
54
|
+
* over localhost, so gitGuard, secretGuard and the Jev gate have one implementation and cannot
|
|
55
|
+
* drift between engines. The cost of the process boundary is a protocol; the cost of the
|
|
56
|
+
* alternative is maintaining the guards twice, which is worse.
|
|
57
|
+
*/
|
|
58
|
+
/**
|
|
59
|
+
* Which Gemini answers which size of card. Flash for everything above the smallest: the Pro line
|
|
60
|
+
* on this key is `gemini-3.1-pro-preview` — a preview id, which is the kind that disappears and
|
|
61
|
+
* takes an unattended agent down with it — and `gemini-2.5-pro` is older than these.
|
|
62
|
+
*/
|
|
63
|
+
const GEMINI_MODELS = {
|
|
64
|
+
small: 'gemini-3.5-flash-lite',
|
|
65
|
+
medium: 'gemini-3.8-flash',
|
|
66
|
+
large: 'gemini-3.8-flash',
|
|
67
|
+
};
|
|
68
|
+
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
69
|
+
const SIDECAR = resolve(join(HERE, '..', 'python', 'sidecar.py'));
|
|
70
|
+
export class AntigravityEngine {
|
|
71
|
+
name = 'antigravity';
|
|
72
|
+
/**
|
|
73
|
+
* Measured against the SDK, not assumed. PreToolCallDecideHook is a DecideHook — it can deny a
|
|
74
|
+
* call and rewrite its arguments. PostToolCallHook is an InspectHook: it SEES a tool result and
|
|
75
|
+
* cannot change it, so a secret that comes back in output can be noticed and never redacted.
|
|
76
|
+
* That is why this is declared rather than hoped for: the harness reads it and refuses to hand
|
|
77
|
+
* this engine a secret, instead of handing one over and finding out afterwards.
|
|
78
|
+
*/
|
|
79
|
+
capabilities = {
|
|
80
|
+
denyToolCall: true,
|
|
81
|
+
rewriteToolInput: true,
|
|
82
|
+
redactToolOutput: false,
|
|
83
|
+
// One turn per `agent.chat()` today. Mid-turn steering needs the SDK's streaming API, which
|
|
84
|
+
// is the next increment; saying false here means a typed line is reported as undeliverable
|
|
85
|
+
// rather than silently dropped.
|
|
86
|
+
steerMidTurn: false,
|
|
87
|
+
resumeSession: true,
|
|
88
|
+
};
|
|
89
|
+
run(brief, ctx) {
|
|
90
|
+
let child = null;
|
|
91
|
+
let guard = null;
|
|
92
|
+
const events = (async function* () {
|
|
93
|
+
const pending = [];
|
|
94
|
+
const { server, url } = await startGuard(ctx);
|
|
95
|
+
guard = server;
|
|
96
|
+
const python = pythonWithSdk((t) => { pending.push({ kind: 'tool', name: t }); });
|
|
97
|
+
while (pending.length)
|
|
98
|
+
yield pending.shift();
|
|
99
|
+
child = spawn(python, [SIDECAR], {
|
|
100
|
+
cwd: ctx.config.repo,
|
|
101
|
+
env: { ...process.env, ...geminiEnv() },
|
|
102
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
103
|
+
});
|
|
104
|
+
// The sidecar's stderr is the SDK's own complaints — a missing wheel, a bad key. Losing it
|
|
105
|
+
// would turn every failure into "the agent did nothing".
|
|
106
|
+
let stderr = '';
|
|
107
|
+
child.stderr.on('data', (d) => { stderr += String(d); });
|
|
108
|
+
// A sidecar that dies before saying anything — a missing wheel, the wrong interpreter, a
|
|
109
|
+
// bad key — would otherwise end this generator with no events and no error, which reads as
|
|
110
|
+
// "the agent did nothing" and is the worst way to fail. Its exit is recorded here and
|
|
111
|
+
// raised below, with whatever it printed.
|
|
112
|
+
const ended = { at: null };
|
|
113
|
+
child.on('exit', (code, signal) => { ended.at = { code, signal }; });
|
|
114
|
+
child.stdin.write(`${JSON.stringify({
|
|
115
|
+
type: 'run',
|
|
116
|
+
brief,
|
|
117
|
+
cwd: ctx.config.repo,
|
|
118
|
+
guard_url: url,
|
|
119
|
+
// FlareDeck over HTTP with the harness's own token, rather than reimplementing the tools
|
|
120
|
+
// in Python. The in-process sets (git publishing, team, runs, schedules) are not bridged
|
|
121
|
+
// yet — see the note on this class.
|
|
122
|
+
mcp: [{
|
|
123
|
+
name: ctx.config.mcpServerName,
|
|
124
|
+
url: ctx.config.mcpUrl,
|
|
125
|
+
headers: { Authorization: `Bearer ${ctx.token}` },
|
|
126
|
+
}],
|
|
127
|
+
// What the harness discovered on this server moments ago. The SDK exposes no way to ask a
|
|
128
|
+
// live session what tools it has, and the daemon refuses a card when the count is zero —
|
|
129
|
+
// rightly, since a session that silently lost FlareDeck would work the card blind.
|
|
130
|
+
tool_names: ctx.tools.flaredeck?.toolNames ?? [],
|
|
131
|
+
...(ctx.resume ? { resume: ctx.resume } : {}),
|
|
132
|
+
// Mapped from the SIZE, never from `ctx.model` — that is the other engine's name for the
|
|
133
|
+
// same decision, and `claude-sonnet-5-5` is a 404 here that fails the card on every retry.
|
|
134
|
+
...(GEMINI_MODELS[ctx.size ?? 'small'] ? { model: GEMINI_MODELS[ctx.size ?? 'small'] } : {}),
|
|
135
|
+
})}\n`);
|
|
136
|
+
let sawEvent = false;
|
|
137
|
+
try {
|
|
138
|
+
for await (const line of createInterface({ input: child.stdout })) {
|
|
139
|
+
if (!line.trim())
|
|
140
|
+
continue;
|
|
141
|
+
let msg;
|
|
142
|
+
try {
|
|
143
|
+
msg = JSON.parse(line);
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (msg.type === 'fatal') {
|
|
149
|
+
const detail = `${msg.message}${stderr ? `\n${stderr.slice(-2000)}` : ''}`;
|
|
150
|
+
// Before the first event means no model ever saw the brief, so the card's event must
|
|
151
|
+
// survive to be tried again. After it, the turn happened and owns its outcome.
|
|
152
|
+
throw sawEvent ? new Error(detail) : new CouldNotWork(detail);
|
|
153
|
+
}
|
|
154
|
+
if (msg.type === 'event') {
|
|
155
|
+
sawEvent = true;
|
|
156
|
+
const { type: _t, ...event } = msg;
|
|
157
|
+
yield event;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (!sawEvent) {
|
|
161
|
+
const why = ended.at ? `exited ${ended.at.code ?? ended.at.signal}` : 'produced nothing';
|
|
162
|
+
throw new CouldNotWork(`The Gemini sidecar ${why} without starting.\n` +
|
|
163
|
+
`${stderr.trim().slice(-2000) || '(it printed nothing)'}\n\n` +
|
|
164
|
+
`Check that ${python} has the SDK: \`pip install google-antigravity\`, or point ` +
|
|
165
|
+
`FLAREDECK_AGENT_PYTHON at an interpreter that does.`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
finally {
|
|
169
|
+
guard?.close();
|
|
170
|
+
child?.kill();
|
|
171
|
+
}
|
|
172
|
+
})();
|
|
173
|
+
return {
|
|
174
|
+
events,
|
|
175
|
+
async steer() {
|
|
176
|
+
// Declared false above, so the caller reports it rather than losing what was typed.
|
|
177
|
+
return false;
|
|
178
|
+
},
|
|
179
|
+
async stop() {
|
|
180
|
+
try {
|
|
181
|
+
child?.stdin.write(`${JSON.stringify({ type: 'stop' })}\n`);
|
|
182
|
+
}
|
|
183
|
+
catch { /* already gone */ }
|
|
184
|
+
child?.kill();
|
|
185
|
+
guard?.close();
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* An interpreter that actually has the SDK, found or built — because nobody should have to type a
|
|
192
|
+
* path to a virtualenv to run an agent.
|
|
193
|
+
*
|
|
194
|
+
* The Antigravity wheel carries a compiled runtime binary, so "python3" is usually the wrong
|
|
195
|
+
* answer: the system interpreter rarely has it, and when it does not the sidecar dies on import.
|
|
196
|
+
* So: an explicit override wins, then a managed virtualenv beside the agent's own config, then the
|
|
197
|
+
* system interpreter if it happens to have it — and if none of them do, the virtualenv is built
|
|
198
|
+
* once, here, and reused forever after.
|
|
199
|
+
*
|
|
200
|
+
* Checked by IMPORTING the package rather than by looking for a directory: a half-finished install
|
|
201
|
+
* leaves the directory behind, and the failure then arrives much later and much less clearly.
|
|
202
|
+
*/
|
|
203
|
+
const CONFIG_DIR = join(process.env['XDG_CONFIG_HOME'] || join(homedir(), '.config'), 'flaredeck-agent');
|
|
204
|
+
const MANAGED_VENV = join(CONFIG_DIR, 'python-antigravity');
|
|
205
|
+
const MANAGED_PYTHON = join(MANAGED_VENV, 'bin', 'python');
|
|
206
|
+
let resolvedPython = null;
|
|
207
|
+
function hasSdk(python) {
|
|
208
|
+
try {
|
|
209
|
+
execFileSync(python, ['-c', 'import google.antigravity'], { stdio: 'ignore', timeout: 60_000 });
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
export function pythonWithSdk(log) {
|
|
217
|
+
if (resolvedPython)
|
|
218
|
+
return resolvedPython;
|
|
219
|
+
const explicit = process.env['FLAREDECK_AGENT_PYTHON'];
|
|
220
|
+
if (explicit) {
|
|
221
|
+
if (!hasSdk(explicit)) {
|
|
222
|
+
throw new Error(`FLAREDECK_AGENT_PYTHON points at ${explicit}, which cannot import google.antigravity.`);
|
|
223
|
+
}
|
|
224
|
+
return (resolvedPython = explicit);
|
|
225
|
+
}
|
|
226
|
+
if (existsSync(MANAGED_PYTHON) && hasSdk(MANAGED_PYTHON))
|
|
227
|
+
return (resolvedPython = MANAGED_PYTHON);
|
|
228
|
+
if (hasSdk('python3'))
|
|
229
|
+
return (resolvedPython = 'python3');
|
|
230
|
+
// First --agy on this machine. Say so: a silent minute looks like a hang.
|
|
231
|
+
log('first run with Gemini — setting up its Python sidecar, about a minute');
|
|
232
|
+
try {
|
|
233
|
+
execFileSync('python3', ['-m', 'venv', MANAGED_VENV], { stdio: 'ignore', timeout: 180_000 });
|
|
234
|
+
execFileSync(MANAGED_PYTHON, ['-m', 'pip', 'install', '-q', 'google-antigravity'], { stdio: 'ignore', timeout: 900_000 });
|
|
235
|
+
}
|
|
236
|
+
catch (e) {
|
|
237
|
+
throw new Error(`Could not set up the Gemini sidecar in ${MANAGED_VENV}: ${e instanceof Error ? e.message : String(e)}\n` +
|
|
238
|
+
'Install it yourself with `pip install google-antigravity` and point FLAREDECK_AGENT_PYTHON at that interpreter.');
|
|
239
|
+
}
|
|
240
|
+
if (!hasSdk(MANAGED_PYTHON)) {
|
|
241
|
+
throw new Error(`The sidecar install finished but ${MANAGED_PYTHON} still cannot import google.antigravity.`);
|
|
242
|
+
}
|
|
243
|
+
log('Gemini sidecar ready');
|
|
244
|
+
return (resolvedPython = MANAGED_PYTHON);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* How this machine talks to Gemini — worked out, never asked for.
|
|
248
|
+
*
|
|
249
|
+
* In order: an explicit Vertex setting, then the Gemini key the harness already keeps for intake
|
|
250
|
+
* briefs, then Google's application-default credentials, which are on any machine that has run
|
|
251
|
+
* `gcloud auth application-default login` — which is to say, any machine that deploys this
|
|
252
|
+
* project. Three ways to already be set up, and a prompt only ever appears if none of them hold.
|
|
253
|
+
*/
|
|
254
|
+
export function geminiEnv() {
|
|
255
|
+
if (process.env['GOOGLE_GENAI_USE_VERTEXAI'])
|
|
256
|
+
return {};
|
|
257
|
+
const key = loadProviders().gemini?.apiKey;
|
|
258
|
+
if (key)
|
|
259
|
+
return { GEMINI_API_KEY: key };
|
|
260
|
+
const adc = join(homedir(), '.config', 'gcloud', 'application_default_credentials.json');
|
|
261
|
+
if (existsSync(adc)) {
|
|
262
|
+
const project = process.env['GOOGLE_CLOUD_PROJECT'] || gcloudProject();
|
|
263
|
+
if (project) {
|
|
264
|
+
return {
|
|
265
|
+
GOOGLE_GENAI_USE_VERTEXAI: 'True',
|
|
266
|
+
GOOGLE_CLOUD_PROJECT: project,
|
|
267
|
+
GOOGLE_CLOUD_LOCATION: process.env['GOOGLE_CLOUD_LOCATION'] || 'us-central1',
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
throw new Error('No way to reach Gemini on this machine: no GEMINI_API_KEY in the harness providers, and no ' +
|
|
272
|
+
'Google application-default credentials with a project. Either is enough — `gcloud auth ' +
|
|
273
|
+
'application-default login` is the one that needs no key.');
|
|
274
|
+
}
|
|
275
|
+
/** The project gcloud is pointed at, when there is one. Never fatal — the caller has other routes. */
|
|
276
|
+
function gcloudProject() {
|
|
277
|
+
try {
|
|
278
|
+
return execFileSync('gcloud', ['config', 'get-value', 'project'], { encoding: 'utf8', timeout: 15_000 })
|
|
279
|
+
.trim()
|
|
280
|
+
.replace(/^\(unset\)$/, '');
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
return '';
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* The guard, served to the sidecar on loopback.
|
|
288
|
+
*
|
|
289
|
+
* Port 0 so the OS picks a free one — several agents run on this machine at once and a fixed port
|
|
290
|
+
* would have them answering each other's tool calls. Bound to 127.0.0.1 so nothing off this
|
|
291
|
+
* machine can reach it.
|
|
292
|
+
*/
|
|
293
|
+
async function startGuard(ctx) {
|
|
294
|
+
const server = createServer((req, res) => {
|
|
295
|
+
let body = '';
|
|
296
|
+
req.on('data', (d) => { body += d; });
|
|
297
|
+
req.on('end', async () => {
|
|
298
|
+
let payload = {};
|
|
299
|
+
try {
|
|
300
|
+
payload = JSON.parse(body || '{}');
|
|
301
|
+
}
|
|
302
|
+
catch { /* answered as a denial below */ }
|
|
303
|
+
const reply = (o) => { res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(JSON.stringify(o)); };
|
|
304
|
+
if (req.url === '/tool-call') {
|
|
305
|
+
// The same pre-approval the other engine gets from `allowedTools`: FlareDeck's READ tools
|
|
306
|
+
// never reach the decider. Without this every get-card-details would post an approval
|
|
307
|
+
// request on a card and wait for a person, which is not an agent.
|
|
308
|
+
const name = String(payload.name ?? '');
|
|
309
|
+
const fromFlaredeck = String(payload.server ?? '') === ctx.config.mcpServerName;
|
|
310
|
+
if (fromFlaredeck && FLAREDECK_READ_TOOLS.includes(name)) {
|
|
311
|
+
return reply({ allow: true });
|
|
312
|
+
}
|
|
313
|
+
// Working in its own checkout is the job too. These are Antigravity's built-in tools, and
|
|
314
|
+
// they reach only the workspace the harness handed it — a worktree cut for this card. The
|
|
315
|
+
// other engine gets the same freedom from auto mode; without it a Gemini agent could not
|
|
316
|
+
// open a file, and "can it actually do the job" answered itself: no.
|
|
317
|
+
if (!payload.server && WORKSPACE_TOOLS.includes(name)) {
|
|
318
|
+
return reply({ allow: true });
|
|
319
|
+
}
|
|
320
|
+
// The shell is the one built-in that can reach past the checkout, so it goes through the
|
|
321
|
+
// SAME Jev gate the other engine's Bash does — not a second copy of the rules.
|
|
322
|
+
if (!payload.server && name === 'run_command') {
|
|
323
|
+
const command = String(payload.args?.CommandLine ?? '');
|
|
324
|
+
const verdict = await judgeCommand({
|
|
325
|
+
apiKey: loadProviders().openrouter?.apiKey ?? '',
|
|
326
|
+
decider: ctx.decider,
|
|
327
|
+
log: () => { },
|
|
328
|
+
agent: ctx.config.mcpServerName,
|
|
329
|
+
repo: ctx.config.repo,
|
|
330
|
+
card: () => null,
|
|
331
|
+
}, command);
|
|
332
|
+
return reply(verdict.allow ? { allow: true } : { allow: false, message: verdict.reason });
|
|
333
|
+
}
|
|
334
|
+
// Reporting on its own card is the JOB, not a privilege. The other engine runs in auto
|
|
335
|
+
// mode, where a classifier waves routine calls through before they ever reach a decider;
|
|
336
|
+
// there is no classifier here, so without this every comment an agent writes became an
|
|
337
|
+
// approval request posted on the card, waiting for a person who was never going to be
|
|
338
|
+
// asked about a comment. That is why Bob picked cards up, moved them, and never reported:
|
|
339
|
+
// it tried, and the harness turned each attempt into a question nobody answered.
|
|
340
|
+
if (fromFlaredeck && FLAREDECK_WORK_TOOLS.includes(name)) {
|
|
341
|
+
return reply({ allow: true });
|
|
342
|
+
}
|
|
343
|
+
const decision = await ctx.decider({ toolName: String(payload.name ?? 'unknown'), input: payload.args ?? {} }, { signal: new AbortController().signal });
|
|
344
|
+
return reply(decision.allow ? { allow: true } : { allow: false, message: decision.reason });
|
|
345
|
+
}
|
|
346
|
+
// The engine cannot redact, so this is a report, not a rewrite — the harness decides what
|
|
347
|
+
// to do about it, and at minimum it is in the log rather than nowhere.
|
|
348
|
+
if (req.url === '/tool-result')
|
|
349
|
+
return reply({ ok: true });
|
|
350
|
+
return reply({ allow: false, message: 'unknown guard endpoint' });
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
await new Promise((ok) => server.listen(0, '127.0.0.1', ok));
|
|
354
|
+
const port = server.address().port;
|
|
355
|
+
return { server, url: `http://127.0.0.1:${port}` };
|
|
356
|
+
}
|
|
357
|
+
//# sourceMappingURL=engine-antigravity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-antigravity.js","sourceRoot":"","sources":["../src/engine-antigravity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAuC,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,YAAY,EAAe,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD;;;;;;GAMG;AACH;;;;GAIG;AACH,MAAM,eAAe,GAAG;IACtB,WAAW;IACX,WAAW;IACX,kBAAkB;IAClB,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,kBAAkB;IAClB,cAAc;IACd,QAAQ;CACA,CAAC;AAEX,MAAM,oBAAoB,GAAG;IAC3B,qBAAqB;IACrB,gBAAgB;IAChB,eAAe;IACf,oBAAoB;IACpB,gBAAgB;IAChB,wBAAwB;IACxB,iBAAiB;IACjB,mBA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AAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YAC9F,CAAC;YACD,0FAA0F;YAC1F,uEAAuE;YACvE,IAAI,GAAG,CAAC,GAAG,KAAK,cAAc;gBAAE,OAAO,KAAK,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;YAC3D,OAAO,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,wBAAwB,EAAE,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,MAAM,IAAI,OAAO,CAAO,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC;IACnE,MAAM,IAAI,GAAI,MAAM,CAAC,OAAO,EAAuB,CAAC,IAAI,CAAC;IACzD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,oBAAoB,IAAI,EAAE,EAAE,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Engine, EngineCapabilities, EngineRun, RunContext } from './engine.js';
|
|
2
|
+
/**
|
|
3
|
+
* The Claude Agent SDK, behind the common interface.
|
|
4
|
+
*
|
|
5
|
+
* This is a wrapper and nothing more: it builds the options the way `cmdServe` always did and
|
|
6
|
+
* hands back the same generator. Nothing about how a card is worked changes by moving the call
|
|
7
|
+
* here — which is the point of doing this step on its own, because a refactor that also changes
|
|
8
|
+
* behaviour cannot be proved by the agents simply carrying on working.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ClaudeEngine implements Engine {
|
|
11
|
+
readonly name = "claude";
|
|
12
|
+
/**
|
|
13
|
+
* All five, which is why this harness could assume them. The next engine will not have all
|
|
14
|
+
* five — see engine.ts — and the harness should read this rather than assume again.
|
|
15
|
+
*/
|
|
16
|
+
readonly capabilities: EngineCapabilities;
|
|
17
|
+
run(brief: string, ctx: RunContext): EngineRun;
|
|
18
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { buildOptions, runTask } from './agent.js';
|
|
2
|
+
/**
|
|
3
|
+
* The Claude Agent SDK, behind the common interface.
|
|
4
|
+
*
|
|
5
|
+
* This is a wrapper and nothing more: it builds the options the way `cmdServe` always did and
|
|
6
|
+
* hands back the same generator. Nothing about how a card is worked changes by moving the call
|
|
7
|
+
* here — which is the point of doing this step on its own, because a refactor that also changes
|
|
8
|
+
* behaviour cannot be proved by the agents simply carrying on working.
|
|
9
|
+
*/
|
|
10
|
+
export class ClaudeEngine {
|
|
11
|
+
name = 'claude';
|
|
12
|
+
/**
|
|
13
|
+
* All five, which is why this harness could assume them. The next engine will not have all
|
|
14
|
+
* five — see engine.ts — and the harness should read this rather than assume again.
|
|
15
|
+
*/
|
|
16
|
+
capabilities = {
|
|
17
|
+
denyToolCall: true,
|
|
18
|
+
rewriteToolInput: true,
|
|
19
|
+
// PostToolUse → updatedToolOutput. The secret scrubber depends on this one.
|
|
20
|
+
redactToolOutput: true,
|
|
21
|
+
steerMidTurn: true,
|
|
22
|
+
resumeSession: true,
|
|
23
|
+
};
|
|
24
|
+
run(brief, ctx) {
|
|
25
|
+
const options = buildOptions(ctx.config, ctx.decider, { ...(ctx.resume ? { resume: ctx.resume } : {}), ...(ctx.model ? { model: ctx.model } : {}) }, ctx.sandbox, ctx.tools.git, ctx.token, ctx.tools.team, ctx.tools.flaredeck, ctx.tools.runs, ctx.tools.schedules, ctx.guard);
|
|
26
|
+
let live = null;
|
|
27
|
+
const events = runTask(brief, options, (q) => { live = q; });
|
|
28
|
+
return {
|
|
29
|
+
events,
|
|
30
|
+
/**
|
|
31
|
+
* `origin: human` and `priority: 'next'` are both load-bearing, and the second one bit this
|
|
32
|
+
* project before: a 'now' message interrupts the tools in flight, the CLI closes the turn
|
|
33
|
+
* with a result, streamInput treats that result as the end of the conversation and closes
|
|
34
|
+
* stdin — the channel every permission verdict and every in-process FlareDeck call comes
|
|
35
|
+
* back on. The agent then concludes FlareDeck is down. 'next' lands at the tool boundary
|
|
36
|
+
* with nothing cut off.
|
|
37
|
+
*/
|
|
38
|
+
async steer(text) {
|
|
39
|
+
if (!live?.streamInput)
|
|
40
|
+
return false;
|
|
41
|
+
await live.streamInput((async function* () {
|
|
42
|
+
yield {
|
|
43
|
+
type: 'user',
|
|
44
|
+
message: { role: 'user', content: text },
|
|
45
|
+
parent_tool_use_id: null,
|
|
46
|
+
// Always human: BOTH existing callers stamp it that way on purpose — a line typed
|
|
47
|
+
// at the pane and the harness's own wrap-up nudge each deserve a person's weight,
|
|
48
|
+
// where an unattributed message is treated as untrusted.
|
|
49
|
+
origin: { kind: 'human' },
|
|
50
|
+
priority: 'next',
|
|
51
|
+
};
|
|
52
|
+
})());
|
|
53
|
+
return true;
|
|
54
|
+
},
|
|
55
|
+
async stop() {
|
|
56
|
+
try {
|
|
57
|
+
await live?.interrupt?.();
|
|
58
|
+
}
|
|
59
|
+
catch { /* a turn that will not stop is the caller's problem */ }
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=engine-claude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-claude.js","sourceRoot":"","sources":["../src/engine-claude.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGnD;;;;;;;GAOG;AACH,MAAM,OAAO,YAAY;IACd,IAAI,GAAG,QAAQ,CAAC;IAEzB;;;OAGG;IACM,YAAY,GAAuB;QAC1C,YAAY,EAAE,IAAI;QAClB,gBAAgB,EAAE,IAAI;QACtB,4EAA4E;QAC5E,gBAAgB,EAAE,IAAI;QACtB,YAAY,EAAE,IAAI;QAClB,aAAa,EAAE,IAAI;KACpB,CAAC;IAEF,GAAG,CAAC,KAAa,EAAE,GAAe;QAChC,MAAM,OAAO,GAAG,YAAY,CAC1B,GAAG,CAAC,MAAM,EACV,GAAG,CAAC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