ghostrail 0.15.1 → 0.16.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/README.md +206 -1
- package/dist/agent/claude-code.d.ts.map +1 -1
- package/dist/agent/claude-code.js +4 -1
- package/dist/agent/claude-code.js.map +1 -1
- package/dist/board/page.d.ts +1 -1
- package/dist/board/page.d.ts.map +1 -1
- package/dist/board/page.js +2 -1
- package/dist/board/page.js.map +1 -1
- package/dist/board/server.d.ts +1 -1
- package/dist/board/server.d.ts.map +1 -1
- package/dist/board/server.js +7 -1
- package/dist/board/server.js.map +1 -1
- package/dist/board/stats.d.ts +1 -1
- package/dist/board/stats.d.ts.map +1 -1
- package/dist/board/stats.js +2 -1
- package/dist/board/stats.js.map +1 -1
- package/dist/claude-profile/index.d.ts +1 -1
- package/dist/claude-profile/index.d.ts.map +1 -1
- package/dist/claude-profile/index.js +1 -1
- package/dist/claude-profile/index.js.map +1 -1
- package/dist/claude-profile/setup.d.ts +7 -0
- package/dist/claude-profile/setup.d.ts.map +1 -1
- package/dist/claude-profile/setup.js +7 -0
- package/dist/claude-profile/setup.js.map +1 -1
- package/dist/cli/commands.d.ts +6 -0
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +142 -33
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/update-diagnosis.d.ts +52 -0
- package/dist/cli/update-diagnosis.d.ts.map +1 -0
- package/dist/cli/update-diagnosis.js +87 -0
- package/dist/cli/update-diagnosis.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +3 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/help.d.ts.map +1 -1
- package/dist/commands/help.js +11 -0
- package/dist/commands/help.js.map +1 -1
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +18 -2
- package/dist/config/load.js.map +1 -1
- package/dist/config/schema.d.ts +8 -2
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/dashboard/index.d.ts +1 -1
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard/index.js.map +1 -1
- package/dist/dashboard/page.d.ts +7 -1
- package/dist/dashboard/page.d.ts.map +1 -1
- package/dist/dashboard/page.js +204 -39
- package/dist/dashboard/page.js.map +1 -1
- package/dist/dashboard/routes.d.ts +32 -0
- package/dist/dashboard/routes.d.ts.map +1 -1
- package/dist/dashboard/routes.js +45 -0
- package/dist/dashboard/routes.js.map +1 -1
- package/dist/dashboard/server.d.ts +55 -10
- package/dist/dashboard/server.d.ts.map +1 -1
- package/dist/dashboard/server.js +91 -14
- package/dist/dashboard/server.js.map +1 -1
- package/dist/doctor/checks.d.ts +87 -0
- package/dist/doctor/checks.d.ts.map +1 -0
- package/dist/doctor/checks.js +414 -0
- package/dist/doctor/checks.js.map +1 -0
- package/dist/doctor/index.d.ts +6 -0
- package/dist/doctor/index.d.ts.map +1 -0
- package/dist/doctor/index.js +5 -0
- package/dist/doctor/index.js.map +1 -0
- package/dist/doctor/probes.d.ts +42 -0
- package/dist/doctor/probes.d.ts.map +1 -0
- package/dist/doctor/probes.js +136 -0
- package/dist/doctor/probes.js.map +1 -0
- package/dist/doctor/report.d.ts +13 -0
- package/dist/doctor/report.d.ts.map +1 -0
- package/dist/doctor/report.js +32 -0
- package/dist/doctor/report.js.map +1 -0
- package/dist/doctor/run.d.ts +48 -0
- package/dist/doctor/run.d.ts.map +1 -0
- package/dist/doctor/run.js +109 -0
- package/dist/doctor/run.js.map +1 -0
- package/dist/doctor/types.d.ts +17 -0
- package/dist/doctor/types.d.ts.map +1 -0
- package/dist/doctor/types.js +6 -0
- package/dist/doctor/types.js.map +1 -0
- package/dist/factory/state.d.ts +1 -0
- package/dist/factory/state.d.ts.map +1 -1
- package/dist/factory/state.js +44 -1
- package/dist/factory/state.js.map +1 -1
- package/dist/loop/budget.d.ts +11 -2
- package/dist/loop/budget.d.ts.map +1 -1
- package/dist/loop/budget.js +13 -3
- package/dist/loop/budget.js.map +1 -1
- package/dist/loop/comments.d.ts +20 -0
- package/dist/loop/comments.d.ts.map +1 -0
- package/dist/loop/comments.js +35 -0
- package/dist/loop/comments.js.map +1 -0
- package/dist/loop/engine.d.ts.map +1 -1
- package/dist/loop/engine.js +18 -0
- package/dist/loop/engine.js.map +1 -1
- package/dist/loop/index.d.ts +1 -0
- package/dist/loop/index.d.ts.map +1 -1
- package/dist/loop/index.js +1 -0
- package/dist/loop/index.js.map +1 -1
- package/dist/source/dependencies.d.ts +81 -0
- package/dist/source/dependencies.d.ts.map +1 -0
- package/dist/source/dependencies.js +218 -0
- package/dist/source/dependencies.js.map +1 -0
- package/dist/source/index.d.ts +1 -0
- package/dist/source/index.d.ts.map +1 -1
- package/dist/source/index.js +1 -0
- package/dist/source/index.js.map +1 -1
- package/dist/source/linear.d.ts +17 -1
- package/dist/source/linear.d.ts.map +1 -1
- package/dist/source/linear.js +75 -9
- package/dist/source/linear.js.map +1 -1
- package/dist/store/events.d.ts +8 -0
- package/dist/store/events.d.ts.map +1 -1
- package/dist/store/events.js +10 -0
- package/dist/store/events.js.map +1 -1
- package/dist/store/file-store.d.ts +1 -1
- package/dist/store/file-store.d.ts.map +1 -1
- package/dist/store/file-store.js +7 -0
- package/dist/store/file-store.js.map +1 -1
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +1 -1
- package/dist/store/index.js.map +1 -1
- package/dist/store/port.d.ts +15 -0
- package/dist/store/port.d.ts.map +1 -1
- package/dist/store/port.js +17 -1
- package/dist/store/port.js.map +1 -1
- package/dist/triage/engine.d.ts.map +1 -1
- package/dist/triage/engine.js +2 -0
- package/dist/triage/engine.js.map +1 -1
- package/package.json +3 -1
- package/skill/ghostrail/SKILL.md +30 -29
- package/templates/code/prompts/resolve-issue.md +7 -0
- package/templates/code/prompts/triage.md +7 -0
- package/templates/content/prompts/draft.md +7 -0
package/dist/dashboard/server.js
CHANGED
|
@@ -2,14 +2,27 @@ import { createServer } from "node:http";
|
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { isLoopback, normalizeToken } from "../board/server.js";
|
|
5
|
-
import {
|
|
5
|
+
import { resolveStateDir } from "../factory/state.js";
|
|
6
6
|
import { repoStateDir } from "../global/state-dir.js";
|
|
7
7
|
import { FileStore } from "../store/file-store.js";
|
|
8
8
|
import { DASHBOARD_PAGE_HTML } from "./page.js";
|
|
9
|
-
import { isCrossOriginWrite, parseDashboardRoute, parseWatchUpdate } from "./routes.js";
|
|
10
|
-
/** The store dir inside a ghostrail. */
|
|
9
|
+
import { isCrossOriginWrite, parseArtifactHash, parseDashboardRoute, parseDetailQuery, parseWatchUpdate, } from "./routes.js";
|
|
11
10
|
/** How many runs to show per ghostrail. Enough to see recent activity, not a log. */
|
|
12
11
|
const RUNS_PER_GHOSTRAIL = 5;
|
|
12
|
+
/**
|
|
13
|
+
* One ghostrail's store: the dep when it was supplied, otherwise a file store
|
|
14
|
+
* over the directory `stateDir` resolved.
|
|
15
|
+
*
|
|
16
|
+
* Every read goes through here, the listing and both detail routes, so nothing
|
|
17
|
+
* in this server can disagree with anything else about where a ghostrail's
|
|
18
|
+
* history lives. That agreement is the whole point: TJ-1639 was two places
|
|
19
|
+
* deriving one directory and reaching different answers.
|
|
20
|
+
*/
|
|
21
|
+
async function storeFor(deps, entry) {
|
|
22
|
+
if (deps.store !== undefined)
|
|
23
|
+
return deps.store(entry);
|
|
24
|
+
return new FileStore(await deps.stateDir(entry));
|
|
25
|
+
}
|
|
13
26
|
function sendJson(res, status, data) {
|
|
14
27
|
res.writeHead(status, { "content-type": "application/json" });
|
|
15
28
|
res.end(JSON.stringify(data));
|
|
@@ -38,15 +51,7 @@ export async function collectViews(deps, entries) {
|
|
|
38
51
|
let runs = [];
|
|
39
52
|
if (health === "ok") {
|
|
40
53
|
try {
|
|
41
|
-
|
|
42
|
-
// runs are one history however many clones of it exist.
|
|
43
|
-
const rows = await new FileStore(repoStateDir(entryKey(entry), process.env, homedir())).listRuns({});
|
|
44
|
-
runs = rows.slice(0, RUNS_PER_GHOSTRAIL).map((row) => ({
|
|
45
|
-
runId: row.runId,
|
|
46
|
-
...(row.itemId === undefined ? {} : { itemId: row.itemId }),
|
|
47
|
-
...(row.state === undefined ? {} : { state: row.state }),
|
|
48
|
-
...(row.title === undefined ? {} : { title: row.title }),
|
|
49
|
-
}));
|
|
54
|
+
runs = (await (await storeFor(deps, entry)).listRuns({})).slice(0, RUNS_PER_GHOSTRAIL);
|
|
50
55
|
}
|
|
51
56
|
catch {
|
|
52
57
|
runs = [];
|
|
@@ -57,8 +62,9 @@ export async function collectViews(deps, entries) {
|
|
|
57
62
|
return views;
|
|
58
63
|
}
|
|
59
64
|
/**
|
|
60
|
-
* The dashboard's HTTP server: one page, one listing,
|
|
61
|
-
*
|
|
65
|
+
* The dashboard's HTTP server: one page, one listing, two read routes for a
|
|
66
|
+
* single run's live PR status and its artifacts, and one write route that sets
|
|
67
|
+
* a ghostrail's `watch` flag and does nothing else.
|
|
62
68
|
*
|
|
63
69
|
* It never starts or stops anything. `start` and the service units act on the
|
|
64
70
|
* flag, which keeps process control off an HTTP surface: the worst a
|
|
@@ -96,6 +102,62 @@ export function createDashboardServer(deps, options = {}) {
|
|
|
96
102
|
if (route.kind === "ghostrails") {
|
|
97
103
|
return sendJson(res, 200, { ghostrails: await collectViews(deps, entries) });
|
|
98
104
|
}
|
|
105
|
+
if (route.kind === "prStatus" || route.kind === "artifact") {
|
|
106
|
+
// Both are reads. The write route states its verb and these did not,
|
|
107
|
+
// which left a form POST able to reach a store read: harmless on its
|
|
108
|
+
// own, since a cross-origin page cannot read the response either way,
|
|
109
|
+
// but a route that accepts verbs it does not mean is the kind of thing
|
|
110
|
+
// a later guard gets reasoned about wrongly.
|
|
111
|
+
if (req.method !== "GET")
|
|
112
|
+
return sendJson(res, 405, { error: "use GET" });
|
|
113
|
+
const key = route.kind === "prStatus" ? "run" : "hash";
|
|
114
|
+
const query = parseDetailQuery(url.searchParams, key);
|
|
115
|
+
if (query === undefined) {
|
|
116
|
+
return sendJson(res, 400, { error: `expected ?path=<ghostrail path>&${key}=<id>` });
|
|
117
|
+
}
|
|
118
|
+
// Same rule the write route holds to: a ghostrail must already be
|
|
119
|
+
// registered. Reading a store under a path supplied by the request
|
|
120
|
+
// would let a caller name any directory on the machine.
|
|
121
|
+
const entry = entries.find((e) => e.path === query.path);
|
|
122
|
+
if (entry === undefined) {
|
|
123
|
+
return sendJson(res, 404, { error: "no registered ghostrail at that path" });
|
|
124
|
+
}
|
|
125
|
+
if (route.kind === "artifact") {
|
|
126
|
+
// A hash that is not a digest is a 404, not a 400: the request is
|
|
127
|
+
// well formed, it just names something no store could hold (TJ-1641).
|
|
128
|
+
const hash = parseArtifactHash(url.searchParams);
|
|
129
|
+
if (hash === undefined)
|
|
130
|
+
return sendJson(res, 404, { error: "not found" });
|
|
131
|
+
const blob = await (await storeFor(deps, entry)).getArtifact(hash);
|
|
132
|
+
if (blob === undefined)
|
|
133
|
+
return sendJson(res, 404, { error: "not found" });
|
|
134
|
+
res.writeHead(200, { "content-type": "application/octet-stream" });
|
|
135
|
+
return res.end(blob);
|
|
136
|
+
}
|
|
137
|
+
const row = await (await storeFor(deps, entry)).getRun(query.value);
|
|
138
|
+
if (row === undefined)
|
|
139
|
+
return sendJson(res, 404, { error: "not found" });
|
|
140
|
+
if (row.prNumber === undefined) {
|
|
141
|
+
return sendJson(res, 404, { error: "no pull request for this run" });
|
|
142
|
+
}
|
|
143
|
+
if (deps.prStatus === undefined)
|
|
144
|
+
return sendJson(res, 200, { available: false });
|
|
145
|
+
try {
|
|
146
|
+
return sendJson(res, 200, {
|
|
147
|
+
available: true,
|
|
148
|
+
...(await deps.prStatus(entry, row.prNumber)),
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
// Never a 500. A route whose whole job is "tell me what is known"
|
|
153
|
+
// answers "not known" when the lookup fails, and the page renders
|
|
154
|
+
// that as a muted line rather than an alarm.
|
|
155
|
+
return sendJson(res, 200, {
|
|
156
|
+
available: false,
|
|
157
|
+
error: error instanceof Error ? error.message : String(error),
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
99
161
|
if (route.kind === "watch") {
|
|
100
162
|
if (req.method !== "POST")
|
|
101
163
|
return sendJson(res, 405, { error: "use POST" });
|
|
@@ -123,4 +185,19 @@ export function createDashboardServer(deps, options = {}) {
|
|
|
123
185
|
})().catch(() => sendJson(res, 500, { error: "internal error" }));
|
|
124
186
|
});
|
|
125
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* The default state-dir resolver: the registry's identity when it has one, else
|
|
190
|
+
* the repo itself.
|
|
191
|
+
*
|
|
192
|
+
* The fast path matters because a listing asks once per ghostrail per request,
|
|
193
|
+
* and an entry that already knows its identity has nothing to look up. The slow
|
|
194
|
+
* path is the one that has to be right: a registry written before identities
|
|
195
|
+
* existed has no `repo`, and falling back to its path keys a directory nothing
|
|
196
|
+
* ever writes to, which is exactly how the dashboard came to show no runs.
|
|
197
|
+
*/
|
|
198
|
+
export function defaultStateDir(entry) {
|
|
199
|
+
return entry.repo === undefined
|
|
200
|
+
? resolveStateDir(entry.path)
|
|
201
|
+
: Promise.resolve(repoStateDir(entry.repo, process.env, homedir()));
|
|
202
|
+
}
|
|
126
203
|
//# sourceMappingURL=server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/dashboard/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,YAAY,EAAE,MAAM,WAAW,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,
|
|
1
|
+
{"version":3,"file":"server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,GAAG,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,KAAgB;IAC9C,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS;QAC7B,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC;QAC7B,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure check functions: each takes already-gathered facts and returns a
|
|
3
|
+
* {@link DoctorCheck} (or one per item, for the checks that repeat per prompt).
|
|
4
|
+
* No I/O here — see probes.ts for that — so every rule is testable without a
|
|
5
|
+
* container, a tracker, or the network. Rules are documented in
|
|
6
|
+
* specs/doctor-command.spec.md.
|
|
7
|
+
*/
|
|
8
|
+
import type { ConfigError } from "../config/result.js";
|
|
9
|
+
import type { BackendKind } from "../config/schema.js";
|
|
10
|
+
import type { RunRow } from "../store/events.js";
|
|
11
|
+
import type { DoctorCheck } from "./types.js";
|
|
12
|
+
export declare function checkConfig(parsed: {
|
|
13
|
+
ok: true;
|
|
14
|
+
} | {
|
|
15
|
+
ok: false;
|
|
16
|
+
errors: readonly ConfigError[];
|
|
17
|
+
}): DoctorCheck;
|
|
18
|
+
export type PromptField = "agent.prompt" | "respond.prompt" | "triage.prompt";
|
|
19
|
+
export interface PromptFact {
|
|
20
|
+
field: PromptField;
|
|
21
|
+
path: string;
|
|
22
|
+
exists: boolean;
|
|
23
|
+
committed: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** One check per configured prompt path: exists on disk, and is committed. */
|
|
26
|
+
export declare function checkPrompt(fact: PromptFact): DoctorCheck;
|
|
27
|
+
/**
|
|
28
|
+
* The `package.json` script name a gate command invokes, if it looks like a
|
|
29
|
+
* package-manager script invocation (`pnpm <script>`, `npm run <script>`,
|
|
30
|
+
* `yarn <script>`); undefined for anything else, including a package-manager
|
|
31
|
+
* builtin like `pnpm install`. Best-effort: a command this misses is simply not
|
|
32
|
+
* checked further, never reported as broken on a guess.
|
|
33
|
+
*/
|
|
34
|
+
export declare function scriptNameOf(command: string): string | undefined;
|
|
35
|
+
/** Gate commands that name a `package.json` script the project does not have. */
|
|
36
|
+
export declare function unresolvedGateCommands(commands: readonly string[], scripts: Record<string, unknown> | undefined): string[];
|
|
37
|
+
export declare function checkGate(commands: readonly string[], scripts: Record<string, unknown> | undefined): DoctorCheck;
|
|
38
|
+
export interface BackendFacts {
|
|
39
|
+
kind: BackendKind;
|
|
40
|
+
image?: string;
|
|
41
|
+
quick: boolean;
|
|
42
|
+
/** undefined only when `quick` skipped the probe. */
|
|
43
|
+
dockerAvailable?: boolean;
|
|
44
|
+
/** undefined when `quick` skipped, docker is unreachable, or no custom image is configured. */
|
|
45
|
+
imagePresent?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export declare function checkBackend(facts: BackendFacts): DoctorCheck;
|
|
48
|
+
export interface ClaudeProfileFacts {
|
|
49
|
+
present: boolean;
|
|
50
|
+
/** Skills requested via `--pin` at `claude-setup` time, not installed. */
|
|
51
|
+
missingPins: string[];
|
|
52
|
+
}
|
|
53
|
+
export declare function checkClaudeProfile(facts: ClaudeProfileFacts): DoctorCheck;
|
|
54
|
+
export type CredentialShape = "unset" | "blank" | "set";
|
|
55
|
+
/** Whether a raw env value is unset, present-but-blank, or a real value. Never returns the value. */
|
|
56
|
+
export declare function classifyCredential(value: string | undefined): CredentialShape;
|
|
57
|
+
export declare function checkClaudeAuthCredential(anthropicApiKey: string | undefined, oauthToken: string | undefined): DoctorCheck;
|
|
58
|
+
export declare function checkLinearCredential(linearApiKey: string | undefined): DoctorCheck;
|
|
59
|
+
export declare function checkGithubCredential(ghToken: string | undefined, githubToken: string | undefined): DoctorCheck;
|
|
60
|
+
export type ClaudeProbeResult = {
|
|
61
|
+
kind: "skipped";
|
|
62
|
+
} | {
|
|
63
|
+
kind: "ok";
|
|
64
|
+
} | {
|
|
65
|
+
kind: "invalid-token";
|
|
66
|
+
} | {
|
|
67
|
+
kind: "error";
|
|
68
|
+
message: string;
|
|
69
|
+
} | {
|
|
70
|
+
kind: "not-run";
|
|
71
|
+
};
|
|
72
|
+
export declare function checkClaudeProbe(result: ClaudeProbeResult, backendKind: BackendKind): DoctorCheck;
|
|
73
|
+
export type LinearProbeResult = {
|
|
74
|
+
kind: "skipped";
|
|
75
|
+
} | {
|
|
76
|
+
kind: "ok";
|
|
77
|
+
} | {
|
|
78
|
+
kind: "unauthorized";
|
|
79
|
+
} | {
|
|
80
|
+
kind: "error";
|
|
81
|
+
message: string;
|
|
82
|
+
} | {
|
|
83
|
+
kind: "not-run";
|
|
84
|
+
};
|
|
85
|
+
export declare function checkLinearProbe(result: LinearProbeResult): DoctorCheck;
|
|
86
|
+
export declare function checkHistory(rows: readonly RunRow[]): DoctorCheck;
|
|
87
|
+
//# sourceMappingURL=checks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../src/doctor/checks.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,wBAAgB,WAAW,CACzB,MAAM,EAAE;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAA;CAAE,GACnE,WAAW,CAgB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