@newrelic/preflight 1.15.5 → 1.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/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 +23 -15
- 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 +75 -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/tool-parsers.d.ts.map +1 -1
- package/dist/hooks/tool-parsers.js +4 -0
- package/dist/hooks/tool-parsers.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/context-composition-tracker.d.ts +1 -1
- package/dist/metrics/context-composition-tracker.d.ts.map +1 -1
- package/dist/metrics/context-composition-tracker.js +15 -4
- package/dist/metrics/context-composition-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/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/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/metrics/retry-detector.d.ts +0 -1
- package/dist/metrics/retry-detector.d.ts.map +1 -1
- package/dist/metrics/retry-detector.js +24 -7
- package/dist/metrics/retry-detector.js.map +1 -1
- 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 +9 -0
- package/dist/storage/session-store.d.ts.map +1 -1
- package/dist/storage/session-store.js +213 -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,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,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAuB,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEzF,sEAAsE;AACtE,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAEpC,MAAM,QAAQ,GAAG;IACf,QAAQ,EAAE,OAAgB;IAC1B,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAiC;IACnE,uEAAuE;IACvE,2EAA2E;IAC3E,kEAAkE;IAClE,IAAI,GAAG;QACL,OAAO,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;IAC1E,CAAC;CACF,CAAC;AA6BF,mFAAmF;AACnF,MAAM,UAAU,kBAAkB,CAAC,MAAiC;IAClE,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpE,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC5B,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM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MAAM,KAAK,QAAQ,EAAE,CAAC;YAC7D,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACnC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;QACzC,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,qBAAqB;IACvB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,8EAA8E;AAC9E,SAAS,gBAAgB,CAAC,MAKzB;IACC,MAAM,GAAG,GAAwC,EAAE,CAAC;IACpD,KAAK,MAAM,CAAC,KAAK,EAAE,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"}
|
|
@@ -37,7 +37,6 @@ export declare class RetryDetector implements Resettable {
|
|
|
37
37
|
private readonly alerts;
|
|
38
38
|
private totalTokensWasted;
|
|
39
39
|
private readonly firedKeys;
|
|
40
|
-
private callCounter;
|
|
41
40
|
constructor(options?: RetryDetectorOptions);
|
|
42
41
|
recordToolCall(record: ToolCallRecord): ThrashingAlert | null;
|
|
43
42
|
getMetrics(): RetryDetectorMetrics;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry-detector.d.ts","sourceRoot":"","sources":["../../src/metrics/retry-detector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KA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CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAS;IAC7C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2C;IAEnE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAwB;IACpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;IAC/C,OAAO,CAAC,iBAAiB,CAAK;IAE9B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqB;gBAEnC,OAAO,CAAC,EAAE,oBAAoB;IAO1C,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,GAAG,IAAI;IAW7D,UAAU,IAAI,oBAAoB;IAQlC,WAAW,CAAC,UAAU,EAAE,gBAAgB,GAAG,IAAI;IAO/C,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAO/B,OAAO,CAAC,WAAW;IAiEnB,OAAO,CAAC,sBAAsB;IA+B9B,OAAO,CAAC,cAAc;IAuBtB,OAAO,CAAC,oBAAoB;CAO7B"}
|
|
@@ -71,7 +71,6 @@ export class RetryDetector {
|
|
|
71
71
|
totalTokensWasted = 0;
|
|
72
72
|
// Track which tool+window combos already fired to avoid spamming
|
|
73
73
|
firedKeys = new Set();
|
|
74
|
-
callCounter = 0;
|
|
75
74
|
constructor(options) {
|
|
76
75
|
this.minOccurrences = options?.minOccurrences ?? DEFAULT_MIN_OCCURRENCES;
|
|
77
76
|
this.windowSize = options?.windowSize ?? DEFAULT_WINDOW_SIZE;
|
|
@@ -80,7 +79,6 @@ export class RetryDetector {
|
|
|
80
79
|
}
|
|
81
80
|
recordToolCall(record) {
|
|
82
81
|
this.recentCalls.push(record);
|
|
83
|
-
this.callCounter++;
|
|
84
82
|
// Only keep the window we need
|
|
85
83
|
if (this.recentCalls.length > this.windowSize * 2) {
|
|
86
84
|
this.recentCalls.splice(0, this.recentCalls.length - this.windowSize * 2);
|
|
@@ -105,7 +103,6 @@ export class RetryDetector {
|
|
|
105
103
|
this.alerts.length = 0;
|
|
106
104
|
this.totalTokensWasted = 0;
|
|
107
105
|
this.firedKeys.clear();
|
|
108
|
-
this.callCounter = 0;
|
|
109
106
|
}
|
|
110
107
|
checkWindow() {
|
|
111
108
|
const window = this.recentCalls.slice(-this.windowSize);
|
|
@@ -127,8 +124,16 @@ export class RetryDetector {
|
|
|
127
124
|
const isSimilar = similarity >= this.similarityThreshold;
|
|
128
125
|
if (!allFailed && !isSimilar)
|
|
129
126
|
continue;
|
|
130
|
-
// Dedupe
|
|
131
|
-
|
|
127
|
+
// Dedupe on the offending group's actual call IDs — not a monotonic
|
|
128
|
+
// counter, which never repeats and so never dedupes: it re-fired for
|
|
129
|
+
// the same unchanged group on every subsequent call, however unrelated.
|
|
130
|
+
// A key built from the group's own call IDs repeats exactly when the
|
|
131
|
+
// group itself hasn't changed, and changes the moment a call ages out
|
|
132
|
+
// of the window or a genuinely new occurrence joins it.
|
|
133
|
+
const dedupeKey = `${toolName}:${calls
|
|
134
|
+
.map((c) => c.id)
|
|
135
|
+
.sort()
|
|
136
|
+
.join(',')}`;
|
|
132
137
|
if (this.firedKeys.has(dedupeKey))
|
|
133
138
|
continue;
|
|
134
139
|
this.firedKeys.add(dedupeKey);
|
|
@@ -174,8 +179,18 @@ export class RetryDetector {
|
|
|
174
179
|
// input/arguments are identical (timestamps, ids, sizes, error details) —
|
|
175
180
|
// without stripping these, every call would serialize as "different" and
|
|
176
181
|
// similarity would never detect a genuine repeated-input retry.
|
|
182
|
+
//
|
|
183
|
+
// inputHash is kept, deliberately not stripped: it's a hash of the FULL raw
|
|
184
|
+
// tool input, computed for every call regardless of tool name, unlike the
|
|
185
|
+
// narrowed per-tool fields extractInputMeta()/parseToolSpecificFields() only
|
|
186
|
+
// populate for a known subset of tools. Without it, a call to any tool
|
|
187
|
+
// outside that subset (PowerShell, WebFetch, a third-party MCP tool, ...)
|
|
188
|
+
// serializes to just `{toolName}` — identical for every call regardless of
|
|
189
|
+
// how different the real inputs were, so it always scored similarity 1.0.
|
|
190
|
+
// A genuine repeat still hashes identically, so real-retry detection is
|
|
191
|
+
// unaffected.
|
|
177
192
|
serializeInput(record) {
|
|
178
|
-
const { id: _id, sessionId: _s, timestamp: _t, durationMs: _d, success: _su, errorType: _e, error: _er, inputSizeBytes: _is, outputSizeBytes: _os,
|
|
193
|
+
const { id: _id, sessionId: _s, timestamp: _t, durationMs: _d, success: _su, errorType: _e, error: _er, inputSizeBytes: _is, outputSizeBytes: _os, toolUseId: _tu, ...rest } = record;
|
|
179
194
|
try {
|
|
180
195
|
return JSON.stringify(rest, null, 0);
|
|
181
196
|
}
|
|
@@ -183,9 +198,11 @@ export class RetryDetector {
|
|
|
183
198
|
return '';
|
|
184
199
|
}
|
|
185
200
|
}
|
|
201
|
+
// The first call in the group is necessary work, not waste — only the
|
|
202
|
+
// repeats after it represent redundant, wasted effort.
|
|
186
203
|
estimateTokensWasted(calls) {
|
|
187
204
|
let totalBytes = 0;
|
|
188
|
-
for (const call of calls) {
|
|
205
|
+
for (const call of calls.slice(1)) {
|
|
189
206
|
totalBytes += (call.inputSizeBytes ?? 0) + (call.outputSizeBytes ?? 0);
|
|
190
207
|
}
|
|
191
208
|
return Math.ceil(totalBytes / BYTES_PER_TOKEN_ESTIMATE);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry-detector.js","sourceRoot":"","sources":["../../src/metrics/retry-detector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIlD,MAAM,MAAM,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC;AA4B9C,8EAA8E;AAC9E,WAAW;AACX,8EAA8E;AAE9E,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAClC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,4BAA4B,GAAG,GAAG,CAAC;AACzC,2EAA2E;AAC3E,yEAAyE;AACzE,uEAAuE;AACvE,kEAAkE;AAClE,MA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,eAAe,EAAE,GAAG,EACpB,SAAS,EAAE,GAAG,EACd,GAAG,IAAI,EACR,GAAG,MAAM,CAAC;QACX,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACvC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED,sEAAsE;IACtE,uDAAuD;IAC/C,oBAAoB,CAAC,KAAuB;QAClD,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;YAClC,UAAU,IAAI,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,CAAC,CAAC;QACzE,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,wBAAwB,CAAC,CAAC;IAC1D,CAAC;CACF"}
|
|
@@ -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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