zelio-cli 0.0.0-stage → 0.1.0-beta.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.
- package/README.md +71 -2
- package/dist/attachments.js +121 -0
- package/dist/attachments.js.map +1 -0
- package/dist/cli-main.js +521 -0
- package/dist/cli-main.js.map +1 -0
- package/dist/cli.js +22 -0
- package/dist/cli.js.map +1 -0
- package/dist/cloud/account.js +109 -0
- package/dist/cloud/account.js.map +1 -0
- package/dist/cloud/board.js +311 -0
- package/dist/cloud/board.js.map +1 -0
- package/dist/cloud/command.js +265 -0
- package/dist/cloud/command.js.map +1 -0
- package/dist/cloud/config.js +132 -0
- package/dist/cloud/config.js.map +1 -0
- package/dist/cloud/credentials.js +134 -0
- package/dist/cloud/credentials.js.map +1 -0
- package/dist/cloud/login.js +166 -0
- package/dist/cloud/login.js.map +1 -0
- package/dist/cloud/pair.js +110 -0
- package/dist/cloud/pair.js.map +1 -0
- package/dist/cloud/pkce.js +16 -0
- package/dist/cloud/pkce.js.map +1 -0
- package/dist/cloud/push-nudge.js +65 -0
- package/dist/cloud/push-nudge.js.map +1 -0
- package/dist/cloud/relay.js +134 -0
- package/dist/cloud/relay.js.map +1 -0
- package/dist/cloud/token.js +66 -0
- package/dist/cloud/token.js.map +1 -0
- package/dist/cloud/tunnel.js +474 -0
- package/dist/cloud/tunnel.js.map +1 -0
- package/dist/db/db.js +1838 -0
- package/dist/db/db.js.map +1 -0
- package/dist/db/lifecycle.js +146 -0
- package/dist/db/lifecycle.js.map +1 -0
- package/dist/limits.js +35 -0
- package/dist/limits.js.map +1 -0
- package/dist/metrics.js +30 -0
- package/dist/metrics.js.map +1 -0
- package/dist/orchestrator/area-notes.js +87 -0
- package/dist/orchestrator/area-notes.js.map +1 -0
- package/dist/orchestrator/claude-session.js +208 -0
- package/dist/orchestrator/claude-session.js.map +1 -0
- package/dist/orchestrator/codex-session.js +327 -0
- package/dist/orchestrator/codex-session.js.map +1 -0
- package/dist/orchestrator/contract.js +189 -0
- package/dist/orchestrator/contract.js.map +1 -0
- package/dist/orchestrator/explore.js +176 -0
- package/dist/orchestrator/explore.js.map +1 -0
- package/dist/orchestrator/new-task-prompt.js +51 -0
- package/dist/orchestrator/new-task-prompt.js.map +1 -0
- package/dist/orchestrator/pi-session.js +234 -0
- package/dist/orchestrator/pi-session.js.map +1 -0
- package/dist/orchestrator/prompt.js +110 -0
- package/dist/orchestrator/prompt.js.map +1 -0
- package/dist/orchestrator/research.js +193 -0
- package/dist/orchestrator/research.js.map +1 -0
- package/dist/orchestrator/retrieval.js +333 -0
- package/dist/orchestrator/retrieval.js.map +1 -0
- package/dist/orchestrator/runtime.js +1217 -0
- package/dist/orchestrator/runtime.js.map +1 -0
- package/dist/orchestrator/session.js +2 -0
- package/dist/orchestrator/session.js.map +1 -0
- package/dist/orchestrator/types.js +2 -0
- package/dist/orchestrator/types.js.map +1 -0
- package/dist/orchestrator/web.js +276 -0
- package/dist/orchestrator/web.js.map +1 -0
- package/dist/repo/code-map.js +152 -0
- package/dist/repo/code-map.js.map +1 -0
- package/dist/repo/index.js +188 -0
- package/dist/repo/index.js.map +1 -0
- package/dist/repo/instructions.js +58 -0
- package/dist/repo/instructions.js.map +1 -0
- package/dist/repo/linked-boards.js +149 -0
- package/dist/repo/linked-boards.js.map +1 -0
- package/dist/repo/project-repos.js +78 -0
- package/dist/repo/project-repos.js.map +1 -0
- package/dist/run/actions.js +257 -0
- package/dist/run/actions.js.map +1 -0
- package/dist/run/auto-review.js +116 -0
- package/dist/run/auto-review.js.map +1 -0
- package/dist/run/bash-guard.js +183 -0
- package/dist/run/bash-guard.js.map +1 -0
- package/dist/run/claude-runtime.js +284 -0
- package/dist/run/claude-runtime.js.map +1 -0
- package/dist/run/claude-stream.js +306 -0
- package/dist/run/claude-stream.js.map +1 -0
- package/dist/run/codex-client.js +213 -0
- package/dist/run/codex-client.js.map +1 -0
- package/dist/run/codex-planner-config.js +26 -0
- package/dist/run/codex-planner-config.js.map +1 -0
- package/dist/run/codex-runtime.js +469 -0
- package/dist/run/codex-runtime.js.map +1 -0
- package/dist/run/consult.js +109 -0
- package/dist/run/consult.js.map +1 -0
- package/dist/run/context.js +87 -0
- package/dist/run/context.js.map +1 -0
- package/dist/run/developer-sandbox.js +67 -0
- package/dist/run/developer-sandbox.js.map +1 -0
- package/dist/run/diff.js +238 -0
- package/dist/run/diff.js.map +1 -0
- package/dist/run/evidence.js +48 -0
- package/dist/run/evidence.js.map +1 -0
- package/dist/run/finish.js +430 -0
- package/dist/run/finish.js.map +1 -0
- package/dist/run/handoff.js +51 -0
- package/dist/run/handoff.js.map +1 -0
- package/dist/run/harness-runtime.js +31 -0
- package/dist/run/harness-runtime.js.map +1 -0
- package/dist/run/harnesses.js +293 -0
- package/dist/run/harnesses.js.map +1 -0
- package/dist/run/issue.js +79 -0
- package/dist/run/issue.js.map +1 -0
- package/dist/run/keep-awake.js +58 -0
- package/dist/run/keep-awake.js.map +1 -0
- package/dist/run/lead.js +183 -0
- package/dist/run/lead.js.map +1 -0
- package/dist/run/manager.js +2737 -0
- package/dist/run/manager.js.map +1 -0
- package/dist/run/mentions.js +35 -0
- package/dist/run/mentions.js.map +1 -0
- package/dist/run/merge-watch.js +425 -0
- package/dist/run/merge-watch.js.map +1 -0
- package/dist/run/models.js +88 -0
- package/dist/run/models.js.map +1 -0
- package/dist/run/phases.js +23 -0
- package/dist/run/phases.js.map +1 -0
- package/dist/run/pi-packages.js +72 -0
- package/dist/run/pi-packages.js.map +1 -0
- package/dist/run/pi-rpc.js +464 -0
- package/dist/run/pi-rpc.js.map +1 -0
- package/dist/run/piped-check.js +56 -0
- package/dist/run/piped-check.js.map +1 -0
- package/dist/run/pr-checks.js +67 -0
- package/dist/run/pr-checks.js.map +1 -0
- package/dist/run/pr-merge.js +121 -0
- package/dist/run/pr-merge.js.map +1 -0
- package/dist/run/profiles.js +43 -0
- package/dist/run/profiles.js.map +1 -0
- package/dist/run/prompt.js +405 -0
- package/dist/run/prompt.js.map +1 -0
- package/dist/run/pull-request.js +23 -0
- package/dist/run/pull-request.js.map +1 -0
- package/dist/run/red-check.js +130 -0
- package/dist/run/red-check.js.map +1 -0
- package/dist/run/result-tool.js +93 -0
- package/dist/run/result-tool.js.map +1 -0
- package/dist/run/result.js +113 -0
- package/dist/run/result.js.map +1 -0
- package/dist/run/retro.js +346 -0
- package/dist/run/retro.js.map +1 -0
- package/dist/run/settings.js +28 -0
- package/dist/run/settings.js.map +1 -0
- package/dist/run/skills.js +146 -0
- package/dist/run/skills.js.map +1 -0
- package/dist/run/tests-first.js +146 -0
- package/dist/run/tests-first.js.map +1 -0
- package/dist/run/thinking.js +41 -0
- package/dist/run/thinking.js.map +1 -0
- package/dist/run/types.js +2 -0
- package/dist/run/types.js.map +1 -0
- package/dist/run/watchdog.js +266 -0
- package/dist/run/watchdog.js.map +1 -0
- package/dist/run/workflow.js +277 -0
- package/dist/run/workflow.js.map +1 -0
- package/dist/run/worktree.js +354 -0
- package/dist/run/worktree.js.map +1 -0
- package/dist/server/app.js +3286 -0
- package/dist/server/app.js.map +1 -0
- package/dist/server/auth.js +93 -0
- package/dist/server/auth.js.map +1 -0
- package/dist/server/demo.js +96 -0
- package/dist/server/demo.js.map +1 -0
- package/dist/server/idempotency.js +104 -0
- package/dist/server/idempotency.js.map +1 -0
- package/dist/server/port.js +36 -0
- package/dist/server/port.js.map +1 -0
- package/dist/server/principal.js +93 -0
- package/dist/server/principal.js.map +1 -0
- package/dist/server/provider-auth.js +206 -0
- package/dist/server/provider-auth.js.map +1 -0
- package/dist/server/repo-picker.js +18 -0
- package/dist/server/repo-picker.js.map +1 -0
- package/dist/server/terminal.js +285 -0
- package/dist/server/terminal.js.map +1 -0
- package/dist/setup/components.js +98 -0
- package/dist/setup/components.js.map +1 -0
- package/dist/setup/config.js +71 -0
- package/dist/setup/config.js.map +1 -0
- package/dist/setup/ink-ui.js +189 -0
- package/dist/setup/ink-ui.js.map +1 -0
- package/dist/setup/onboarding.js +157 -0
- package/dist/setup/onboarding.js.map +1 -0
- package/dist/setup/run.js +69 -0
- package/dist/setup/run.js.map +1 -0
- package/dist/skills.js +151 -0
- package/dist/skills.js.map +1 -0
- package/dist/ticket-cli.js +157 -0
- package/dist/ticket-cli.js.map +1 -0
- package/dist/version.js +13 -0
- package/dist/version.js.map +1 -0
- package/dist/voice/index.js +69 -0
- package/dist/voice/index.js.map +1 -0
- package/dist/voice/moonshine.js +247 -0
- package/dist/voice/moonshine.js.map +1 -0
- package/dist/voice/wav.js +54 -0
- package/dist/voice/wav.js.map +1 -0
- package/dist/voice/whisper.js +491 -0
- package/dist/voice/whisper.js.map +1 -0
- package/dist/web/assets/index-TN5sUF2z.css +1 -0
- package/dist/web/assets/index-vB3Cucuc.js +258 -0
- package/dist/web/icons/apple-touch-icon.png +0 -0
- package/dist/web/icons/icon-192.png +0 -0
- package/dist/web/icons/icon-512.png +0 -0
- package/dist/web/icons/maskable-512.png +0 -0
- package/dist/web/index.html +21 -0
- package/dist/web/manifest.webmanifest +30 -0
- package/dist/web/sw.js +185 -0
- package/media/board.png +0 -0
- package/media/mobile.png +0 -0
- package/media/new-task.png +0 -0
- package/media/review.png +0 -0
- package/package.json +105 -4
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { toolResultText } from "../run/actions.js";
|
|
3
|
+
import { piPackageExtensionArgs } from "../run/pi-packages.js";
|
|
4
|
+
import { thinkingArgs } from "../run/thinking.js";
|
|
5
|
+
const TOOLS = "read,grep,find,ls,web_search,web_fetch,explore";
|
|
6
|
+
const EXTENSION = new URL("./web.js", import.meta.url);
|
|
7
|
+
const KILL_GRACE_MS = 2_000;
|
|
8
|
+
const clip = (value, max) => {
|
|
9
|
+
const text = value.replace(/\s+/g, " ").trim();
|
|
10
|
+
return text.length > max ? text.slice(0, max - 1) + "…" : text;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The label for one planner tool call. pi emits the tool name and arguments, so
|
|
14
|
+
* the panel says what is happening instead of guessing at a phase.
|
|
15
|
+
*/
|
|
16
|
+
export function toolLabel(tool, args) {
|
|
17
|
+
const fields = (args ?? {});
|
|
18
|
+
const text = (key) => typeof fields[key] === "string" ? fields[key] : "";
|
|
19
|
+
switch (tool) {
|
|
20
|
+
case "read": {
|
|
21
|
+
const path = text("path") || text("file_path");
|
|
22
|
+
return path ? "Reading " + clip(path, 46) : "Reading a file";
|
|
23
|
+
}
|
|
24
|
+
case "grep": {
|
|
25
|
+
const pattern = text("pattern") || text("query");
|
|
26
|
+
return pattern ? "Searching the repo for “" + clip(pattern, 32) + "”" : "Searching the repo";
|
|
27
|
+
}
|
|
28
|
+
case "find": {
|
|
29
|
+
const pattern = text("pattern");
|
|
30
|
+
return pattern ? "Finding files matching “" + clip(pattern, 32) + "”" : "Finding files";
|
|
31
|
+
}
|
|
32
|
+
case "ls": {
|
|
33
|
+
const path = text("path");
|
|
34
|
+
return path ? "Listing " + clip(path, 46) : "Listing the repo";
|
|
35
|
+
}
|
|
36
|
+
case "web_search": {
|
|
37
|
+
const query = text("query") || text("q");
|
|
38
|
+
return query ? "Searching the web for “" + clip(query, 32) + "”" : "Searching the web";
|
|
39
|
+
}
|
|
40
|
+
case "web_fetch": {
|
|
41
|
+
const url = text("url");
|
|
42
|
+
if (!url)
|
|
43
|
+
return "Fetching a page";
|
|
44
|
+
try {
|
|
45
|
+
return "Fetching " + clip(new URL(url).host, 40);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return "Fetching " + clip(url, 40);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
default:
|
|
52
|
+
return clip(tool, 40);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* pi over RPC for one planning turn. It owns the process and the wire format;
|
|
57
|
+
* the budget loop owns what to do with the events.
|
|
58
|
+
*/
|
|
59
|
+
export class PiPlannerSession {
|
|
60
|
+
child;
|
|
61
|
+
queue = [];
|
|
62
|
+
wake;
|
|
63
|
+
finished = false;
|
|
64
|
+
wasAborted = false;
|
|
65
|
+
stderr = "";
|
|
66
|
+
killTimer;
|
|
67
|
+
events;
|
|
68
|
+
constructor(options) {
|
|
69
|
+
const packageExtensionArgs = options.packageExtensionArgs ?? piPackageExtensionArgs(options.command);
|
|
70
|
+
this.child = spawn(options.command, [
|
|
71
|
+
"--mode",
|
|
72
|
+
"rpc",
|
|
73
|
+
"--no-session",
|
|
74
|
+
"--no-mcp",
|
|
75
|
+
"--no-extensions",
|
|
76
|
+
// --no-extensions also drops the user's installed pi packages, and a
|
|
77
|
+
// package can be the provider behind a picked model. Load the personal
|
|
78
|
+
// ones by path; the ticket repository's project packages stay out.
|
|
79
|
+
...packageExtensionArgs,
|
|
80
|
+
"--no-skills",
|
|
81
|
+
"--no-prompt-templates",
|
|
82
|
+
"--no-context-files",
|
|
83
|
+
...(options.noTools ? ["--no-tools"] : ["--extension", EXTENSION.href, "--tools", TOOLS]),
|
|
84
|
+
"--system-prompt",
|
|
85
|
+
options.systemPrompt,
|
|
86
|
+
...(options.model?.trim() ? ["--model", options.model.trim()] : []),
|
|
87
|
+
...thinkingArgs(options.thinking),
|
|
88
|
+
], { cwd: options.cwd, stdio: ["pipe", "pipe", "pipe"] });
|
|
89
|
+
this.events = this.iterate();
|
|
90
|
+
this.child.stdin.on("error", () => { });
|
|
91
|
+
this.child.stderr.setEncoding("utf8");
|
|
92
|
+
this.child.stderr.on("data", (chunk) => {
|
|
93
|
+
this.stderr = (this.stderr + chunk).slice(-4000);
|
|
94
|
+
});
|
|
95
|
+
let buffer = "";
|
|
96
|
+
this.child.stdout.setEncoding("utf8");
|
|
97
|
+
this.child.stdout.on("data", (chunk) => {
|
|
98
|
+
buffer += chunk;
|
|
99
|
+
let newline;
|
|
100
|
+
while ((newline = buffer.indexOf("\n")) !== -1) {
|
|
101
|
+
const line = buffer.slice(0, newline).replace(/\r$/, "");
|
|
102
|
+
buffer = buffer.slice(newline + 1);
|
|
103
|
+
if (!line.trim())
|
|
104
|
+
continue;
|
|
105
|
+
let record;
|
|
106
|
+
try {
|
|
107
|
+
record = JSON.parse(line);
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
this.read(record);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
this.child.on("error", (error) => {
|
|
116
|
+
this.finish({
|
|
117
|
+
type: "exit",
|
|
118
|
+
code: null,
|
|
119
|
+
stderr: options.command + ": " + error.message,
|
|
120
|
+
timedOut: false,
|
|
121
|
+
spawnError: true,
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
this.child.on("exit", (code) => {
|
|
125
|
+
clearTimeout(this.killTimer);
|
|
126
|
+
this.finish({ type: "exit", code, stderr: this.stderr.trim(), timedOut: false });
|
|
127
|
+
});
|
|
128
|
+
this.child.stdin.write(JSON.stringify({
|
|
129
|
+
id: options.id,
|
|
130
|
+
type: "prompt",
|
|
131
|
+
message: options.prompt,
|
|
132
|
+
...(options.images && options.images.length > 0 ? { images: options.images } : {}),
|
|
133
|
+
}) + "\n");
|
|
134
|
+
}
|
|
135
|
+
read(record) {
|
|
136
|
+
if (record.type === "message_update" && record.assistantMessageEvent?.type === "text_delta") {
|
|
137
|
+
this.push({ type: "text", text: record.assistantMessageEvent.delta ?? "" });
|
|
138
|
+
}
|
|
139
|
+
if (record.type === "tool_execution_start" && record.toolName) {
|
|
140
|
+
this.push({
|
|
141
|
+
type: "tool_start",
|
|
142
|
+
tool: record.toolName,
|
|
143
|
+
args: record.args,
|
|
144
|
+
label: toolLabel(record.toolName, record.args),
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
if (record.type === "tool_execution_end" && record.toolName) {
|
|
148
|
+
if (record.isError) {
|
|
149
|
+
const output = toolResultText(record.result);
|
|
150
|
+
if (output) {
|
|
151
|
+
this.push({ type: "tool_output", tool: record.toolName, text: output });
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
this.push({
|
|
155
|
+
type: "tool_end",
|
|
156
|
+
tool: record.toolName,
|
|
157
|
+
isError: Boolean(record.isError),
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
if (record.type === "agent_settled")
|
|
161
|
+
this.push({ type: "settled" });
|
|
162
|
+
}
|
|
163
|
+
push(event) {
|
|
164
|
+
this.queue.push(event);
|
|
165
|
+
const wake = this.wake;
|
|
166
|
+
this.wake = undefined;
|
|
167
|
+
wake?.();
|
|
168
|
+
}
|
|
169
|
+
finish(event) {
|
|
170
|
+
if (this.finished)
|
|
171
|
+
return;
|
|
172
|
+
this.finished = true;
|
|
173
|
+
clearTimeout(this.killTimer);
|
|
174
|
+
this.push(event);
|
|
175
|
+
}
|
|
176
|
+
async *iterate() {
|
|
177
|
+
for (;;) {
|
|
178
|
+
if (this.queue.length === 0) {
|
|
179
|
+
if (this.finished)
|
|
180
|
+
return;
|
|
181
|
+
// oxlint-disable-next-line no-await-in-loop
|
|
182
|
+
await new Promise((resolve) => {
|
|
183
|
+
this.wake = resolve;
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
const event = this.queue.shift();
|
|
187
|
+
if (!event)
|
|
188
|
+
continue;
|
|
189
|
+
yield event;
|
|
190
|
+
if (event.type === "exit")
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
send(record) {
|
|
195
|
+
if (this.finished)
|
|
196
|
+
return;
|
|
197
|
+
try {
|
|
198
|
+
this.child.stdin.write(JSON.stringify(record) + "\n");
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
// The process is gone; its exit event is the answer.
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
steer(text) {
|
|
205
|
+
this.send({ id: "budget-steer", type: "steer", message: text });
|
|
206
|
+
}
|
|
207
|
+
interrupt() {
|
|
208
|
+
this.send({ id: "budget-stop", type: "abort" });
|
|
209
|
+
}
|
|
210
|
+
prompt(text) {
|
|
211
|
+
this.send({ id: "budget-wrapup", type: "prompt", message: text });
|
|
212
|
+
}
|
|
213
|
+
close() {
|
|
214
|
+
if (this.finished)
|
|
215
|
+
return;
|
|
216
|
+
try {
|
|
217
|
+
this.child.stdin.end();
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
// Already gone.
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
abort() {
|
|
224
|
+
if (this.finished || this.wasAborted)
|
|
225
|
+
return;
|
|
226
|
+
this.wasAborted = true;
|
|
227
|
+
this.child.kill("SIGTERM");
|
|
228
|
+
this.killTimer = setTimeout(() => this.child.kill("SIGKILL"), KILL_GRACE_MS);
|
|
229
|
+
}
|
|
230
|
+
get aborted() {
|
|
231
|
+
return this.wasAborted;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
//# sourceMappingURL=pi-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pi-session.js","sourceRoot":"","sources":["../../src/orchestrator/pi-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAuC,MAAM,oBAAoB,CAAC;AAEhF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIlD,MAAM,KAAK,GAAG,gDAAgD,CAAC;AAC/D,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,UAAU,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AACvD,MAAM,aAAa,GAAG,KAAK,CAAC;AAE5B,MAAM,IAAI,GAAG,CAAC,KAAa,EAAE,GAAW,EAAU,EAAE;IAClD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/C,OAAO,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC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AAK,CAAC,GAAG,EAAE,CAAC;QACzB,CAAC;QAAC,MAAM,CAAC;YACP,gBAAgB;QAClB,CAAC;IACH,CAAC;IAED,KAAK;QACH,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,UAAU;YAAE,OAAO;QAC7C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC,CAAC;IAC/E,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The orchestrator's system prompt. This is the product: everything else in
|
|
3
|
+
* M2 is plumbing around it.
|
|
4
|
+
*
|
|
5
|
+
* The rules are the ones argued for in docs/PLAN.md — read-only on the repo,
|
|
6
|
+
* acceptance criteria derived from the user's words and repo evidence rather
|
|
7
|
+
* than from the agent's taste, a rationale on every card, and questions
|
|
8
|
+
* instead of confident invention.
|
|
9
|
+
*
|
|
10
|
+
* This is the chat's doctrine. The planning method, card rules and output block
|
|
11
|
+
* come from `contract.ts`, because the new-task dialog emits the same JSON under
|
|
12
|
+
* its own prompt; see `new-task-prompt.ts`.
|
|
13
|
+
*/
|
|
14
|
+
import { OUTPUT_CONTRACT, PLANNING_METHOD, TICKET_RULES } from "./contract.js";
|
|
15
|
+
export const ORCHESTRATOR_PROMPT = `You are the planner inside Zelio, a local kanban board for supervising coding agents. You help a person decide what to build, then turn work they have agreed to into draft tickets other agents will execute.
|
|
16
|
+
|
|
17
|
+
You are read-only. You never change files, never run builds, never implement. If asked to implement, you write a ticket instead.
|
|
18
|
+
|
|
19
|
+
## When to draft
|
|
20
|
+
|
|
21
|
+
Conversation is the default. Most turns are you helping the person decide what the work is; that is not a failed turn because no card came out of it.
|
|
22
|
+
|
|
23
|
+
Do not create or change a draft until the person signals they want the work turned into one. A signal is explicit — "create a ticket", "add it to the drafts", "make a card", "write that up" — or a clear acceptance of a concrete shape you proposed: "yes", "do that", "sounds right", "let's do it". Exploring, asking questions, thinking out loud, and "maybe" are not signals.
|
|
24
|
+
|
|
25
|
+
If the discussion has settled but they have not asked for a draft, say so in one sentence and ask whether to put it in the drafts. Do not create it just to be helpful.
|
|
26
|
+
|
|
27
|
+
When no draft exists, return \`cards: []\` on discussion turns. When a draft already exists and the person refines it, keep those cards current — they have already opted into the draft.
|
|
28
|
+
|
|
29
|
+
When you do add or change drafts, say so plainly in \`reply\`: "Added it to your drafts." These are drafts, not tickets; a ticket only exists after the person confirms it. Do not name the surface the drafts live on: it differs by the door the person came through, and the card is either in front of them or one click away.
|
|
30
|
+
|
|
31
|
+
## Asking
|
|
32
|
+
|
|
33
|
+
A question is a decision with a price on each answer. That is the whole shape of one.
|
|
34
|
+
|
|
35
|
+
- **Ask only what the repo cannot tell you.** If the code already answers it, say so in \`reply\` as a fact and do not ask. Put the path and line in \`evidence\`.
|
|
36
|
+
- **Never more than three questions.** Three is a conversation; four is a form.
|
|
37
|
+
- **Every option carries its consequence.** Not "add a migration" but "Add a migration — touches \`db.ts\`, +40 lines, needs a backfill test". The server deletes an option with no cost, so a costless option is a question you did not really ask.
|
|
38
|
+
- **Two to four options.** One option is an announcement, five is a menu.
|
|
39
|
+
- **A recommendation says where it came from.** \`derived: true\` means repo evidence produced the options, and \`evidence\` carries the path. A recommendation out of your own taste is \`derived: false\`, and the board labels it "my guess". Never dress taste as evidence.
|
|
40
|
+
- **If both answers lead to the same card, delete the question.** A question that cannot change the diff is a tax on the person's attention.
|
|
41
|
+
- **A question never blocks a draft you could already write.** Asking and drafting in the same turn is right when the cards are honest without the answer.
|
|
42
|
+
|
|
43
|
+
## Splitting
|
|
44
|
+
|
|
45
|
+
Default to one card. Split only along genuinely independent behavior boundaries; do not fragment one coherent outcome into file-edit chores. Each card must be verifiable with its siblings reverted. Parallel cards must be workable at the same time without touching the same files or making each other wrong.
|
|
46
|
+
|
|
47
|
+
If a goal is split, preserve the complete user outcome across the cards and state dependencies plus who owns cross-card integration and final end-to-end verification. Individual green cards do not prove the full user flow.
|
|
48
|
+
|
|
49
|
+
So, before writing a second card, check all four:
|
|
50
|
+
|
|
51
|
+
1. **File overlap.** Parallel cards whose \`likely_files\` intersect cannot run together. If the overlapping work is one behavior, keep it in one card; otherwise state the actual dependency and integration owner.
|
|
52
|
+
2. **Order dependence.** Sequential implementation steps for one behavior stay in one ticket. A real dependency between independently useful outcomes may be separate cards only when each card's acceptance can pass on its own; state the dependency and integration owner.
|
|
53
|
+
3. **Verifiable alone.** If a card's acceptance criteria cannot pass with its siblings reverted, it is a slice, not a ticket.
|
|
54
|
+
4. **Check count.** Keep acceptance at four checks maximum. If a fifth check is needed, split only along independent behavior boundaries with stand-alone acceptance; when no such split exists, ask the person to choose a smaller outcome. Never evade the four-check limit by grouping several observations into one sentence.
|
|
55
|
+
|
|
56
|
+
One or two cards is the normal answer, even for a change that touches five files. Five is the ceiling for genuinely independent work, never a target. Never pad a plan — a board of artificial slices spends the person's attention, which is the scarcest thing here.
|
|
57
|
+
|
|
58
|
+
Prefer the smallest version that tests the riskiest assumption.
|
|
59
|
+
|
|
60
|
+
## Refining a draft
|
|
61
|
+
|
|
62
|
+
When cards already exist they arrive in \`<draft-plan>\`. You are editing them, not writing them again.
|
|
63
|
+
|
|
64
|
+
- Keep a card's \`id\` when you change it. A card you leave out of the block is removed, so restate every card you still want.
|
|
65
|
+
- Do not restate, reword or re-guess a field the last message did not touch. Numbers, sizes and file lists the person already saw are theirs; if you think one is wrong, say so in \`reply\` and flag it in \`assumed\` — do not silently change it.
|
|
66
|
+
- A new constraint applies to every card it affects, not only the obvious one.
|
|
67
|
+
- Only invent a card without an id when the work is genuinely new.
|
|
68
|
+
- **A card the person accepted is finished being a card.** It is now a ticket in \`<board>\`, and it must not come back: not as a card, not reworded, not split off a corner of itself. If they ask for more work on it, that is a new card whose goal says what changes on top of that ticket.
|
|
69
|
+
- A new subject does not require dropping the cards on the table. Keep them unless they are now wrong or the person asked for something else instead.
|
|
70
|
+
|
|
71
|
+
## Outside this repo
|
|
72
|
+
|
|
73
|
+
You read this repo, and you can look things up: \`web_search\` finds GitHub repositories and Wikipedia, \`web_fetch\` reads a public page or raw file. You have no other checkout and no login, so a private page is not available to you.
|
|
74
|
+
|
|
75
|
+
When the person points at another product — "how does X do it", "look at their extension" — read it before you plan from it. Search for the repository, fetch the file that matters, and quote the path or URL you actually read. A card that borrows an idea says where the idea came from.
|
|
76
|
+
|
|
77
|
+
Two things you must never do here: pretend to have read something you did not, and copy a design without checking it against this repo. "They do X" is evidence; "we should do X because they do" is not a reason on its own.
|
|
78
|
+
|
|
79
|
+
If what you need is behind a login or not on the open web, say so in one sentence and make the ticket ask the person for the file — do not fill the gap with a guess.
|
|
80
|
+
|
|
81
|
+
## Fresh or empty repo
|
|
82
|
+
|
|
83
|
+
No code to read means no evidence, so do not pretend otherwise: propose 2-3 options with real tradeoffs rather than one confident recommendation, and make the first ticket a decision (write the choice into \`docs/DECISIONS.md\`) instead of a diff.
|
|
84
|
+
|
|
85
|
+
${PLANNING_METHOD}
|
|
86
|
+
|
|
87
|
+
${TICKET_RULES}
|
|
88
|
+
|
|
89
|
+
${OUTPUT_CONTRACT}`;
|
|
90
|
+
/**
|
|
91
|
+
* The handoff summariser. It is a separate pass, with its own system prompt,
|
|
92
|
+
* because compression is a different job from planning: the planner needs the
|
|
93
|
+
* decisions and constraints, not another draft. It gets the read-only toolset
|
|
94
|
+
* so it can check a path if the transcript mentions one, but it must not change
|
|
95
|
+
* anything.
|
|
96
|
+
*/
|
|
97
|
+
export const SUMMARY_PROMPT = `You are writing a handoff summary for the planner inside Zelio. The conversation you are given is at its message limit, so a new chat will continue the work and will not have the old transcript in front of it.
|
|
98
|
+
|
|
99
|
+
Compress the conversation into what the next planner must know. Be specific and factual, and keep the person's own words where they named a constraint. Cover:
|
|
100
|
+
|
|
101
|
+
- the goal: what the person is actually trying to get built
|
|
102
|
+
- every constraint or decision they stated, including things they explicitly ruled out
|
|
103
|
+
- work that was rejected, dropped, or replaced, and why
|
|
104
|
+
- open questions, unresolved assumptions, and anything the planner was unsure about
|
|
105
|
+
- the state of the draft plan or accepted tickets, if they matter to what comes next
|
|
106
|
+
|
|
107
|
+
Do not invent anything. Do not turn the summary into a new plan or a list of new questions. Do not include greetings or preamble. Use short paragraphs or bullets under those headings, under 500 words. Output only the summary text.
|
|
108
|
+
|
|
109
|
+
You are read-only: never edit, write, run commands, or change the repository.`;
|
|
110
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/orchestrator/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsEjC,eAAe;;EAEf,YAAY;;EAEZ,eAAe,EAAE,CAAC;AAEpB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;8EAYgD,CAAC"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { SCOUT_MAX_ANSWER_CHARS, SCOUT_PROMPT, SCOUT_TOOL_BUDGET } from "./explore.js";
|
|
2
|
+
export const MAX_RESEARCH = 3;
|
|
3
|
+
export const RESEARCH_TIMEOUT_MS = 90_000;
|
|
4
|
+
export const RESEARCH_TOOLS = ["read", "grep", "find", "ls"];
|
|
5
|
+
/**
|
|
6
|
+
* The nudge sent once a scout crosses `SCOUT_TOOL_BUDGET` tool calls — the same
|
|
7
|
+
* ceiling `scoutRepo` steers at in explore.ts. Without this, a scout that keeps
|
|
8
|
+
* reading past the point of a useful answer runs silently to
|
|
9
|
+
* `RESEARCH_TIMEOUT_MS` and comes back clipped and marked as timed out, instead
|
|
10
|
+
* of answering from what it already has.
|
|
11
|
+
*/
|
|
12
|
+
export const SCOUT_STEER_MESSAGE = "You have read enough to answer. Write your cited answer now and stop.";
|
|
13
|
+
const MAX_QUESTION_CHARS = 20_000;
|
|
14
|
+
const MAX_PATHS = 6;
|
|
15
|
+
/** Keeps only well-formed questions, in order, and caps them at MAX_RESEARCH. */
|
|
16
|
+
export function normaliseResearch(value) {
|
|
17
|
+
if (!Array.isArray(value))
|
|
18
|
+
return [];
|
|
19
|
+
const questions = [];
|
|
20
|
+
for (const item of value) {
|
|
21
|
+
if (questions.length >= MAX_RESEARCH)
|
|
22
|
+
break;
|
|
23
|
+
if (!item || typeof item !== "object")
|
|
24
|
+
continue;
|
|
25
|
+
const record = item;
|
|
26
|
+
const question = typeof record.question === "string" ? record.question.trim() : "";
|
|
27
|
+
if (question.length === 0 || question.length > MAX_QUESTION_CHARS)
|
|
28
|
+
continue;
|
|
29
|
+
const paths = Array.isArray(record.paths)
|
|
30
|
+
? record.paths
|
|
31
|
+
.filter((path) => typeof path === "string")
|
|
32
|
+
.map((path) => path.trim())
|
|
33
|
+
.filter((path) => path.length > 0)
|
|
34
|
+
.slice(0, MAX_PATHS)
|
|
35
|
+
: [];
|
|
36
|
+
const board = typeof record.board === "string"
|
|
37
|
+
? record.board.trim()
|
|
38
|
+
: "";
|
|
39
|
+
questions.push({ question, paths, ...(board ? { board } : {}) });
|
|
40
|
+
}
|
|
41
|
+
return questions;
|
|
42
|
+
}
|
|
43
|
+
export function researchPrompt(question) {
|
|
44
|
+
const paths = question.paths.filter((path) => path.trim().length > 0);
|
|
45
|
+
return [
|
|
46
|
+
"Question:",
|
|
47
|
+
question.question,
|
|
48
|
+
...(paths.length > 0 ? ["", "Start here:", ...paths.map((path) => `- ${path}`)] : []),
|
|
49
|
+
"",
|
|
50
|
+
"Answer with findings and cited paths. No card, no code, no plan.",
|
|
51
|
+
].join("\n");
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The scout for a linked board: it reads that repository, not this one, and
|
|
55
|
+
* answers whether the task needs a change there at all.
|
|
56
|
+
*/
|
|
57
|
+
export function linkedBoardQuestion(board, description) {
|
|
58
|
+
return {
|
|
59
|
+
board,
|
|
60
|
+
paths: [],
|
|
61
|
+
question: `This repository (${board}) is one the home repository works with. Does this task need a change in it? If so: where it enters, which stores and routes it touches, which tests cover them, and what this repository must accept from or send to the other one. If not, say so.\n\nTask: ${description.slice(0, MAX_QUESTION_CHARS - 600)}`,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function messageOf(error) {
|
|
65
|
+
return error instanceof Error ? error.message : String(error);
|
|
66
|
+
}
|
|
67
|
+
function clip(answer) {
|
|
68
|
+
return answer.length > SCOUT_MAX_ANSWER_CHARS ? answer.slice(0, SCOUT_MAX_ANSWER_CHARS) : answer;
|
|
69
|
+
}
|
|
70
|
+
function stopRun(run) {
|
|
71
|
+
try {
|
|
72
|
+
run.abort();
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// A run that is already gone has nothing left to stop.
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/** Fire-and-forget: a steer that fails must not fail the scout reading it. */
|
|
79
|
+
function nudge(run, message) {
|
|
80
|
+
try {
|
|
81
|
+
void run.sendMessage?.(message)?.catch(() => { });
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
// The adapter rejected the nudge; the scout still has until its timeout.
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** One question, one scout. Never rejects. */
|
|
88
|
+
async function scout(question, options) {
|
|
89
|
+
const started = Date.now();
|
|
90
|
+
const finding = (answer, error) => ({
|
|
91
|
+
question: question.question,
|
|
92
|
+
answer,
|
|
93
|
+
error,
|
|
94
|
+
durationMs: Date.now() - started,
|
|
95
|
+
...(question.board ? { board: question.board } : {}),
|
|
96
|
+
});
|
|
97
|
+
if (options.signal?.aborted)
|
|
98
|
+
return finding("", "cancelled");
|
|
99
|
+
let run;
|
|
100
|
+
try {
|
|
101
|
+
run = options.runtime.spawn(options.cwd, researchPrompt(question), {
|
|
102
|
+
readOnly: true,
|
|
103
|
+
tools: RESEARCH_TOOLS,
|
|
104
|
+
systemPrompt: SCOUT_PROMPT,
|
|
105
|
+
thinking: "low",
|
|
106
|
+
...(options.command ? { command: options.command } : {}),
|
|
107
|
+
...(options.model ? { model: options.model } : {}),
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
return finding("", messageOf(error));
|
|
112
|
+
}
|
|
113
|
+
let text = "";
|
|
114
|
+
let toolCalls = 0;
|
|
115
|
+
let steered = false;
|
|
116
|
+
const reading = (async () => {
|
|
117
|
+
try {
|
|
118
|
+
for await (const event of run.events) {
|
|
119
|
+
if (event.type === "text")
|
|
120
|
+
text += event.text;
|
|
121
|
+
if (event.type === "tool_start") {
|
|
122
|
+
toolCalls += 1;
|
|
123
|
+
if (!steered && toolCalls >= SCOUT_TOOL_BUDGET) {
|
|
124
|
+
steered = true;
|
|
125
|
+
nudge(run, SCOUT_STEER_MESSAGE);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (event.type === "exit")
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
return { kind: "ended", error: null };
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
return { kind: "ended", error: messageOf(error) };
|
|
135
|
+
}
|
|
136
|
+
})();
|
|
137
|
+
let resolveStop = () => { };
|
|
138
|
+
const stopped = new Promise((resolve) => {
|
|
139
|
+
resolveStop = resolve;
|
|
140
|
+
});
|
|
141
|
+
const timer = setTimeout(() => resolveStop({ kind: "timeout" }), options.timeoutMs);
|
|
142
|
+
const onAbort = () => resolveStop({ kind: "cancelled" });
|
|
143
|
+
options.signal?.addEventListener("abort", onAbort, { once: true });
|
|
144
|
+
try {
|
|
145
|
+
const outcome = await Promise.race([reading, stopped]);
|
|
146
|
+
if (outcome.kind === "ended") {
|
|
147
|
+
if (outcome.error !== null)
|
|
148
|
+
return finding("", outcome.error);
|
|
149
|
+
const answer = text.trim();
|
|
150
|
+
return answer ? finding(clip(answer), null) : finding("", "the scout returned nothing");
|
|
151
|
+
}
|
|
152
|
+
stopRun(run);
|
|
153
|
+
if (outcome.kind === "cancelled")
|
|
154
|
+
return finding("", "cancelled");
|
|
155
|
+
const seconds = Number((options.timeoutMs / 1000).toFixed(3));
|
|
156
|
+
const partial = clip(text.trim());
|
|
157
|
+
return partial
|
|
158
|
+
? finding(partial, `timed out after ${seconds}s; answer is partial`)
|
|
159
|
+
: finding("", `timed out after ${seconds}s`);
|
|
160
|
+
}
|
|
161
|
+
finally {
|
|
162
|
+
clearTimeout(timer);
|
|
163
|
+
options.signal?.removeEventListener("abort", onAbort);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Runs every question concurrently, in its own read-only scout. Results keep
|
|
168
|
+
* the input order; onFinding fires as each one finishes. Never rejects.
|
|
169
|
+
*/
|
|
170
|
+
export async function runResearch(questions, options) {
|
|
171
|
+
const items = normaliseResearch(questions);
|
|
172
|
+
const total = items.length;
|
|
173
|
+
let done = 0;
|
|
174
|
+
return Promise.all(items.map(async (question) => {
|
|
175
|
+
const finding = await scout(question, {
|
|
176
|
+
runtime: options.runtime,
|
|
177
|
+
cwd: (question.board && options.cwdFor?.(question.board)) || options.cwd,
|
|
178
|
+
command: options.command?.trim() || undefined,
|
|
179
|
+
model: options.model?.trim() || undefined,
|
|
180
|
+
timeoutMs: options.timeoutMs ?? RESEARCH_TIMEOUT_MS,
|
|
181
|
+
signal: options.signal,
|
|
182
|
+
});
|
|
183
|
+
done += 1;
|
|
184
|
+
try {
|
|
185
|
+
options.onFinding?.(finding, done, total);
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
// A listener must not sink the other scouts.
|
|
189
|
+
}
|
|
190
|
+
return finding;
|
|
191
|
+
}));
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=research.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"research.js","sourceRoot":"","sources":["../../src/orchestrator/research.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGvF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAC9B,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAC1C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAU,CAAC;AAEtE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAC9B,uEAAuE,CAAC;AAE1E,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,SAAS,GAAG,CAAC,CAAC;AAEpB,iFAAiF;AACjF,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACrC,MAAM,SAAS,GAAuB,EAAE,CAAC;IACzC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,SAAS,CAAC,MAAM,IAAI,YAAY;YAAE,MAAM;QAC5C,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,SAAS;QAChD,MAAM,MAAM,GAAG,IAA+C,CAAC;QAC/D,MAAM,QAAQ,GAAG,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnF,IAAI,QAAQ,CA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