@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
|
@@ -21,6 +21,40 @@ const COPILOT_EVENT_TYPE_MAP = {
|
|
|
21
21
|
terminal_command: 'Bash',
|
|
22
22
|
task: 'Bash',
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Maps VS Code Copilot tool names (carried in hook `tool_name`) to the
|
|
26
|
+
* normalized Claude Code tool vocabulary. VS Code agent hooks send VS Code's
|
|
27
|
+
* own tool names, not Claude Code's — documented in the hooks FAQ
|
|
28
|
+
* (https://code.visualstudio.com/docs/copilot/customization/hooks, "Tool
|
|
29
|
+
* names: ... VS Code uses tool names like `create_file` and
|
|
30
|
+
* `replace_string_in_file`"). The full name inventory is the `ToolName` enum
|
|
31
|
+
* in microsoft/vscode `extensions/copilot/src/extension/tools/common/toolNames.ts`.
|
|
32
|
+
* `editFiles` appears in the hooks reference example payloads
|
|
33
|
+
* (https://code.visualstudio.com/docs/agents/reference/hooks-reference).
|
|
34
|
+
* This map is VS Code-specific — the GitHub Copilot CLI/SDK runtime is a
|
|
35
|
+
* separate adapter (copilot-sdk) with its own tool-name vocabulary. Names
|
|
36
|
+
* without a clear canonical correspondence (semantic_search, get_errors,
|
|
37
|
+
* ...) are deliberately left unmapped so the original name is preserved
|
|
38
|
+
* downstream.
|
|
39
|
+
*/
|
|
40
|
+
const COPILOT_TOOL_MAP = {
|
|
41
|
+
read_file: 'Read',
|
|
42
|
+
create_file: 'Write',
|
|
43
|
+
replace_string_in_file: 'Edit',
|
|
44
|
+
multi_replace_string_in_file: 'Edit',
|
|
45
|
+
insert_edit_into_file: 'Edit',
|
|
46
|
+
apply_patch: 'Edit',
|
|
47
|
+
edit_files: 'Edit',
|
|
48
|
+
editFiles: 'Edit',
|
|
49
|
+
run_in_terminal: 'Bash',
|
|
50
|
+
grep_search: 'Grep',
|
|
51
|
+
file_search: 'Glob',
|
|
52
|
+
list_dir: 'Glob',
|
|
53
|
+
runSubagent: 'Agent',
|
|
54
|
+
search_subagent: 'Agent',
|
|
55
|
+
explore_subagent: 'Agent',
|
|
56
|
+
execution_subagent: 'Agent',
|
|
57
|
+
};
|
|
24
58
|
export function parseCopilotUsageResponse(raw) {
|
|
25
59
|
if (!Array.isArray(raw))
|
|
26
60
|
return [];
|
|
@@ -28,11 +62,15 @@ export function parseCopilotUsageResponse(raw) {
|
|
|
28
62
|
}
|
|
29
63
|
export class CopilotAdapter {
|
|
30
64
|
platformName = 'copilot';
|
|
31
|
-
|
|
65
|
+
// Full-hooks since VS Code agent hooks (PreToolUse/PostToolUse et al.,
|
|
66
|
+
// https://code.visualstudio.com/docs/copilot/customization/hooks) fire on
|
|
67
|
+
// every built-in tool call and are parsed by collector-script.ts's uniform
|
|
68
|
+
// branch. The HTTP-push extension path below remains as a legacy fallback.
|
|
69
|
+
visibilityLevel = 'full-hooks';
|
|
32
70
|
capabilities = { instructionFilePaths: [] };
|
|
33
71
|
async initialize(_config) {
|
|
34
|
-
//
|
|
35
|
-
//
|
|
72
|
+
// Tool calls arrive via VS Code agent hooks (collector script), or
|
|
73
|
+
// legacy HTTP push from a Copilot-compatible extension.
|
|
36
74
|
}
|
|
37
75
|
normalizeToolCall(raw) {
|
|
38
76
|
const event = isCopilotToolCallEvent(raw) ? raw : undefined;
|
|
@@ -58,7 +96,7 @@ export class CopilotAdapter {
|
|
|
58
96
|
};
|
|
59
97
|
}
|
|
60
98
|
mapToolName(platformToolName) {
|
|
61
|
-
return COPILOT_EVENT_TYPE_MAP[platformToolName] ?? 'Unknown';
|
|
99
|
+
return (COPILOT_TOOL_MAP[platformToolName] ?? COPILOT_EVENT_TYPE_MAP[platformToolName] ?? 'Unknown');
|
|
62
100
|
}
|
|
63
101
|
getSessionMetadata() {
|
|
64
102
|
return {
|
|
@@ -71,12 +109,28 @@ export class CopilotAdapter {
|
|
|
71
109
|
}
|
|
72
110
|
getHookInstallInstructions() {
|
|
73
111
|
return [
|
|
74
|
-
'GitHub Copilot Observability Setup:',
|
|
75
|
-
'1.
|
|
76
|
-
'
|
|
77
|
-
'
|
|
78
|
-
'
|
|
79
|
-
'
|
|
112
|
+
'GitHub Copilot Observability Setup (VS Code agent hooks):',
|
|
113
|
+
'1. Create a hooks file — user-level ~/.copilot/hooks/preflight.json (applies to',
|
|
114
|
+
' all workspaces) or workspace-level .github/hooks/preflight.json:',
|
|
115
|
+
' {',
|
|
116
|
+
' "version": 1,',
|
|
117
|
+
' "hooks": {',
|
|
118
|
+
' "PreToolUse": [{ "type": "command", "command": "preflight-collector pre-tool" }],',
|
|
119
|
+
' "PostToolUse": [{ "type": "command", "command": "preflight-collector post-tool" }]',
|
|
120
|
+
' }',
|
|
121
|
+
' }',
|
|
122
|
+
' (VS Code also reads Claude-format hooks from ~/.claude/settings.json by',
|
|
123
|
+
' default — if preflight hooks are installed there for Claude Code, either',
|
|
124
|
+
' rely on those or disable that location via chat.hookFilesLocations to',
|
|
125
|
+
' avoid double capture.)',
|
|
126
|
+
'2. Ensure preflight-collector is on PATH (npm install -g @newrelic/preflight).',
|
|
127
|
+
'3. Register the Preflight MCP server for nr_observe_* tools with env',
|
|
128
|
+
' MCP_CLIENT=copilot, NEW_RELIC_LICENSE_KEY, NEW_RELIC_ACCOUNT_ID.',
|
|
129
|
+
'4. For the GitHub Copilot CLI/SDK runtime instead of VS Code, use the',
|
|
130
|
+
" copilot-sdk adapter's own setup — Copilot CLI's native lowerCamelCase",
|
|
131
|
+
' hooks are not compatible with this adapter.',
|
|
132
|
+
'Legacy fallback: a Copilot-compatible extension may instead push events to',
|
|
133
|
+
'http://localhost:9847 ("preflight.endpoint" in VS Code settings).',
|
|
80
134
|
].join('\n');
|
|
81
135
|
}
|
|
82
136
|
isSupported() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot-adapter.js","sourceRoot":"","sources":["../../src/platforms/copilot-adapter.ts"],"names":[],"mappings":"AAyBA,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAS;IAC1C,WAAW;IACX,WAAW;IACX,aAAa;IACb,aAAa;IACb,kBAAkB;IAClB,MAAM;CACP,CAAC,CAAC;AAEH,SAAS,sBAAsB,CAAC,CAAU;IACxC,OAAO,CACL,OAAO,CAAC,KAAK,QAAQ;QACrB,CAAC,KAAK,IAAI;QACV,MAAM,IAAI,CAAC;QACX,OAAQ,CAAuB,CAAC,IAAI,KAAK,QAAQ;QACjD,mBAAmB,CAAC,GAAG,CAAE,CAAsB,CAAC,IAAI,CAAC,CACtD,CAAC;AACJ,CAAC;AAED,MAAM,sBAAsB,GAA2B;IACrD,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,OAAO;IACpB,WAAW,EAAE,QAAQ;IACrB,gBAAgB,EAAE,MAAM;IACxB,IAAI,EAAE,MAAM;CACb,CAAC;AAWF,MAAM,UAAU,yBAAyB,CAAC,GAAY;IACpD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,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;gBAC3C,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB;aACxD,CAAC;SACH,CAAC;IACJ,CAAC;IAED,0BAA0B;QACxB,OAAO;YACL,2DAA2D;YAC3D,iFAAiF;YACjF,qEAAqE;YACrE,MAAM;YACN,oBAAoB;YACpB,iBAAiB;YACjB,0FAA0F;YAC1F,2FAA2F;YAC3F,QAAQ;YACR,MAAM;YACN,4EAA4E;YAC5E,6EAA6E;YAC7E,0EAA0E;YAC1E,2BAA2B;YAC3B,gFAAgF;YAChF,sEAAsE;YACtE,qEAAqE;YACrE,uEAAuE;YACvE,0EAA0E;YAC1E,gDAAgD;YAChD,4EAA4E;YAC5E,mEAAmE;SACpE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IAED,WAAW;QACT,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,KAAK,SAAS,CAAC;IACjG,CAAC;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { NormalizedToolCall, PlatformAdapter, PlatformConfig, PlatformSessionMetadata } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Adapter for the GitHub Copilot SDK / agent-host runtime — distinct from the
|
|
4
|
+
* VS Code Copilot Chat adapter (`CopilotAdapter`): different session-id space
|
|
5
|
+
* (no `workspaceStorage`; sessions live in `~/.copilot/session-state/<id>/`),
|
|
6
|
+
* and different tool-name vocabulary (`bash`/`edit`/`grep` rather than VS
|
|
7
|
+
* Code's `run_in_terminal`/`replace_string_in_file`). The Copilot CLI is the
|
|
8
|
+
* confirmed host of this runtime; the same SDK extension mechanism plausibly
|
|
9
|
+
* hosts elsewhere (e.g. the desktop app), untested.
|
|
10
|
+
*/
|
|
11
|
+
export declare class CopilotSdkAdapter implements PlatformAdapter {
|
|
12
|
+
readonly platformName = "copilot-sdk";
|
|
13
|
+
readonly visibilityLevel: "full-hooks";
|
|
14
|
+
readonly capabilities: {
|
|
15
|
+
instructionFilePaths: readonly ["AGENTS.md", "CLAUDE.md", "GEMINI.md", ".github/copilot-instructions.md"];
|
|
16
|
+
};
|
|
17
|
+
initialize(_config: PlatformConfig): Promise<void>;
|
|
18
|
+
normalizeToolCall(raw: unknown): NormalizedToolCall;
|
|
19
|
+
mapToolName(platformToolName: string): string;
|
|
20
|
+
getSessionMetadata(): PlatformSessionMetadata;
|
|
21
|
+
getHookInstallInstructions(): string;
|
|
22
|
+
isSupported(): boolean;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=copilot-sdk-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-sdk-adapter.d.ts","sourceRoot":"","sources":["../../src/platforms/copilot-sdk-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAkFpB;;;;;;;;GAQG;AACH,qBAAa,iBAAkB,YAAW,eAAe;IACvD,QAAQ,CAAC,YAAY,iBAAiB;IAWtC,QAAQ,CAAC,eAAe,EAAG,YAAY,CAAU;IAYjD,QAAQ,CAAC,YAAY;;MAOnB;IAEI,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAKxD,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,kBAAkB;IAsBnD,WAAW,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM;IAI7C,kBAAkB,IAAI,uBAAuB;IAM7C,0BAA0B,IAAI,MAAM;IAgCpC,WAAW,IAAI,OAAO;CAMvB"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps the Copilot agent-host's built-in tool names to Preflight's canonical
|
|
3
|
+
* (Claude-Code-shaped) vocabulary. Source: GitHub's own Copilot hooks
|
|
4
|
+
* reference, "Claude-format matchers (PascalCase PreToolUse)" section
|
|
5
|
+
* (docs.github.com/en/copilot/reference/copilot-cli-reference/cli-hooks-reference#pretooluse--pretooluse),
|
|
6
|
+
* which documents this exact runtime-tool → Claude-tool-name table.
|
|
7
|
+
*
|
|
8
|
+
* Under the PascalCase `PreToolUse`/`PostToolUse` hook config this adapter's
|
|
9
|
+
* setup instructions require (see getHookInstallInstructions() below), the
|
|
10
|
+
* CLI has ALREADY canonicalized `tool_name` to these Claude-shaped values
|
|
11
|
+
* before Preflight ever sees them (confirmed in the same reference: "Payloads
|
|
12
|
+
* for PascalCase PreToolUse report tool_name as the Claude tool name, for
|
|
13
|
+
* example Bash, not bash"). The canonical-name entries below are therefore
|
|
14
|
+
* the ones that actually get looked up in practice; the lowercase
|
|
15
|
+
* runtime-name entries are kept only as a defensive fallback in case some
|
|
16
|
+
* other Copilot SDK host ever delivers un-canonicalized names.
|
|
17
|
+
*
|
|
18
|
+
* Deliberately unmapped (no Claude equivalent per the same reference table,
|
|
19
|
+
* preserved as the original name downstream): the shell session-management
|
|
20
|
+
* variants (list_bash/read_bash/stop_bash/write_bash and their powershell
|
|
21
|
+
* equivalents — these manage a *background* shell session rather than
|
|
22
|
+
* running a command, unlike bash/powershell itself), list_agents,
|
|
23
|
+
* read_agent, write_agent, skill. This mirrors the VS Code CopilotAdapter's
|
|
24
|
+
* COPILOT_TOOL_MAP precedent of leaving introspection tools unmapped rather
|
|
25
|
+
* than guessing.
|
|
26
|
+
*/
|
|
27
|
+
const COPILOT_SDK_TOOL_MAP = {
|
|
28
|
+
// Canonical Claude-shaped names, as actually delivered by PascalCase
|
|
29
|
+
// PreToolUse/PostToolUse (identity — see the module doc above).
|
|
30
|
+
Bash: 'Bash',
|
|
31
|
+
Read: 'Read',
|
|
32
|
+
Write: 'Write',
|
|
33
|
+
Edit: 'Edit',
|
|
34
|
+
Grep: 'Grep',
|
|
35
|
+
Glob: 'Glob',
|
|
36
|
+
Agent: 'Agent',
|
|
37
|
+
Task: 'Agent', // GitHub's docs note the literal 'Task' is also accepted.
|
|
38
|
+
WebFetch: 'WebFetch',
|
|
39
|
+
WebSearch: 'WebSearch',
|
|
40
|
+
AskUserQuestion: 'AskUserQuestion',
|
|
41
|
+
TodoWrite: 'TodoWrite',
|
|
42
|
+
// Raw runtime names — defensive fallback only; not expected to be looked
|
|
43
|
+
// up under the documented PascalCase config, which already canonicalizes
|
|
44
|
+
// tool_name before this adapter sees it.
|
|
45
|
+
bash: 'Bash',
|
|
46
|
+
powershell: 'Bash',
|
|
47
|
+
apply_patch: 'Edit',
|
|
48
|
+
create: 'Write',
|
|
49
|
+
edit: 'Edit',
|
|
50
|
+
str_replace_editor: 'Edit',
|
|
51
|
+
view: 'Read',
|
|
52
|
+
task: 'Agent',
|
|
53
|
+
glob: 'Glob',
|
|
54
|
+
grep: 'Grep',
|
|
55
|
+
rg: 'Grep',
|
|
56
|
+
web_fetch: 'WebFetch',
|
|
57
|
+
web_search: 'WebSearch',
|
|
58
|
+
ask_user: 'AskUserQuestion',
|
|
59
|
+
update_todo: 'TodoWrite',
|
|
60
|
+
};
|
|
61
|
+
function isCopilotSdkToolCallEvent(x) {
|
|
62
|
+
return typeof x === 'object' && x !== null;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Adapter for the GitHub Copilot SDK / agent-host runtime — distinct from the
|
|
66
|
+
* VS Code Copilot Chat adapter (`CopilotAdapter`): different session-id space
|
|
67
|
+
* (no `workspaceStorage`; sessions live in `~/.copilot/session-state/<id>/`),
|
|
68
|
+
* and different tool-name vocabulary (`bash`/`edit`/`grep` rather than VS
|
|
69
|
+
* Code's `run_in_terminal`/`replace_string_in_file`). The Copilot CLI is the
|
|
70
|
+
* confirmed host of this runtime; the same SDK extension mechanism plausibly
|
|
71
|
+
* hosts elsewhere (e.g. the desktop app), untested.
|
|
72
|
+
*/
|
|
73
|
+
export class CopilotSdkAdapter {
|
|
74
|
+
platformName = 'copilot-sdk';
|
|
75
|
+
// The agent host's hooks fire on every built-in tool call via the same
|
|
76
|
+
// uniform hook envelope collector-script.ts already parses — but only
|
|
77
|
+
// when configured with the PascalCase event names PreToolUse/PostToolUse
|
|
78
|
+
// (see getHookInstallInstructions() below), which deliver the
|
|
79
|
+
// VS-Code-compatible snake_case payload (hook_event_name/tool_name/...)
|
|
80
|
+
// collector-script.ts's uniform branch expects. GitHub's native
|
|
81
|
+
// lowerCamelCase config (preToolUse) is NOT supported here: it emits an
|
|
82
|
+
// incompatible payload shape (sessionId/toolName, no hook_event_name field
|
|
83
|
+
// at all) that the collector's uniform branch can't parse. See
|
|
84
|
+
// docs/ADAPTERS.md's Copilot SDK section.
|
|
85
|
+
visibilityLevel = 'full-hooks';
|
|
86
|
+
// Repo-relative instruction files the host itself reads (Git root and cwd),
|
|
87
|
+
// per GitHub's own "Add custom instructions" guide for Copilot CLI
|
|
88
|
+
// (docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/add-custom-instructions#custom-instructions-locations),
|
|
89
|
+
// which also lists `CLAUDE.md` and `GEMINI.md` alongside `AGENTS.md` and
|
|
90
|
+
// `.github/copilot-instructions.md`. The same table lists a user-level
|
|
91
|
+
// `$HOME/.copilot/copilot-instructions.md` and a glob-based
|
|
92
|
+
// `.github/instructions/**/*.instructions.md` — neither fits here: every
|
|
93
|
+
// existing adapter's instructionFilePaths entry is a repo-relative exact
|
|
94
|
+
// filename matched against a tool call's filePath (see
|
|
95
|
+
// ClaudeMdTracker.matchesInstructionFile), which supports neither a
|
|
96
|
+
// per-user global path nor a glob pattern.
|
|
97
|
+
capabilities = {
|
|
98
|
+
instructionFilePaths: [
|
|
99
|
+
'AGENTS.md',
|
|
100
|
+
'CLAUDE.md',
|
|
101
|
+
'GEMINI.md',
|
|
102
|
+
'.github/copilot-instructions.md',
|
|
103
|
+
],
|
|
104
|
+
};
|
|
105
|
+
async initialize(_config) {
|
|
106
|
+
// Tool calls arrive via the Copilot agent host's hooks (collector
|
|
107
|
+
// script), parsed by collector-script.ts's uniform branch.
|
|
108
|
+
}
|
|
109
|
+
normalizeToolCall(raw) {
|
|
110
|
+
const event = isCopilotSdkToolCallEvent(raw) ? raw : {};
|
|
111
|
+
const platformToolName = event.tool ?? event.toolName ?? 'unknown';
|
|
112
|
+
const toolName = COPILOT_SDK_TOOL_MAP[platformToolName] ?? 'Unknown';
|
|
113
|
+
const filePath = event.filePath ?? event.path;
|
|
114
|
+
return {
|
|
115
|
+
toolName,
|
|
116
|
+
platformToolName,
|
|
117
|
+
platform: this.platformName,
|
|
118
|
+
timestamp: event.timestamp ?? Date.now(),
|
|
119
|
+
durationMs: event.durationMs ?? null,
|
|
120
|
+
success: event.success ?? true,
|
|
121
|
+
...(event.error !== undefined && { error: event.error }),
|
|
122
|
+
...(event.inputSizeBytes !== undefined && { inputSizeBytes: event.inputSizeBytes }),
|
|
123
|
+
...(event.outputSizeBytes !== undefined && { outputSizeBytes: event.outputSizeBytes }),
|
|
124
|
+
...(filePath !== undefined && { filePath }),
|
|
125
|
+
...(event.command !== undefined && { command: event.command }),
|
|
126
|
+
...(event.sessionId !== undefined && { sessionId: event.sessionId }),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
mapToolName(platformToolName) {
|
|
130
|
+
return COPILOT_SDK_TOOL_MAP[platformToolName] ?? 'Unknown';
|
|
131
|
+
}
|
|
132
|
+
getSessionMetadata() {
|
|
133
|
+
return {
|
|
134
|
+
platform: this.platformName,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
getHookInstallInstructions() {
|
|
138
|
+
return [
|
|
139
|
+
'GitHub Copilot (SDK / agent-host, e.g. the Copilot CLI) Setup:',
|
|
140
|
+
'1. Create a hooks file to enable tool-call capture — user-level',
|
|
141
|
+
' ~/.copilot/hooks/preflight.json (applies to all sessions) or',
|
|
142
|
+
' workspace-level .github/hooks/preflight.json:',
|
|
143
|
+
' {',
|
|
144
|
+
' "version": 1,',
|
|
145
|
+
' "hooks": {',
|
|
146
|
+
' "PreToolUse": [{ "type": "command", "command": "preflight-collector pre-tool" }],',
|
|
147
|
+
' "PostToolUse": [{ "type": "command", "command": "preflight-collector post-tool" }]',
|
|
148
|
+
' }',
|
|
149
|
+
' }',
|
|
150
|
+
'2. Ensure preflight-collector is on PATH (npm link, or npm install -g @newrelic/preflight)',
|
|
151
|
+
'3. Register the Preflight MCP server:',
|
|
152
|
+
' copilot mcp add preflight \\',
|
|
153
|
+
' --env MCP_CLIENT=copilot-sdk \\',
|
|
154
|
+
' --env NEW_RELIC_LICENSE_KEY=<your-key> \\',
|
|
155
|
+
' --env NEW_RELIC_ACCOUNT_ID=<your-account-id> \\',
|
|
156
|
+
' -- npx preflight --stdio',
|
|
157
|
+
'4. (Optional, for token-exact cost) Copy the bundled Copilot SDK extension',
|
|
158
|
+
' to pick up per-call token counts (the hooks above cover tool calls only):',
|
|
159
|
+
' mkdir -p ~/.copilot/extensions/preflight',
|
|
160
|
+
' cp <preflight-install-dir>/data/copilot-sdk-extension/extension.mjs \\',
|
|
161
|
+
' ~/.copilot/extensions/preflight/extension.mjs',
|
|
162
|
+
'5. Restart the host (extensions load at startup) with --experimental',
|
|
163
|
+
' (or run /experimental on) — extensions require the experimental',
|
|
164
|
+
' feature flag. If already open, asking Copilot to reload extensions',
|
|
165
|
+
' or running /clear may also pick up a newly-copied extension.',
|
|
166
|
+
].join('\n');
|
|
167
|
+
}
|
|
168
|
+
isSupported() {
|
|
169
|
+
return (process.env.MCP_CLIENT === 'copilot-sdk' ||
|
|
170
|
+
process.env.NEW_RELIC_AI_PLATFORM === 'copilot-sdk');
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=copilot-sdk-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-sdk-adapter.js","sourceRoot":"","sources":["../../src/platforms/copilot-sdk-adapter.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,oBAAoB,GAA2B;IACnD,qEAAqE;IACrE,gEAAgE;IAChE,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IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;YAC9D,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;SACrE,CAAC;IACJ,CAAC;IAED,WAAW,CAAC,gBAAwB;QAClC,OAAO,oBAAoB,CAAC,gBAAgB,CAAC,IAAI,SAAS,CAAC;IAC7D,CAAC;IAED,kBAAkB;QAChB,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,YAAY;SAC5B,CAAC;IACJ,CAAC;IAED,0BAA0B;QACxB,OAAO;YACL,gEAAgE;YAChE,iEAAiE;YACjE,iEAAiE;YACjE,kDAAkD;YAClD,MAAM;YACN,oBAAoB;YACpB,iBAAiB;YACjB,0FAA0F;YAC1F,2FAA2F;YAC3F,QAAQ;YACR,MAAM;YACN,4FAA4F;YAC5F,uCAAuC;YACvC,iCAAiC;YACjC,sCAAsC;YACtC,gDAAgD;YAChD,sDAAsD;YACtD,+BAA+B;YAC/B,4EAA4E;YAC5E,8EAA8E;YAC9E,6CAA6C;YAC7C,2EAA2E;YAC3E,oDAAoD;YACpD,sEAAsE;YACtE,oEAAoE;YACpE,uEAAuE;YACvE,iEAAiE;SAClE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IAED,WAAW;QACT,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,aAAa;YACxC,OAAO,CAAC,GAAG,CAAC,qBAAqB,KAAK,aAAa,CACpD,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -3,6 +3,7 @@ export { ClaudeCodeAdapter } from './claude-code-adapter.js';
|
|
|
3
3
|
export { CursorAdapter } from './cursor-adapter.js';
|
|
4
4
|
export { WindsurfAdapter } from './windsurf-adapter.js';
|
|
5
5
|
export { CopilotAdapter } from './copilot-adapter.js';
|
|
6
|
+
export { CopilotSdkAdapter } from './copilot-sdk-adapter.js';
|
|
6
7
|
export type { CopilotToolCallEvent, CopilotUsageRecord } from './copilot-adapter.js';
|
|
7
8
|
export { parseCopilotUsageResponse } from './copilot-adapter.js';
|
|
8
9
|
export { ZedAdapter } from './zed-adapter.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/platforms/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,uBAAuB,EACvB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EA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D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAC1F,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/platforms/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { ClaudeCodeAdapter } from './claude-code-adapter.js';
|
|
|
2
2
|
export { CursorAdapter } from './cursor-adapter.js';
|
|
3
3
|
export { WindsurfAdapter } from './windsurf-adapter.js';
|
|
4
4
|
export { CopilotAdapter } from './copilot-adapter.js';
|
|
5
|
+
export { CopilotSdkAdapter } from './copilot-sdk-adapter.js';
|
|
5
6
|
export { parseCopilotUsageResponse } from './copilot-adapter.js';
|
|
6
7
|
export { ZedAdapter } from './zed-adapter.js';
|
|
7
8
|
export { ContinueAdapter } from './continue-adapter.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platforms/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,C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
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-registry.d.ts","sourceRoot":"","sources":["../../src/platforms/platform-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"platform-registry.d.ts","sourceRoot":"","sources":["../../src/platforms/platform-registry.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAM3E,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyB;IAClD,OAAO,CAAC,MAAM,CAAgC;IAE9C,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAKxC,MAAM,IAAI,eAAe,GAAG,IAAI;IAahC,SAAS,IAAI,eAAe;IAY5B,aAAa,IAAI,SAAS,eAAe,EAAE;CAG5C;AAED,wBAAgB,qBAAqB,IAAI,gBAAgB,CAqBxD;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,IAAI,WAAW,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAKvF"}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { createLogger } from '../shared/index.js';
|
|
2
|
+
import { AmazonQAdapter } from './amazon-q-adapter.js';
|
|
3
|
+
import { AntigravityAdapter } from './antigravity-adapter.js';
|
|
2
4
|
import { ClaudeCodeAdapter } from './claude-code-adapter.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { CopilotAdapter } from './copilot-adapter.js';
|
|
6
|
-
import { ZedAdapter } from './zed-adapter.js';
|
|
5
|
+
import { ClineAdapter } from './cline-adapter.js';
|
|
6
|
+
import { CodexAdapter } from './codex-adapter.js';
|
|
7
7
|
import { ContinueAdapter } from './continue-adapter.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { CopilotAdapter } from './copilot-adapter.js';
|
|
9
|
+
import { CopilotSdkAdapter } from './copilot-sdk-adapter.js';
|
|
10
|
+
import { CursorAdapter } from './cursor-adapter.js';
|
|
10
11
|
import { DroidAdapter } from './droid-adapter.js';
|
|
11
12
|
import { GeminiCliAdapter } from './gemini-cli-adapter.js';
|
|
12
|
-
import {
|
|
13
|
-
import { CodexAdapter } from './codex-adapter.js';
|
|
14
|
-
import { OpencodeAdapter } from './opencode-adapter.js';
|
|
13
|
+
import { GenericMcpAdapter } from './generic-mcp-adapter.js';
|
|
15
14
|
import { KiloCodeAdapter } from './kilo-code-adapter.js';
|
|
15
|
+
import { KiroAdapter } from './kiro-adapter.js';
|
|
16
|
+
import { OpencodeAdapter } from './opencode-adapter.js';
|
|
16
17
|
import { PiAdapter } from './pi-adapter.js';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
18
|
+
import { WindsurfAdapter } from './windsurf-adapter.js';
|
|
19
|
+
import { ZedAdapter } from './zed-adapter.js';
|
|
19
20
|
const logger = createLogger('platform-registry');
|
|
20
21
|
export class PlatformRegistry {
|
|
21
22
|
adapters = [];
|
|
@@ -54,6 +55,7 @@ export function createDefaultRegistry() {
|
|
|
54
55
|
registry.register(new CursorAdapter());
|
|
55
56
|
registry.register(new WindsurfAdapter());
|
|
56
57
|
registry.register(new CopilotAdapter());
|
|
58
|
+
registry.register(new CopilotSdkAdapter());
|
|
57
59
|
registry.register(new ZedAdapter());
|
|
58
60
|
registry.register(new ContinueAdapter());
|
|
59
61
|
registry.register(new AmazonQAdapter());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-registry.js","sourceRoot":"","sources":["../../src/platforms/platform-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"platform-registry.js","sourceRoot":"","sources":["../../src/platforms/platform-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EA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portion of estimatedCostUsd attributed to subagent (ctx.agentId) calls —
|
|
65
|
-
* see CostMetrics.subagentCostUsd. 0 for
|
|
66
|
-
* cost was
|
|
65
|
+
* see CostMetrics.subagentCostUsd. 0 for an older session summary written
|
|
66
|
+
* before subagent cost was tracked, and for sessions with no subagent
|
|
67
|
+
* activity.
|
|
67
68
|
*/
|
|
68
69
|
readonly subagentCostUsd: number;
|
|
70
|
+
/**
|
|
71
|
+
* Total cost bucketed by local-day key (`YYYY-MM-DD`), mirrored from
|
|
72
|
+
* `CostMetrics.costByDayUsd`. The dashboard's "Spend Today" aggregate sums
|
|
73
|
+
* `costByDayUsd[todayKey]` across sessions — the authoritative today-figure —
|
|
74
|
+
* instead of pro-rating `estimatedCostUsd` (a lifetime cumulative total) by a
|
|
75
|
+
* tool-call timeline, which over-attributes a resumed multi-day session's
|
|
76
|
+
* whole cost to one day. Optional: absent on a session summary written
|
|
77
|
+
* before this field existed, which falls back to the timeline pro-rate
|
|
78
|
+
* path in the aggregate route.
|
|
79
|
+
*/
|
|
80
|
+
readonly costByDayUsd?: Record<string, number>;
|
|
81
|
+
/** Subagent-attributed cost by local-day key; today-scoped counterpart to
|
|
82
|
+
* `subagentCostUsd`. Optional for the same backward-compat reason as
|
|
83
|
+
* `costByDayUsd`. */
|
|
84
|
+
readonly subagentCostByDayUsd?: Record<string, number>;
|
|
69
85
|
readonly tokensInput: number;
|
|
70
86
|
readonly tokensOutput: number;
|
|
71
87
|
readonly tokensThinking: number;
|
|
@@ -82,8 +98,9 @@ export interface FullSessionSummary extends SessionSummary {
|
|
|
82
98
|
* losing every pre-restart task's contribution to it. Optional (unlike
|
|
83
99
|
* most fields on this interface) so the many existing test factories
|
|
84
100
|
* building `FullSessionSummary` literals don't all need updating for an
|
|
85
|
-
* additive field — read with `?? 0` at the point of use. 0/absent for
|
|
86
|
-
*
|
|
101
|
+
* additive field — read with `?? 0` at the point of use. 0/absent for an
|
|
102
|
+
* older session summary written before this field existed, and for
|
|
103
|
+
* sessions with no scored tasks.
|
|
87
104
|
*/
|
|
88
105
|
readonly efficiencyScoreSampleCount?: number;
|
|
89
106
|
/**
|
|
@@ -92,7 +109,8 @@ export interface FullSessionSummary extends SessionSummary {
|
|
|
92
109
|
* alongside `efficiencyScoreSampleCount` so a re-seeded average's
|
|
93
110
|
* component breakdown is exact, not just its top-level score. Optional
|
|
94
111
|
* for the same reason as `efficiencyScoreSampleCount` above. null/absent
|
|
95
|
-
* for
|
|
112
|
+
* for an older session summary written before this field existed, and
|
|
113
|
+
* for sessions with no scored tasks.
|
|
96
114
|
*/
|
|
97
115
|
readonly efficiencyScoreComponents?: EfficiencyScoreComponents | null;
|
|
98
116
|
readonly antiPatterns: PersistedAntiPattern[];
|
|
@@ -113,7 +131,8 @@ export interface FullSessionSummary extends SessionSummary {
|
|
|
113
131
|
* time from the full in-memory ToolCallRecord[] — the only point where
|
|
114
132
|
* outputSizeBytes (needed for unused-output detection) is still available;
|
|
115
133
|
* it is never persisted anywhere else, including `timeline` above. null
|
|
116
|
-
* for
|
|
134
|
+
* for an older session summary written before this field existed, and
|
|
135
|
+
* for sessions with no tool calls.
|
|
117
136
|
*/
|
|
118
137
|
readonly toolSelectionMetrics: ToolSelectionSummary | null;
|
|
119
138
|
/**
|
|
@@ -121,7 +140,8 @@ export interface FullSessionSummary extends SessionSummary {
|
|
|
121
140
|
* Captured once at save time from ModelUsageTracker.getRawBreakdown(). Raw
|
|
122
141
|
* counters only, no derived ratios — see ModelUsageTracker.combineBreakdowns
|
|
123
142
|
* for why ratios are always recomputed at read time instead of persisted.
|
|
124
|
-
* `{}` for
|
|
143
|
+
* `{}` for an older session summary written before this field existed,
|
|
144
|
+
* and for sessions with no token events.
|
|
125
145
|
*/
|
|
126
146
|
readonly modelBreakdown: Readonly<Record<string, ModelBreakdownEntry>>;
|
|
127
147
|
/**
|
|
@@ -129,7 +149,8 @@ export interface FullSessionSummary extends SessionSummary {
|
|
|
129
149
|
* day key — the exact shape `CostMetrics.costByWorkflowRunId` already
|
|
130
150
|
* produces. Captured once at save time so a resumed session's per-run
|
|
131
151
|
* spend survives a process restart (see CostTracker.seedFromPersisted()).
|
|
132
|
-
* `{}` for
|
|
152
|
+
* `{}` for an older session summary written before this field existed,
|
|
153
|
+
* and for sessions with no workflow runs.
|
|
133
154
|
*/
|
|
134
155
|
readonly costByWorkflowRunId: Record<string, Record<string, number>>;
|
|
135
156
|
/**
|
|
@@ -137,8 +158,9 @@ export interface FullSessionSummary extends SessionSummary {
|
|
|
137
158
|
* time from QualityProxyTracker.getRawCounts(). Raw counts only, no derived
|
|
138
159
|
* rates — see combineQualityProxyRawCounts for why rates are always
|
|
139
160
|
* recomputed at read time instead of persisted. All-zero
|
|
140
|
-
* (ZERO_QUALITY_PROXY_COUNTS) for
|
|
141
|
-
* with no quality signals. Nested
|
|
161
|
+
* (ZERO_QUALITY_PROXY_COUNTS) for an older session summary written before
|
|
162
|
+
* this field existed, and for sessions with no quality signals. Nested
|
|
163
|
+
* (not top-level) specifically to avoid
|
|
142
164
|
* colliding with the unrelated top-level testPassCount/testRunCount fields
|
|
143
165
|
* above (total task test runs, not quality-proxy test signals).
|
|
144
166
|
*/
|
|
@@ -153,6 +175,13 @@ export interface ListSessionsOptions {
|
|
|
153
175
|
since?: Date;
|
|
154
176
|
developer?: string;
|
|
155
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Combine two views of the same session so neither writer can lose the other's
|
|
180
|
+
* data. Counters take the max rather than the sum: the two processes observe
|
|
181
|
+
* overlapping (not disjoint) slices of one session, so summing would inflate
|
|
182
|
+
* and taking the incoming value alone would regress.
|
|
183
|
+
*/
|
|
184
|
+
export declare function mergeSummaries(existing: FullSessionSummary, incoming: FullSessionSummary): FullSessionSummary;
|
|
156
185
|
export declare class SessionStore {
|
|
157
186
|
private readonly sessionsDir;
|
|
158
187
|
constructor(options: {
|
|
@@ -161,6 +190,8 @@ export declare class SessionStore {
|
|
|
161
190
|
getSessionsDir(): string;
|
|
162
191
|
saveSession(summary: FullSessionSummary): void;
|
|
163
192
|
loadSession(sessionId: string): FullSessionSummary | null;
|
|
193
|
+
/** Like loadSession(), but also returns the file path it was loaded from — used by saveSession() to detect and clean up a stale file after a merge relocates a session to a different filename. */
|
|
194
|
+
private loadSessionWithPath;
|
|
164
195
|
listSessions(options?: ListSessionsOptions): SessionFileInfo[];
|
|
165
196
|
loadAllSessions(options?: ListSessionsOptions): FullSessionSummary[];
|
|
166
197
|
loadTodaySessions(): FullSessionSummary[];
|
|
@@ -239,6 +270,8 @@ interface SerializedFullSessionSummary {
|
|
|
239
270
|
readonly buildPassCount?: unknown;
|
|
240
271
|
readonly estimatedCostUsd?: unknown;
|
|
241
272
|
readonly subagentCostUsd?: unknown;
|
|
273
|
+
readonly costByDayUsd?: unknown;
|
|
274
|
+
readonly subagentCostByDayUsd?: unknown;
|
|
242
275
|
readonly tokensInput?: unknown;
|
|
243
276
|
readonly tokensOutput?: unknown;
|
|
244
277
|
readonly tokensThinking?: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../../src/storage/session-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../../src/storage/session-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAcH,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAClG,OAAO,K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