@refrainai/cli 0.4.1 → 0.4.3
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/{ai-model-FM6GWCID.js → ai-model-DP5PKGM6.js} +2 -2
- package/dist/{chunk-IGFCYKHC.js → chunk-5CKPPEYP.js} +262 -305
- package/dist/chunk-5CKPPEYP.js.map +1 -0
- package/dist/{chunk-7UCVPKD4.js → chunk-6FGCPMBU.js} +34 -74
- package/dist/chunk-6FGCPMBU.js.map +1 -0
- package/dist/{chunk-2BVDAJZT.js → chunk-A5X2VF5G.js} +9 -6
- package/dist/chunk-A5X2VF5G.js.map +1 -0
- package/dist/{chunk-H47NWH7N.js → chunk-AOCGSFRM.js} +611 -73
- package/dist/chunk-AOCGSFRM.js.map +1 -0
- package/dist/{chunk-CLYJHKPY.js → chunk-CMWLFQXD.js} +43 -42
- package/dist/chunk-CMWLFQXD.js.map +1 -0
- package/dist/chunk-GC7I5SGK.js +1146 -0
- package/dist/chunk-GC7I5SGK.js.map +1 -0
- package/dist/{chunk-WEYR56ZN.js → chunk-HHRHHFSK.js} +4 -4
- package/dist/chunk-IGJNT457.js +30 -0
- package/dist/chunk-IGJNT457.js.map +1 -0
- package/dist/{chunk-UGPXCQY3.js → chunk-KFNW4XR2.js} +13 -4
- package/dist/chunk-KFNW4XR2.js.map +1 -0
- package/dist/{chunk-RT664YIO.js → chunk-LZDZGI4M.js} +3 -1
- package/dist/chunk-LZDZGI4M.js.map +1 -0
- package/dist/{chunk-RYIJPYM3.js → chunk-MYITSQYV.js} +25 -8
- package/dist/chunk-MYITSQYV.js.map +1 -0
- package/dist/chunk-NRKZJVPE.js +74 -0
- package/dist/chunk-NRKZJVPE.js.map +1 -0
- package/dist/chunk-RBZK7T76.js +349 -0
- package/dist/chunk-RBZK7T76.js.map +1 -0
- package/dist/{chunk-HQDXLWAY.js → chunk-SDV3X5UN.js} +2 -2
- package/dist/{chunk-Z33FCOTZ.js → chunk-VVXNFUPL.js} +4 -2
- package/dist/chunk-VVXNFUPL.js.map +1 -0
- package/dist/chunk-YTVEYQGA.js +64 -0
- package/dist/chunk-YTVEYQGA.js.map +1 -0
- package/dist/{chunk-DJVUITRB.js → chunk-ZEBQWBEU.js} +898 -1135
- package/dist/chunk-ZEBQWBEU.js.map +1 -0
- package/dist/cli.js +5 -5
- package/dist/{compose-MTSIJY5D.js → compose-AVX5RU67.js} +9 -7
- package/dist/{compose-MTSIJY5D.js.map → compose-AVX5RU67.js.map} +1 -1
- package/dist/extraction-prompt-VDCKIFLB.js +17 -0
- package/dist/extraction-prompt-VDCKIFLB.js.map +1 -0
- package/dist/{fix-runbook-ZSBOTLC2.js → fix-runbook-6L5ZMA5G.js} +12 -10
- package/dist/{fix-runbook-ZSBOTLC2.js.map → fix-runbook-6L5ZMA5G.js.map} +1 -1
- package/dist/prompts-AGUYYIOM.js +13 -0
- package/dist/runbook-builder-2ZLE2AEO.js +11 -0
- package/dist/{runbook-data-helpers-KRR2SH76.js → runbook-data-helpers-5UAO65TZ.js} +3 -3
- package/dist/{runbook-executor-K7T6RJWJ.js → runbook-executor-OJXJTN6A.js} +41 -444
- package/dist/runbook-executor-OJXJTN6A.js.map +1 -0
- package/dist/{runbook-generator-MPXJBQ5N.js → runbook-generator-UIHWBEYC.js} +61 -136
- package/dist/runbook-generator-UIHWBEYC.js.map +1 -0
- package/dist/{runbook-schema-3T6TP3JJ.js → runbook-schema-X7DW725O.js} +2 -2
- package/dist/runbook-store-S24PXIHD.js +11 -0
- package/dist/{schema-5G6UQSPT.js → schema-XFSD5EWN.js} +2 -2
- package/dist/{server-AG3LXQBI.js → server-MULT5ZWG.js} +1176 -128
- package/dist/server-MULT5ZWG.js.map +1 -0
- package/dist/{tenant-ai-config-QPFEJUVJ.js → tenant-ai-config-4NHKRW7O.js} +4 -4
- package/dist/tenant-ai-config-4NHKRW7O.js.map +1 -0
- package/dist/yaml-patcher-GOCLYKZZ.js +18 -0
- package/dist/yaml-patcher-GOCLYKZZ.js.map +1 -0
- package/package.json +3 -2
- package/dist/chunk-2BVDAJZT.js.map +0 -1
- package/dist/chunk-7UCVPKD4.js.map +0 -1
- package/dist/chunk-CLYJHKPY.js.map +0 -1
- package/dist/chunk-DJVUITRB.js.map +0 -1
- package/dist/chunk-H47NWH7N.js.map +0 -1
- package/dist/chunk-IGFCYKHC.js.map +0 -1
- package/dist/chunk-RT664YIO.js.map +0 -1
- package/dist/chunk-RYIJPYM3.js.map +0 -1
- package/dist/chunk-UGPXCQY3.js.map +0 -1
- package/dist/chunk-VPK2MQAZ.js +0 -589
- package/dist/chunk-VPK2MQAZ.js.map +0 -1
- package/dist/chunk-Z33FCOTZ.js.map +0 -1
- package/dist/runbook-executor-K7T6RJWJ.js.map +0 -1
- package/dist/runbook-generator-MPXJBQ5N.js.map +0 -1
- package/dist/runbook-store-G5GUOWRR.js +0 -11
- package/dist/server-AG3LXQBI.js.map +0 -1
- package/dist/yaml-patcher-VGUS2JGH.js +0 -15
- /package/dist/{ai-model-FM6GWCID.js.map → ai-model-DP5PKGM6.js.map} +0 -0
- /package/dist/{chunk-WEYR56ZN.js.map → chunk-HHRHHFSK.js.map} +0 -0
- /package/dist/{chunk-HQDXLWAY.js.map → chunk-SDV3X5UN.js.map} +0 -0
- /package/dist/{runbook-data-helpers-KRR2SH76.js.map → prompts-AGUYYIOM.js.map} +0 -0
- /package/dist/{runbook-schema-3T6TP3JJ.js.map → runbook-builder-2ZLE2AEO.js.map} +0 -0
- /package/dist/{runbook-store-G5GUOWRR.js.map → runbook-data-helpers-5UAO65TZ.js.map} +0 -0
- /package/dist/{schema-5G6UQSPT.js.map → runbook-schema-X7DW725O.js.map} +0 -0
- /package/dist/{tenant-ai-config-QPFEJUVJ.js.map → runbook-store-S24PXIHD.js.map} +0 -0
- /package/dist/{yaml-patcher-VGUS2JGH.js.map → schema-XFSD5EWN.js.map} +0 -0
package/dist/chunk-VPK2MQAZ.js
DELETED
|
@@ -1,589 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
computeCacheRate,
|
|
4
|
-
computeTotalRealInput,
|
|
5
|
-
getModelId,
|
|
6
|
-
getModelProvider
|
|
7
|
-
} from "./chunk-UGPXCQY3.js";
|
|
8
|
-
|
|
9
|
-
// src/cli/options-serializer.ts
|
|
10
|
-
function serializeGeneratorOptions(config) {
|
|
11
|
-
const opts = [];
|
|
12
|
-
opts.push({ name: "--url", value: config.url });
|
|
13
|
-
opts.push({ name: "--goal", value: config.goal });
|
|
14
|
-
opts.push({ name: "--output", value: config.output });
|
|
15
|
-
opts.push({ name: "--headless", value: String(config.headless) });
|
|
16
|
-
opts.push({ name: "--max-iterations", value: String(config.maxIterations) });
|
|
17
|
-
opts.push({ name: "--step-delay", value: `${config.stepDelay}ms` });
|
|
18
|
-
opts.push({ name: "--stall-check-interval", value: String(config.stallCheckInterval) });
|
|
19
|
-
opts.push({ name: "--history-window", value: String(config.historyWindow) });
|
|
20
|
-
opts.push({ name: "--max-failures", value: String(config.maxConsecutiveFailures) });
|
|
21
|
-
opts.push({ name: "--snapshot-filter", value: String(config.snapshotFilter) });
|
|
22
|
-
if (config.screenshotDir) {
|
|
23
|
-
opts.push({ name: "--screenshots", value: config.screenshotDir });
|
|
24
|
-
}
|
|
25
|
-
if (config.contextMarkdown) {
|
|
26
|
-
opts.push({ name: "--context", value: `loaded (${config.contextMarkdown.split("\n").length} lines)` });
|
|
27
|
-
}
|
|
28
|
-
if (config.secrets && Object.keys(config.secrets.values).length > 0) {
|
|
29
|
-
opts.push({ name: "--secrets", value: `${Object.keys(config.secrets.values).length} keys` });
|
|
30
|
-
}
|
|
31
|
-
if (config.debugLogPath) {
|
|
32
|
-
opts.push({ name: "--debug-log", value: config.debugLogPath });
|
|
33
|
-
}
|
|
34
|
-
if (config.debugConsole) {
|
|
35
|
-
opts.push({ name: "--debug", value: "true" });
|
|
36
|
-
}
|
|
37
|
-
if (config.stealth) {
|
|
38
|
-
opts.push({ name: "--stealth", value: "true" });
|
|
39
|
-
}
|
|
40
|
-
if (config.proxy) {
|
|
41
|
-
opts.push({ name: "--proxy", value: config.proxy });
|
|
42
|
-
}
|
|
43
|
-
if (config.videoDir) {
|
|
44
|
-
opts.push({ name: "--video", value: config.videoDir });
|
|
45
|
-
}
|
|
46
|
-
if (config.skills && config.skills.length > 0) {
|
|
47
|
-
opts.push({ name: "--skill", value: config.skills.join(", ") });
|
|
48
|
-
}
|
|
49
|
-
serializeModelConfig(opts, config.aiModelConfig);
|
|
50
|
-
return opts;
|
|
51
|
-
}
|
|
52
|
-
function serializeExecutorOptions(config) {
|
|
53
|
-
const opts = [];
|
|
54
|
-
opts.push({ name: "--runbook", value: config.runbookPath });
|
|
55
|
-
opts.push({ name: "--headless", value: String(config.headless) });
|
|
56
|
-
if (config.stepDelay !== void 0) {
|
|
57
|
-
opts.push({ name: "--step-delay", value: `${config.stepDelay}ms` });
|
|
58
|
-
}
|
|
59
|
-
if (config.screenshotDir) {
|
|
60
|
-
opts.push({ name: "--screenshots", value: config.screenshotDir });
|
|
61
|
-
}
|
|
62
|
-
if (config.contextMarkdown) {
|
|
63
|
-
opts.push({ name: "--context", value: `loaded (${config.contextMarkdown.split("\n").length} lines)` });
|
|
64
|
-
}
|
|
65
|
-
if (config.secrets && Object.keys(config.secrets.values).length > 0) {
|
|
66
|
-
opts.push({ name: "--secrets", value: `${Object.keys(config.secrets.values).length} keys` });
|
|
67
|
-
}
|
|
68
|
-
if (config.skipConfirmation) {
|
|
69
|
-
opts.push({ name: "--skip-confirmation", value: "true" });
|
|
70
|
-
}
|
|
71
|
-
if (config.dataFilePath) {
|
|
72
|
-
opts.push({ name: "--data", value: config.dataFilePath });
|
|
73
|
-
}
|
|
74
|
-
if (config.reuseSession === false) {
|
|
75
|
-
opts.push({ name: "--no-reuse-session", value: "true" });
|
|
76
|
-
}
|
|
77
|
-
if (config.debugLogPath) {
|
|
78
|
-
opts.push({ name: "--debug-log", value: config.debugLogPath });
|
|
79
|
-
}
|
|
80
|
-
if (config.debugConsole) {
|
|
81
|
-
opts.push({ name: "--debug", value: "true" });
|
|
82
|
-
}
|
|
83
|
-
if (config.approvalMode && config.approvalMode !== "web") {
|
|
84
|
-
opts.push({ name: "--approval-mode", value: config.approvalMode });
|
|
85
|
-
}
|
|
86
|
-
if (config.notifyMode) {
|
|
87
|
-
opts.push({ name: "--notify", value: config.notifyMode });
|
|
88
|
-
}
|
|
89
|
-
if (config.enableSelectorCache) {
|
|
90
|
-
opts.push({ name: "--enable-selector-cache", value: "true" });
|
|
91
|
-
}
|
|
92
|
-
if (config.enableAgentFallback) {
|
|
93
|
-
opts.push({ name: "--enable-agent-fallback", value: "true" });
|
|
94
|
-
}
|
|
95
|
-
if (config.enableVisionFallback) {
|
|
96
|
-
opts.push({ name: "--enable-vision-fallback", value: "true" });
|
|
97
|
-
}
|
|
98
|
-
if (config.outputDir) {
|
|
99
|
-
opts.push({ name: "--output-dir", value: config.outputDir });
|
|
100
|
-
}
|
|
101
|
-
if (config.mergeDownloads) {
|
|
102
|
-
opts.push({ name: "--merge-downloads", value: "true" });
|
|
103
|
-
}
|
|
104
|
-
if (config.selfHeal) {
|
|
105
|
-
opts.push({ name: "--self-heal", value: "true" });
|
|
106
|
-
}
|
|
107
|
-
if (config.maxRetries !== void 0) {
|
|
108
|
-
opts.push({ name: "--max-retries", value: String(config.maxRetries) });
|
|
109
|
-
}
|
|
110
|
-
if (config.retryWarningThreshold !== void 0) {
|
|
111
|
-
opts.push({ name: "--retry-warning-threshold", value: String(config.retryWarningThreshold) });
|
|
112
|
-
}
|
|
113
|
-
if (config.forceReport) {
|
|
114
|
-
opts.push({ name: "--report", value: "true" });
|
|
115
|
-
}
|
|
116
|
-
if (config.videoDir) {
|
|
117
|
-
opts.push({ name: "--video", value: config.videoDir });
|
|
118
|
-
}
|
|
119
|
-
if (config.callbackPort !== void 0) {
|
|
120
|
-
opts.push({ name: "--callback-port", value: String(config.callbackPort) });
|
|
121
|
-
}
|
|
122
|
-
if (config.approvalTimeoutMs !== void 0) {
|
|
123
|
-
opts.push({ name: "--approval-timeout", value: `${config.approvalTimeoutMs}ms` });
|
|
124
|
-
}
|
|
125
|
-
if (config.stealth) {
|
|
126
|
-
opts.push({ name: "--stealth", value: "true" });
|
|
127
|
-
}
|
|
128
|
-
if (config.proxy) {
|
|
129
|
-
opts.push({ name: "--proxy", value: config.proxy });
|
|
130
|
-
}
|
|
131
|
-
if (config.skills && config.skills.length > 0) {
|
|
132
|
-
opts.push({ name: "--skill", value: config.skills.join(", ") });
|
|
133
|
-
}
|
|
134
|
-
serializeModelConfig(opts, config.aiModelConfig);
|
|
135
|
-
return opts;
|
|
136
|
-
}
|
|
137
|
-
var MODEL_OVERRIDE_FLAGS = {
|
|
138
|
-
selector: "--model-selector",
|
|
139
|
-
extraction: "--model-extraction",
|
|
140
|
-
exploration: "--model-exploration",
|
|
141
|
-
review: "--model-review",
|
|
142
|
-
fallback: "--model-fallback",
|
|
143
|
-
vision: "--model-vision"
|
|
144
|
-
};
|
|
145
|
-
function serializeModelConfig(opts, aiModelConfig) {
|
|
146
|
-
if (!aiModelConfig) return;
|
|
147
|
-
opts.push({ name: "--model", value: aiModelConfig.modelId });
|
|
148
|
-
opts.push({ name: "--model-provider", value: aiModelConfig.provider });
|
|
149
|
-
if (aiModelConfig.baseURL) {
|
|
150
|
-
opts.push({ name: "--model-base-url", value: aiModelConfig.baseURL });
|
|
151
|
-
}
|
|
152
|
-
if (aiModelConfig.modelOverrides) {
|
|
153
|
-
for (const [purpose, modelId] of Object.entries(aiModelConfig.modelOverrides)) {
|
|
154
|
-
const flag = MODEL_OVERRIDE_FLAGS[purpose];
|
|
155
|
-
if (flag && modelId) {
|
|
156
|
-
opts.push({ name: flag, value: modelId });
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
function renderOptionsMarkdown(options) {
|
|
162
|
-
if (options.length === 0) return [];
|
|
163
|
-
const lines = [];
|
|
164
|
-
for (const opt of options) {
|
|
165
|
-
lines.push(`- \`${opt.name}\`: ${opt.value}`);
|
|
166
|
-
}
|
|
167
|
-
return lines;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// src/harness/report-sections.ts
|
|
171
|
-
import { readFile } from "fs/promises";
|
|
172
|
-
async function readDebugLog(filePath) {
|
|
173
|
-
try {
|
|
174
|
-
const content = await readFile(filePath, "utf-8");
|
|
175
|
-
return content.trim().split("\n").filter((line) => line.trim()).map((line) => {
|
|
176
|
-
try {
|
|
177
|
-
return JSON.parse(line);
|
|
178
|
-
} catch {
|
|
179
|
-
return {};
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
} catch {
|
|
183
|
-
return [];
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
function formatAiMetricsSection(aiMetrics) {
|
|
187
|
-
const lines = [];
|
|
188
|
-
if (aiMetrics.totalCalls <= 0) return lines;
|
|
189
|
-
const m = aiMetrics;
|
|
190
|
-
const totalRealInput = computeTotalRealInput(m);
|
|
191
|
-
const cacheRate = (computeCacheRate(m) * 100).toFixed(1);
|
|
192
|
-
lines.push("### AI Metrics");
|
|
193
|
-
lines.push("");
|
|
194
|
-
lines.push("| \u30E1\u30C8\u30EA\u30AF\u30B9 | \u5024 |");
|
|
195
|
-
lines.push("|-----------|-----|");
|
|
196
|
-
lines.push(`| Total calls | ${m.totalCalls} |`);
|
|
197
|
-
lines.push(`| Total input tokens | ${totalRealInput.toLocaleString()} |`);
|
|
198
|
-
lines.push(`| Output tokens | ${m.totalOutputTokens.toLocaleString()} |`);
|
|
199
|
-
lines.push(`| Cache read tokens | ${m.totalCachedInputTokens.toLocaleString()} |`);
|
|
200
|
-
lines.push(`| Cache write tokens | ${m.totalCacheCreationTokens.toLocaleString()} |`);
|
|
201
|
-
lines.push(`| Cache hit rate | ${cacheRate}% |`);
|
|
202
|
-
lines.push(`| Estimated cost | $${m.estimatedCostUsd.toFixed(4)} |`);
|
|
203
|
-
lines.push(`| Total AI duration | ${(m.totalDurationMs / 1e3).toFixed(1)}s |`);
|
|
204
|
-
lines.push("");
|
|
205
|
-
const cacheHitRate = computeCacheRate(m);
|
|
206
|
-
if (cacheHitRate < 0.3 && m.totalCalls >= 3) {
|
|
207
|
-
lines.push(`> **:warning: \u30AD\u30E3\u30C3\u30B7\u30E5\u30D2\u30C3\u30C8\u7387\u304C\u4F4E\u3044 (${cacheRate}%)**`);
|
|
208
|
-
lines.push("> AI \u30D7\u30ED\u30F3\u30D7\u30C8\u30AD\u30E3\u30C3\u30B7\u30E5\u306E\u6D3B\u7528\u304C\u5C11\u306A\u304F\u3001\u30B3\u30B9\u30C8\u52B9\u7387\u304C\u60AA\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002");
|
|
209
|
-
lines.push("> \u8003\u3048\u3089\u308C\u308B\u539F\u56E0: \u30D7\u30ED\u30F3\u30D7\u30C8\u306E\u5148\u982D\u90E8\u5206\u304C\u6BCE\u56DE\u7570\u306A\u308B\u3001\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u304C\u5927\u304D\u304F\u5909\u52D5\u3059\u308B\u3001\u540C\u4E00\u30BB\u30EC\u30AF\u30BF\u306E\u518D\u89E3\u6C7A\u304C\u767A\u751F\u3057\u3066\u3044\u306A\u3044\u3002");
|
|
210
|
-
lines.push("");
|
|
211
|
-
}
|
|
212
|
-
if (Object.keys(m.byPurpose).length > 0) {
|
|
213
|
-
lines.push("**By purpose:**");
|
|
214
|
-
lines.push("");
|
|
215
|
-
lines.push("| Purpose | Calls | Input | Output | Cache Read | Cache Write | Duration |");
|
|
216
|
-
lines.push("|---------|-------|-------|--------|------------|-------------|----------|");
|
|
217
|
-
for (const [purpose, b] of Object.entries(m.byPurpose)) {
|
|
218
|
-
const purposeRealInput = computeTotalRealInput(b);
|
|
219
|
-
lines.push(
|
|
220
|
-
`| ${purpose} | ${b.calls} | ${purposeRealInput.toLocaleString()} | ${b.outputTokens.toLocaleString()} | ${b.cachedInputTokens.toLocaleString()} | ${b.cacheCreationTokens.toLocaleString()} | ${(b.durationMs / 1e3).toFixed(1)}s |`
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
|
-
lines.push("");
|
|
224
|
-
}
|
|
225
|
-
if (m.byModel && Object.keys(m.byModel).length > 0) {
|
|
226
|
-
lines.push("**By model:**");
|
|
227
|
-
lines.push("");
|
|
228
|
-
lines.push("| Model | Calls | Input | Output | Cache Read | Cache Write | Cost | Duration |");
|
|
229
|
-
lines.push("|-------|-------|-------|--------|------------|-------------|------|----------|");
|
|
230
|
-
for (const [modelId, b] of Object.entries(m.byModel)) {
|
|
231
|
-
const modelRealInput = computeTotalRealInput(b);
|
|
232
|
-
lines.push(
|
|
233
|
-
`| ${modelId} | ${b.calls} | ${modelRealInput.toLocaleString()} | ${b.outputTokens.toLocaleString()} | ${b.cachedInputTokens.toLocaleString()} | ${b.cacheCreationTokens.toLocaleString()} | $${b.estimatedCostUsd.toFixed(4)} | ${(b.durationMs / 1e3).toFixed(1)}s |`
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
lines.push("");
|
|
237
|
-
}
|
|
238
|
-
return lines;
|
|
239
|
-
}
|
|
240
|
-
function formatRuntimeEnvironment() {
|
|
241
|
-
const lines = [];
|
|
242
|
-
lines.push("### Runtime Environment");
|
|
243
|
-
lines.push("");
|
|
244
|
-
lines.push(`- **AI Model**: ${getModelId()} (${getModelProvider()})`);
|
|
245
|
-
lines.push(`- **Node.js**: ${process.version}`);
|
|
246
|
-
lines.push(`- **Platform**: ${process.platform} ${process.arch}`);
|
|
247
|
-
lines.push("");
|
|
248
|
-
return lines;
|
|
249
|
-
}
|
|
250
|
-
function formatSelectorResolutionStats(debugEntries, allSteps) {
|
|
251
|
-
const lines = [];
|
|
252
|
-
lines.push("### Selector Resolution Statistics");
|
|
253
|
-
lines.push("");
|
|
254
|
-
const stepsWithSelector = allSteps.filter(
|
|
255
|
-
(s) => s.diagnostics?.stepAction?.selector || s.diagnostics?.deterministicResolveResult
|
|
256
|
-
);
|
|
257
|
-
const deterministicHits = debugEntries.filter((e) => e.event === "deterministic_resolve").length;
|
|
258
|
-
const deterministicMisses = debugEntries.filter((e) => e.event === "deterministic_resolve_miss").length;
|
|
259
|
-
const aiResolves = debugEntries.filter((e) => e.event === "selector_resolve").length;
|
|
260
|
-
const cacheHits = debugEntries.filter((e) => e.event === "selector_cache_hit").length;
|
|
261
|
-
const cacheStales = debugEntries.filter((e) => e.event === "selector_cache_stale").length;
|
|
262
|
-
const retryEvents = debugEntries.filter((e) => e.event === "selector_retry").length;
|
|
263
|
-
const recoveryAttempts = debugEntries.filter((e) => e.event === "recovery_attempt").length;
|
|
264
|
-
const agentFallbackStarts = debugEntries.filter((e) => e.event === "agent_fallback_start").length;
|
|
265
|
-
const agentFallbackResults = debugEntries.filter((e) => e.event === "agent_fallback_result");
|
|
266
|
-
const agentFallbackSuccesses = agentFallbackResults.filter(
|
|
267
|
-
(e) => e.data && e.data.success === true
|
|
268
|
-
).length;
|
|
269
|
-
const totalResolveAttempts = deterministicHits + deterministicMisses + cacheHits;
|
|
270
|
-
if (totalResolveAttempts > 0 || stepsWithSelector.length > 0) {
|
|
271
|
-
lines.push("| \u30E1\u30C8\u30EA\u30AF\u30B9 | \u4EF6\u6570 |");
|
|
272
|
-
lines.push("|-----------|------|");
|
|
273
|
-
if (totalResolveAttempts > 0) {
|
|
274
|
-
lines.push(`| \u6C7A\u5B9A\u8AD6\u7684\u89E3\u6C7A \u6210\u529F | ${deterministicHits} |`);
|
|
275
|
-
lines.push(`| \u6C7A\u5B9A\u8AD6\u7684\u89E3\u6C7A \u5931\u6557\u2192AI\u59D4\u8B72 | ${deterministicMisses} |`);
|
|
276
|
-
lines.push(`| AI \u30BB\u30EC\u30AF\u30BF\u89E3\u6C7A | ${aiResolves} |`);
|
|
277
|
-
if (cacheHits > 0 || cacheStales > 0) {
|
|
278
|
-
lines.push(`| \u30AD\u30E3\u30C3\u30B7\u30E5\u30D2\u30C3\u30C8 | ${cacheHits} |`);
|
|
279
|
-
lines.push(`| \u30AD\u30E3\u30C3\u30B7\u30E5 stale\uFF08\u81EA\u52D5\u7121\u52B9\u5316\uFF09 | ${cacheStales} |`);
|
|
280
|
-
}
|
|
281
|
-
lines.push(`| \u30BB\u30EC\u30AF\u30BF\u30EA\u30C8\u30E9\u30A4 | ${retryEvents} |`);
|
|
282
|
-
if (recoveryAttempts > 0) {
|
|
283
|
-
lines.push(`| \u30B9\u30AF\u30ED\u30FC\u30EB\u56DE\u5FA9 | ${recoveryAttempts} |`);
|
|
284
|
-
}
|
|
285
|
-
const visionFbStarts = debugEntries.filter((e) => e.event === "vision_fallback_start").length;
|
|
286
|
-
if (visionFbStarts > 0) {
|
|
287
|
-
const visionFbSuccesses = debugEntries.filter(
|
|
288
|
-
(e) => e.event === "vision_fallback_result" && e.data && e.data.ref
|
|
289
|
-
).length;
|
|
290
|
-
lines.push(`| Vision Fallback \u767A\u52D5 | ${visionFbStarts} |`);
|
|
291
|
-
lines.push(`| Vision Fallback \u6210\u529F | ${visionFbSuccesses} |`);
|
|
292
|
-
}
|
|
293
|
-
if (agentFallbackStarts > 0) {
|
|
294
|
-
lines.push(`| Agent Fallback \u767A\u52D5 | ${agentFallbackStarts} |`);
|
|
295
|
-
lines.push(`| Agent Fallback \u6210\u529F | ${agentFallbackSuccesses} |`);
|
|
296
|
-
}
|
|
297
|
-
} else {
|
|
298
|
-
const totalRetries = allSteps.reduce((sum, s) => sum + (s.retryCount ?? 0), 0);
|
|
299
|
-
const stepsWithRetry = allSteps.filter((s) => s.retryCount && s.retryCount > 0);
|
|
300
|
-
lines.push(`| \u30BB\u30EC\u30AF\u30BF\u89E3\u6C7A\u5BFE\u8C61\u30B9\u30C6\u30C3\u30D7 | ${stepsWithSelector.length} |`);
|
|
301
|
-
lines.push(`| \u30EA\u30C8\u30E9\u30A4\u767A\u751F\u30B9\u30C6\u30C3\u30D7 | ${stepsWithRetry.length} |`);
|
|
302
|
-
lines.push(`| \u5408\u8A08\u30EA\u30C8\u30E9\u30A4\u56DE\u6570 | ${totalRetries} |`);
|
|
303
|
-
}
|
|
304
|
-
lines.push("");
|
|
305
|
-
if (totalResolveAttempts > 0) {
|
|
306
|
-
const deterministicRate = deterministicHits + deterministicMisses > 0 ? Math.round(deterministicHits / (deterministicHits + deterministicMisses) * 100) : 0;
|
|
307
|
-
lines.push(`**\u6C7A\u5B9A\u8AD6\u7684\u89E3\u6C7A\u7387**: ${deterministicRate}% \u2014 `);
|
|
308
|
-
if (deterministicRate < 50) {
|
|
309
|
-
lines.push("\u4F4E\u3044\u3002`deterministic-resolver.ts` \u306E\u30D1\u30BF\u30FC\u30F3\u30DE\u30C3\u30C1\u30F3\u30B0\u7CBE\u5EA6\u6539\u5584\u306E\u4F59\u5730\u3042\u308A\u3002");
|
|
310
|
-
} else if (deterministicRate < 80) {
|
|
311
|
-
lines.push("\u4E2D\u7A0B\u5EA6\u3002\u983B\u51FA\u306E\u30DE\u30C3\u30C1\u5931\u6557\u30D1\u30BF\u30FC\u30F3\u3092\u5206\u6790\u3057\u8FFD\u52A0\u3059\u308B\u3068 AI \u547C\u3073\u51FA\u3057\u3092\u524A\u6E1B\u3067\u304D\u308B\u3002");
|
|
312
|
-
} else {
|
|
313
|
-
lines.push("\u9AD8\u3044\u3002\u6C7A\u5B9A\u8AD6\u7684\u89E3\u6C7A\u304C\u6709\u52B9\u306B\u6A5F\u80FD\u3057\u3066\u3044\u308B\u3002");
|
|
314
|
-
}
|
|
315
|
-
lines.push("");
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
return lines;
|
|
319
|
-
}
|
|
320
|
-
function formatRetryDistribution(allSteps) {
|
|
321
|
-
const lines = [];
|
|
322
|
-
lines.push("### Retry Distribution");
|
|
323
|
-
lines.push("");
|
|
324
|
-
const retryDistribution = /* @__PURE__ */ new Map();
|
|
325
|
-
for (const step of allSteps) {
|
|
326
|
-
const count = step.retryCount ?? 0;
|
|
327
|
-
retryDistribution.set(count, (retryDistribution.get(count) ?? 0) + 1);
|
|
328
|
-
}
|
|
329
|
-
if (retryDistribution.size > 0) {
|
|
330
|
-
lines.push("| \u30EA\u30C8\u30E9\u30A4\u56DE\u6570 | \u30B9\u30C6\u30C3\u30D7\u6570 |");
|
|
331
|
-
lines.push("|-------------|-----------|");
|
|
332
|
-
for (const [count, steps] of [...retryDistribution.entries()].sort((a, b) => a[0] - b[0])) {
|
|
333
|
-
lines.push(`| ${count} | ${steps} |`);
|
|
334
|
-
}
|
|
335
|
-
lines.push("");
|
|
336
|
-
}
|
|
337
|
-
return lines;
|
|
338
|
-
}
|
|
339
|
-
function getSystemImprovementHint(category) {
|
|
340
|
-
switch (category) {
|
|
341
|
-
case "element_not_found":
|
|
342
|
-
return "\u6C7A\u5B9A\u8AD6\u7684\u89E3\u6C7A\u306E\u30D1\u30BF\u30FC\u30F3\u8FFD\u52A0\u3001\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u30D5\u30A3\u30EB\u30BF\u306E\u898B\u76F4\u3057";
|
|
343
|
-
case "element_stale":
|
|
344
|
-
return "\u30AD\u30E3\u30C3\u30B7\u30E5\u7121\u52B9\u5316\u30ED\u30B8\u30C3\u30AF\u306E\u6539\u5584\u3001DOM\u5B89\u5B9A\u5316\u5F85\u6A5F\u306E\u8ABF\u6574";
|
|
345
|
-
case "page_structure_changed":
|
|
346
|
-
return "\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u5DEE\u5206\u691C\u77E5\u306E\u611F\u5EA6\u8ABF\u6574\u3001\u52D5\u7684\u30B3\u30F3\u30C6\u30F3\u30C4\u5BFE\u5FDC";
|
|
347
|
-
case "navigation_timeout":
|
|
348
|
-
return "\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u5F85\u6A5F\u306E\u6BB5\u968E\u7684\u30BF\u30A4\u30E0\u30A2\u30A6\u30C8\u8ABF\u6574\u3001SPA\u691C\u77E5\u306E\u6539\u5584";
|
|
349
|
-
case "action_failed":
|
|
350
|
-
return "\u30A2\u30AF\u30B7\u30E7\u30F3\u30D0\u30EA\u30C7\u30FC\u30B7\u30E7\u30F3\u306E\u7DB2\u7F85\u6027\u5411\u4E0A\u3001role\u4E92\u63DB\u30DE\u30C3\u30D4\u30F3\u30B0\u306E\u62E1\u5145";
|
|
351
|
-
case "unknown":
|
|
352
|
-
return "\u30A8\u30E9\u30FC\u5206\u985E\u30ED\u30B8\u30C3\u30AF\u3078\u306E\u65B0\u30AB\u30C6\u30B4\u30EA\u8FFD\u52A0\u3092\u691C\u8A0E";
|
|
353
|
-
default:
|
|
354
|
-
return "\u65B0\u3057\u3044\u30AB\u30C6\u30B4\u30EA \u2014 error-classifier.ts \u306B\u8FFD\u52A0\u3092\u691C\u8A0E";
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
function formatFailureCategoryDistribution(failedSteps) {
|
|
358
|
-
const lines = [];
|
|
359
|
-
if (failedSteps.length === 0) return lines;
|
|
360
|
-
lines.push("### Failure Category Distribution");
|
|
361
|
-
lines.push("");
|
|
362
|
-
const categoryCount = /* @__PURE__ */ new Map();
|
|
363
|
-
for (const step of failedSteps) {
|
|
364
|
-
const cat = step.failureCategory ?? "unclassified";
|
|
365
|
-
categoryCount.set(cat, (categoryCount.get(cat) ?? 0) + 1);
|
|
366
|
-
}
|
|
367
|
-
lines.push("| \u30AB\u30C6\u30B4\u30EA | \u4EF6\u6570 | \u6539\u5584\u30D2\u30F3\u30C8 |");
|
|
368
|
-
lines.push("|---------|------|-----------|");
|
|
369
|
-
for (const [cat, count] of [...categoryCount.entries()].sort((a, b) => b[1] - a[1])) {
|
|
370
|
-
const hint = getSystemImprovementHint(cat);
|
|
371
|
-
lines.push(`| \`${cat}\` | ${count} | ${hint} |`);
|
|
372
|
-
}
|
|
373
|
-
lines.push("");
|
|
374
|
-
return lines;
|
|
375
|
-
}
|
|
376
|
-
function analyzeRecoveryEffectiveness(entries, allSteps) {
|
|
377
|
-
const results = [];
|
|
378
|
-
const retrySteps = allSteps.filter((s) => s.retryCount && s.retryCount > 0);
|
|
379
|
-
if (retrySteps.length > 0) {
|
|
380
|
-
const retrySuccesses = retrySteps.filter((s) => s.status === "success").length;
|
|
381
|
-
results.push({ name: "\u30B9\u30DE\u30FC\u30C8\u30EA\u30C8\u30E9\u30A4", total: retrySteps.length, success: retrySuccesses });
|
|
382
|
-
}
|
|
383
|
-
const scrollRecoveries = entries.filter((e) => e.event === "recovery_attempt");
|
|
384
|
-
if (scrollRecoveries.length > 0) {
|
|
385
|
-
const scrollStepOrdinals = new Set(scrollRecoveries.map((e) => e.step).filter((s) => s !== void 0));
|
|
386
|
-
const scrollSuccesses = allSteps.filter(
|
|
387
|
-
(s) => scrollStepOrdinals.has(s.ordinal) && s.status === "success"
|
|
388
|
-
).length;
|
|
389
|
-
results.push({ name: "\u30B9\u30AF\u30ED\u30FC\u30EB\u56DE\u5FA9", total: scrollRecoveries.length, success: scrollSuccesses });
|
|
390
|
-
}
|
|
391
|
-
const visionFallbackStarts = entries.filter((e) => e.event === "vision_fallback_start").length;
|
|
392
|
-
if (visionFallbackStarts > 0) {
|
|
393
|
-
const visionSuccesses = entries.filter(
|
|
394
|
-
(e) => e.event === "vision_fallback_result" && e.data && e.data.ref
|
|
395
|
-
).length;
|
|
396
|
-
results.push({ name: "Vision Fallback", total: visionFallbackStarts, success: visionSuccesses });
|
|
397
|
-
}
|
|
398
|
-
const fbStarts = entries.filter((e) => e.event === "agent_fallback_start").length;
|
|
399
|
-
if (fbStarts > 0) {
|
|
400
|
-
const fbSuccesses = entries.filter(
|
|
401
|
-
(e) => e.event === "agent_fallback_result" && e.data && e.data.success === true
|
|
402
|
-
).length;
|
|
403
|
-
results.push({ name: "Agent Fallback", total: fbStarts, success: fbSuccesses });
|
|
404
|
-
}
|
|
405
|
-
const deterministicMisses = entries.filter((e) => e.event === "deterministic_resolve_miss");
|
|
406
|
-
if (deterministicMisses.length > 0) {
|
|
407
|
-
const missStepOrdinals = new Set(deterministicMisses.map((e) => e.step).filter((s) => s !== void 0));
|
|
408
|
-
const aiRecoveries = allSteps.filter(
|
|
409
|
-
(s) => missStepOrdinals.has(s.ordinal) && s.status === "success"
|
|
410
|
-
).length;
|
|
411
|
-
results.push({ name: "AI \u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF\uFF08\u6C7A\u5B9A\u8AD6\u7684\u5931\u6557\u5F8C\uFF09", total: deterministicMisses.length, success: aiRecoveries });
|
|
412
|
-
}
|
|
413
|
-
return results;
|
|
414
|
-
}
|
|
415
|
-
function formatRecoveryEffectiveness(entries, allSteps) {
|
|
416
|
-
const lines = [];
|
|
417
|
-
if (entries.length === 0) return lines;
|
|
418
|
-
const recoveryResults = analyzeRecoveryEffectiveness(entries, allSteps);
|
|
419
|
-
if (recoveryResults.length === 0) return lines;
|
|
420
|
-
lines.push("### Recovery Mechanism Effectiveness");
|
|
421
|
-
lines.push("");
|
|
422
|
-
lines.push("| \u56DE\u5FA9\u6A5F\u69CB | \u767A\u52D5\u56DE\u6570 | \u6210\u529F | \u5931\u6557 | \u6210\u529F\u7387 |");
|
|
423
|
-
lines.push("|---------|---------|------|------|--------|");
|
|
424
|
-
for (const r of recoveryResults) {
|
|
425
|
-
const rate = r.total > 0 ? Math.round(r.success / r.total * 100) : 0;
|
|
426
|
-
lines.push(`| ${r.name} | ${r.total} | ${r.success} | ${r.total - r.success} | ${rate}% |`);
|
|
427
|
-
}
|
|
428
|
-
lines.push("");
|
|
429
|
-
return lines;
|
|
430
|
-
}
|
|
431
|
-
function formatPerformanceBottlenecks(allSteps) {
|
|
432
|
-
const lines = [];
|
|
433
|
-
const slowSteps = [...allSteps].filter((s) => s.durationMs > 0).sort((a, b) => b.durationMs - a.durationMs).slice(0, 5);
|
|
434
|
-
if (slowSteps.length > 0 && slowSteps[0].durationMs > 3e3) {
|
|
435
|
-
lines.push("### Performance Bottlenecks");
|
|
436
|
-
lines.push("");
|
|
437
|
-
lines.push("| Step | \u6240\u8981\u6642\u9593 | \u30EA\u30C8\u30E9\u30A4 | \u72B6\u614B | \u8AAC\u660E |");
|
|
438
|
-
lines.push("|------|---------|---------|------|------|");
|
|
439
|
-
for (const step of slowSteps) {
|
|
440
|
-
if (step.durationMs <= 3e3) break;
|
|
441
|
-
const status = step.status === "failed" ? ":x:" : ":white_check_mark:";
|
|
442
|
-
lines.push(
|
|
443
|
-
`| #${step.ordinal} | ${(step.durationMs / 1e3).toFixed(1)}s | ${step.retryCount ?? 0} | ${status} | ${step.description} |`
|
|
444
|
-
);
|
|
445
|
-
}
|
|
446
|
-
lines.push("");
|
|
447
|
-
}
|
|
448
|
-
return lines;
|
|
449
|
-
}
|
|
450
|
-
function analyzeAiSelectorQuality(entries) {
|
|
451
|
-
const issues = [];
|
|
452
|
-
const aiResponses = entries.filter((e) => e.event === "ai_selector_response");
|
|
453
|
-
const stepAiCounts = /* @__PURE__ */ new Map();
|
|
454
|
-
for (const e of aiResponses) {
|
|
455
|
-
if (e.step !== void 0) {
|
|
456
|
-
stepAiCounts.set(e.step, (stepAiCounts.get(e.step) ?? 0) + 1);
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
for (const [step, count] of stepAiCounts) {
|
|
460
|
-
if (count > 1) {
|
|
461
|
-
issues.push({
|
|
462
|
-
step,
|
|
463
|
-
description: `AI \u304C ${count} \u56DE\u547C\u3073\u51FA\u3055\u308C\u305F\uFF08\u524D\u56DE\u5FDC\u7B54\u304C\u4E0D\u6B63\u78BA\uFF09\u3002\u30D7\u30ED\u30F3\u30D7\u30C8\u306E\u6539\u5584\u4F59\u5730\u3042\u308A`
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
const unchangedRetries = entries.filter(
|
|
468
|
-
(e) => e.event === "snapshot_unchanged" && e.data && !e.data.skippingAI
|
|
469
|
-
);
|
|
470
|
-
if (unchangedRetries.length > 0) {
|
|
471
|
-
for (const e of unchangedRetries) {
|
|
472
|
-
if (e.step !== void 0) {
|
|
473
|
-
issues.push({
|
|
474
|
-
step: e.step,
|
|
475
|
-
description: "\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u672A\u5909\u5316\u306A\u306E\u306B AI \u304C\u518D\u547C\u3073\u51FA\u3057\u3055\u308C\u305F\u3002\u30B9\u30AD\u30C3\u30D7\u30ED\u30B8\u30C3\u30AF\u306E\u78BA\u8A8D\u304C\u5FC5\u8981"
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
const emptyRefResponses = entries.filter(
|
|
481
|
-
(e) => e.event === "ai_selector_response" && e.data && typeof e.data.parsedResult === "object" && e.data.parsedResult !== null && e.data.parsedResult.ref === ""
|
|
482
|
-
);
|
|
483
|
-
if (emptyRefResponses.length > 0) {
|
|
484
|
-
const steps = [...new Set(emptyRefResponses.map((e) => e.step).filter((s) => s !== void 0))];
|
|
485
|
-
for (const step of steps) {
|
|
486
|
-
issues.push({
|
|
487
|
-
step,
|
|
488
|
-
description: "AI \u304C\u7A7A ref \u3092\u8FD4\u3057\u305F\uFF08\u8981\u7D20\u4E0D\u5728\u5224\u5B9A\uFF09\u3002\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u30D5\u30A3\u30EB\u30BF\u304C\u8981\u7D20\u3092\u9664\u53BB\u3057\u3066\u3044\u306A\u3044\u304B\u78BA\u8A8D"
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
return issues;
|
|
493
|
-
}
|
|
494
|
-
function formatAiSelectorQualityIssues(entries) {
|
|
495
|
-
const lines = [];
|
|
496
|
-
const aiQualityIssues = analyzeAiSelectorQuality(entries);
|
|
497
|
-
if (aiQualityIssues.length === 0) return lines;
|
|
498
|
-
lines.push("### AI Selector Resolution Issues");
|
|
499
|
-
lines.push("");
|
|
500
|
-
lines.push("> AI \u30BB\u30EC\u30AF\u30BF\u89E3\u6C7A\u3067\u554F\u984C\u304C\u691C\u51FA\u3055\u308C\u305F\u30B1\u30FC\u30B9\u3002\u30D7\u30ED\u30F3\u30D7\u30C8\u6539\u5584\u306E\u6750\u6599\u3002");
|
|
501
|
-
lines.push("");
|
|
502
|
-
for (const issue of aiQualityIssues.slice(0, 5)) {
|
|
503
|
-
lines.push(`- **Step #${issue.step}**: ${issue.description}`);
|
|
504
|
-
}
|
|
505
|
-
lines.push("");
|
|
506
|
-
return lines;
|
|
507
|
-
}
|
|
508
|
-
var DEFAULT_RECENT_EVENT_TYPES = [
|
|
509
|
-
"action",
|
|
510
|
-
"snapshot",
|
|
511
|
-
"selector_resolve",
|
|
512
|
-
"selector_retry",
|
|
513
|
-
"selector_cache_hit",
|
|
514
|
-
"selector_cache_stale",
|
|
515
|
-
"deterministic_resolve",
|
|
516
|
-
"deterministic_resolve_miss",
|
|
517
|
-
"vision_fallback_start",
|
|
518
|
-
"vision_fallback_result",
|
|
519
|
-
"agent_fallback_start",
|
|
520
|
-
"agent_fallback_result",
|
|
521
|
-
"recovery_attempt",
|
|
522
|
-
"extract",
|
|
523
|
-
"extract_result",
|
|
524
|
-
"memory_operation"
|
|
525
|
-
];
|
|
526
|
-
function formatDebugLogSections(entries, options = {}) {
|
|
527
|
-
const lines = [];
|
|
528
|
-
if (entries.length === 0) return lines;
|
|
529
|
-
const maxErrors = options.maxErrors ?? 20;
|
|
530
|
-
const maxRecent = options.maxRecent ?? 15;
|
|
531
|
-
const recentEventTypes = options.recentEventTypes ?? DEFAULT_RECENT_EVENT_TYPES;
|
|
532
|
-
if (options.showFailedStepEvents && options.failedOrdinals && options.failedOrdinals.size > 0) {
|
|
533
|
-
const failedStepEntries = entries.filter(
|
|
534
|
-
(e) => e.step !== void 0 && options.failedOrdinals.has(e.step)
|
|
535
|
-
);
|
|
536
|
-
if (failedStepEntries.length > 0) {
|
|
537
|
-
lines.push("## Debug Log (Failed Step Events)");
|
|
538
|
-
lines.push("```json");
|
|
539
|
-
for (const entry of failedStepEntries.slice(-30)) {
|
|
540
|
-
lines.push(JSON.stringify(entry));
|
|
541
|
-
}
|
|
542
|
-
lines.push("```");
|
|
543
|
-
lines.push("");
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
const errorEntries = entries.filter(
|
|
547
|
-
(e) => e.event === "error" || e.event === "step_error" || e.event === "validation_failed" || e.data && typeof e.data === "object" && "result" in e.data && typeof e.data.result === "object" && e.data.result !== null && "success" in e.data.result && e.data.result.success === false
|
|
548
|
-
);
|
|
549
|
-
if (errorEntries.length > 0) {
|
|
550
|
-
lines.push("## Debug Log (Error Events)");
|
|
551
|
-
lines.push("```json");
|
|
552
|
-
for (const entry of errorEntries.slice(-maxErrors)) {
|
|
553
|
-
lines.push(JSON.stringify(entry));
|
|
554
|
-
}
|
|
555
|
-
lines.push("```");
|
|
556
|
-
lines.push("");
|
|
557
|
-
}
|
|
558
|
-
const actionEntries = entries.filter(
|
|
559
|
-
(e) => e.event !== void 0 && recentEventTypes.includes(e.event)
|
|
560
|
-
);
|
|
561
|
-
const recentActions = actionEntries.slice(-maxRecent);
|
|
562
|
-
if (recentActions.length > 0) {
|
|
563
|
-
lines.push("## Debug Log (Recent Events)");
|
|
564
|
-
lines.push("```json");
|
|
565
|
-
for (const entry of recentActions) {
|
|
566
|
-
lines.push(JSON.stringify(entry));
|
|
567
|
-
}
|
|
568
|
-
lines.push("```");
|
|
569
|
-
lines.push("");
|
|
570
|
-
}
|
|
571
|
-
return lines;
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
export {
|
|
575
|
-
serializeGeneratorOptions,
|
|
576
|
-
serializeExecutorOptions,
|
|
577
|
-
renderOptionsMarkdown,
|
|
578
|
-
readDebugLog,
|
|
579
|
-
formatAiMetricsSection,
|
|
580
|
-
formatRuntimeEnvironment,
|
|
581
|
-
formatSelectorResolutionStats,
|
|
582
|
-
formatRetryDistribution,
|
|
583
|
-
formatFailureCategoryDistribution,
|
|
584
|
-
formatRecoveryEffectiveness,
|
|
585
|
-
formatPerformanceBottlenecks,
|
|
586
|
-
formatAiSelectorQualityIssues,
|
|
587
|
-
formatDebugLogSections
|
|
588
|
-
};
|
|
589
|
-
//# sourceMappingURL=chunk-VPK2MQAZ.js.map
|