blun-king-cli 9.1.216 → 9.1.217
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/bin/validated-learning-signal.cjs +16 -8
- package/blun.mjs +12 -7
- package/package.json +1 -1
|
@@ -171,22 +171,24 @@ function readValidatedLearningCandidates(options = {}) {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
function
|
|
175
|
-
const calls = new
|
|
174
|
+
function successfulMistakeRecordCandidateIds(history) {
|
|
175
|
+
const calls = new Map();
|
|
176
|
+
const candidateIds = new Set();
|
|
176
177
|
for (const message of currentUserTurn(history)) {
|
|
177
178
|
for (const call of toolCallsFrom(message)) {
|
|
178
179
|
if (typeof call?.id === 'string' && String(call.name).toLowerCase() === 'mistakerecord') {
|
|
179
|
-
|
|
180
|
+
const args = parseArguments(call.arguments);
|
|
181
|
+
calls.set(call.id, typeof args?.candidateId === 'string' ? args.candidateId.trim() : '');
|
|
180
182
|
}
|
|
181
183
|
}
|
|
182
184
|
if (message?.role === 'tool'
|
|
183
185
|
&& typeof message.toolCallId === 'string'
|
|
184
|
-
&& calls.
|
|
186
|
+
&& calls.get(message.toolCallId)
|
|
185
187
|
&& message.isError !== true) {
|
|
186
|
-
|
|
188
|
+
candidateIds.add(calls.get(message.toolCallId));
|
|
187
189
|
}
|
|
188
190
|
}
|
|
189
|
-
return
|
|
191
|
+
return candidateIds;
|
|
190
192
|
}
|
|
191
193
|
|
|
192
194
|
function newestPending(candidates) {
|
|
@@ -252,8 +254,14 @@ function syncValidatedLearningCandidate(history, options = {}) {
|
|
|
252
254
|
homeDir,
|
|
253
255
|
profile: options.profile,
|
|
254
256
|
});
|
|
255
|
-
|
|
256
|
-
|
|
257
|
+
const recordedCandidateIds = successfulMistakeRecordCandidateIds(history);
|
|
258
|
+
for (const candidateId of recordedCandidateIds) {
|
|
259
|
+
const candidate = candidates.find((item) => (
|
|
260
|
+
item.id === candidateId && item.status === 'pending'
|
|
261
|
+
));
|
|
262
|
+
markCandidate(candidate, 'recorded', nowIso);
|
|
263
|
+
}
|
|
264
|
+
if (recordedCandidateIds.size > 0) {
|
|
257
265
|
candidates = readValidatedLearningCandidates({ homeDir, profile: options.profile });
|
|
258
266
|
}
|
|
259
267
|
if (signal !== null) {
|
package/blun.mjs
CHANGED
|
@@ -232137,15 +232137,19 @@ var init_repeated_assistant_response = __esmMin((() => {
|
|
|
232137
232137
|
function isValidatedLearningSignalReminder(message) {
|
|
232138
232138
|
return message.origin?.kind === "injection" && message.origin.variant === "validated_learning_signal";
|
|
232139
232139
|
}
|
|
232140
|
-
function buildValidatedLearningSignalReminder() {
|
|
232141
|
-
|
|
232140
|
+
function buildValidatedLearningSignalReminder(signal) {
|
|
232141
|
+
const lines = [
|
|
232142
232142
|
"<validated-learning-signal>",
|
|
232143
232143
|
"The same verification command failed and now succeeds in this user turn.",
|
|
232144
232144
|
"Use MistakeRecord only when the red-to-green result exposes a reusable lesson.",
|
|
232145
232145
|
"Do not record transient environment failures, raw command output, or a success with no general repetition guard.",
|
|
232146
|
-
"If there is a reusable lesson, record the incorrect assumption, the measured correction, and the concrete condition that would cause it again."
|
|
232147
|
-
|
|
232148
|
-
|
|
232146
|
+
"If there is a reusable lesson, record the incorrect assumption, the measured correction, and the concrete condition that would cause it again."
|
|
232147
|
+
];
|
|
232148
|
+
if (typeof signal?.id === "string" && signal.id.length > 0) {
|
|
232149
|
+
lines.push(`When recording this lesson, pass candidateId "${signal.id}" so only this candidate is resolved.`);
|
|
232150
|
+
}
|
|
232151
|
+
lines.push("</validated-learning-signal>");
|
|
232152
|
+
return lines.join("\n");
|
|
232149
232153
|
}
|
|
232150
232154
|
var ValidatedLearningSignalInjector, syncValidatedLearningCandidate;
|
|
232151
232155
|
var init_validated_learning_signal = __esmMin((() => {
|
|
@@ -232163,7 +232167,7 @@ var init_validated_learning_signal = __esmMin((() => {
|
|
|
232163
232167
|
if (existing.length > 0) this.agent.context.removeSystemRemindersMatching(isValidatedLearningSignalReminder);
|
|
232164
232168
|
return;
|
|
232165
232169
|
}
|
|
232166
|
-
const injection = buildValidatedLearningSignalReminder();
|
|
232170
|
+
const injection = buildValidatedLearningSignalReminder(signal);
|
|
232167
232171
|
const expected = `<system-reminder>\n${injection}\n</system-reminder>`;
|
|
232168
232172
|
if (existing.length === 1 && reminderText(existing[0]) === expected) return;
|
|
232169
232173
|
this.agent.context.removeSystemRemindersMatching(isValidatedLearningSignalReminder);
|
|
@@ -263285,7 +263289,8 @@ var init_mistake_record = __esmMin((() => {
|
|
|
263285
263289
|
about: string().min(1).describe("Who made the original claim (agent name, or \"me\" for yourself)."),
|
|
263286
263290
|
claim: string().min(1).describe("What was claimed — one sentence."),
|
|
263287
263291
|
measurement: string().min(1).describe("What was actually measured — one sentence."),
|
|
263288
|
-
condition: string().min(1).describe("Under what condition this mistake will happen again. Required — without it the entry is discarded by A2.")
|
|
263292
|
+
condition: string().min(1).describe("Under what condition this mistake will happen again. Required — without it the entry is discarded by A2."),
|
|
263293
|
+
candidateId: string().optional().describe("Optional validated-learning candidate ID. Pass the exact ID from the current reminder so only that candidate is resolved.")
|
|
263289
263294
|
}).strict();
|
|
263290
263295
|
MistakeRecordTool = class {
|
|
263291
263296
|
agent;
|