@netlify/axis 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +977 -0
- package/dist/adapters/base/acp-adapter.d.ts +44 -0
- package/dist/adapters/base/acp-adapter.d.ts.map +1 -0
- package/dist/adapters/base/acp-adapter.js +559 -0
- package/dist/adapters/base/acp-adapter.js.map +1 -0
- package/dist/adapters/base/agent-adapter.d.ts +132 -0
- package/dist/adapters/base/agent-adapter.d.ts.map +1 -0
- package/dist/adapters/base/agent-adapter.js +212 -0
- package/dist/adapters/base/agent-adapter.js.map +1 -0
- package/dist/adapters/claude-code.d.ts +3 -0
- package/dist/adapters/claude-code.d.ts.map +1 -0
- package/dist/adapters/claude-code.js +138 -0
- package/dist/adapters/claude-code.js.map +1 -0
- package/dist/adapters/claude-sdk.d.ts +11 -0
- package/dist/adapters/claude-sdk.d.ts.map +1 -0
- package/dist/adapters/claude-sdk.js +46 -0
- package/dist/adapters/claude-sdk.js.map +1 -0
- package/dist/adapters/codex.d.ts +3 -0
- package/dist/adapters/codex.d.ts.map +1 -0
- package/dist/adapters/codex.js +183 -0
- package/dist/adapters/codex.js.map +1 -0
- package/dist/adapters/gemini-acp.d.ts +11 -0
- package/dist/adapters/gemini-acp.d.ts.map +1 -0
- package/dist/adapters/gemini-acp.js +60 -0
- package/dist/adapters/gemini-acp.js.map +1 -0
- package/dist/adapters/gemini.d.ts +3 -0
- package/dist/adapters/gemini.d.ts.map +1 -0
- package/dist/adapters/gemini.js +222 -0
- package/dist/adapters/gemini.js.map +1 -0
- package/dist/adapters/goose.d.ts +3 -0
- package/dist/adapters/goose.d.ts.map +1 -0
- package/dist/adapters/goose.js +9 -0
- package/dist/adapters/goose.js.map +1 -0
- package/dist/adapters/registry.d.ts +7 -0
- package/dist/adapters/registry.d.ts.map +1 -0
- package/dist/adapters/registry.js +37 -0
- package/dist/adapters/registry.js.map +1 -0
- package/dist/adapters/utils/mcp.d.ts +23 -0
- package/dist/adapters/utils/mcp.d.ts.map +1 -0
- package/dist/adapters/utils/mcp.js +114 -0
- package/dist/adapters/utils/mcp.js.map +1 -0
- package/dist/adapters/utils/resolve.d.ts +20 -0
- package/dist/adapters/utils/resolve.d.ts.map +1 -0
- package/dist/adapters/utils/resolve.js +48 -0
- package/dist/adapters/utils/resolve.js.map +1 -0
- package/dist/adapters/utils/skills.d.ts +17 -0
- package/dist/adapters/utils/skills.d.ts.map +1 -0
- package/dist/adapters/utils/skills.js +52 -0
- package/dist/adapters/utils/skills.js.map +1 -0
- package/dist/adapters/utils/token-estimator.d.ts +21 -0
- package/dist/adapters/utils/token-estimator.d.ts.map +1 -0
- package/dist/adapters/utils/token-estimator.js +37 -0
- package/dist/adapters/utils/token-estimator.js.map +1 -0
- package/dist/baselines/diff.d.ts +9 -0
- package/dist/baselines/diff.d.ts.map +1 -0
- package/dist/baselines/diff.js +83 -0
- package/dist/baselines/diff.js.map +1 -0
- package/dist/baselines/index.d.ts +3 -0
- package/dist/baselines/index.d.ts.map +1 -0
- package/dist/baselines/index.js +3 -0
- package/dist/baselines/index.js.map +1 -0
- package/dist/baselines/store.d.ts +19 -0
- package/dist/baselines/store.d.ts.map +1 -0
- package/dist/baselines/store.js +104 -0
- package/dist/baselines/store.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +487 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/loader.d.ts +8 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +99 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/validator.d.ts +11 -0
- package/dist/config/validator.d.ts.map +1 -0
- package/dist/config/validator.js +203 -0
- package/dist/config/validator.js.map +1 -0
- package/dist/docs-site/_astro/cli.DDWZtG0-.css +1 -0
- package/dist/docs-site/cli/index.html +18 -0
- package/dist/docs-site/configuration/index.html +121 -0
- package/dist/docs-site/content-assets.mjs +1 -0
- package/dist/docs-site/content-modules.mjs +1 -0
- package/dist/docs-site/data-store.json +9 -0
- package/dist/docs-site/index.html +69 -0
- package/dist/docs-site/quickstart/index.html +59 -0
- package/dist/docs-site/running/index.html +87 -0
- package/dist/docs-site/scoring/index.html +135 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/report-ui/index.html +291 -0
- package/dist/report-ui/mock-data.json +298 -0
- package/dist/reports/html.d.ts +7 -0
- package/dist/reports/html.d.ts.map +1 -0
- package/dist/reports/html.js +27 -0
- package/dist/reports/html.js.map +1 -0
- package/dist/reports/reader.d.ts +21 -0
- package/dist/reports/reader.d.ts.map +1 -0
- package/dist/reports/reader.js +110 -0
- package/dist/reports/reader.js.map +1 -0
- package/dist/reports/writer.d.ts +14 -0
- package/dist/reports/writer.d.ts.map +1 -0
- package/dist/reports/writer.js +106 -0
- package/dist/reports/writer.js.map +1 -0
- package/dist/runner/lifecycle.d.ts +10 -0
- package/dist/runner/lifecycle.d.ts.map +1 -0
- package/dist/runner/lifecycle.js +58 -0
- package/dist/runner/lifecycle.js.map +1 -0
- package/dist/runner/runner.d.ts +34 -0
- package/dist/runner/runner.d.ts.map +1 -0
- package/dist/runner/runner.js +330 -0
- package/dist/runner/runner.js.map +1 -0
- package/dist/scoring/category-score.d.ts +52 -0
- package/dist/scoring/category-score.d.ts.map +1 -0
- package/dist/scoring/category-score.js +157 -0
- package/dist/scoring/category-score.js.map +1 -0
- package/dist/scoring/composite.d.ts +5 -0
- package/dist/scoring/composite.d.ts.map +1 -0
- package/dist/scoring/composite.js +24 -0
- package/dist/scoring/composite.js.map +1 -0
- package/dist/scoring/deep-eval.d.ts +25 -0
- package/dist/scoring/deep-eval.d.ts.map +1 -0
- package/dist/scoring/deep-eval.js +382 -0
- package/dist/scoring/deep-eval.js.map +1 -0
- package/dist/scoring/goal-achievement.d.ts +5 -0
- package/dist/scoring/goal-achievement.d.ts.map +1 -0
- package/dist/scoring/goal-achievement.js +241 -0
- package/dist/scoring/goal-achievement.js.map +1 -0
- package/dist/scoring/index.d.ts +22 -0
- package/dist/scoring/index.d.ts.map +1 -0
- package/dist/scoring/index.js +115 -0
- package/dist/scoring/index.js.map +1 -0
- package/dist/scoring/parse-json.d.ts +6 -0
- package/dist/scoring/parse-json.d.ts.map +1 -0
- package/dist/scoring/parse-json.js +18 -0
- package/dist/scoring/parse-json.js.map +1 -0
- package/dist/scoring/sparse-index.d.ts +15 -0
- package/dist/scoring/sparse-index.d.ts.map +1 -0
- package/dist/scoring/sparse-index.js +338 -0
- package/dist/scoring/sparse-index.js.map +1 -0
- package/dist/scoring/triage.d.ts +15 -0
- package/dist/scoring/triage.d.ts.map +1 -0
- package/dist/scoring/triage.js +204 -0
- package/dist/scoring/triage.js.map +1 -0
- package/dist/skills/resolver.d.ts +19 -0
- package/dist/skills/resolver.d.ts.map +1 -0
- package/dist/skills/resolver.js +95 -0
- package/dist/skills/resolver.js.map +1 -0
- package/dist/transcript/categorize.d.ts +24 -0
- package/dist/transcript/categorize.d.ts.map +1 -0
- package/dist/transcript/categorize.js +233 -0
- package/dist/transcript/categorize.js.map +1 -0
- package/dist/transcript/classify.d.ts +7 -0
- package/dist/transcript/classify.d.ts.map +1 -0
- package/dist/transcript/classify.js +32 -0
- package/dist/transcript/classify.js.map +1 -0
- package/dist/transcript/extract.d.ts +24 -0
- package/dist/transcript/extract.d.ts.map +1 -0
- package/dist/transcript/extract.js +266 -0
- package/dist/transcript/extract.js.map +1 -0
- package/dist/transcript/index.d.ts +3 -0
- package/dist/transcript/index.d.ts.map +1 -0
- package/dist/transcript/index.js +2 -0
- package/dist/transcript/index.js.map +1 -0
- package/dist/transcript/normalize.d.ts +15 -0
- package/dist/transcript/normalize.d.ts.map +1 -0
- package/dist/transcript/normalize.js +160 -0
- package/dist/transcript/normalize.js.map +1 -0
- package/dist/transcript/types.d.ts +92 -0
- package/dist/transcript/types.d.ts.map +1 -0
- package/dist/transcript/types.js +2 -0
- package/dist/transcript/types.js.map +1 -0
- package/dist/transcript/urls.d.ts +10 -0
- package/dist/transcript/urls.d.ts.map +1 -0
- package/dist/transcript/urls.js +31 -0
- package/dist/transcript/urls.js.map +1 -0
- package/dist/types/agent.d.ts +80 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.js +2 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/baseline.d.ts +65 -0
- package/dist/types/baseline.d.ts.map +1 -0
- package/dist/types/baseline.js +2 -0
- package/dist/types/baseline.js.map +1 -0
- package/dist/types/config.d.ts +76 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +2 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +8 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/output.d.ts +70 -0
- package/dist/types/output.d.ts.map +1 -0
- package/dist/types/output.js +15 -0
- package/dist/types/output.js.map +1 -0
- package/dist/types/report.d.ts +37 -0
- package/dist/types/report.d.ts.map +1 -0
- package/dist/types/report.js +2 -0
- package/dist/types/report.js.map +1 -0
- package/dist/types/scenario.d.ts +23 -0
- package/dist/types/scenario.d.ts.map +1 -0
- package/dist/types/scenario.js +2 -0
- package/dist/types/scenario.js.map +1 -0
- package/dist/types/scoring.d.ts +176 -0
- package/dist/types/scoring.d.ts.map +1 -0
- package/dist/types/scoring.js +2 -0
- package/dist/types/scoring.js.map +1 -0
- package/dist/ui/AnimatedTokens.d.ts +29 -0
- package/dist/ui/AnimatedTokens.d.ts.map +1 -0
- package/dist/ui/AnimatedTokens.js +53 -0
- package/dist/ui/AnimatedTokens.js.map +1 -0
- package/dist/ui/App.d.ts +6 -0
- package/dist/ui/App.d.ts.map +1 -0
- package/dist/ui/App.js +16 -0
- package/dist/ui/App.js.map +1 -0
- package/dist/ui/LiveDuration.d.ts +20 -0
- package/dist/ui/LiveDuration.d.ts.map +1 -0
- package/dist/ui/LiveDuration.js +31 -0
- package/dist/ui/LiveDuration.js.map +1 -0
- package/dist/ui/LiveStatus.d.ts +7 -0
- package/dist/ui/LiveStatus.d.ts.map +1 -0
- package/dist/ui/LiveStatus.js +52 -0
- package/dist/ui/LiveStatus.js.map +1 -0
- package/dist/ui/format.d.ts +29 -0
- package/dist/ui/format.d.ts.map +1 -0
- package/dist/ui/format.js +514 -0
- package/dist/ui/format.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TranscriptEntry } from "../types/agent.js";
|
|
2
|
+
export interface ExtractedFields {
|
|
3
|
+
text: string | null;
|
|
4
|
+
toolName: string | null;
|
|
5
|
+
toolInput: Record<string, unknown> | null;
|
|
6
|
+
toolInputSummary: string | null;
|
|
7
|
+
toolResultText: string | null;
|
|
8
|
+
errorMessage: string | null;
|
|
9
|
+
toolId: string | null;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Extract adapter-agnostic fields from a raw transcript entry.
|
|
13
|
+
* Tries known adapter content shapes in priority order, with graceful fallbacks.
|
|
14
|
+
*/
|
|
15
|
+
export declare function extractFields(entry: TranscriptEntry): ExtractedFields;
|
|
16
|
+
/**
|
|
17
|
+
* Extract tool name from content, trying adapter-specific shapes in priority order:
|
|
18
|
+
* 1. content.tool_name (Gemini)
|
|
19
|
+
* 2. content.name (Codex items, some custom adapters)
|
|
20
|
+
* 3. content.type for Codex item types (command_execution, mcp_tool_calls, etc.)
|
|
21
|
+
* 4. Nested message.content[].name (Claude Code)
|
|
22
|
+
*/
|
|
23
|
+
export declare function extractToolName(content: Record<string, unknown>): string | null;
|
|
24
|
+
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/transcript/extract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC1C,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,eAAe,CA2ErE;AAMD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CAuB/E"}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract adapter-agnostic fields from a raw transcript entry.
|
|
3
|
+
* Tries known adapter content shapes in priority order, with graceful fallbacks.
|
|
4
|
+
*/
|
|
5
|
+
export function extractFields(entry) {
|
|
6
|
+
const { content } = entry;
|
|
7
|
+
switch (entry.type) {
|
|
8
|
+
case "assistant": {
|
|
9
|
+
// Claude Code embeds tool_use blocks inside assistant messages.
|
|
10
|
+
// When present, extract tool fields alongside text.
|
|
11
|
+
const toolName = extractToolName(content);
|
|
12
|
+
if (toolName) {
|
|
13
|
+
const toolInput = extractToolInput(content);
|
|
14
|
+
return {
|
|
15
|
+
text: extractAssistantText(content),
|
|
16
|
+
toolName,
|
|
17
|
+
toolInput,
|
|
18
|
+
toolInputSummary: summarizeInput(toolInput),
|
|
19
|
+
toolResultText: null,
|
|
20
|
+
errorMessage: null,
|
|
21
|
+
toolId: extractToolId(content),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
text: extractAssistantText(content),
|
|
26
|
+
toolName: null,
|
|
27
|
+
toolInput: null,
|
|
28
|
+
toolInputSummary: null,
|
|
29
|
+
toolResultText: null,
|
|
30
|
+
errorMessage: null,
|
|
31
|
+
toolId: null,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
case "tool_use":
|
|
35
|
+
return {
|
|
36
|
+
text: null,
|
|
37
|
+
toolName: extractToolName(content),
|
|
38
|
+
toolInput: extractToolInput(content),
|
|
39
|
+
toolInputSummary: summarizeInput(extractToolInput(content)),
|
|
40
|
+
toolResultText: null,
|
|
41
|
+
errorMessage: null,
|
|
42
|
+
toolId: extractToolId(content),
|
|
43
|
+
};
|
|
44
|
+
case "tool_result":
|
|
45
|
+
return {
|
|
46
|
+
text: null,
|
|
47
|
+
toolName: extractToolName(content),
|
|
48
|
+
toolInput: null,
|
|
49
|
+
toolInputSummary: null,
|
|
50
|
+
toolResultText: extractToolResultText(content),
|
|
51
|
+
errorMessage: null,
|
|
52
|
+
toolId: extractToolId(content),
|
|
53
|
+
};
|
|
54
|
+
case "error":
|
|
55
|
+
return {
|
|
56
|
+
text: extractGenericText(content),
|
|
57
|
+
toolName: null,
|
|
58
|
+
toolInput: null,
|
|
59
|
+
toolInputSummary: null,
|
|
60
|
+
toolResultText: null,
|
|
61
|
+
errorMessage: extractErrorMessage(content),
|
|
62
|
+
toolId: null,
|
|
63
|
+
};
|
|
64
|
+
default:
|
|
65
|
+
return {
|
|
66
|
+
text: extractGenericText(content),
|
|
67
|
+
toolName: null,
|
|
68
|
+
toolInput: null,
|
|
69
|
+
toolInputSummary: null,
|
|
70
|
+
toolResultText: null,
|
|
71
|
+
errorMessage: null,
|
|
72
|
+
toolId: null,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
// Tool name extraction
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
/**
|
|
80
|
+
* Extract tool name from content, trying adapter-specific shapes in priority order:
|
|
81
|
+
* 1. content.tool_name (Gemini)
|
|
82
|
+
* 2. content.name (Codex items, some custom adapters)
|
|
83
|
+
* 3. content.type for Codex item types (command_execution, mcp_tool_calls, etc.)
|
|
84
|
+
* 4. Nested message.content[].name (Claude Code)
|
|
85
|
+
*/
|
|
86
|
+
export function extractToolName(content) {
|
|
87
|
+
// Gemini: { tool_name: "Bash" }
|
|
88
|
+
if (typeof content.tool_name === "string")
|
|
89
|
+
return content.tool_name;
|
|
90
|
+
// Codex / generic: { name: "read_file" }
|
|
91
|
+
if (typeof content.name === "string")
|
|
92
|
+
return content.name;
|
|
93
|
+
// Codex item types: { type: "command_execution", command: "..." }
|
|
94
|
+
if (typeof content.type === "string" && content.type === "command_execution") {
|
|
95
|
+
return "shell";
|
|
96
|
+
}
|
|
97
|
+
if (typeof content.type === "string" && content.type === "mcp_tool_calls") {
|
|
98
|
+
return "mcp";
|
|
99
|
+
}
|
|
100
|
+
if (typeof content.type === "string" && content.type === "web_search") {
|
|
101
|
+
return "web_search";
|
|
102
|
+
}
|
|
103
|
+
// Claude Code nested: { message: { content: [{ type: "tool_use", name: "..." }] } }
|
|
104
|
+
const nested = extractNestedBlock(content, "tool_use");
|
|
105
|
+
if (nested && typeof nested.name === "string")
|
|
106
|
+
return nested.name;
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
110
|
+
// Tool input extraction
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
function extractToolInput(content) {
|
|
113
|
+
// Gemini: { parameters: { command: "ls" } }
|
|
114
|
+
if (content.parameters && typeof content.parameters === "object") {
|
|
115
|
+
return content.parameters;
|
|
116
|
+
}
|
|
117
|
+
// Claude Code nested: { message: { content: [{ type: "tool_use", input: {...} }] } }
|
|
118
|
+
const nested = extractNestedBlock(content, "tool_use");
|
|
119
|
+
if (nested?.input && typeof nested.input === "object") {
|
|
120
|
+
return nested.input;
|
|
121
|
+
}
|
|
122
|
+
// Codex command_execution: { command: "echo hello" }
|
|
123
|
+
if (typeof content.command === "string") {
|
|
124
|
+
return { command: content.command };
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
function summarizeInput(input) {
|
|
129
|
+
if (!input)
|
|
130
|
+
return null;
|
|
131
|
+
const parts = [];
|
|
132
|
+
for (const [key, value] of Object.entries(input)) {
|
|
133
|
+
if (typeof value === "string") {
|
|
134
|
+
parts.push(`${key}: ${value.length > 100 ? value.slice(0, 100) + "..." : value}`);
|
|
135
|
+
}
|
|
136
|
+
else if (typeof value === "boolean" || typeof value === "number") {
|
|
137
|
+
parts.push(`${key}: ${value}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return parts.length > 0 ? parts.join(", ") : null;
|
|
141
|
+
}
|
|
142
|
+
// ---------------------------------------------------------------------------
|
|
143
|
+
// Tool result text extraction
|
|
144
|
+
// ---------------------------------------------------------------------------
|
|
145
|
+
function extractToolResultText(content) {
|
|
146
|
+
// Claude Code nested: { message: { content: [{ type: "tool_result", content: "..." }] } }
|
|
147
|
+
const nested = extractNestedBlock(content, "tool_result");
|
|
148
|
+
if (nested) {
|
|
149
|
+
const resultContent = nested.content;
|
|
150
|
+
if (typeof resultContent === "string")
|
|
151
|
+
return resultContent;
|
|
152
|
+
if (Array.isArray(resultContent)) {
|
|
153
|
+
const parts = [];
|
|
154
|
+
for (const item of resultContent) {
|
|
155
|
+
const r = item;
|
|
156
|
+
if (typeof r.text === "string")
|
|
157
|
+
parts.push(r.text);
|
|
158
|
+
}
|
|
159
|
+
if (parts.length > 0)
|
|
160
|
+
return parts.join(" | ");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
// Gemini / Codex: { output: "..." }
|
|
164
|
+
if (typeof content.output === "string")
|
|
165
|
+
return content.output;
|
|
166
|
+
// Generic: { content: "..." }
|
|
167
|
+
if (typeof content.content === "string")
|
|
168
|
+
return content.content;
|
|
169
|
+
// Generic: { text: "..." }
|
|
170
|
+
if (typeof content.text === "string")
|
|
171
|
+
return content.text;
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
// ---------------------------------------------------------------------------
|
|
175
|
+
// Text extraction (assistant and generic)
|
|
176
|
+
// ---------------------------------------------------------------------------
|
|
177
|
+
function extractAssistantText(content) {
|
|
178
|
+
// Claude Code nested: { message: { content: [{ type: "text", text: "..." }] } }
|
|
179
|
+
const message = content.message;
|
|
180
|
+
if (message) {
|
|
181
|
+
const blocks = message.content;
|
|
182
|
+
if (Array.isArray(blocks)) {
|
|
183
|
+
const parts = [];
|
|
184
|
+
for (const block of blocks) {
|
|
185
|
+
if (block.type === "text" && typeof block.text === "string") {
|
|
186
|
+
parts.push(block.text);
|
|
187
|
+
}
|
|
188
|
+
else if (block.type === "tool_use") {
|
|
189
|
+
parts.push(`[calls ${block.name}]`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (parts.length > 0)
|
|
193
|
+
return parts.join(" ");
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
// Gemini: { content: "assistant text" }
|
|
197
|
+
if (typeof content.content === "string")
|
|
198
|
+
return content.content;
|
|
199
|
+
// Codex / generic: { text: "..." }
|
|
200
|
+
if (typeof content.text === "string")
|
|
201
|
+
return content.text;
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
function extractGenericText(content) {
|
|
205
|
+
if (typeof content.text === "string")
|
|
206
|
+
return content.text;
|
|
207
|
+
if (typeof content.message === "string")
|
|
208
|
+
return content.message;
|
|
209
|
+
if (typeof content.content === "string")
|
|
210
|
+
return content.content;
|
|
211
|
+
if (typeof content.error === "string")
|
|
212
|
+
return content.error;
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
// ---------------------------------------------------------------------------
|
|
216
|
+
// Error message extraction
|
|
217
|
+
// ---------------------------------------------------------------------------
|
|
218
|
+
function extractErrorMessage(content) {
|
|
219
|
+
// Direct: { error: "message" }
|
|
220
|
+
if (typeof content.error === "string")
|
|
221
|
+
return content.error;
|
|
222
|
+
// Gemini error events: { message: "..." }
|
|
223
|
+
if (typeof content.message === "string")
|
|
224
|
+
return content.message;
|
|
225
|
+
// Gemini result error: { error: { message: "..." } }
|
|
226
|
+
const errObj = content.error;
|
|
227
|
+
if (errObj && typeof errObj.message === "string")
|
|
228
|
+
return errObj.message;
|
|
229
|
+
// Text fallback
|
|
230
|
+
if (typeof content.text === "string")
|
|
231
|
+
return content.text;
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
// ---------------------------------------------------------------------------
|
|
235
|
+
// Tool ID extraction
|
|
236
|
+
// ---------------------------------------------------------------------------
|
|
237
|
+
function extractToolId(content) {
|
|
238
|
+
// Gemini: { tool_id: "bash-123" }
|
|
239
|
+
if (typeof content.tool_id === "string")
|
|
240
|
+
return content.tool_id;
|
|
241
|
+
// Generic: { id: "..." }
|
|
242
|
+
if (typeof content.id === "string")
|
|
243
|
+
return content.id;
|
|
244
|
+
// Claude nested: tool_use_id on tool_result blocks
|
|
245
|
+
const nested = extractNestedBlock(content, "tool_result");
|
|
246
|
+
if (nested && typeof nested.tool_use_id === "string")
|
|
247
|
+
return nested.tool_use_id;
|
|
248
|
+
const nestedUse = extractNestedBlock(content, "tool_use");
|
|
249
|
+
if (nestedUse && typeof nestedUse.id === "string")
|
|
250
|
+
return nestedUse.id;
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
// ---------------------------------------------------------------------------
|
|
254
|
+
// Helpers
|
|
255
|
+
// ---------------------------------------------------------------------------
|
|
256
|
+
/** Extract the first block of a given type from Claude's nested message.content[] structure. */
|
|
257
|
+
function extractNestedBlock(content, blockType) {
|
|
258
|
+
const message = content.message;
|
|
259
|
+
if (!message)
|
|
260
|
+
return null;
|
|
261
|
+
const blocks = message.content;
|
|
262
|
+
if (!Array.isArray(blocks))
|
|
263
|
+
return null;
|
|
264
|
+
return blocks.find((b) => b.type === blockType) ?? null;
|
|
265
|
+
}
|
|
266
|
+
//# sourceMappingURL=extract.js.map
|
|
@@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C1D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transcript/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,aAAa,EACb,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transcript/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TranscriptEntry } from "../types/agent.js";
|
|
2
|
+
import type { NormalizedTranscript, TranscriptAnalysis } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Normalize a raw transcript into adapter-agnostic entries.
|
|
5
|
+
* Purely deterministic — no LLM calls, no side effects.
|
|
6
|
+
* Designed to be called once after adapter.run() returns and before scoring.
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizeTranscript(transcript: TranscriptEntry[]): NormalizedTranscript;
|
|
9
|
+
/**
|
|
10
|
+
* Convert a NormalizedTranscript to the serializable TranscriptAnalysis format.
|
|
11
|
+
* Strips the `raw` back-reference and `index` from each entry so the result
|
|
12
|
+
* can be safely JSON-serialized alongside the original transcript.
|
|
13
|
+
*/
|
|
14
|
+
export declare function toTranscriptAnalysis(normalized: NormalizedTranscript): TranscriptAnalysis;
|
|
15
|
+
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/transcript/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAkC,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAO3G;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,eAAe,EAAE,GAAG,oBAAoB,CAMvF;AA0HD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,oBAAoB,GAAG,kBAAkB,CAUzF"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { extractFields } from "./extract.js";
|
|
2
|
+
import { extractUrls } from "./urls.js";
|
|
3
|
+
import { isNetworkCall } from "./classify.js";
|
|
4
|
+
const PRODUCTIVE_TYPES = new Set(["assistant", "tool_use"]);
|
|
5
|
+
/**
|
|
6
|
+
* Normalize a raw transcript into adapter-agnostic entries.
|
|
7
|
+
* Purely deterministic — no LLM calls, no side effects.
|
|
8
|
+
* Designed to be called once after adapter.run() returns and before scoring.
|
|
9
|
+
*/
|
|
10
|
+
export function normalizeTranscript(transcript) {
|
|
11
|
+
const entries = transcript.map((raw, index) => normalizeEntry(raw, index));
|
|
12
|
+
pairTools(entries);
|
|
13
|
+
return buildAggregate(entries);
|
|
14
|
+
}
|
|
15
|
+
function normalizeEntry(raw, index) {
|
|
16
|
+
const fields = extractFields(raw);
|
|
17
|
+
// Claude Code embeds tool_use blocks inside "assistant" entries.
|
|
18
|
+
// Re-classify to "tool_use" so pairing, counting, and network detection all work.
|
|
19
|
+
const effectiveType = raw.type === "assistant" && fields.toolName !== null ? "tool_use" : raw.type;
|
|
20
|
+
// Collect all text that might contain URLs for extraction
|
|
21
|
+
const textForUrls = collectTextForUrls(fields);
|
|
22
|
+
const urls = textForUrls ? extractUrls(textForUrls) : [];
|
|
23
|
+
return {
|
|
24
|
+
index,
|
|
25
|
+
raw,
|
|
26
|
+
type: effectiveType,
|
|
27
|
+
timestamp: raw.timestamp,
|
|
28
|
+
text: fields.text,
|
|
29
|
+
toolName: fields.toolName,
|
|
30
|
+
toolInput: fields.toolInput,
|
|
31
|
+
toolInputSummary: fields.toolInputSummary,
|
|
32
|
+
toolResultText: fields.toolResultText,
|
|
33
|
+
errorMessage: fields.errorMessage,
|
|
34
|
+
toolId: fields.toolId,
|
|
35
|
+
pairedIndex: null,
|
|
36
|
+
urls,
|
|
37
|
+
isNetworkCall: effectiveType === "tool_use" && isNetworkCall(fields.toolName, urls),
|
|
38
|
+
isError: raw.type === "error",
|
|
39
|
+
isProductive: PRODUCTIVE_TYPES.has(raw.type),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Collect text from entry fields that may contain URLs.
|
|
44
|
+
* Prioritizes tool input (most likely for network calls) and general text.
|
|
45
|
+
*/
|
|
46
|
+
function collectTextForUrls(fields) {
|
|
47
|
+
const parts = [];
|
|
48
|
+
if (fields.toolInputSummary)
|
|
49
|
+
parts.push(fields.toolInputSummary);
|
|
50
|
+
if (fields.text)
|
|
51
|
+
parts.push(fields.text);
|
|
52
|
+
if (fields.toolResultText)
|
|
53
|
+
parts.push(fields.toolResultText);
|
|
54
|
+
return parts.length > 0 ? parts.join(" ") : null;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Pair tool_use entries with their corresponding tool_result entries.
|
|
58
|
+
* Pass 1: pair by matching toolId (Gemini, Claude with IDs).
|
|
59
|
+
* Pass 2: positional pairing for remaining unpaired entries.
|
|
60
|
+
*/
|
|
61
|
+
function pairTools(entries) {
|
|
62
|
+
// Pass 1: pair by toolId
|
|
63
|
+
const useByToolId = new Map();
|
|
64
|
+
for (const entry of entries) {
|
|
65
|
+
if (entry.type === "tool_use" && entry.toolId) {
|
|
66
|
+
useByToolId.set(entry.toolId, entry.index);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
for (const entry of entries) {
|
|
70
|
+
if (entry.type === "tool_result" && entry.toolId && useByToolId.has(entry.toolId)) {
|
|
71
|
+
const useIndex = useByToolId.get(entry.toolId);
|
|
72
|
+
entry.pairedIndex = useIndex;
|
|
73
|
+
entries[useIndex].pairedIndex = entry.index;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Pass 2: positional pairing for unpaired entries
|
|
77
|
+
for (const entry of entries) {
|
|
78
|
+
if (entry.type === "tool_use" && entry.pairedIndex === null) {
|
|
79
|
+
for (let j = entry.index + 1; j < entries.length; j++) {
|
|
80
|
+
const candidate = entries[j];
|
|
81
|
+
if (candidate.type === "tool_result" && candidate.pairedIndex === null) {
|
|
82
|
+
entry.pairedIndex = j;
|
|
83
|
+
candidate.pairedIndex = entry.index;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
// Don't skip over another unpaired tool_use
|
|
87
|
+
if (candidate.type === "tool_use")
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function buildAggregate(entries) {
|
|
94
|
+
const typeCounts = {};
|
|
95
|
+
const toolNameSet = new Set();
|
|
96
|
+
const domainSet = new Set();
|
|
97
|
+
let toolUseCount = 0;
|
|
98
|
+
let errorCount = 0;
|
|
99
|
+
let pairedToolCount = 0;
|
|
100
|
+
for (const entry of entries) {
|
|
101
|
+
typeCounts[entry.type] = (typeCounts[entry.type] ?? 0) + 1;
|
|
102
|
+
if (entry.type === "tool_use") {
|
|
103
|
+
toolUseCount++;
|
|
104
|
+
if (entry.pairedIndex !== null)
|
|
105
|
+
pairedToolCount++;
|
|
106
|
+
}
|
|
107
|
+
if (entry.isError)
|
|
108
|
+
errorCount++;
|
|
109
|
+
if (entry.toolName)
|
|
110
|
+
toolNameSet.add(entry.toolName);
|
|
111
|
+
for (const { domain } of entry.urls) {
|
|
112
|
+
if (domain)
|
|
113
|
+
domainSet.add(domain);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
entries,
|
|
118
|
+
typeCounts,
|
|
119
|
+
toolUseCount,
|
|
120
|
+
errorCount,
|
|
121
|
+
pairedToolCount,
|
|
122
|
+
toolNames: [...toolNameSet],
|
|
123
|
+
domains: [...domainSet],
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Convert a NormalizedTranscript to the serializable TranscriptAnalysis format.
|
|
128
|
+
* Strips the `raw` back-reference and `index` from each entry so the result
|
|
129
|
+
* can be safely JSON-serialized alongside the original transcript.
|
|
130
|
+
*/
|
|
131
|
+
export function toTranscriptAnalysis(normalized) {
|
|
132
|
+
return {
|
|
133
|
+
entries: normalized.entries.map(toEntryAnalysis),
|
|
134
|
+
typeCounts: normalized.typeCounts,
|
|
135
|
+
toolUseCount: normalized.toolUseCount,
|
|
136
|
+
errorCount: normalized.errorCount,
|
|
137
|
+
pairedToolCount: normalized.pairedToolCount,
|
|
138
|
+
toolNames: normalized.toolNames,
|
|
139
|
+
domains: normalized.domains,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function toEntryAnalysis(entry) {
|
|
143
|
+
return {
|
|
144
|
+
type: entry.type,
|
|
145
|
+
timestamp: entry.timestamp,
|
|
146
|
+
text: entry.text,
|
|
147
|
+
toolName: entry.toolName,
|
|
148
|
+
toolInput: entry.toolInput,
|
|
149
|
+
toolInputSummary: entry.toolInputSummary,
|
|
150
|
+
toolResultText: entry.toolResultText,
|
|
151
|
+
errorMessage: entry.errorMessage,
|
|
152
|
+
toolId: entry.toolId,
|
|
153
|
+
pairedIndex: entry.pairedIndex,
|
|
154
|
+
urls: entry.urls,
|
|
155
|
+
isNetworkCall: entry.isNetworkCall,
|
|
156
|
+
isError: entry.isError,
|
|
157
|
+
isProductive: entry.isProductive,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=normalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../src/transcript/normalize.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACx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AAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;QACxC,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,YAAY,EAAE,KAAK,CAAC,YAAY;KACjC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { TranscriptEntry } from "../types/agent.js";
|
|
2
|
+
/** A URL extracted from entry content with its parsed domain. */
|
|
3
|
+
export interface ExtractedUrl {
|
|
4
|
+
url: string;
|
|
5
|
+
domain: string | null;
|
|
6
|
+
}
|
|
7
|
+
/** Normalized, adapter-agnostic representation of a transcript entry. */
|
|
8
|
+
export interface NormalizedEntry {
|
|
9
|
+
/** Index in the original transcript array. */
|
|
10
|
+
index: number;
|
|
11
|
+
/** The original raw entry, preserved for custom access patterns. */
|
|
12
|
+
raw: TranscriptEntry;
|
|
13
|
+
/** Entry type, copied from raw for convenience. */
|
|
14
|
+
type: TranscriptEntry["type"];
|
|
15
|
+
/** ISO timestamp, copied from raw for convenience. */
|
|
16
|
+
timestamp: string;
|
|
17
|
+
/** Human-readable text content of this entry. */
|
|
18
|
+
text: string | null;
|
|
19
|
+
/** Tool name, for tool_use and tool_result entries. */
|
|
20
|
+
toolName: string | null;
|
|
21
|
+
/** Tool input as structured data, for tool_use entries. */
|
|
22
|
+
toolInput: Record<string, unknown> | null;
|
|
23
|
+
/** Tool input summarized as a brief string, for tool_use entries. */
|
|
24
|
+
toolInputSummary: string | null;
|
|
25
|
+
/** Tool result text, for tool_result entries. */
|
|
26
|
+
toolResultText: string | null;
|
|
27
|
+
/** Error message, for error entries or entries indicating failure. */
|
|
28
|
+
errorMessage: string | null;
|
|
29
|
+
/** Tool ID for pairing tool_use with tool_result. */
|
|
30
|
+
toolId: string | null;
|
|
31
|
+
/**
|
|
32
|
+
* Index of the paired entry in the normalized array.
|
|
33
|
+
* For tool_use: points to the matching tool_result.
|
|
34
|
+
* For tool_result: points to the matching tool_use.
|
|
35
|
+
* null if no pair was found.
|
|
36
|
+
*/
|
|
37
|
+
pairedIndex: number | null;
|
|
38
|
+
/** URLs found in text content or tool inputs. */
|
|
39
|
+
urls: ExtractedUrl[];
|
|
40
|
+
/** True if this entry represents a network-related action. */
|
|
41
|
+
isNetworkCall: boolean;
|
|
42
|
+
/** True if this entry is an error. */
|
|
43
|
+
isError: boolean;
|
|
44
|
+
/** True if this is a productive action (assistant reasoning or tool invocation). */
|
|
45
|
+
isProductive: boolean;
|
|
46
|
+
}
|
|
47
|
+
/** Aggregate metadata about a normalized transcript. */
|
|
48
|
+
export interface NormalizedTranscript {
|
|
49
|
+
/** Normalized entries in original order. */
|
|
50
|
+
entries: NormalizedEntry[];
|
|
51
|
+
/** Count of entries by type. */
|
|
52
|
+
typeCounts: Record<string, number>;
|
|
53
|
+
/** Total number of tool_use entries. */
|
|
54
|
+
toolUseCount: number;
|
|
55
|
+
/** Total number of error entries. */
|
|
56
|
+
errorCount: number;
|
|
57
|
+
/** Number of successfully paired tool_use/tool_result pairs. */
|
|
58
|
+
pairedToolCount: number;
|
|
59
|
+
/** All unique tool names used. */
|
|
60
|
+
toolNames: string[];
|
|
61
|
+
/** All unique domains referenced. */
|
|
62
|
+
domains: string[];
|
|
63
|
+
}
|
|
64
|
+
/** Per-entry extracted signals, indexed to match transcript[]. No raw back-reference. */
|
|
65
|
+
export interface EntryAnalysis {
|
|
66
|
+
type: TranscriptEntry["type"];
|
|
67
|
+
timestamp: string;
|
|
68
|
+
text: string | null;
|
|
69
|
+
toolName: string | null;
|
|
70
|
+
toolInput: Record<string, unknown> | null;
|
|
71
|
+
toolInputSummary: string | null;
|
|
72
|
+
toolResultText: string | null;
|
|
73
|
+
errorMessage: string | null;
|
|
74
|
+
toolId: string | null;
|
|
75
|
+
pairedIndex: number | null;
|
|
76
|
+
urls: ExtractedUrl[];
|
|
77
|
+
isNetworkCall: boolean;
|
|
78
|
+
isError: boolean;
|
|
79
|
+
isProductive: boolean;
|
|
80
|
+
}
|
|
81
|
+
/** Serializable transcript analysis — per-entry signals + aggregates. */
|
|
82
|
+
export interface TranscriptAnalysis {
|
|
83
|
+
/** Per-entry signals. entries[i] corresponds to transcript[i]. */
|
|
84
|
+
entries: EntryAnalysis[];
|
|
85
|
+
typeCounts: Record<string, number>;
|
|
86
|
+
toolUseCount: number;
|
|
87
|
+
errorCount: number;
|
|
88
|
+
pairedToolCount: number;
|
|
89
|
+
toolNames: string[];
|
|
90
|
+
domains: string[];
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/transcript/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,iEAAiE;AACjE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,yEAAyE;AACzE,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IAEd,oEAAoE;IACpE,GAAG,EAAE,eAAe,CAAC;IAErB,mDAAmD;IACnD,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAE9B,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IA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EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC1C,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,yEAAyE;AACzE,MAAM,WAAW,kBAAkB;IACjC,kEAAkE;IAClE,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/transcript/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ExtractedUrl } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Extract the domain from a URL string. Returns null on parse failure.
|
|
4
|
+
*/
|
|
5
|
+
export declare function extractDomain(url: string): string | null;
|
|
6
|
+
/**
|
|
7
|
+
* Extract URLs from a string. Returns deduplicated URLs with parsed domains.
|
|
8
|
+
*/
|
|
9
|
+
export declare function extractUrls(text: string): ExtractedUrl[];
|
|
10
|
+
//# sourceMappingURL=urls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urls.d.ts","sourceRoot":"","sources":["../../src/transcript/urls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAK/C;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMxD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,CAcxD"}
|