@newrelic/preflight 1.15.6 → 1.16.1
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/alerts/alert-snapshot-collector.d.ts +2 -3
- package/dist/alerts/alert-snapshot-collector.d.ts.map +1 -1
- package/dist/alerts/alert-snapshot-collector.js +1 -1
- package/dist/alerts/alert-snapshot-collector.js.map +1 -1
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +3 -0
- package/dist/config.js.map +1 -1
- package/dist/dashboard/dashboard-server.d.ts.map +1 -1
- package/dist/dashboard/dashboard-server.js +15 -0
- package/dist/dashboard/dashboard-server.js.map +1 -1
- package/dist/dashboard/routes/api-handler.d.ts +26 -18
- package/dist/dashboard/routes/api-handler.d.ts.map +1 -1
- package/dist/dashboard/routes/api-handler.js +71 -23
- package/dist/dashboard/routes/api-handler.js.map +1 -1
- package/dist/data/copilot-pricing/README.md +42 -0
- package/dist/data/copilot-pricing/pricing.json +54 -0
- package/dist/data/copilot-sdk-extension/extension.mjs +123 -0
- package/dist/deploy/data-paths.d.ts +6 -4
- package/dist/deploy/data-paths.d.ts.map +1 -1
- package/dist/deploy/data-paths.js +5 -3
- package/dist/deploy/data-paths.js.map +1 -1
- package/dist/hooks/collector-script.d.ts +12 -3
- package/dist/hooks/collector-script.d.ts.map +1 -1
- package/dist/hooks/collector-script.js +70 -18
- package/dist/hooks/collector-script.js.map +1 -1
- package/dist/hooks/copilot-sdk-usage-mapper.d.ts +45 -0
- package/dist/hooks/copilot-sdk-usage-mapper.d.ts.map +1 -0
- package/dist/hooks/copilot-sdk-usage-mapper.js +73 -0
- package/dist/hooks/copilot-sdk-usage-mapper.js.map +1 -0
- package/dist/hooks/copilot-usage-watcher.d.ts +109 -0
- package/dist/hooks/copilot-usage-watcher.d.ts.map +1 -0
- package/dist/hooks/copilot-usage-watcher.js +436 -0
- package/dist/hooks/copilot-usage-watcher.js.map +1 -0
- package/dist/hooks/parent-transcript-watcher.d.ts +11 -1
- package/dist/hooks/parent-transcript-watcher.d.ts.map +1 -1
- package/dist/hooks/parent-transcript-watcher.js +71 -15
- package/dist/hooks/parent-transcript-watcher.js.map +1 -1
- package/dist/hooks/subagent-watcher.d.ts +14 -0
- package/dist/hooks/subagent-watcher.d.ts.map +1 -1
- package/dist/hooks/subagent-watcher.js +50 -6
- package/dist/hooks/subagent-watcher.js.map +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +162 -70
- package/dist/index.js.map +1 -1
- package/dist/metrics/budget-tracker.d.ts +4 -3
- package/dist/metrics/budget-tracker.d.ts.map +1 -1
- package/dist/metrics/budget-tracker.js +4 -3
- package/dist/metrics/budget-tracker.js.map +1 -1
- package/dist/metrics/copilot-pricing-overlay.d.ts +42 -0
- package/dist/metrics/copilot-pricing-overlay.d.ts.map +1 -0
- package/dist/metrics/copilot-pricing-overlay.js +97 -0
- package/dist/metrics/copilot-pricing-overlay.js.map +1 -0
- package/dist/metrics/cost-tracker.d.ts +14 -0
- package/dist/metrics/cost-tracker.d.ts.map +1 -1
- package/dist/metrics/cost-tracker.js +2 -0
- package/dist/metrics/cost-tracker.js.map +1 -1
- package/dist/metrics/git-efficiency-tracker.d.ts +12 -1
- package/dist/metrics/git-efficiency-tracker.d.ts.map +1 -1
- package/dist/metrics/git-efficiency-tracker.js +18 -3
- package/dist/metrics/git-efficiency-tracker.js.map +1 -1
- package/dist/metrics/instruction-drift-tracker.d.ts.map +1 -1
- package/dist/metrics/instruction-drift-tracker.js +1 -2
- package/dist/metrics/instruction-drift-tracker.js.map +1 -1
- package/dist/metrics/local-session-aggregator.d.ts +164 -0
- package/dist/metrics/local-session-aggregator.d.ts.map +1 -0
- package/dist/metrics/local-session-aggregator.js +444 -0
- package/dist/metrics/local-session-aggregator.js.map +1 -0
- package/dist/platforms/copilot-adapter.d.ts +1 -1
- package/dist/platforms/copilot-adapter.d.ts.map +1 -1
- package/dist/platforms/copilot-adapter.js +64 -10
- package/dist/platforms/copilot-adapter.js.map +1 -1
- package/dist/platforms/copilot-sdk-adapter.d.ts +24 -0
- package/dist/platforms/copilot-sdk-adapter.d.ts.map +1 -0
- package/dist/platforms/copilot-sdk-adapter.js +173 -0
- package/dist/platforms/copilot-sdk-adapter.js.map +1 -0
- package/dist/platforms/index.d.ts +1 -0
- package/dist/platforms/index.d.ts.map +1 -1
- package/dist/platforms/index.js +1 -0
- package/dist/platforms/index.js.map +1 -1
- package/dist/platforms/platform-registry.d.ts.map +1 -1
- package/dist/platforms/platform-registry.js +13 -11
- package/dist/platforms/platform-registry.js.map +1 -1
- package/dist/storage/session-store.d.ts +43 -10
- package/dist/storage/session-store.d.ts.map +1 -1
- package/dist/storage/session-store.js +238 -20
- package/dist/storage/session-store.js.map +1 -1
- package/dist/web/assets/{index-BasTEtUs.js → index-Bwc4qaqj.js} +1 -1
- package/dist/web/assets/index-DwdSz9gz.css +2 -0
- package/dist/web/index.html +2 -2
- package/package.json +2 -2
- package/dist/web/assets/index-BI-2ELf2.css +0 -2
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-real-session aggregation for `--local` (and other unscoped) dashboard
|
|
3
|
+
* processes.
|
|
4
|
+
*
|
|
5
|
+
* Background: a session's own MCP engine normally owns `buffer-<sessionId>.jsonl`
|
|
6
|
+
* (announced via an `active-<sessionId>.pid` heartbeat) and persists that
|
|
7
|
+
* session itself. A `--local` dashboard has no such ownership — it drains every
|
|
8
|
+
* *unowned* buffer destructively and folds the events into trackers keyed by its
|
|
9
|
+
* own synthetic `local-<ts>` identity, which `persistSession()` deliberately
|
|
10
|
+
* skips. Under Claude Code that is fine, because every session has an engine.
|
|
11
|
+
*
|
|
12
|
+
* Under GitHub Copilot it is not: VS Code runs one MCP server per *window* and
|
|
13
|
+
* that engine pins a single session id at startup, while a window has many chat
|
|
14
|
+
* sessions. Tool calls made in any other chat land in an unowned buffer, get
|
|
15
|
+
* drained by the dashboard, and are therefore never written to disk — the live
|
|
16
|
+
* view is correct and rich while `sessions/` stays empty or all-zero.
|
|
17
|
+
*
|
|
18
|
+
* Every drained record already carries its true `sessionId` (that is how
|
|
19
|
+
* `/api/sessions/live` reconstructs per-session timelines), so the dashboard has
|
|
20
|
+
* everything it needs to persist real sessions itself. This module keeps a
|
|
21
|
+
* lightweight per-session rollup so it can do exactly that.
|
|
22
|
+
*/
|
|
23
|
+
import type { ReplayTimelineEntry, ToolCallRecord } from '../storage/types.js';
|
|
24
|
+
import { QualityProxyTracker } from './quality-proxy-tracker.js';
|
|
25
|
+
import { ToolSelectionScorer } from './tool-selection-scorer.js';
|
|
26
|
+
export interface LocalSessionRollup {
|
|
27
|
+
sessionId: string;
|
|
28
|
+
startTime: number;
|
|
29
|
+
endTime: number;
|
|
30
|
+
toolCallCount: number;
|
|
31
|
+
toolBreakdown: Record<string, number>;
|
|
32
|
+
filesRead: Set<string>;
|
|
33
|
+
filesModified: Set<string>;
|
|
34
|
+
cwd: string | null;
|
|
35
|
+
timeline: ReplayTimelineEntry[];
|
|
36
|
+
/** Live records kept for sequence-sensitive tool-selection scoring. */
|
|
37
|
+
records: ToolCallRecord[];
|
|
38
|
+
/** Per-session quality tracker, so raw counts survive into the summary. */
|
|
39
|
+
quality: QualityProxyTracker;
|
|
40
|
+
modelBreakdown: Map<string, {
|
|
41
|
+
requestCount: number;
|
|
42
|
+
input: number;
|
|
43
|
+
output: number;
|
|
44
|
+
cost: number;
|
|
45
|
+
}>;
|
|
46
|
+
costUsd: number;
|
|
47
|
+
tokensInput: number;
|
|
48
|
+
tokensOutput: number;
|
|
49
|
+
tokensCacheRead: number;
|
|
50
|
+
tokensCacheCreation: number;
|
|
51
|
+
models: Set<string>;
|
|
52
|
+
successCount: number;
|
|
53
|
+
}
|
|
54
|
+
/** Parse `owner/name` out of a git remote URL. Null when it isn't recognizable. */
|
|
55
|
+
export declare function repoNameFromRemote(remote: string | null | undefined): string | null;
|
|
56
|
+
/**
|
|
57
|
+
* Strips heredoc bodies from a shell command so its *text* is not mistaken for
|
|
58
|
+
* its *actions*. Agents routinely pipe scripts inline (`python3 - <<'PY' ...`),
|
|
59
|
+
* and a body that merely mentions git words made the command classify as a real
|
|
60
|
+
* `push`/`log` and made a `cd` inside the script hijack repo attribution.
|
|
61
|
+
*
|
|
62
|
+
* The line introducing the heredoc is kept — `git commit -F- <<'MSG'` is still
|
|
63
|
+
* a commit.
|
|
64
|
+
*/
|
|
65
|
+
export declare function stripHeredocBodies(command: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Directory a git command actually acts on. Work is often driven from one
|
|
68
|
+
* workspace but targeted at another repo (`git -C <path>`, or `cd <path> &&
|
|
69
|
+
* git ...`), so the tool call's cwd alone would mislabel those events with the
|
|
70
|
+
* driving repo instead of the one being changed.
|
|
71
|
+
*/
|
|
72
|
+
export declare function gitCommandTargetDir(rawCommand: string, cwd: string | null | undefined): string | null;
|
|
73
|
+
/**
|
|
74
|
+
* Resolves a directory to its repo's `owner/name`, shelling out at most once per
|
|
75
|
+
* distinct directory. Returns null for non-repos and for repos with no origin.
|
|
76
|
+
*/
|
|
77
|
+
export declare class RepoNameResolver {
|
|
78
|
+
private readonly cache;
|
|
79
|
+
resolve(dir: string | null | undefined): string | null;
|
|
80
|
+
/** Repo root (`git rev-parse --show-toplevel`) for a directory, or null. */
|
|
81
|
+
root(dir: string | null | undefined): string | null;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Accumulates tool-call and token activity per real session id. Synthetic ids
|
|
85
|
+
* (`local-`, `proxy-`, `pending-`) are rejected: they are MCP-internal
|
|
86
|
+
* bookkeeping, not real sessions, and persisting them produces the confusing
|
|
87
|
+
* duplicate rows `persistSession()` already guards against.
|
|
88
|
+
*/
|
|
89
|
+
export declare class LocalSessionAggregator {
|
|
90
|
+
private readonly sessions;
|
|
91
|
+
/** Repo dirs targeted by git commands but never entered as a cwd. */
|
|
92
|
+
private readonly gitTargetDirs;
|
|
93
|
+
private static isReal;
|
|
94
|
+
private ensure;
|
|
95
|
+
recordToolCall(record: {
|
|
96
|
+
sessionId?: string | null;
|
|
97
|
+
toolName?: string;
|
|
98
|
+
timestamp?: number;
|
|
99
|
+
durationMs?: number | null;
|
|
100
|
+
success?: boolean;
|
|
101
|
+
cwd?: unknown;
|
|
102
|
+
filePath?: unknown;
|
|
103
|
+
command?: unknown;
|
|
104
|
+
isTestCommand?: boolean;
|
|
105
|
+
isBuildCommand?: boolean;
|
|
106
|
+
isLintCommand?: boolean;
|
|
107
|
+
errorType?: unknown;
|
|
108
|
+
}): void;
|
|
109
|
+
recordTokenUsage(sessionId: string | null | undefined, usage: {
|
|
110
|
+
timestamp?: number;
|
|
111
|
+
costUsd?: number;
|
|
112
|
+
model?: string;
|
|
113
|
+
inputTokens?: number;
|
|
114
|
+
outputTokens?: number;
|
|
115
|
+
cacheReadTokens?: number;
|
|
116
|
+
cacheCreationTokens?: number;
|
|
117
|
+
}): void;
|
|
118
|
+
/** Distinct working directories seen across all sessions. */
|
|
119
|
+
cwds(): string[];
|
|
120
|
+
size(): number;
|
|
121
|
+
/**
|
|
122
|
+
* Session summaries ready for `SessionStore.saveSession()`. Only sessions with
|
|
123
|
+
* observed tool calls are returned — a token-only rollup would be filtered out
|
|
124
|
+
* of `/api/sessions` anyway (it requires `toolCallCount > 0`), and writing it
|
|
125
|
+
* would burn a file that the empty-summary guard then has to defend.
|
|
126
|
+
*/
|
|
127
|
+
toSummaries(context: {
|
|
128
|
+
developer: string;
|
|
129
|
+
platform?: string | null;
|
|
130
|
+
outcome: string;
|
|
131
|
+
repoResolver: RepoNameResolver;
|
|
132
|
+
toolSelectionScorer: ToolSelectionScorer;
|
|
133
|
+
}): Array<Record<string, unknown>>;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Collects today's commits across several repos.
|
|
137
|
+
*
|
|
138
|
+
* The stock hydration runs `git log` with no `cwd`, so it inherits the dashboard
|
|
139
|
+
* process's own working directory — reporting whichever repo the dashboard
|
|
140
|
+
* happens to have been started in rather than the repos actually being worked
|
|
141
|
+
* on, and (having no `--author` filter) counting other people's commits in it.
|
|
142
|
+
* Scanning an explicit set of roots and filtering by author fixes both.
|
|
143
|
+
*
|
|
144
|
+
* `since` is passed per call rather than captured once so a long-lived process
|
|
145
|
+
* rolls over at midnight instead of reporting "today" relative to its start day.
|
|
146
|
+
*/
|
|
147
|
+
export interface CollectedCommit {
|
|
148
|
+
hash: string;
|
|
149
|
+
timestamp: number;
|
|
150
|
+
repo: string | null;
|
|
151
|
+
subject: string | null;
|
|
152
|
+
url: string | null;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Build a browsable GitHub commit URL from a git remote. Handles both SSH
|
|
156
|
+
* (`git@github.com:owner/repo.git`) and HTTPS remotes, and returns null for
|
|
157
|
+
* hosts we can't confidently map so the UI degrades to plain text rather than
|
|
158
|
+
* rendering a broken link.
|
|
159
|
+
*/
|
|
160
|
+
export declare function commitUrlFromRemote(remote: string | null, hash: string): string | null;
|
|
161
|
+
export declare function collectCommitsAcrossRepos(repoRoots: readonly string[], since: string, authorEmail: string | null): CollectedCommit[];
|
|
162
|
+
/** Current git identity, used to keep other contributors' commits out of the count. */
|
|
163
|
+
export declare function resolveAuthorEmail(dir: string): string | null;
|
|
164
|
+
//# sourceMappingURL=local-session-aggregator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-session-aggregator.d.ts","sourceRoot":"","sources":["../../src/metrics/local-session-aggregator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAA0B,MAAM,4BAA4B,CAAC;AAiBzF,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAA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EAAE,MAAM,CAAC;QACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAC9B,GACA,IAAI;IAwBP,6DAA6D;IAC7D,IAAI,IAAI,MAAM,EAAE;IAQhB,IAAI,IAAI,MAAM;IAId;;;;;OAKG;IACH,WAAW,CAAC,OAAO,EAAE;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,EAAE,gBAAgB,CAAC;QAC/B,mBAAmB,EAAE,mBAAmB,CAAC;KAC1C,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CA6DnC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUtF;AAaD,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAAG,IAAI,GACzB,eAAe,EAAE,CAgCnB;AAED,uFAAuF;AACvF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW7D"}
|
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-real-session aggregation for `--local` (and other unscoped) dashboard
|
|
3
|
+
* processes.
|
|
4
|
+
*
|
|
5
|
+
* Background: a session's own MCP engine normally owns `buffer-<sessionId>.jsonl`
|
|
6
|
+
* (announced via an `active-<sessionId>.pid` heartbeat) and persists that
|
|
7
|
+
* session itself. A `--local` dashboard has no such ownership — it drains every
|
|
8
|
+
* *unowned* buffer destructively and folds the events into trackers keyed by its
|
|
9
|
+
* own synthetic `local-<ts>` identity, which `persistSession()` deliberately
|
|
10
|
+
* skips. Under Claude Code that is fine, because every session has an engine.
|
|
11
|
+
*
|
|
12
|
+
* Under GitHub Copilot it is not: VS Code runs one MCP server per *window* and
|
|
13
|
+
* that engine pins a single session id at startup, while a window has many chat
|
|
14
|
+
* sessions. Tool calls made in any other chat land in an unowned buffer, get
|
|
15
|
+
* drained by the dashboard, and are therefore never written to disk — the live
|
|
16
|
+
* view is correct and rich while `sessions/` stays empty or all-zero.
|
|
17
|
+
*
|
|
18
|
+
* Every drained record already carries its true `sessionId` (that is how
|
|
19
|
+
* `/api/sessions/live` reconstructs per-session timelines), so the dashboard has
|
|
20
|
+
* everything it needs to persist real sessions itself. This module keeps a
|
|
21
|
+
* lightweight per-session rollup so it can do exactly that.
|
|
22
|
+
*/
|
|
23
|
+
import { spawnSync } from 'node:child_process';
|
|
24
|
+
import { QualityProxyTracker } from './quality-proxy-tracker.js';
|
|
25
|
+
import { toToolSelectionSummary } from './tool-selection-scorer.js';
|
|
26
|
+
/** Matches SessionTracker's own cap so session files stay bounded. */
|
|
27
|
+
const MAX_TIMELINE_ENTRIES = 10_000;
|
|
28
|
+
const GIT_OPTS = {
|
|
29
|
+
encoding: 'utf-8',
|
|
30
|
+
timeout: 2000,
|
|
31
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
32
|
+
// GIT_DIR/GIT_WORK_TREE (set by git for hook subprocesses, among other
|
|
33
|
+
// cases) override `-C <dir>`, silently redirecting these calls to whatever
|
|
34
|
+
// repo the ambient env points at instead of the target directory.
|
|
35
|
+
get env() {
|
|
36
|
+
return { ...process.env, GIT_DIR: undefined, GIT_WORK_TREE: undefined };
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
/** Parse `owner/name` out of a git remote URL. Null when it isn't recognizable. */
|
|
40
|
+
export function repoNameFromRemote(remote) {
|
|
41
|
+
if (typeof remote !== 'string')
|
|
42
|
+
return null;
|
|
43
|
+
const match = remote.trim().match(/[/:]([^/]+\/[^/]+?)(?:\.git)?$/);
|
|
44
|
+
return match?.[1] ?? null;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Strips heredoc bodies from a shell command so its *text* is not mistaken for
|
|
48
|
+
* its *actions*. Agents routinely pipe scripts inline (`python3 - <<'PY' ...`),
|
|
49
|
+
* and a body that merely mentions git words made the command classify as a real
|
|
50
|
+
* `push`/`log` and made a `cd` inside the script hijack repo attribution.
|
|
51
|
+
*
|
|
52
|
+
* The line introducing the heredoc is kept — `git commit -F- <<'MSG'` is still
|
|
53
|
+
* a commit.
|
|
54
|
+
*/
|
|
55
|
+
export function stripHeredocBodies(command) {
|
|
56
|
+
if (!command.includes('<<'))
|
|
57
|
+
return command;
|
|
58
|
+
const startRe = /<<(-?)\s*(?:'([^']+)'|"([^"]+)"|\\?([A-Za-z_][A-Za-z0-9_]*))/g;
|
|
59
|
+
const kept = [];
|
|
60
|
+
const pending = [];
|
|
61
|
+
for (const line of command.split('\n')) {
|
|
62
|
+
if (pending.length > 0) {
|
|
63
|
+
const current = pending[0];
|
|
64
|
+
const candidate = current.stripTabs ? line.replace(/^\t+/, '') : line;
|
|
65
|
+
if (candidate.trim() === current.tag)
|
|
66
|
+
pending.shift();
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
kept.push(line);
|
|
70
|
+
startRe.lastIndex = 0;
|
|
71
|
+
let match;
|
|
72
|
+
while ((match = startRe.exec(line)) !== null) {
|
|
73
|
+
const tag = match[2] ?? match[3] ?? match[4];
|
|
74
|
+
if (tag)
|
|
75
|
+
pending.push({ tag, stripTabs: match[1] === '-' });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return kept.join('\n');
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Directory a git command actually acts on. Work is often driven from one
|
|
82
|
+
* workspace but targeted at another repo (`git -C <path>`, or `cd <path> &&
|
|
83
|
+
* git ...`), so the tool call's cwd alone would mislabel those events with the
|
|
84
|
+
* driving repo instead of the one being changed.
|
|
85
|
+
*/
|
|
86
|
+
export function gitCommandTargetDir(rawCommand, cwd) {
|
|
87
|
+
const command = stripHeredocBodies(rawCommand);
|
|
88
|
+
const dashC = /(?:^|[|&;]\s*)git\s+(?:-c\s+\S+\s+)*-C\s+(?:"([^"]+)"|'([^']+)'|(\S+))/.exec(command);
|
|
89
|
+
if (dashC)
|
|
90
|
+
return dashC[1] ?? dashC[2] ?? dashC[3] ?? null;
|
|
91
|
+
// `cd <path> && git ...` — the last cd before the git call wins.
|
|
92
|
+
const cd = /(?:^|[|&;]\s*)cd\s+(?:"([^"]+)"|'([^']+)'|(\S+))\s*(?:&&|;)/.exec(command);
|
|
93
|
+
if (cd) {
|
|
94
|
+
const dir = cd[1] ?? cd[2] ?? cd[3] ?? null;
|
|
95
|
+
if (dir && !dir.startsWith('-'))
|
|
96
|
+
return dir;
|
|
97
|
+
}
|
|
98
|
+
return typeof cwd === 'string' && cwd.length > 0 ? cwd : null;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Resolves a directory to its repo's `owner/name`, shelling out at most once per
|
|
102
|
+
* distinct directory. Returns null for non-repos and for repos with no origin.
|
|
103
|
+
*/
|
|
104
|
+
export class RepoNameResolver {
|
|
105
|
+
cache = new Map();
|
|
106
|
+
resolve(dir) {
|
|
107
|
+
if (typeof dir !== 'string' || dir.length === 0)
|
|
108
|
+
return null;
|
|
109
|
+
const cached = this.cache.get(dir);
|
|
110
|
+
if (cached !== undefined)
|
|
111
|
+
return cached;
|
|
112
|
+
let repoName = null;
|
|
113
|
+
try {
|
|
114
|
+
const remote = spawnSync('git', ['-C', dir, 'remote', 'get-url', 'origin'], GIT_OPTS);
|
|
115
|
+
if (remote.status === 0 && typeof remote.stdout === 'string') {
|
|
116
|
+
repoName = repoNameFromRemote(remote.stdout);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
repoName = null;
|
|
121
|
+
}
|
|
122
|
+
this.cache.set(dir, repoName);
|
|
123
|
+
return repoName;
|
|
124
|
+
}
|
|
125
|
+
/** Repo root (`git rev-parse --show-toplevel`) for a directory, or null. */
|
|
126
|
+
root(dir) {
|
|
127
|
+
if (typeof dir !== 'string' || dir.length === 0)
|
|
128
|
+
return null;
|
|
129
|
+
try {
|
|
130
|
+
const result = spawnSync('git', ['-C', dir, 'rev-parse', '--show-toplevel'], GIT_OPTS);
|
|
131
|
+
if (result.status === 0 && typeof result.stdout === 'string') {
|
|
132
|
+
const root = result.stdout.trim();
|
|
133
|
+
return root.length > 0 ? root : null;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
/* not a repo */
|
|
138
|
+
}
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Accumulates tool-call and token activity per real session id. Synthetic ids
|
|
144
|
+
* (`local-`, `proxy-`, `pending-`) are rejected: they are MCP-internal
|
|
145
|
+
* bookkeeping, not real sessions, and persisting them produces the confusing
|
|
146
|
+
* duplicate rows `persistSession()` already guards against.
|
|
147
|
+
*/
|
|
148
|
+
export class LocalSessionAggregator {
|
|
149
|
+
sessions = new Map();
|
|
150
|
+
/** Repo dirs targeted by git commands but never entered as a cwd. */
|
|
151
|
+
gitTargetDirs = new Set();
|
|
152
|
+
static isReal(sessionId) {
|
|
153
|
+
if (typeof sessionId !== 'string' || sessionId.length === 0)
|
|
154
|
+
return false;
|
|
155
|
+
return (!sessionId.startsWith('local-') &&
|
|
156
|
+
!sessionId.startsWith('proxy-') &&
|
|
157
|
+
!sessionId.startsWith('pending-'));
|
|
158
|
+
}
|
|
159
|
+
ensure(sessionId, timestamp) {
|
|
160
|
+
let rollup = this.sessions.get(sessionId);
|
|
161
|
+
if (!rollup) {
|
|
162
|
+
rollup = {
|
|
163
|
+
sessionId,
|
|
164
|
+
startTime: timestamp,
|
|
165
|
+
endTime: timestamp,
|
|
166
|
+
toolCallCount: 0,
|
|
167
|
+
toolBreakdown: {},
|
|
168
|
+
filesRead: new Set(),
|
|
169
|
+
filesModified: new Set(),
|
|
170
|
+
cwd: null,
|
|
171
|
+
timeline: [],
|
|
172
|
+
records: [],
|
|
173
|
+
quality: new QualityProxyTracker(),
|
|
174
|
+
modelBreakdown: new Map(),
|
|
175
|
+
costUsd: 0,
|
|
176
|
+
tokensInput: 0,
|
|
177
|
+
tokensOutput: 0,
|
|
178
|
+
tokensCacheRead: 0,
|
|
179
|
+
tokensCacheCreation: 0,
|
|
180
|
+
models: new Set(),
|
|
181
|
+
successCount: 0,
|
|
182
|
+
};
|
|
183
|
+
this.sessions.set(sessionId, rollup);
|
|
184
|
+
}
|
|
185
|
+
if (timestamp < rollup.startTime)
|
|
186
|
+
rollup.startTime = timestamp;
|
|
187
|
+
if (timestamp > rollup.endTime)
|
|
188
|
+
rollup.endTime = timestamp;
|
|
189
|
+
return rollup;
|
|
190
|
+
}
|
|
191
|
+
recordToolCall(record) {
|
|
192
|
+
if (!LocalSessionAggregator.isReal(record.sessionId))
|
|
193
|
+
return;
|
|
194
|
+
const timestamp = record.timestamp ?? Date.now();
|
|
195
|
+
const rollup = this.ensure(record.sessionId, timestamp);
|
|
196
|
+
rollup.toolCallCount += 1;
|
|
197
|
+
if (record.success !== false)
|
|
198
|
+
rollup.successCount += 1;
|
|
199
|
+
const tool = record.toolName ?? 'unknown';
|
|
200
|
+
rollup.toolBreakdown[tool] = (rollup.toolBreakdown[tool] ?? 0) + 1;
|
|
201
|
+
if (typeof record.cwd === 'string' && record.cwd.length > 0)
|
|
202
|
+
rollup.cwd = record.cwd;
|
|
203
|
+
// A `git -C <path>` / `cd <path> && git` command works on a repo that the
|
|
204
|
+
// cwd never names, so without this the repo would be invisible to commit
|
|
205
|
+
// hydration — the whole point of driving other repos from one workspace.
|
|
206
|
+
if (typeof record.command === 'string' && /(?:^|[|&;]\s*)(?:cd\s|git\s)/.test(record.command)) {
|
|
207
|
+
const target = gitCommandTargetDir(record.command, record.cwd);
|
|
208
|
+
if (target)
|
|
209
|
+
this.gitTargetDirs.add(target);
|
|
210
|
+
}
|
|
211
|
+
// Matches TaskDetector's Read-vs-Write/Edit split (task-detector.ts) —
|
|
212
|
+
// without gating by tool, a read-only exploration session would come
|
|
213
|
+
// back as filesModified: [...everything it opened], which misclassifies
|
|
214
|
+
// it in cost-per-outcome (classifySessionOutcome branches on
|
|
215
|
+
// filesModified.length > 0) and, once merged into a real engine's own
|
|
216
|
+
// accurate list via mergeSummaries()'s union, permanently pollutes it.
|
|
217
|
+
if (typeof record.filePath === 'string' && record.filePath.length > 0) {
|
|
218
|
+
if (tool === 'Read') {
|
|
219
|
+
rollup.filesRead.add(record.filePath);
|
|
220
|
+
}
|
|
221
|
+
else if (tool === 'Write' || tool === 'Edit') {
|
|
222
|
+
rollup.filesModified.add(record.filePath);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
// Persisting the per-call timeline is what lets a restarted process replay
|
|
226
|
+
// this session (git activity, anti-pattern analysis). Capped the same way
|
|
227
|
+
// SessionTracker caps its own timeline so a long session can't grow the
|
|
228
|
+
// session file without bound.
|
|
229
|
+
if (rollup.timeline.length < MAX_TIMELINE_ENTRIES) {
|
|
230
|
+
rollup.timeline.push({
|
|
231
|
+
timestamp,
|
|
232
|
+
toolName: tool,
|
|
233
|
+
durationMs: record.durationMs ?? null,
|
|
234
|
+
success: record.success !== false,
|
|
235
|
+
...(typeof record.filePath === 'string' && { filePath: record.filePath }),
|
|
236
|
+
...(typeof record.command === 'string' && { command: record.command }),
|
|
237
|
+
...(record.isTestCommand === true && { isTestCommand: true }),
|
|
238
|
+
...(record.isBuildCommand === true && { isBuildCommand: true }),
|
|
239
|
+
...(record.isLintCommand === true && { isLintCommand: true }),
|
|
240
|
+
...(typeof record.errorType === 'string' && { errorType: record.errorType }),
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
// Feed the real trackers rather than reimplementing their heuristics, so a
|
|
244
|
+
// rehydrated panel shows exactly what the live one would have shown.
|
|
245
|
+
const fullRecord = record;
|
|
246
|
+
rollup.quality.recordToolCall(fullRecord);
|
|
247
|
+
if (rollup.records.length < MAX_TIMELINE_ENTRIES)
|
|
248
|
+
rollup.records.push(fullRecord);
|
|
249
|
+
}
|
|
250
|
+
recordTokenUsage(sessionId, usage) {
|
|
251
|
+
if (!LocalSessionAggregator.isReal(sessionId))
|
|
252
|
+
return;
|
|
253
|
+
const rollup = this.ensure(sessionId, usage.timestamp ?? Date.now());
|
|
254
|
+
rollup.costUsd += usage.costUsd ?? 0;
|
|
255
|
+
rollup.tokensInput += usage.inputTokens ?? 0;
|
|
256
|
+
rollup.tokensOutput += usage.outputTokens ?? 0;
|
|
257
|
+
rollup.tokensCacheRead += usage.cacheReadTokens ?? 0;
|
|
258
|
+
rollup.tokensCacheCreation += usage.cacheCreationTokens ?? 0;
|
|
259
|
+
if (usage.model) {
|
|
260
|
+
rollup.models.add(usage.model);
|
|
261
|
+
const entry = rollup.modelBreakdown.get(usage.model) ?? {
|
|
262
|
+
requestCount: 0,
|
|
263
|
+
input: 0,
|
|
264
|
+
output: 0,
|
|
265
|
+
cost: 0,
|
|
266
|
+
};
|
|
267
|
+
entry.requestCount += 1;
|
|
268
|
+
entry.input += usage.inputTokens ?? 0;
|
|
269
|
+
entry.output += usage.outputTokens ?? 0;
|
|
270
|
+
entry.cost += usage.costUsd ?? 0;
|
|
271
|
+
rollup.modelBreakdown.set(usage.model, entry);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
/** Distinct working directories seen across all sessions. */
|
|
275
|
+
cwds() {
|
|
276
|
+
const out = new Set(this.gitTargetDirs);
|
|
277
|
+
for (const rollup of this.sessions.values()) {
|
|
278
|
+
if (rollup.cwd)
|
|
279
|
+
out.add(rollup.cwd);
|
|
280
|
+
}
|
|
281
|
+
return [...out];
|
|
282
|
+
}
|
|
283
|
+
size() {
|
|
284
|
+
return this.sessions.size;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Session summaries ready for `SessionStore.saveSession()`. Only sessions with
|
|
288
|
+
* observed tool calls are returned — a token-only rollup would be filtered out
|
|
289
|
+
* of `/api/sessions` anyway (it requires `toolCallCount > 0`), and writing it
|
|
290
|
+
* would burn a file that the empty-summary guard then has to defend.
|
|
291
|
+
*/
|
|
292
|
+
toSummaries(context) {
|
|
293
|
+
const out = [];
|
|
294
|
+
for (const rollup of this.sessions.values()) {
|
|
295
|
+
if (rollup.toolCallCount === 0)
|
|
296
|
+
continue;
|
|
297
|
+
const models = [...rollup.models];
|
|
298
|
+
out.push({
|
|
299
|
+
sessionId: rollup.sessionId,
|
|
300
|
+
sessionName: null,
|
|
301
|
+
repoName: context.repoResolver.resolve(rollup.cwd),
|
|
302
|
+
startTime: rollup.startTime,
|
|
303
|
+
endTime: rollup.endTime,
|
|
304
|
+
durationMs: Math.max(0, rollup.endTime - rollup.startTime),
|
|
305
|
+
toolCallCount: rollup.toolCallCount,
|
|
306
|
+
toolBreakdown: { ...rollup.toolBreakdown },
|
|
307
|
+
developer: context.developer,
|
|
308
|
+
model: models.length === 1 ? models[0] : null,
|
|
309
|
+
filesRead: [...rollup.filesRead],
|
|
310
|
+
filesModified: [...rollup.filesModified],
|
|
311
|
+
timeline: rollup.timeline.length > 0 ? [...rollup.timeline] : undefined,
|
|
312
|
+
// These three fields are what let the dashboard rebuild its
|
|
313
|
+
// Model Usage / Quality / Tool Selection panels after a restart: the
|
|
314
|
+
// API combines them across today's persisted sessions. Without them a
|
|
315
|
+
// restarted process shows empty panels despite having the history.
|
|
316
|
+
modelBreakdown: modelBreakdownOf(rollup),
|
|
317
|
+
qualityProxy: rollup.quality.getRawCounts(),
|
|
318
|
+
toolSelectionMetrics: rollup.records.length > 0
|
|
319
|
+
? toToolSelectionSummary(context.toolSelectionScorer.scoreSession(rollup.records))
|
|
320
|
+
: null,
|
|
321
|
+
linesAdded: 0,
|
|
322
|
+
linesRemoved: 0,
|
|
323
|
+
bashCommandCount: 0,
|
|
324
|
+
testRunCount: 0,
|
|
325
|
+
testPassCount: 0,
|
|
326
|
+
buildRunCount: 0,
|
|
327
|
+
buildPassCount: 0,
|
|
328
|
+
estimatedCostUsd: rollup.costUsd > 0 ? rollup.costUsd : null,
|
|
329
|
+
subagentCostUsd: 0,
|
|
330
|
+
tokensInput: rollup.tokensInput,
|
|
331
|
+
tokensOutput: rollup.tokensOutput,
|
|
332
|
+
tokensThinking: 0,
|
|
333
|
+
tokensCacheRead: rollup.tokensCacheRead,
|
|
334
|
+
tokensCacheCreation: rollup.tokensCacheCreation,
|
|
335
|
+
cacheSavingsUsd: 0,
|
|
336
|
+
efficiencyScore: null,
|
|
337
|
+
antiPatterns: [],
|
|
338
|
+
taskCount: 0,
|
|
339
|
+
taskSuccessRate: null,
|
|
340
|
+
toolSuccessRate: rollup.toolCallCount > 0 ? rollup.successCount / rollup.toolCallCount : null,
|
|
341
|
+
contextCompressions: 0,
|
|
342
|
+
agentSpawns: 0,
|
|
343
|
+
userMessages: 0,
|
|
344
|
+
assistantMessages: 0,
|
|
345
|
+
userCorrections: 0,
|
|
346
|
+
outcome: context.outcome,
|
|
347
|
+
platform: context.platform ?? null,
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
return out;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Build a browsable GitHub commit URL from a git remote. Handles both SSH
|
|
355
|
+
* (`git@github.com:owner/repo.git`) and HTTPS remotes, and returns null for
|
|
356
|
+
* hosts we can't confidently map so the UI degrades to plain text rather than
|
|
357
|
+
* rendering a broken link.
|
|
358
|
+
*/
|
|
359
|
+
export function commitUrlFromRemote(remote, hash) {
|
|
360
|
+
if (!remote || !hash)
|
|
361
|
+
return null;
|
|
362
|
+
const trimmed = remote.trim().replace(/\.git$/, '');
|
|
363
|
+
const ssh = /^(?:ssh:\/\/)?[^@]+@([^:/]+)[:/](.+)$/.exec(trimmed);
|
|
364
|
+
const https = /^https?:\/\/(?:[^@/]+@)?([^/]+)\/(.+)$/.exec(trimmed);
|
|
365
|
+
const match = ssh ?? https;
|
|
366
|
+
if (!match)
|
|
367
|
+
return null;
|
|
368
|
+
const [, host, path] = match;
|
|
369
|
+
if (!host || !path)
|
|
370
|
+
return null;
|
|
371
|
+
return `https://${host}/${path}/commit/${hash}`;
|
|
372
|
+
}
|
|
373
|
+
function gitOut(root, args) {
|
|
374
|
+
try {
|
|
375
|
+
const result = spawnSync('git', ['-C', root, ...args], GIT_OPTS);
|
|
376
|
+
if (result.status !== 0 || typeof result.stdout !== 'string')
|
|
377
|
+
return null;
|
|
378
|
+
const out = result.stdout.trim();
|
|
379
|
+
return out.length > 0 ? out : null;
|
|
380
|
+
}
|
|
381
|
+
catch {
|
|
382
|
+
return null;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
export function collectCommitsAcrossRepos(repoRoots, since, authorEmail) {
|
|
386
|
+
const seen = new Set();
|
|
387
|
+
const commits = [];
|
|
388
|
+
for (const root of repoRoots) {
|
|
389
|
+
// %x1f (unit separator) can't appear in a hash, epoch, or subject, so it is
|
|
390
|
+
// a safe delimiter where a space would break on multi-word subjects.
|
|
391
|
+
const args = ['log', `--since=${since}T00:00:00`, '--format=%H%x1f%ct%x1f%s'];
|
|
392
|
+
if (authorEmail)
|
|
393
|
+
args.push(`--author=${authorEmail}`);
|
|
394
|
+
const stdout = gitOut(root, args);
|
|
395
|
+
if (stdout === null)
|
|
396
|
+
continue;
|
|
397
|
+
const remote = gitOut(root, ['remote', 'get-url', 'origin']);
|
|
398
|
+
const repo = repoNameFromRemote(remote);
|
|
399
|
+
for (const line of stdout.split('\n')) {
|
|
400
|
+
if (!line)
|
|
401
|
+
continue;
|
|
402
|
+
const [hash, epochStr, subject] = line.split('\x1f');
|
|
403
|
+
if (!hash || seen.has(hash))
|
|
404
|
+
continue;
|
|
405
|
+
seen.add(hash);
|
|
406
|
+
commits.push({
|
|
407
|
+
hash,
|
|
408
|
+
timestamp: parseInt(epochStr ?? '0', 10) * 1000,
|
|
409
|
+
repo,
|
|
410
|
+
subject: subject ?? null,
|
|
411
|
+
url: commitUrlFromRemote(remote, hash),
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
return commits;
|
|
416
|
+
}
|
|
417
|
+
/** Current git identity, used to keep other contributors' commits out of the count. */
|
|
418
|
+
export function resolveAuthorEmail(dir) {
|
|
419
|
+
try {
|
|
420
|
+
const result = spawnSync('git', ['-C', dir, 'config', 'user.email'], GIT_OPTS);
|
|
421
|
+
if (result.status === 0 && typeof result.stdout === 'string') {
|
|
422
|
+
const email = result.stdout.trim();
|
|
423
|
+
return email.length > 0 ? email : null;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
catch {
|
|
427
|
+
/* no git identity */
|
|
428
|
+
}
|
|
429
|
+
return null;
|
|
430
|
+
}
|
|
431
|
+
/** Shape the per-model tallies the way `combineBreakdowns()` expects them. */
|
|
432
|
+
function modelBreakdownOf(rollup) {
|
|
433
|
+
const out = {};
|
|
434
|
+
for (const [model, e] of rollup.modelBreakdown) {
|
|
435
|
+
out[model] = {
|
|
436
|
+
requestCount: e.requestCount,
|
|
437
|
+
totalInputTokens: e.input,
|
|
438
|
+
totalOutputTokens: e.output,
|
|
439
|
+
totalCostUsd: e.cost,
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
return out;
|
|
443
|
+
}
|
|
444
|
+
//# sourceMappingURL=local-session-aggregator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-session-aggregator.js","sourceRoot":"","sources":["../../src/metrics/local-session-aggregator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,SAAS,EAAE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,CAAC,CAAC,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;QAC/C,GAAG,CAAC,KAAK,CAAC,GAAG;YACX,YAAY,EAAE,CAAC,CAAC,YAAY;YAC5B,gBAAgB,EAAE,CAAC,CAAC,KAAK;YACzB,iBAAiB,EAAE,CAAC,CAAC,MAAM;YAC3B,YAAY,EAAE,CAAC,CAAC,IAAI;SACrB,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -26,7 +26,7 @@ export interface CopilotUsageRecord {
|
|
|
26
26
|
export declare function parseCopilotUsageResponse(raw: unknown): CopilotUsageRecord[];
|
|
27
27
|
export declare class CopilotAdapter implements PlatformAdapter {
|
|
28
28
|
readonly platformName = "copilot";
|
|
29
|
-
readonly visibilityLevel: "
|
|
29
|
+
readonly visibilityLevel: "full-hooks";
|
|
30
30
|
readonly capabilities: {
|
|
31
31
|
instructionFilePaths: readonly [];
|
|
32
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot-adapter.d.ts","sourceRoot":"","sources":["../../src/platforms/copilot-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EACX,WAAW,GAAG,WAAW,GAAG,aAAa,GAAG,aAAa,GAAG,kBAAkB,GAAG,MAAM,CAAC;IAC1F,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,KAAK,CA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