@prestyj/cli 5.30.3 → 5.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-sidecar/goal-routes.d.ts +2 -22
- package/dist/app-sidecar/goal-routes.js +12 -93
- package/dist/app-sidecar/goal-routes.js.map +1 -1
- package/dist/app-sidecar/history-routes.js +1 -2
- package/dist/app-sidecar/history-routes.js.map +1 -1
- package/dist/app-sidecar/prompt-routes.js +1 -2
- package/dist/app-sidecar/prompt-routes.js.map +1 -1
- package/dist/app-sidecar/run-control-routes.d.ts +14 -0
- package/dist/app-sidecar/run-control-routes.js +61 -22
- package/dist/app-sidecar/run-control-routes.js.map +1 -1
- package/dist/app-sidecar/session-routes.js +5 -1
- package/dist/app-sidecar/session-routes.js.map +1 -1
- package/dist/app-sidecar/task-routes.js +22 -0
- package/dist/app-sidecar/task-routes.js.map +1 -1
- package/dist/app-sidecar.js +6 -7
- package/dist/app-sidecar.js.map +1 -1
- package/dist/core/agent-session.d.ts +17 -0
- package/dist/core/agent-session.js +48 -12
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/custom-commands.d.ts +6 -0
- package/dist/core/custom-commands.js +17 -0
- package/dist/core/custom-commands.js.map +1 -1
- package/dist/core/goal-run-marker.d.ts +32 -0
- package/dist/core/goal-run-marker.js +178 -0
- package/dist/core/goal-run-marker.js.map +1 -0
- package/dist/core/goal-summary.d.ts +32 -0
- package/dist/core/goal-summary.js +110 -0
- package/dist/core/goal-summary.js.map +1 -0
- package/dist/core/plan-handoff.d.ts +8 -0
- package/dist/core/plan-handoff.js +11 -0
- package/dist/core/plan-handoff.js.map +1 -1
- package/dist/core/resolve-start.d.ts +2 -0
- package/dist/core/resolve-start.js +34 -5
- package/dist/core/resolve-start.js.map +1 -1
- package/dist/core/subagent-policy.js +4 -1
- package/dist/core/subagent-policy.js.map +1 -1
- package/dist/goals-agent/goals-agent.js +43 -1
- package/dist/goals-agent/goals-agent.js.map +1 -1
- package/dist/modes/acp-autopilot.d.ts +27 -0
- package/dist/modes/acp-autopilot.js +54 -0
- package/dist/modes/acp-autopilot.js.map +1 -0
- package/dist/modes/acp-goals.d.ts +52 -0
- package/dist/modes/acp-goals.js +102 -0
- package/dist/modes/acp-goals.js.map +1 -0
- package/dist/modes/acp-mode.d.ts +128 -3
- package/dist/modes/acp-mode.js +1086 -52
- package/dist/modes/acp-mode.js.map +1 -1
- package/dist/tools/grep-scan.d.ts +96 -0
- package/dist/tools/grep-scan.js +283 -0
- package/dist/tools/grep-scan.js.map +1 -0
- package/dist/tools/grep.d.ts +10 -0
- package/dist/tools/grep.js +418 -10
- package/dist/tools/grep.js.map +1 -1
- package/dist/ui/components/Footer.js +4 -0
- package/dist/ui/components/Footer.js.map +1 -1
- package/dist/utils/git-overview.d.ts +41 -0
- package/dist/utils/git-overview.js +146 -0
- package/dist/utils/git-overview.js.map +1 -0
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-commands.js","sourceRoot":"","sources":["../../src/core/custom-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAS7C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,GAAW;IAClD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAC3D,MAAM,QAAQ,GAAoB,EAAE,CAAC;IAErC,IAAI,KAAe,CAAC;IACpB,IAAI,CAAC;QACH,KAAK,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI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rC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** How often a held marker is re-stamped. */
|
|
2
|
+
export declare const GOAL_RUN_HEARTBEAT_MS = 15000;
|
|
3
|
+
/** A marker not re-stamped for this long belongs to a run that is gone. */
|
|
4
|
+
export declare const GOAL_RUN_STALE_MS = 60000;
|
|
5
|
+
/** What the file holds. */
|
|
6
|
+
export interface GoalRunMarker {
|
|
7
|
+
version: 1;
|
|
8
|
+
pid: number;
|
|
9
|
+
/** Distinguishes two holds by the same pid across a restart of the process. */
|
|
10
|
+
token: string;
|
|
11
|
+
startedAt: string;
|
|
12
|
+
heartbeatAt: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function goalRunMarkerPath(dir: string): string;
|
|
15
|
+
/** Whether a marker stands for a run still going. Pure, so it can be tested. */
|
|
16
|
+
export declare function goalRunMarkerLive(marker: GoalRunMarker, now: number, isAlive?: (pid: number) => boolean): boolean;
|
|
17
|
+
/** The marker in a goal folder, or null when there is none or it can't be read. */
|
|
18
|
+
export declare function readGoalRunMarker(dir: string): GoalRunMarker | null;
|
|
19
|
+
/** Some process (this one included) is running the goal right now. */
|
|
20
|
+
export declare function goalRunLive(dir: string, now?: number): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Another process is running the goal right now. What the resume checks ask:
|
|
23
|
+
* this process's own run is already known to them, and must not stop it
|
|
24
|
+
* resuming a goal it was itself cut off from.
|
|
25
|
+
*/
|
|
26
|
+
export declare function goalRunningElsewhere(dir: string, now?: number): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Mark a goal as being worked on by this process until the returned release
|
|
29
|
+
* is called. Holds nest: two sessions on one goal (two windows) keep the
|
|
30
|
+
* marker until both let go. Releasing twice is harmless.
|
|
31
|
+
*/
|
|
32
|
+
export declare function holdGoalRun(goalDir: string, now?: () => Date): () => void;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a goal is being worked on right now, by any process on this machine.
|
|
3
|
+
*
|
|
4
|
+
* A goal can be run by the desktop app's sidecar, by `ezcoder acp` (pew2 on
|
|
5
|
+
* the phone spawns that), or by both over a day. Each knows only its own
|
|
6
|
+
* sessions, so a goal another process was in the middle of read as cut off
|
|
7
|
+
* mid-work: its session file ends on a tool call. The goal list said
|
|
8
|
+
* "Interrupted" for a goal that was running, and opening it offered to resume
|
|
9
|
+
* it, which would start a second coordinator on the same goal.
|
|
10
|
+
*
|
|
11
|
+
* So the process running a goal says so, in a small file in the goal's
|
|
12
|
+
* `.gg` folder: its pid and a heartbeat. A reader counts it only while that
|
|
13
|
+
* pid is alive *and* the heartbeat is fresh. A crash leaves the file behind,
|
|
14
|
+
* and the heartbeat going stale (or the pid being gone) is what lets the goal
|
|
15
|
+
* read as interrupted again; the freshness check also stops a recycled pid
|
|
16
|
+
* from passing as the old run.
|
|
17
|
+
*/
|
|
18
|
+
import fs from "node:fs";
|
|
19
|
+
import path from "node:path";
|
|
20
|
+
import { randomUUID } from "node:crypto";
|
|
21
|
+
/** How often a held marker is re-stamped. */
|
|
22
|
+
export const GOAL_RUN_HEARTBEAT_MS = 15_000;
|
|
23
|
+
/** A marker not re-stamped for this long belongs to a run that is gone. */
|
|
24
|
+
export const GOAL_RUN_STALE_MS = 60_000;
|
|
25
|
+
export function goalRunMarkerPath(dir) {
|
|
26
|
+
return path.join(dir, ".ezcoder", "goal-running.json");
|
|
27
|
+
}
|
|
28
|
+
/** True when a process with this pid exists (EPERM: it exists, it's just not ours). */
|
|
29
|
+
function processAlive(pid) {
|
|
30
|
+
try {
|
|
31
|
+
process.kill(pid, 0);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
return err.code === "EPERM";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** Whether a marker stands for a run still going. Pure, so it can be tested. */
|
|
39
|
+
export function goalRunMarkerLive(marker, now, isAlive = processAlive) {
|
|
40
|
+
const beat = Date.parse(marker.heartbeatAt);
|
|
41
|
+
if (!Number.isFinite(beat) || now - beat > GOAL_RUN_STALE_MS)
|
|
42
|
+
return false;
|
|
43
|
+
return isAlive(marker.pid);
|
|
44
|
+
}
|
|
45
|
+
/** The marker in a goal folder, or null when there is none or it can't be read. */
|
|
46
|
+
export function readGoalRunMarker(dir) {
|
|
47
|
+
let raw;
|
|
48
|
+
try {
|
|
49
|
+
raw = fs.readFileSync(goalRunMarkerPath(dir), "utf-8");
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
const value = JSON.parse(raw);
|
|
56
|
+
if (value.version !== 1 ||
|
|
57
|
+
typeof value.pid !== "number" ||
|
|
58
|
+
!Number.isInteger(value.pid) ||
|
|
59
|
+
value.pid <= 0 ||
|
|
60
|
+
typeof value.token !== "string" ||
|
|
61
|
+
typeof value.startedAt !== "string" ||
|
|
62
|
+
typeof value.heartbeatAt !== "string") {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** Some process (this one included) is running the goal right now. */
|
|
72
|
+
export function goalRunLive(dir, now = Date.now()) {
|
|
73
|
+
const marker = readGoalRunMarker(dir);
|
|
74
|
+
return marker !== null && goalRunMarkerLive(marker, now);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Another process is running the goal right now. What the resume checks ask:
|
|
78
|
+
* this process's own run is already known to them, and must not stop it
|
|
79
|
+
* resuming a goal it was itself cut off from.
|
|
80
|
+
*/
|
|
81
|
+
export function goalRunningElsewhere(dir, now = Date.now()) {
|
|
82
|
+
const marker = readGoalRunMarker(dir);
|
|
83
|
+
return marker !== null && marker.pid !== process.pid && goalRunMarkerLive(marker, now);
|
|
84
|
+
}
|
|
85
|
+
/** Live holds in this process, by resolved goal folder. */
|
|
86
|
+
const holds = new Map();
|
|
87
|
+
let exitHookInstalled = false;
|
|
88
|
+
/** Written beside the target and renamed, so a reader never sees half a file. */
|
|
89
|
+
function writeMarker(dir, marker) {
|
|
90
|
+
const file = goalRunMarkerPath(dir);
|
|
91
|
+
try {
|
|
92
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
93
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
94
|
+
fs.writeFileSync(tmp, JSON.stringify(marker));
|
|
95
|
+
fs.renameSync(tmp, file);
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
// Best effort: without the file the goal just isn't shown as running
|
|
99
|
+
// elsewhere, exactly as before the marker existed. Never fail a run on it.
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/** Removes the file only while it is still this hold's: another process may have taken over. */
|
|
103
|
+
function removeMarker(dir, marker) {
|
|
104
|
+
const current = readGoalRunMarker(dir);
|
|
105
|
+
if (!current || current.pid !== marker.pid || current.token !== marker.token)
|
|
106
|
+
return;
|
|
107
|
+
try {
|
|
108
|
+
fs.unlinkSync(goalRunMarkerPath(dir));
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
// Already gone.
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function installExitHook() {
|
|
115
|
+
if (exitHookInstalled)
|
|
116
|
+
return;
|
|
117
|
+
exitHookInstalled = true;
|
|
118
|
+
// A clean exit (quit, a supervisor restart) clears its markers at once
|
|
119
|
+
// instead of leaving the goal "running" until the heartbeat goes stale.
|
|
120
|
+
process.once("exit", () => {
|
|
121
|
+
for (const [dir, hold] of holds) {
|
|
122
|
+
clearInterval(hold.timer);
|
|
123
|
+
removeMarker(dir, hold.marker);
|
|
124
|
+
}
|
|
125
|
+
holds.clear();
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Mark a goal as being worked on by this process until the returned release
|
|
130
|
+
* is called. Holds nest: two sessions on one goal (two windows) keep the
|
|
131
|
+
* marker until both let go. Releasing twice is harmless.
|
|
132
|
+
*/
|
|
133
|
+
export function holdGoalRun(goalDir, now = () => new Date()) {
|
|
134
|
+
const dir = path.resolve(goalDir);
|
|
135
|
+
let hold = holds.get(dir);
|
|
136
|
+
if (hold) {
|
|
137
|
+
hold.count++;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
const at = now().toISOString();
|
|
141
|
+
const marker = {
|
|
142
|
+
version: 1,
|
|
143
|
+
pid: process.pid,
|
|
144
|
+
token: randomUUID(),
|
|
145
|
+
startedAt: at,
|
|
146
|
+
heartbeatAt: at,
|
|
147
|
+
};
|
|
148
|
+
writeMarker(dir, marker);
|
|
149
|
+
const timer = setInterval(() => {
|
|
150
|
+
const current = holds.get(dir);
|
|
151
|
+
if (!current)
|
|
152
|
+
return;
|
|
153
|
+
current.marker = { ...current.marker, heartbeatAt: now().toISOString() };
|
|
154
|
+
writeMarker(dir, current.marker);
|
|
155
|
+
}, GOAL_RUN_HEARTBEAT_MS);
|
|
156
|
+
// Never what keeps a process alive.
|
|
157
|
+
timer.unref?.();
|
|
158
|
+
hold = { count: 1, marker, timer };
|
|
159
|
+
holds.set(dir, hold);
|
|
160
|
+
installExitHook();
|
|
161
|
+
}
|
|
162
|
+
let released = false;
|
|
163
|
+
return () => {
|
|
164
|
+
if (released)
|
|
165
|
+
return;
|
|
166
|
+
released = true;
|
|
167
|
+
const current = holds.get(dir);
|
|
168
|
+
if (!current)
|
|
169
|
+
return;
|
|
170
|
+
current.count--;
|
|
171
|
+
if (current.count > 0)
|
|
172
|
+
return;
|
|
173
|
+
clearInterval(current.timer);
|
|
174
|
+
holds.delete(dir);
|
|
175
|
+
removeMarker(dir, current.marker);
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
//# sour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AAqB,CAAC,CAAC;QAC1B,oCAAoC;QACpC,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;QAChB,IAAI,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QACnC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACrB,eAAe,EAAE,CAAC;IACpB,CAAC;IACD,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,OAAO,GAAG,EAAE;QACV,IAAI,QAAQ;YAAE,OAAO;QACrB,QAAQ,GAAG,IAAI,CAAC;QAChB,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,CAAC,OAAO;YAAE,OAAO;QACrB,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,IAAI,OAAO,CAAC,KAAK,GAAG,CAAC;YAAE,OAAO;QAC9B,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC7B,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAClB,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { MessageProvenance } from "@prestyj/ai";
|
|
2
|
+
import { type GoalRecord } from "./goals-store.js";
|
|
3
|
+
import type { SessionManager } from "./session-manager.js";
|
|
4
|
+
/** The kickoff/resume instruction is runtime-authored and never shown as a user bubble. */
|
|
5
|
+
export declare const GOAL_RUNTIME_PROVENANCE: MessageProvenance;
|
|
6
|
+
/** One row of the app's goal list. */
|
|
7
|
+
export interface GoalSummary {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
goal: string;
|
|
11
|
+
context: GoalRecord["context"];
|
|
12
|
+
path: string;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
lastActiveMs: number;
|
|
15
|
+
lastActiveDisplay: string;
|
|
16
|
+
/** Newest non-empty session to resume; null opens a fresh coordinator session. */
|
|
17
|
+
latestSessionPath: string | null;
|
|
18
|
+
/**
|
|
19
|
+
* Where the goal stands, for the goal list: briefing (not started yet),
|
|
20
|
+
* running (working right now), paused (by the user), or idle (started,
|
|
21
|
+
* not working: done, or waiting to be opened again).
|
|
22
|
+
*/
|
|
23
|
+
status: "briefing" | "running" | "paused" | "interrupted" | "idle";
|
|
24
|
+
}
|
|
25
|
+
/** A summary plus the newest session's id, for callers that address sessions by id. */
|
|
26
|
+
export type GoalSummaryWithSessionId = GoalSummary & {
|
|
27
|
+
latestSessionId: string | null;
|
|
28
|
+
};
|
|
29
|
+
/** A goal's status for the list (see GoalSummary.status). */
|
|
30
|
+
export declare function goalListStatus(record: GoalRecord, busy: boolean, cutOff?: boolean): GoalSummary["status"];
|
|
31
|
+
/** Summarize one goal for a list, from its record and its coordinator sessions. */
|
|
32
|
+
export declare function summarizeGoal(sessions: SessionManager, dir: string, record: GoalRecord, busy?: boolean): Promise<GoalSummaryWithSessionId>;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Goal list rows, shared by the desktop sidecar (`app-sidecar/goal-routes.ts`)
|
|
3
|
+
* and ACP mode (`modes/acp-goals.ts`), so both surfaces describe a goal the
|
|
4
|
+
* same way.
|
|
5
|
+
*/
|
|
6
|
+
import { promises as fs } from "node:fs";
|
|
7
|
+
import { goalWasInterrupted } from "./goals-store.js";
|
|
8
|
+
import { goalRunLive } from "./goal-run-marker.js";
|
|
9
|
+
import { formatRelativeTime } from "./project-discovery.js";
|
|
10
|
+
/** The kickoff/resume instruction is runtime-authored and never shown as a user bubble. */
|
|
11
|
+
export const GOAL_RUNTIME_PROVENANCE = {
|
|
12
|
+
source: "runtime",
|
|
13
|
+
kind: "automation",
|
|
14
|
+
visibility: "hidden",
|
|
15
|
+
};
|
|
16
|
+
/** How much of a session file's end is read to find its last message. */
|
|
17
|
+
const TAIL_BYTES = 64 * 1024;
|
|
18
|
+
/**
|
|
19
|
+
* The last few messages of a session file (role and content), read from its
|
|
20
|
+
* end only, never thawing or rewriting it. Empty when it can't be read
|
|
21
|
+
* (archived, gone): the goal then just isn't marked interrupted.
|
|
22
|
+
*/
|
|
23
|
+
async function lastMessages(file) {
|
|
24
|
+
let text;
|
|
25
|
+
try {
|
|
26
|
+
const handle = await fs.open(file, "r");
|
|
27
|
+
try {
|
|
28
|
+
const { size } = await handle.stat();
|
|
29
|
+
const start = Math.max(0, size - TAIL_BYTES);
|
|
30
|
+
const buf = Buffer.alloc(size - start);
|
|
31
|
+
await handle.read(buf, 0, buf.length, start);
|
|
32
|
+
text = buf.toString("utf-8");
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
await handle.close();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
const out = [];
|
|
42
|
+
for (const line of text.split("\n")) {
|
|
43
|
+
if (!line.startsWith("{"))
|
|
44
|
+
continue;
|
|
45
|
+
try {
|
|
46
|
+
const entry = JSON.parse(line);
|
|
47
|
+
if (entry.type === "message" && entry.message?.role) {
|
|
48
|
+
out.push({ role: entry.message.role, content: entry.message.content });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// A line cut at the start of the read window.
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
/** A goal's status for the list (see GoalSummary.status). */
|
|
58
|
+
export function goalListStatus(record, busy, cutOff = false) {
|
|
59
|
+
if (record.pausedAt)
|
|
60
|
+
return "paused";
|
|
61
|
+
if (busy)
|
|
62
|
+
return "running";
|
|
63
|
+
if (cutOff)
|
|
64
|
+
return "interrupted";
|
|
65
|
+
return record.startedAt ? "idle" : "briefing";
|
|
66
|
+
}
|
|
67
|
+
/** Summarize one goal for a list, from its record and its coordinator sessions. */
|
|
68
|
+
export async function summarizeGoal(sessions, dir, record, busy = false) {
|
|
69
|
+
const list = await sessions.list(dir).catch(() => []);
|
|
70
|
+
const withMessages = list.filter((s) => s.messageCount > 0);
|
|
71
|
+
let lastActiveMs = Date.parse(record.createdAt) || 0;
|
|
72
|
+
let latestSessionPath = null;
|
|
73
|
+
let latestSessionId = null;
|
|
74
|
+
let latestMs = -1;
|
|
75
|
+
for (const s of withMessages) {
|
|
76
|
+
const ms = Date.parse(s.lastActivity) || 0;
|
|
77
|
+
if (ms > latestMs) {
|
|
78
|
+
latestMs = ms;
|
|
79
|
+
latestSessionPath = s.path;
|
|
80
|
+
latestSessionId = s.id;
|
|
81
|
+
}
|
|
82
|
+
if (ms > lastActiveMs)
|
|
83
|
+
lastActiveMs = ms;
|
|
84
|
+
}
|
|
85
|
+
// `busy` only knows this process's sessions. A goal another process is
|
|
86
|
+
// running (the phone through `ezcoder acp`, or the desktop app while the
|
|
87
|
+
// phone asks) says so through its run marker; without it, a session file
|
|
88
|
+
// ending on a tool call read as "Interrupted" while the goal was working.
|
|
89
|
+
const live = busy || goalRunLive(dir);
|
|
90
|
+
return {
|
|
91
|
+
id: record.id,
|
|
92
|
+
name: record.name,
|
|
93
|
+
goal: record.goal,
|
|
94
|
+
context: record.context,
|
|
95
|
+
path: dir,
|
|
96
|
+
createdAt: record.createdAt,
|
|
97
|
+
lastActiveMs,
|
|
98
|
+
lastActiveDisplay: formatRelativeTime(lastActiveMs),
|
|
99
|
+
latestSessionPath,
|
|
100
|
+
latestSessionId,
|
|
101
|
+
status: goalListStatus(record, live,
|
|
102
|
+
// Not working, but its last turn never finished: the app closed, or it
|
|
103
|
+
// was stopped, mid-work. Workers aren't known here, only the session.
|
|
104
|
+
!live &&
|
|
105
|
+
Boolean(record.startedAt) &&
|
|
106
|
+
latestSessionPath !== null &&
|
|
107
|
+
goalWasInterrupted(record, await lastMessages(latestSessionPath), [])),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=goal-summary.js.map
|
|
@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OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;YACzB,iBAAiB,KAAK,IAAI;YAC1B,kBAAkB,CAAC,MAAM,EAAE,MAAM,YAAY,CAAC,iBAAiB,CAAC,EAAE,EAAE,CAAC,CACxE;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -28,3 +28,11 @@ export interface PendingPlanOfferInput {
|
|
|
28
28
|
queued: number;
|
|
29
29
|
}
|
|
30
30
|
export declare function shouldOfferPendingPlan(input: Readonly<PendingPlanOfferInput>): boolean;
|
|
31
|
+
/** The tool result exit_plan returns while a submitted plan awaits review. */
|
|
32
|
+
export declare const PLAN_SUBMITTED_FOR_REVIEW = "Plan submitted for user review. Wait for the user to approve, reject, or dismiss it before implementing.";
|
|
33
|
+
/** The prompt run in the fresh session after a plan is accepted — the SAME
|
|
34
|
+
* string ezcoder-app's PlanReviewModal sends on a manual Accept (App.tsx). */
|
|
35
|
+
export declare const IMPLEMENT_PLAN_PROMPT = "The plan has been approved. Implement it now, following each step in order.";
|
|
36
|
+
/** The revision prompt for the user's plan feedback (ezcoder-app App.tsx
|
|
37
|
+
* sendPlanFeedback wording). */
|
|
38
|
+
export declare function buildUserPlanFeedbackPrompt(feedback: string): string;
|
|
@@ -7,4 +7,15 @@ export function shouldOfferPendingPlan(input) {
|
|
|
7
7
|
return false;
|
|
8
8
|
return input.queued === 0;
|
|
9
9
|
}
|
|
10
|
+
/** The tool result exit_plan returns while a submitted plan awaits review. */
|
|
11
|
+
export const PLAN_SUBMITTED_FOR_REVIEW = "Plan submitted for user review. Wait for the user to approve, reject, or dismiss it before implementing.";
|
|
12
|
+
/** The prompt run in the fresh session after a plan is accepted — the SAME
|
|
13
|
+
* string ezcoder-app's PlanReviewModal sends on a manual Accept (App.tsx). */
|
|
14
|
+
export const IMPLEMENT_PLAN_PROMPT = "The plan has been approved. Implement it now, following each step in order.";
|
|
15
|
+
/** The revision prompt for the user's plan feedback (ezcoder-app App.tsx
|
|
16
|
+
* sendPlanFeedback wording). */
|
|
17
|
+
export function buildUserPlanFeedbackPrompt(feedback) {
|
|
18
|
+
return (`The plan was not approved. Feedback from the user:\n\n${feedback}\n\n` +
|
|
19
|
+
"Revise the plan based on this feedback, then call exit_plan again for review.");
|
|
20
|
+
}
|
|
10
21
|
//# sourceMappingURL=plan-handoff.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-handoff.js","sourceRoot":"","sources":["../../src/core/plan-handoff.ts"],"names":[],"mappings":"AA8BA,MAAM,UAAU,sBAAsB,CAAC,KAAsC;IAC3E,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC1C,IAAI,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC,iBAAiB;QAAE,OAAO,KAAK,CAAC;IAC/D,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,eAAe;QAAE,OAAO,KAAK,CAAC;IAC3E,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;AAC5B,CAAC"}
|
|
1
|
+
{"version":3,"file":"plan-handoff.js","sourceRoot":"","sources":["../../src/core/plan-handoff.ts"],"names":[],"mappings":"AA8BA,MAAM,UAAU,sBAAsB,CAAC,KAAsC;IAC3E,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC1C,IAAI,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC,iBAAiB;QAAE,OAAO,KAAK,CAAC;IAC/D,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,eAAe;QAAE,OAAO,KAAK,CAAC;IAC3E,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED,8EAA8E;AAC9E,MAAM,CAAC,MAAM,yBAAyB,GACpC,0GAA0G,CAAC;AAE7G;+EAC+E;AAC/E,MAAM,CAAC,MAAM,qBAAqB,GAChC,6EAA6E,CAAC;AAEhF;iCACiC;AACjC,MAAM,UAAU,2BAA2B,CAAC,QAAgB;IAC1D,OAAO,CACL,yDAAyD,QAAQ,MAAM;QACvE,+EAA+E,CAChF,CAAC;AACJ,CAAC"}
|
|
@@ -13,6 +13,8 @@ export interface ResolvedStartResult extends ResolvedStart {
|
|
|
13
13
|
/** Minimal auth surface needed to decide the startup provider (testable). */
|
|
14
14
|
export interface ProviderAuthLookup {
|
|
15
15
|
hasProviderAuth(provider: string): Promise<boolean>;
|
|
16
|
+
/** First of `keys` with a stored credential (see AuthStorage.pickStorageKey). */
|
|
17
|
+
pickStorageKey(keys: string[]): Promise<string | undefined>;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* Pick a provider/model the user is logged into, preferring the saved defaults.
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import { getDefaultModel, getModel } from "./model-registry.js";
|
|
2
|
+
/**
|
|
3
|
+
* True when `model` can actually authenticate. Provider-level auth isn't enough
|
|
4
|
+
* for models pinned to specific credentials (`authStorageKeys`): Xiaomi's
|
|
5
|
+
* `mimo-v2.6-pro-ultraspeed` needs API Credits even when the Token Plan is
|
|
6
|
+
* connected, and OAuth-only Kimi models need the Kimi sign-in, not the API key.
|
|
7
|
+
*/
|
|
8
|
+
async function modelHasAuth(auth, model) {
|
|
9
|
+
if (!model.authStorageKeys)
|
|
10
|
+
return true;
|
|
11
|
+
return (await auth.pickStorageKey(model.authStorageKeys)) !== undefined;
|
|
12
|
+
}
|
|
13
|
+
/** The provider's default model, when this login can actually use it. */
|
|
14
|
+
async function usableDefault(auth, provider) {
|
|
15
|
+
const model = getDefaultModel(provider);
|
|
16
|
+
return (await modelHasAuth(auth, model)) ? model.id : undefined;
|
|
17
|
+
}
|
|
2
18
|
/**
|
|
3
19
|
* Pick a provider/model the user is logged into, preferring the saved defaults.
|
|
4
20
|
* Mirrors the CLI's resolveActiveProvider, but NEVER throws when logged out:
|
|
@@ -22,13 +38,26 @@ export async function resolveStartOrFallback(auth, allProviders, preferred, save
|
|
|
22
38
|
return { provider: preferred, model: getDefaultModel(preferred).id, loggedIn: false };
|
|
23
39
|
}
|
|
24
40
|
if (loggedIn.includes(preferred)) {
|
|
41
|
+
// A saved model this login can't authenticate (e.g. picked, then backed out
|
|
42
|
+
// of, a model needing a credential the user never configured) must not lock
|
|
43
|
+
// the project: fall back to the provider default, then to another provider.
|
|
25
44
|
const saved = savedModel ? getModel(savedModel) : undefined;
|
|
26
|
-
|
|
27
|
-
provider: preferred,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
45
|
+
if (saved?.provider === preferred && (await modelHasAuth(auth, saved))) {
|
|
46
|
+
return { provider: preferred, model: saved.id, loggedIn: true };
|
|
47
|
+
}
|
|
48
|
+
const model = await usableDefault(auth, preferred);
|
|
49
|
+
if (model)
|
|
50
|
+
return { provider: preferred, model, loggedIn: true };
|
|
51
|
+
}
|
|
52
|
+
for (const provider of loggedIn) {
|
|
53
|
+
if (provider === preferred)
|
|
54
|
+
continue;
|
|
55
|
+
const model = await usableDefault(auth, provider);
|
|
56
|
+
if (model)
|
|
57
|
+
return { provider, model, loggedIn: true };
|
|
31
58
|
}
|
|
59
|
+
// Every logged-in provider's default needs a credential that's missing —
|
|
60
|
+
// keep the old behaviour rather than claiming the user is logged out.
|
|
32
61
|
const provider = loggedIn[0];
|
|
33
62
|
return { provider, model: getDefaultModel(provider).id, loggedIn: true };
|
|
34
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-start.js","sourceRoot":"","sources":["../../src/core/resolve-start.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"resolve-start.js","sourceRoot":"","sources":["../../src/core/resolve-start.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAkB,MAAM,qBAAqB,CAAC;AAsBhF;;;;;GAKG;AACH,KAAK,UAAU,YAAY,CAAC,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AE,QAAQ,KAAK,SAAS,IAAI,CAAC,MAAM,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;YACvE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAClE,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACnD,IAAI,KAAK;YAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACnE,CAAC;IAED,KAAK,MAAM,QAAQ,IAAI,QAAQ,EAAE,CAAC;QAChC,IAAI,QAAQ,KAAK,SAAS;YAAE,SAAS;QACrC,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAClD,IAAI,KAAK;YAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACxD,CAAC;IAED,yEAAyE;IACzE,sEAAsE;IACtE,MAAM,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAE,CAAC;IAC9B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC3E,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveFastModeModel } from "@prestyj/ai";
|
|
1
2
|
export const ASYNC_ORCHESTRATION_MARKER = "\n\n## Async subagent orchestration\n";
|
|
2
3
|
const ULTRA_ORCHESTRATION_PROMPT = `${ASYNC_ORCHESTRATION_MARKER}` +
|
|
3
4
|
`Proactively use spawn_agent for substantial independent workstreams. Start every independent child before calling wait_agent, and continue useful parent work while children run. ` +
|
|
@@ -8,9 +9,11 @@ const EXPLICIT_ORCHESTRATION_PROMPT = `${ASYNC_ORCHESTRATION_MARKER}` +
|
|
|
8
9
|
export function applyAsyncSubagentPolicy(prompt, provider, model, thinkingLevel, toolNames) {
|
|
9
10
|
const markerIndex = prompt.indexOf(ASYNC_ORCHESTRATION_MARKER);
|
|
10
11
|
const basePrompt = markerIndex === -1 ? prompt : prompt.slice(0, markerIndex);
|
|
12
|
+
// Fast-mode ids are the same model at a faster tier — same policy.
|
|
13
|
+
const baseModel = resolveFastModeModel(provider, model).model;
|
|
11
14
|
const supportsPolicy = toolNames.includes("spawn_agent") &&
|
|
12
15
|
provider === "openai" &&
|
|
13
|
-
(
|
|
16
|
+
(baseModel === "gpt-6-astra" || baseModel === "gpt-6.1-sol");
|
|
14
17
|
if (!supportsPolicy)
|
|
15
18
|
return basePrompt;
|
|
16
19
|
return (basePrompt +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagent-policy.js","sourceRoot":"","sources":["../../src/core/subagent-policy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"subagent-policy.js","sourceRoot":"","sources":["../../src/core/subagent-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,MAAM,CAAC,MAAM,0BAA0B,GAAG,uCAAuC,CAAC;AAElF,MAAM,0BAA0B,GAC9B,GAAG,0BAA0B,EAAE;IAC/B,oLAAoL;IACpL,oNAAoN;IACpN,qOAAqO,CAAC;AAExO,MAAM,6BAA6B,GACjC,GAAG,0BAA0B,EAAE;IAC/B,kQAAkQ,CAAC;AAErQ,MAAM,UAAU,wBAAwB,CACtC,MAAc,EACd,QAAkB,EAClB,KAAa,EACb,aAAwC,EACxC,SAA4B;IAE5B,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC/D,MAAM,UAAU,GAAG,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;IAC9E,mEAAmE;IACnE,MAAM,SAAS,GAAG,oBAAoB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC;IAC9D,MAAM,cAAc,GAClB,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC;QACjC,QAAQ,KAAK,QAAQ;QACrB,CAAC,SAAS,KAAK,aAAa,IAAI,SAAS,KAAK,aAAa,CAAC,CAAC;IAC/D,IAAI,CAAC,cAAc;QAAE,OAAO,UAAU,CAAC;IACvC,OAAO,CACL,UAAU;QACV,CAAC,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,6BAA6B,CAAC,CACzF,CAAC;AACJ,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { AgentSession } from "../core/agent-session.js";
|
|
|
2
2
|
import { readGoalMemory, renderGoalPrompt, } from "../core/goals-store.js";
|
|
3
3
|
import { collectProjectContext } from "../system-prompt.js";
|
|
4
4
|
import { getModel } from "../core/model-registry.js";
|
|
5
|
+
import { holdGoalRun } from "../core/goal-run-marker.js";
|
|
5
6
|
import { GOAL_TEAM } from "./goal-team.js";
|
|
6
7
|
/**
|
|
7
8
|
* Little Nolan's faces in the Workers view's dialogue box. EZ Goals picks one
|
|
@@ -195,8 +196,24 @@ function goalAskUser(tools, hasSpoken, isActive) {
|
|
|
195
196
|
* the goal folder, so the goal list and goal deletion find them there.
|
|
196
197
|
*/
|
|
197
198
|
export function createGoalsAgentSession(options) {
|
|
198
|
-
const { goal, extras, additionalTools = [], isActive = () => false, ...sessionOptions } = options;
|
|
199
|
+
const { goal, extras, additionalTools = [], isActive = () => false, onRunActive, ...sessionOptions } = options;
|
|
199
200
|
let spokeThisSession = false;
|
|
201
|
+
// The goal is being worked on while GG Goals' own loop runs or any worker
|
|
202
|
+
// is still live (a turn can end waiting on its team). Other processes read
|
|
203
|
+
// that from the marker, so a goal this one is running never shows there as
|
|
204
|
+
// interrupted, and is never resumed twice.
|
|
205
|
+
let looping = false;
|
|
206
|
+
const liveWorkers = new Set();
|
|
207
|
+
let release = null;
|
|
208
|
+
const syncRunMarker = () => {
|
|
209
|
+
const working = looping || liveWorkers.size > 0;
|
|
210
|
+
if (working && !release)
|
|
211
|
+
release = holdGoalRun(goal.dir);
|
|
212
|
+
else if (!working && release) {
|
|
213
|
+
release();
|
|
214
|
+
release = null;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
200
217
|
// `getMessages()` is the conversation as of the last finished run, so text
|
|
201
218
|
// streamed in the current run is tracked live alongside it.
|
|
202
219
|
const hasSpoken = () => spokeThisSession || hasAssistantText(session.getMessages());
|
|
@@ -212,6 +229,11 @@ export function createGoalsAgentSession(options) {
|
|
|
212
229
|
// as workspace roots and read on demand.
|
|
213
230
|
agentContext: "none",
|
|
214
231
|
promptCacheKeyPrefix: "gggoals",
|
|
232
|
+
onRunActive: (active) => {
|
|
233
|
+
looping = active;
|
|
234
|
+
syncRunMarker();
|
|
235
|
+
onRunActive?.(active);
|
|
236
|
+
},
|
|
215
237
|
// Orchestrating is the job: bringing in workers, steering them and
|
|
216
238
|
// waiting on them must not need a tool_search first.
|
|
217
239
|
coreTools: GOALS_CORE_TOOLS,
|
|
@@ -241,6 +263,26 @@ export function createGoalsAgentSession(options) {
|
|
|
241
263
|
if (text.trim())
|
|
242
264
|
spokeThisSession = true;
|
|
243
265
|
});
|
|
266
|
+
session.eventBus.on("subagent_state", (worker) => {
|
|
267
|
+
if (worker.state === "starting" || worker.state === "running")
|
|
268
|
+
liveWorkers.add(worker.agent_id);
|
|
269
|
+
else
|
|
270
|
+
liveWorkers.delete(worker.agent_id);
|
|
271
|
+
syncRunMarker();
|
|
272
|
+
});
|
|
273
|
+
// Teardown drops every bus listener, so a worker's last "closed" may never
|
|
274
|
+
// arrive: a disposed session lets go of the goal however it ended.
|
|
275
|
+
const dispose = session.dispose.bind(session);
|
|
276
|
+
session.dispose = async () => {
|
|
277
|
+
try {
|
|
278
|
+
await dispose();
|
|
279
|
+
}
|
|
280
|
+
finally {
|
|
281
|
+
looping = false;
|
|
282
|
+
liveWorkers.clear();
|
|
283
|
+
syncRunMarker();
|
|
284
|
+
}
|
|
285
|
+
};
|
|
244
286
|
return session;
|
|
245
287
|
}
|
|
246
288
|
//# sourceMappingURL=goals-agent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goals-agent.js","sourceRoot":"","sources":["../../src/goals-agent/goals-agent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAA4B,MAAM,0BAA0B,CAAC;AAClF,OAAO,EACL,cAAc,EACd,gBAAgB,GAGjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,SAAS;IACT,OAAO;IACP,SAAS;IACT,UAAU;IACV,SAAS;IACT,WAAW;IACX,SAAS;IACT,KAAK;IACL,OAAO;IACP,MAAM;CACE,CAAC;AAEX;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAkCf,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;;sIAE8F,CAAC;AAEvI,gFAAgF;AAChF,MAAM,CAAC,MAAM,gBAAgB,GAAsB;IACjD,aAAa;IACb,YAAY;IACZ,cAAc;IACd,eAAe;IACf,aAAa;IACb,iBAAiB;IACjB,YAAY;IACZ,WAAW;IACX,gDAAgD;IAChD,MAAM;IACN,IAAI;CACL,CAAC;AA8BF;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAA8B;IAC5D,MAAM,IAAI,GAAG,MAAM,EAAE,YAAY,CAAC;IAClC,IAAI,CAAC,IA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