tarsk 0.5.65 → 0.5.67
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/bundled-skills/skill-creator/eval-viewer/generate_review.js +41 -40
- package/dist/bundled-skills/skill-creator/scripts/aggregate_benchmark.js +106 -98
- package/dist/bundled-skills/skill-creator/scripts/generate_report.js +78 -67
- package/dist/bundled-skills/skill-creator/scripts/improve_description.js +119 -72
- package/dist/bundled-skills/skill-creator/scripts/run_eval.js +76 -54
- package/dist/bundled-skills/skill-creator/scripts/run_loop.js +221 -142
- package/dist/index.js +51645 -47173
- package/dist/public/assets/{account-view-Dp0PfqVq.js → account-view-BlK6g38q.js} +1 -1
- package/dist/public/assets/{alert-dialog-Ge-FFGao.js → alert-dialog-B6An1LDY.js} +1 -1
- package/dist/public/assets/{async-error-boundary-B0tQed36.js → async-error-boundary-Rf-s2_Ez.js} +1 -1
- package/dist/public/assets/browser-tab-BJxPUVJi.js +12 -0
- package/dist/public/assets/{card-xQfAy2Rx.js → card-BDQUHsPD.js} +1 -1
- package/dist/public/assets/chat-dock-context-DyKjqpND.js +1 -0
- package/dist/public/assets/commit-dialog-CYb1kJCq.js +1 -0
- package/dist/public/assets/commit-error-dialog-DvxaNRcH.js +1 -0
- package/dist/public/assets/commit-method-fields-Dijc502F.js +1 -0
- package/dist/public/assets/context-menu-C51M1WGZ.js +1 -0
- package/dist/public/assets/conversation-history-view-w_6Jd3d-.js +1 -0
- package/dist/public/assets/create-project-dialog-CSVkngnF.js +6 -0
- package/dist/public/assets/create-repo-dialog-CcFA8pXz.js +1 -0
- package/dist/public/assets/{delete-confirm-dialog-Dy0dOtPe.js → delete-confirm-dialog-uTSX_x-i.js} +1 -1
- package/dist/public/assets/diff-view-XN5G5F6E.js +4 -0
- package/dist/public/assets/dist-IeRYu0zQ.js +142 -0
- package/dist/public/assets/{explorer-tab-context-8bs_tiCO.js → explorer-tab-context-BdjTEbFh.js} +1 -1
- package/dist/public/assets/explorer-tab-view-A2ICDFPB.js +2 -0
- package/dist/public/assets/explorer-tree-B04Ba59E.js +1 -0
- package/dist/public/assets/explorer-view-CofaKFiu.js +75 -0
- package/dist/public/assets/git-history-dialog-V3kaff2G.js +1 -0
- package/dist/public/assets/index-B0xy4BkI.js +3360 -0
- package/dist/public/assets/index-Cndc50ux.css +1 -0
- package/dist/public/assets/interactive-BrHVRHmQ.js +21 -0
- package/dist/public/assets/{main-tab-context-DHeKIUsf.js → main-tab-context-zQSuRQQG.js} +1 -1
- package/dist/public/assets/mcp-server-card-DOsP-SQ8.js +1 -0
- package/dist/public/assets/merged-pr-dialog-BerRzLlh.js +1 -0
- package/dist/public/assets/model-list-controls-Dw98tMn7.js +1 -0
- package/dist/public/assets/{monaco-setup-x3evbdq3.js → monaco-setup-C87kBr4u.js} +1 -1
- package/dist/public/assets/onboarding-DVc9-yKJ.js +46 -0
- package/dist/public/assets/project-env-vars-view-BQwUd7y6.js +1 -0
- package/dist/public/assets/project-model-aliases-view-CobSp09z.js +1 -0
- package/dist/public/assets/project-settings-view-CPTd5lEi.js +1 -0
- package/dist/public/assets/{project-tools-view-C44y08lY.js → project-tools-view-DShQghoz.js} +1 -1
- package/dist/public/assets/providers-list-view-Da9VMcuP.js +1 -0
- package/dist/public/assets/pull-request-dialog-BAarT9EM.js +1 -0
- package/dist/public/assets/pull-with-changes-dialog-BcF25mjQ.js +1 -0
- package/dist/public/assets/push-before-pr-dialog-BF0NzV2u.js +1 -0
- package/dist/public/assets/react-vendor-B7jFrulV.js +22 -0
- package/dist/public/assets/settings-general-view-DT4nElcL.js +1 -0
- package/dist/public/assets/settings-instructions-view-Bsr8wRMf.js +1 -0
- package/dist/public/assets/settings-list-B9wyVzKw.js +1 -0
- package/dist/public/assets/settings-logs-view-CyaGqUKH.js +5 -0
- package/dist/public/assets/settings-mcp-servers-view-BTUWHB5K.js +5 -0
- package/dist/public/assets/settings-models-view-DFwkVdt3.js +1 -0
- package/dist/public/assets/settings-rules-view-BhA9tjVh.js +8 -0
- package/dist/public/assets/settings-skills-view-BFoO9oZk.js +3 -0
- package/dist/public/assets/{settings-slack-view-OFUhhjTj.js → settings-slack-view-D4mrQ9C9.js} +1 -1
- package/dist/public/assets/settings-slash-commands-view-BLKPDUVG.js +1 -0
- package/dist/public/assets/settings-statistics-view-fa6iBiP8.js +1 -0
- package/dist/public/assets/settings-storage-view-LaiAi5gv.js +1 -0
- package/dist/public/assets/settings-subagents-view-BjMz2Ri_.js +2 -0
- package/dist/public/assets/settings-system-prompt-view-DNh1yqZh.js +1 -0
- package/dist/public/assets/settings-view-BoC66Wji.js +2 -0
- package/dist/public/assets/skeleton-CJSNEi3C.js +1 -0
- package/dist/public/assets/store-B_cK-gsT.js +8 -0
- package/dist/public/assets/{table-CYWF-RhQ.js → table-Cb2C1rQy.js} +1 -1
- package/dist/public/assets/tasks-view-B049aXpC.js +2 -0
- package/dist/public/assets/{terminal-panel-BxUHr-tZ.js → terminal-panel-Pv5xqCpm.js} +3 -3
- package/dist/public/assets/thread-tool-blocks-D9HUkPHB.js +1 -0
- package/dist/public/assets/{ui-components-DjoQfi8k.js → ui-components-DJLsrr5e.js} +1 -1
- package/dist/public/assets/{use-active-dock-panel-instance-BE69kVdb.js → use-active-dock-panel-instance-BlRDPUlZ.js} +1 -1
- package/dist/public/assets/{use-deferred-search-DXrcdbyC.js → use-deferred-search-0sV7mSzX.js} +1 -1
- package/dist/public/assets/use-installed-ai-files-DmLnugpj.js +1 -0
- package/dist/public/assets/{use-settings-page-loading-BC_wP7pl.js → use-settings-page-loading-BU2CDnfE.js} +1 -1
- package/dist/public/assets/{use-suspense-resource-rX-GqyWi.js → use-suspense-resource-CExc4Svq.js} +1 -1
- package/dist/public/assets/{use-toast-BFQ85Ly5.js → use-toast-hxHsVv6a.js} +1 -1
- package/dist/public/assets/{utils-Rlf65JHq.js → utils-SsF94Pkg.js} +1 -1
- package/dist/public/assets/{web-Q-tJsXNN.js → web-BidDZaMC.js} +1 -1
- package/dist/public/assets/{web-D8z4Nni0.js → web-C_HuLxHj.js} +1 -1
- package/dist/public/assets/{web-CxBqU2BU.js → web-DHUv7oQP.js} +1 -1
- package/dist/public/assets/{web-DTwF_7w-.js → web-JMCxQg4N.js} +1 -1
- package/dist/public/browser-preview-rpc.js +465 -7
- package/dist/public/index.html +14 -16
- package/dist/recommended-models.txt +5 -5
- package/package.json +1 -14
- package/dist/public/assets/api-BsPadLpi.js +0 -1
- package/dist/public/assets/browser-tab-hcbTzpVn.js +0 -8
- package/dist/public/assets/chat-dock-context-yQDhSXnw.js +0 -1
- package/dist/public/assets/commit-dialog-DK-NP7EN.js +0 -1
- package/dist/public/assets/commit-method-fields-DG3NtLE2.js +0 -1
- package/dist/public/assets/context-menu-M5y1Qb8G.js +0 -1
- package/dist/public/assets/conversation-history-view-YGPt-fC9.js +0 -1
- package/dist/public/assets/create-project-dialog-DW4oGrl2.js +0 -6
- package/dist/public/assets/create-repo-dialog-BFBOFZ2W.js +0 -1
- package/dist/public/assets/diff-view-Cy5PjlG_.js +0 -4
- package/dist/public/assets/dist-oojFghRi.js +0 -134
- package/dist/public/assets/explorer-tab-view-D6t9Ce05.js +0 -2
- package/dist/public/assets/explorer-tree-BCs2U0De.js +0 -1
- package/dist/public/assets/explorer-view-CxN4GRyn.js +0 -75
- package/dist/public/assets/git-history-dialog-fm9qhkgI.js +0 -1
- package/dist/public/assets/git-ops-button-DO1ng45p.js +0 -2
- package/dist/public/assets/index-B7qJtiRL.js +0 -3307
- package/dist/public/assets/index-GYexJ6QO.css +0 -1
- package/dist/public/assets/interactive-WtOIgeV4.js +0 -21
- package/dist/public/assets/local-tool-blocks-DlqmJ7__.js +0 -1
- package/dist/public/assets/mcp-server-card-V4Ddsgv3.js +0 -1
- package/dist/public/assets/merged-pr-dialog-Bi5pJzTO.js +0 -1
- package/dist/public/assets/model-list-controls-oiBE9X9_.js +0 -1
- package/dist/public/assets/onboarding-dbhmRuxw.js +0 -46
- package/dist/public/assets/project-env-vars-view-OVck-YEy.js +0 -1
- package/dist/public/assets/project-model-aliases-view-Cu-n2j94.js +0 -1
- package/dist/public/assets/project-settings-view-DKkLgg3C.js +0 -1
- package/dist/public/assets/providers-list-view-BEXiqKg8.js +0 -1
- package/dist/public/assets/pull-request-dialog-BOl1VloY.js +0 -1
- package/dist/public/assets/pull-with-changes-dialog-CJKvLUaf.js +0 -1
- package/dist/public/assets/push-before-pr-dialog-BZLScOoO.js +0 -1
- package/dist/public/assets/react-vendor-wGLyNWf9.js +0 -22
- package/dist/public/assets/settings-general-view-LnCQ2zkv.js +0 -1
- package/dist/public/assets/settings-instructions-view-B7lADJZh.js +0 -1
- package/dist/public/assets/settings-list-C5MACtux.js +0 -1
- package/dist/public/assets/settings-logs-view-YWMyQqu5.js +0 -5
- package/dist/public/assets/settings-mcp-servers-view-CN7JO2UD.js +0 -5
- package/dist/public/assets/settings-models-view-CswWfeDN.js +0 -1
- package/dist/public/assets/settings-rules-view-__5f33ot.js +0 -8
- package/dist/public/assets/settings-skills-view-Dvfrl9kz.js +0 -3
- package/dist/public/assets/settings-slash-commands-view-B1pO-Yie.js +0 -1
- package/dist/public/assets/settings-statistics-view-Bp624KXI.js +0 -1
- package/dist/public/assets/settings-storage-view-CHpGieRu.js +0 -1
- package/dist/public/assets/settings-subagents-view-CFggo62r.js +0 -2
- package/dist/public/assets/settings-system-prompt-view-BWD6RrX8.js +0 -1
- package/dist/public/assets/settings-view-ZgVxZhur.js +0 -2
- package/dist/public/assets/skeleton-B_xdlo2b.js +0 -1
- package/dist/public/assets/slug-utils-C5rnmMMP.js +0 -1
- package/dist/public/assets/store-CSyJjyNs.js +0 -7
- package/dist/public/assets/tasks-view-4yyCDYbV.js +0 -2
- package/dist/public/assets/thread-tool-blocks-BfowiaTH.js +0 -1
- package/dist/public/assets/use-installed-ai-files-CZIOFhcX.js +0 -1
|
@@ -70,25 +70,7 @@ function printEvalStats(label, results, elapsed, stderr = process.stderr) {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
evalSet,
|
|
75
|
-
skillPath,
|
|
76
|
-
descriptionOverride = null,
|
|
77
|
-
numWorkers,
|
|
78
|
-
timeout,
|
|
79
|
-
maxIterations,
|
|
80
|
-
runsPerQuery,
|
|
81
|
-
triggerThreshold,
|
|
82
|
-
holdout,
|
|
83
|
-
model,
|
|
84
|
-
verbose = false,
|
|
85
|
-
liveReportPath = null,
|
|
86
|
-
logDir = null,
|
|
87
|
-
}) {
|
|
88
|
-
const projectRoot = findProjectRoot();
|
|
89
|
-
const { name, description: originalDescription, content } = parseSkillMd(skillPath);
|
|
90
|
-
let currentDescription = descriptionOverride ?? originalDescription;
|
|
91
|
-
|
|
73
|
+
function splitSets(evalSet, holdout, verbose) {
|
|
92
74
|
let trainSet;
|
|
93
75
|
let testSet;
|
|
94
76
|
if (holdout > 0) {
|
|
@@ -102,22 +84,106 @@ async function runLoop({
|
|
|
102
84
|
trainSet = evalSet;
|
|
103
85
|
testSet = [];
|
|
104
86
|
}
|
|
87
|
+
return { trainSet, testSet };
|
|
88
|
+
}
|
|
105
89
|
|
|
106
|
-
|
|
107
|
-
|
|
90
|
+
function summarizeResults(resultList) {
|
|
91
|
+
const passed = resultList.filter((r) => r.pass).length;
|
|
92
|
+
const total = resultList.length;
|
|
93
|
+
return { passed, failed: total - passed, total };
|
|
94
|
+
}
|
|
108
95
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
96
|
+
function selectBest(history, testSet) {
|
|
97
|
+
if (testSet.length) {
|
|
98
|
+
return history.reduce(
|
|
99
|
+
(a, b) => ((a.test_passed ?? 0) > (b.test_passed ?? 0) ? a : b),
|
|
100
|
+
history[0],
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
return history.reduce(
|
|
104
|
+
(a, b) => ((a.train_passed ?? 0) > (b.train_passed ?? 0) ? a : b),
|
|
105
|
+
history[0],
|
|
106
|
+
);
|
|
107
|
+
}
|
|
116
108
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
109
|
+
async function runIterationEval({
|
|
110
|
+
trainSet,
|
|
111
|
+
testSet,
|
|
112
|
+
name,
|
|
113
|
+
currentDescription,
|
|
114
|
+
numWorkers,
|
|
115
|
+
timeout,
|
|
116
|
+
projectRoot,
|
|
117
|
+
runsPerQuery,
|
|
118
|
+
triggerThreshold,
|
|
119
|
+
model,
|
|
120
|
+
}) {
|
|
121
|
+
const allQueries = trainSet.concat(testSet);
|
|
122
|
+
const t0 = Date.now();
|
|
123
|
+
const allResults = await runEval(
|
|
124
|
+
allQueries,
|
|
125
|
+
name,
|
|
126
|
+
currentDescription,
|
|
127
|
+
numWorkers,
|
|
128
|
+
timeout,
|
|
129
|
+
projectRoot,
|
|
130
|
+
runsPerQuery,
|
|
131
|
+
triggerThreshold,
|
|
132
|
+
model,
|
|
133
|
+
);
|
|
134
|
+
const evalElapsed = (Date.now() - t0) / 1000;
|
|
135
|
+
|
|
136
|
+
const trainQueriesSet = new Set(trainSet.map((q) => q.query));
|
|
137
|
+
const trainResultList = allResults.results.filter((r) => trainQueriesSet.has(r.query));
|
|
138
|
+
const testResultList = allResults.results.filter((r) => !trainQueriesSet.has(r.query));
|
|
139
|
+
|
|
140
|
+
const trainSummary = summarizeResults(trainResultList);
|
|
141
|
+
const trainResults = { results: trainResultList, summary: trainSummary };
|
|
142
|
+
|
|
143
|
+
let testResults = null;
|
|
144
|
+
let testSummary = null;
|
|
145
|
+
if (testSet.length) {
|
|
146
|
+
testSummary = summarizeResults(testResultList);
|
|
147
|
+
testResults = { results: testResultList, summary: testSummary };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return { evalElapsed, trainResults, testResults, trainSummary, testSummary };
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
async function runIteration(ctx) {
|
|
154
|
+
const {
|
|
155
|
+
iteration,
|
|
156
|
+
maxIterations,
|
|
157
|
+
trainSet,
|
|
158
|
+
testSet,
|
|
159
|
+
name,
|
|
160
|
+
currentDescription,
|
|
161
|
+
numWorkers,
|
|
162
|
+
timeout,
|
|
163
|
+
projectRoot,
|
|
164
|
+
runsPerQuery,
|
|
165
|
+
triggerThreshold,
|
|
166
|
+
model,
|
|
167
|
+
verbose,
|
|
168
|
+
history,
|
|
169
|
+
liveReportPath,
|
|
170
|
+
originalDescription,
|
|
171
|
+
holdout,
|
|
172
|
+
content,
|
|
173
|
+
logDir,
|
|
174
|
+
} = ctx;
|
|
175
|
+
|
|
176
|
+
if (verbose) {
|
|
177
|
+
process.stderr.write(`\n${"=".repeat(60)}\n`);
|
|
178
|
+
process.stderr.write(`Iteration ${iteration}/${maxIterations}\n`);
|
|
179
|
+
process.stderr.write(`Description: ${currentDescription}\n`);
|
|
180
|
+
process.stderr.write(`${"=".repeat(60)}\n`);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const { evalElapsed, trainResults, testResults, trainSummary, testSummary } =
|
|
184
|
+
await runIterationEval({
|
|
185
|
+
trainSet,
|
|
186
|
+
testSet,
|
|
121
187
|
name,
|
|
122
188
|
currentDescription,
|
|
123
189
|
numWorkers,
|
|
@@ -126,132 +192,147 @@ async function runLoop({
|
|
|
126
192
|
runsPerQuery,
|
|
127
193
|
triggerThreshold,
|
|
128
194
|
model,
|
|
129
|
-
);
|
|
130
|
-
const evalElapsed = (Date.now() - t0) / 1000;
|
|
131
|
-
|
|
132
|
-
const trainQueriesSet = new Set(trainSet.map((q) => q.query));
|
|
133
|
-
const trainResultList = allResults.results.filter((r) => trainQueriesSet.has(r.query));
|
|
134
|
-
const testResultList = allResults.results.filter((r) => !trainQueriesSet.has(r.query));
|
|
135
|
-
|
|
136
|
-
const trainPassed = trainResultList.filter((r) => r.pass).length;
|
|
137
|
-
const trainTotal = trainResultList.length;
|
|
138
|
-
const trainSummary = {
|
|
139
|
-
passed: trainPassed,
|
|
140
|
-
failed: trainTotal - trainPassed,
|
|
141
|
-
total: trainTotal,
|
|
142
|
-
};
|
|
143
|
-
const trainResults = { results: trainResultList, summary: trainSummary };
|
|
144
|
-
|
|
145
|
-
let testResults = null;
|
|
146
|
-
let testSummary = null;
|
|
147
|
-
if (testSet.length) {
|
|
148
|
-
const testPassed = testResultList.filter((r) => r.pass).length;
|
|
149
|
-
const testTotal = testResultList.length;
|
|
150
|
-
testSummary = {
|
|
151
|
-
passed: testPassed,
|
|
152
|
-
failed: testTotal - testPassed,
|
|
153
|
-
total: testTotal,
|
|
154
|
-
};
|
|
155
|
-
testResults = { results: testResultList, summary: testSummary };
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
history.push({
|
|
159
|
-
iteration,
|
|
160
|
-
description: currentDescription,
|
|
161
|
-
train_passed: trainSummary.passed,
|
|
162
|
-
train_failed: trainSummary.failed,
|
|
163
|
-
train_total: trainSummary.total,
|
|
164
|
-
train_results: trainResults.results,
|
|
165
|
-
test_passed: testSummary?.passed ?? null,
|
|
166
|
-
test_failed: testSummary?.failed ?? null,
|
|
167
|
-
test_total: testSummary?.total ?? null,
|
|
168
|
-
test_results: testResults?.results ?? null,
|
|
169
|
-
passed: trainSummary.passed,
|
|
170
|
-
failed: trainSummary.failed,
|
|
171
|
-
total: trainSummary.total,
|
|
172
|
-
results: trainResults.results,
|
|
173
195
|
});
|
|
174
196
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
197
|
+
history.push({
|
|
198
|
+
iteration,
|
|
199
|
+
description: currentDescription,
|
|
200
|
+
train_passed: trainSummary.passed,
|
|
201
|
+
train_failed: trainSummary.failed,
|
|
202
|
+
train_total: trainSummary.total,
|
|
203
|
+
train_results: trainResults.results,
|
|
204
|
+
test_passed: testSummary?.passed ?? null,
|
|
205
|
+
test_failed: testSummary?.failed ?? null,
|
|
206
|
+
test_total: testSummary?.total ?? null,
|
|
207
|
+
test_results: testResults?.results ?? null,
|
|
208
|
+
passed: trainSummary.passed,
|
|
209
|
+
failed: trainSummary.failed,
|
|
210
|
+
total: trainSummary.total,
|
|
211
|
+
results: trainResults.results,
|
|
212
|
+
});
|
|
188
213
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
214
|
+
if (liveReportPath) {
|
|
215
|
+
const partialOutput = {
|
|
216
|
+
original_description: originalDescription,
|
|
217
|
+
best_description: currentDescription,
|
|
218
|
+
best_score: "in progress",
|
|
219
|
+
iterations_run: history.length,
|
|
220
|
+
holdout,
|
|
221
|
+
train_size: trainSet.length,
|
|
222
|
+
test_size: testSet.length,
|
|
223
|
+
history,
|
|
224
|
+
};
|
|
225
|
+
fs.writeFileSync(liveReportPath, generateHtml(partialOutput, true, name));
|
|
226
|
+
}
|
|
195
227
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
break;
|
|
228
|
+
if (verbose) {
|
|
229
|
+
printEvalStats("Train", trainResults.results, evalElapsed);
|
|
230
|
+
if (testSummary) {
|
|
231
|
+
printEvalStats("Test ", testResults.results, 0);
|
|
202
232
|
}
|
|
233
|
+
}
|
|
203
234
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
process.stderr.write(`\nMax iterations reached (${maxIterations}).\n`);
|
|
208
|
-
}
|
|
209
|
-
break;
|
|
235
|
+
if (trainSummary.failed === 0) {
|
|
236
|
+
if (verbose) {
|
|
237
|
+
process.stderr.write(`\nAll train queries passed on iteration ${iteration}!\n`);
|
|
210
238
|
}
|
|
239
|
+
return `all_passed (iteration ${iteration})`;
|
|
240
|
+
}
|
|
211
241
|
|
|
242
|
+
if (iteration === maxIterations) {
|
|
212
243
|
if (verbose) {
|
|
213
|
-
process.stderr.write(
|
|
244
|
+
process.stderr.write(`\nMax iterations reached (${maxIterations}).\n`);
|
|
214
245
|
}
|
|
246
|
+
return `max_iterations (${maxIterations})`;
|
|
247
|
+
}
|
|
215
248
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
249
|
+
if (verbose) {
|
|
250
|
+
process.stderr.write("\nImproving description...\n");
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const improveStart = Date.now();
|
|
254
|
+
const blindedHistory = history.map((h) =>
|
|
255
|
+
Object.fromEntries(Object.entries(h).filter(([k]) => !k.startsWith("test_"))),
|
|
256
|
+
);
|
|
257
|
+
const newDescription = improveDescription(
|
|
258
|
+
name,
|
|
259
|
+
content,
|
|
260
|
+
currentDescription,
|
|
261
|
+
trainResults,
|
|
262
|
+
blindedHistory,
|
|
263
|
+
model,
|
|
264
|
+
null,
|
|
265
|
+
logDir,
|
|
266
|
+
iteration,
|
|
267
|
+
);
|
|
268
|
+
const improveElapsed = (Date.now() - improveStart) / 1000;
|
|
269
|
+
|
|
270
|
+
if (verbose) {
|
|
271
|
+
process.stderr.write(`Proposed (${improveElapsed.toFixed(1)}s): ${newDescription}\n`);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
ctx.currentDescription = newDescription;
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
async function runLoop({
|
|
279
|
+
evalSet,
|
|
280
|
+
skillPath,
|
|
281
|
+
descriptionOverride = null,
|
|
282
|
+
numWorkers,
|
|
283
|
+
timeout,
|
|
284
|
+
maxIterations,
|
|
285
|
+
runsPerQuery,
|
|
286
|
+
triggerThreshold,
|
|
287
|
+
holdout,
|
|
288
|
+
model,
|
|
289
|
+
verbose = false,
|
|
290
|
+
liveReportPath = null,
|
|
291
|
+
logDir = null,
|
|
292
|
+
}) {
|
|
293
|
+
const projectRoot = findProjectRoot();
|
|
294
|
+
const { name, description: originalDescription, content } = parseSkillMd(skillPath);
|
|
295
|
+
let currentDescription = descriptionOverride ?? originalDescription;
|
|
296
|
+
|
|
297
|
+
const { trainSet, testSet } = splitSets(evalSet, holdout, verbose);
|
|
298
|
+
|
|
299
|
+
const history = [];
|
|
300
|
+
let exitReason = "unknown";
|
|
301
|
+
|
|
302
|
+
for (let iteration = 1; iteration <= maxIterations; iteration++) {
|
|
303
|
+
const ctx = {
|
|
304
|
+
iteration,
|
|
305
|
+
maxIterations,
|
|
306
|
+
trainSet,
|
|
307
|
+
testSet,
|
|
221
308
|
name,
|
|
222
|
-
content,
|
|
223
309
|
currentDescription,
|
|
224
|
-
|
|
225
|
-
|
|
310
|
+
numWorkers,
|
|
311
|
+
timeout,
|
|
312
|
+
projectRoot,
|
|
313
|
+
runsPerQuery,
|
|
314
|
+
triggerThreshold,
|
|
226
315
|
model,
|
|
227
|
-
|
|
316
|
+
verbose,
|
|
317
|
+
history,
|
|
318
|
+
liveReportPath,
|
|
319
|
+
originalDescription,
|
|
320
|
+
holdout,
|
|
321
|
+
content,
|
|
228
322
|
logDir,
|
|
229
|
-
|
|
230
|
-
);
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
323
|
+
};
|
|
324
|
+
const reason = await runIteration(ctx);
|
|
325
|
+
currentDescription = ctx.currentDescription;
|
|
326
|
+
if (reason) {
|
|
327
|
+
exitReason = reason;
|
|
328
|
+
break;
|
|
235
329
|
}
|
|
236
|
-
|
|
237
|
-
currentDescription = newDescription;
|
|
238
330
|
}
|
|
239
331
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
best
|
|
244
|
-
(a, b) => ((a.test_passed ?? 0) > (b.test_passed ?? 0) ? a : b),
|
|
245
|
-
history[0],
|
|
246
|
-
);
|
|
247
|
-
bestScore = `${best.test_passed}/${best.test_total}`;
|
|
248
|
-
} else {
|
|
249
|
-
best = history.reduce(
|
|
250
|
-
(a, b) => ((a.train_passed ?? 0) > (b.train_passed ?? 0) ? a : b),
|
|
251
|
-
history[0],
|
|
252
|
-
);
|
|
253
|
-
bestScore = `${best.train_passed}/${best.train_total}`;
|
|
254
|
-
}
|
|
332
|
+
const best = selectBest(history, testSet);
|
|
333
|
+
const bestScore = testSet.length
|
|
334
|
+
? `${best.test_passed}/${best.test_total}`
|
|
335
|
+
: `${best.train_passed}/${best.train_total}`;
|
|
255
336
|
|
|
256
337
|
if (verbose) {
|
|
257
338
|
process.stderr.write(`\nExit reason: ${exitReason}\n`);
|
|
@@ -407,5 +488,3 @@ if (require.main === module) {
|
|
|
407
488
|
process.exit(1);
|
|
408
489
|
});
|
|
409
490
|
}
|
|
410
|
-
|
|
411
|
-
module.exports = { splitEvalSet, runLoop, openInBrowser };
|