blun-king-cli 9.1.395 → 9.1.397
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/LIESMICH.txt +28 -0
- package/README.md +26 -0
- package/bin/goal-completion-evidence-policy.cjs +57 -0
- package/bin/turn-tool-performance-policy.cjs +99 -1
- package/blun.mjs +18 -7
- package/package.json +1 -1
package/LIESMICH.txt
CHANGED
|
@@ -364,6 +364,34 @@ Folgeturns hinweg gespeichert. Solange er offen ist, bleibt `GetMedia`
|
|
|
364
364
|
verfügbar; King prüft den tatsächlichen Status, statt fälschlich zu behaupten,
|
|
365
365
|
die Medienerzeugung sei nicht verfügbar.
|
|
366
366
|
|
|
367
|
+
Passende Werkzeuge ohne Such-Zwischenschritt
|
|
368
|
+
---------------------------------------------
|
|
369
|
+
|
|
370
|
+
Ab BLUN King 9.1.396 vergleicht King die aktuelle Anfrage mit den bereits
|
|
371
|
+
registrierten Werkzeugbeschreibungen. Bei eindeutiger Übereinstimmung lädt er
|
|
372
|
+
für diesen Zug höchstens zwei passende, sonst zurückgestellte Schemata direkt.
|
|
373
|
+
Name, Beschreibung, Parameterhinweise und Beispiele dürfen zur Auswahl
|
|
374
|
+
beitragen; frühere Nachrichten außerhalb des aktuellen Telegram-Kanalblocks
|
|
375
|
+
zählen nicht als neue Absicht.
|
|
376
|
+
|
|
377
|
+
ToolSearch bleibt für unklare, unbekannte und mehrdeutige Anfragen vollständig
|
|
378
|
+
verfügbar. Eine automatische Auswahl wird nicht dauerhaft gespeichert und
|
|
379
|
+
vergrößert den residenten Werkzeugsatz nicht. Dadurch kann eine natürliche
|
|
380
|
+
Anweisung wie "Zeig mir den letzten Telegram-Verlauf" das passende Werkzeug im
|
|
381
|
+
selben Modellschritt erhalten, während Begrüßungen und fachfremde Anfragen keine
|
|
382
|
+
zusätzlichen Schemata laden.
|
|
383
|
+
|
|
384
|
+
Abschlussbedingungen mit Laufzeitbeleg
|
|
385
|
+
--------------------------------------
|
|
386
|
+
|
|
387
|
+
Ab BLUN King 9.1.397 kann ein autonomes Ziel mit ausdrücklich gesetzter
|
|
388
|
+
Abschlussbedingung nicht mehr allein aufgrund einer Textbehauptung als fertig
|
|
389
|
+
markiert werden. Vor dem Abschluss muss ein aktueller Prüf-Checkpoint vorliegen,
|
|
390
|
+
der auf mindestens einem erfolgreichen Laufzeitwerkzeug beruht und als verifiziert
|
|
391
|
+
eingestuft ist. Fehlt dieser Beleg, bleibt das Ziel aktiv und King erhält eine
|
|
392
|
+
konkrete Nachbesserung statt einer falschen Fertigmeldung. Ziele ohne ausdrücklich
|
|
393
|
+
gesetzte Abschlussbedingung behalten ihr bisheriges Verhalten.
|
|
394
|
+
|
|
367
395
|
Angehängte Bilder werden weiterhin mit ReadMediaFile gelesen. Bild-, Video- und
|
|
368
396
|
Spracherzeugung laufen asynchron, sodass die Konsole während der Verarbeitung
|
|
369
397
|
nutzbar bleibt. GenerateVideo kann außerdem einen abgeschlossenen Bildauftrag
|
package/README.md
CHANGED
|
@@ -375,6 +375,32 @@ Folgeturns hinweg gespeichert. Solange er offen ist, bleibt `GetMedia`
|
|
|
375
375
|
verfügbar; King prüft den tatsächlichen Status, statt fälschlich zu behaupten,
|
|
376
376
|
die Medienerzeugung sei nicht verfügbar.
|
|
377
377
|
|
|
378
|
+
## Passende Werkzeuge ohne Such-Zwischenschritt
|
|
379
|
+
|
|
380
|
+
Ab BLUN King 9.1.396 vergleicht King die aktuelle Anfrage mit den bereits
|
|
381
|
+
registrierten Werkzeugbeschreibungen. Bei eindeutiger Übereinstimmung lädt er
|
|
382
|
+
für diesen Zug höchstens zwei passende, sonst zurückgestellte Schemata direkt.
|
|
383
|
+
Name, Beschreibung, Parameterhinweise und Beispiele dürfen zur Auswahl
|
|
384
|
+
beitragen; frühere Nachrichten außerhalb des aktuellen Telegram-Kanalblocks
|
|
385
|
+
zählen nicht als neue Absicht.
|
|
386
|
+
|
|
387
|
+
`ToolSearch` bleibt für unklare, unbekannte und mehrdeutige Anfragen vollständig
|
|
388
|
+
verfügbar. Eine automatische Auswahl wird nicht dauerhaft gespeichert und
|
|
389
|
+
vergrößert den residenten Werkzeugsatz nicht. Dadurch kann eine natürliche
|
|
390
|
+
Anweisung wie „Zeig mir den letzten Telegram-Verlauf“ das passende Werkzeug im
|
|
391
|
+
selben Modellschritt erhalten, während Begrüßungen und fachfremde Anfragen keine
|
|
392
|
+
zusätzlichen Schemata laden.
|
|
393
|
+
|
|
394
|
+
## Abschlussbedingungen mit Laufzeitbeleg
|
|
395
|
+
|
|
396
|
+
Ab BLUN King 9.1.397 kann ein autonomes Ziel mit ausdrücklich gesetzter
|
|
397
|
+
Abschlussbedingung nicht mehr allein aufgrund einer Textbehauptung als fertig
|
|
398
|
+
markiert werden. Vor dem Abschluss muss ein aktueller Prüf-Checkpoint vorliegen,
|
|
399
|
+
der auf mindestens einem erfolgreichen Laufzeitwerkzeug beruht und als verifiziert
|
|
400
|
+
eingestuft ist. Fehlt dieser Beleg, bleibt das Ziel aktiv und King erhält eine
|
|
401
|
+
konkrete Nachbesserung statt einer falschen Fertigmeldung. Ziele ohne ausdrücklich
|
|
402
|
+
gesetzte Abschlussbedingung behalten ihr bisheriges Verhalten.
|
|
403
|
+
|
|
378
404
|
Angehängte Bilder werden weiterhin mit `ReadMediaFile` gelesen. Bild-, Video-
|
|
379
405
|
und Spracherzeugung laufen asynchron, sodass die Konsole während der Verarbeitung
|
|
380
406
|
nutzbar bleibt. `GenerateVideo` kann außerdem einen abgeschlossenen Bildauftrag
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function hasCompletionCriterion(goal) {
|
|
4
|
+
return typeof goal?.completionCriterion === 'string'
|
|
5
|
+
&& goal.completionCriterion.trim().length > 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function successfulRuntimeEvidence(checkpoint) {
|
|
9
|
+
const successfulTools = Number(checkpoint?.evidenceReceipt?.successfulTools);
|
|
10
|
+
return Number.isSafeInteger(successfulTools) && successfulTools > 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function evaluateGoalCompletionEvidence(goal) {
|
|
14
|
+
if (!hasCompletionCriterion(goal)) {
|
|
15
|
+
return {
|
|
16
|
+
required: false,
|
|
17
|
+
allPassed: true,
|
|
18
|
+
result: 'satisfied',
|
|
19
|
+
gaps: [],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const checkpoint = goal?.actionCheckpoint;
|
|
24
|
+
if (!checkpoint || typeof checkpoint !== 'object' || Array.isArray(checkpoint)) {
|
|
25
|
+
return {
|
|
26
|
+
required: true,
|
|
27
|
+
allPassed: false,
|
|
28
|
+
result: 'needs_revision',
|
|
29
|
+
gaps: ['Save a verify-phase action checkpoint before completing the goal.'],
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const gaps = [];
|
|
34
|
+
if (checkpoint.phase !== 'verify') {
|
|
35
|
+
gaps.push('The latest action checkpoint must be in the verify phase.');
|
|
36
|
+
}
|
|
37
|
+
if (checkpoint.evidenceBasis !== 'runtime_tool') {
|
|
38
|
+
gaps.push('The completion proof must come from a runtime tool.');
|
|
39
|
+
}
|
|
40
|
+
if (checkpoint.epistemicState !== 'verified') {
|
|
41
|
+
gaps.push('The completion proof must be classified as verified.');
|
|
42
|
+
}
|
|
43
|
+
if (!successfulRuntimeEvidence(checkpoint)) {
|
|
44
|
+
gaps.push('The runtime evidence receipt must contain at least one successful tool result.');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
required: true,
|
|
49
|
+
allPassed: gaps.length === 0,
|
|
50
|
+
result: gaps.length === 0 ? 'satisfied' : 'needs_revision',
|
|
51
|
+
gaps,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
module.exports = {
|
|
56
|
+
evaluateGoalCompletionEvidence,
|
|
57
|
+
};
|
|
@@ -5,13 +5,20 @@ const TOOL_SCHEMA_MAX_TOKENS = 32_000;
|
|
|
5
5
|
const DEFERRED_TOOL_LOADER_NAME = 'ToolSearch';
|
|
6
6
|
const MAX_PERSISTENT_DEFERRED_TOOLS = 4;
|
|
7
7
|
const MAX_TOOL_SEARCH_QUERY_CHARS = 1_000;
|
|
8
|
+
const MAX_AUTO_RANKED_TOOLS = 2;
|
|
9
|
+
const TOOL_RANK_STOP_WORDS = new Set([
|
|
10
|
+
'aber', 'also', 'and', 'aus', 'bitte', 'can', 'das', 'den', 'der', 'des', 'die', 'dies', 'diese',
|
|
11
|
+
'du', 'ein', 'eine', 'einer', 'eines', 'for', 'fuer', 'für', 'haben', 'ich', 'ist', 'kann', 'kannst',
|
|
12
|
+
'mal', 'me', 'mein', 'meine', 'mir', 'mit', 'of', 'please', 'soll', 'the', 'und', 'uns', 'von',
|
|
13
|
+
'was', 'wir', 'with', 'you', 'zeige', 'zeig', 'pruefe', 'prüfe', 'lies', 'read', 'show', 'get',
|
|
14
|
+
]);
|
|
8
15
|
const TOOL_SEARCH_INTENT_WORDS = new Set([
|
|
9
16
|
'find', 'fetch', 'get', 'holen', 'list', 'read', 'search', 'show', 'anzeigen', 'lesen', 'suchen',
|
|
10
17
|
]);
|
|
11
18
|
const TOOL_SEARCH_RELATED_TERM_GROUPS = Object.freeze([
|
|
12
19
|
Object.freeze([
|
|
13
20
|
'current', 'inbox', 'latest', 'message', 'messages', 'nachricht', 'nachrichten', 'queue', 'queued',
|
|
14
|
-
'recent', 'update', 'updates',
|
|
21
|
+
'recent', 'letzte', 'letzten', 'letzter', 'vergangen', 'update', 'updates',
|
|
15
22
|
]),
|
|
16
23
|
Object.freeze([
|
|
17
24
|
'chat', 'conversation', 'history', 'log', 'logs', 'processed', 'protokoll', 'transcript', 'verlauf',
|
|
@@ -165,6 +172,96 @@ function relatedSearchTerms(token) {
|
|
|
165
172
|
return group || [token];
|
|
166
173
|
}
|
|
167
174
|
|
|
175
|
+
function rankingIntentTexts(value) {
|
|
176
|
+
const text = String(value || '');
|
|
177
|
+
const channelBodies = [...text.matchAll(
|
|
178
|
+
/(?:^|\r?\n)<channel\b[^>]*>\r?\n([\s\S]*?)\r?\n<\/channel>(?=\r?\n|$)/giu,
|
|
179
|
+
)].map((match) => match[1]);
|
|
180
|
+
return channelBodies.length > 0 ? channelBodies : [text];
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function rankingTokens(value) {
|
|
184
|
+
return [...new Set(String(value || '')
|
|
185
|
+
.normalize('NFKC')
|
|
186
|
+
.toLowerCase()
|
|
187
|
+
.match(/[\p{L}\p{N}]{3,}/gu) || [])]
|
|
188
|
+
.filter((token) => !TOOL_RANK_STOP_WORDS.has(token));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function toolRankingDocument(tool) {
|
|
192
|
+
const name = String(tool?.name || '');
|
|
193
|
+
const leaf = name.split(/__|:/).at(-1) || name;
|
|
194
|
+
const nameTokens = rankingTokens(`${name.replaceAll('_', ' ')} ${leaf.replaceAll('_', ' ')}`);
|
|
195
|
+
const descriptionTokens = rankingTokens(tool?.description);
|
|
196
|
+
const parameterText = [];
|
|
197
|
+
const properties = tool?.parameters?.properties;
|
|
198
|
+
if (properties && typeof properties === 'object') {
|
|
199
|
+
for (const [parameterName, definition] of Object.entries(properties)) {
|
|
200
|
+
parameterText.push(parameterName, definition?.description || '');
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const exampleText = Array.isArray(tool?.examples)
|
|
204
|
+
? tool.examples.map((example) => example?.prompt || '').join(' ')
|
|
205
|
+
: '';
|
|
206
|
+
return {
|
|
207
|
+
name,
|
|
208
|
+
nameTokens: new Set(nameTokens),
|
|
209
|
+
descriptionTokens: new Set(descriptionTokens),
|
|
210
|
+
detailTokens: new Set(rankingTokens(`${parameterText.join(' ')} ${exampleText}`)),
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function tokenMatchScore(document, token) {
|
|
215
|
+
if (document.nameTokens.has(token)) return 10;
|
|
216
|
+
if (document.descriptionTokens.has(token)) return 5;
|
|
217
|
+
if (document.detailTokens.has(token)) return 4;
|
|
218
|
+
const related = relatedSearchTerms(token).filter((term) => term !== token);
|
|
219
|
+
if (related.some((term) => document.nameTokens.has(term))) return 5;
|
|
220
|
+
if (related.some((term) => document.descriptionTokens.has(term))) return 3;
|
|
221
|
+
if (related.some((term) => document.detailTokens.has(term))) return 2;
|
|
222
|
+
return 0;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Select a tiny, high-confidence subset of deferred schemas for the current
|
|
227
|
+
* request. This mirrors AnythingLLM's tool-reranker boundary without adding an
|
|
228
|
+
* embedding runtime: King reuses the descriptions it already owns and keeps
|
|
229
|
+
* ToolSearch available whenever the lexical evidence is weak or ambiguous.
|
|
230
|
+
*/
|
|
231
|
+
function rankedToolNamesForTurnText(tools, value, options = {}) {
|
|
232
|
+
const maxTools = Math.max(0, Math.min(
|
|
233
|
+
MAX_AUTO_RANKED_TOOLS,
|
|
234
|
+
Number.isInteger(options.maxTools) ? options.maxTools : MAX_AUTO_RANKED_TOOLS,
|
|
235
|
+
));
|
|
236
|
+
if (maxTools === 0) return new Set();
|
|
237
|
+
const queryTokens = [...new Set(rankingIntentTexts(value).flatMap(rankingTokens))];
|
|
238
|
+
if (queryTokens.length === 0) return new Set();
|
|
239
|
+
|
|
240
|
+
const ranked = (Array.isArray(tools) ? tools : []).map((tool) => {
|
|
241
|
+
const document = toolRankingDocument(tool);
|
|
242
|
+
if (!document.name) return null;
|
|
243
|
+
let score = 0;
|
|
244
|
+
let matchedTokens = 0;
|
|
245
|
+
let exactNameMatches = 0;
|
|
246
|
+
for (const token of queryTokens) {
|
|
247
|
+
const tokenScore = tokenMatchScore(document, token);
|
|
248
|
+
if (tokenScore === 0) continue;
|
|
249
|
+
score += tokenScore;
|
|
250
|
+
matchedTokens += 1;
|
|
251
|
+
if (document.nameTokens.has(token)) exactNameMatches += 1;
|
|
252
|
+
}
|
|
253
|
+
const highConfidence = matchedTokens >= 2 || (exactNameMatches >= 1 && score >= 10);
|
|
254
|
+
return highConfidence ? { name: document.name, score, matchedTokens, exactNameMatches } : null;
|
|
255
|
+
}).filter(Boolean).sort((left, right) => (
|
|
256
|
+
right.matchedTokens - left.matchedTokens
|
|
257
|
+
|| right.score - left.score
|
|
258
|
+
|| right.exactNameMatches - left.exactNameMatches
|
|
259
|
+
|| left.name.localeCompare(right.name)
|
|
260
|
+
));
|
|
261
|
+
|
|
262
|
+
return new Set(ranked.slice(0, maxTools).map((entry) => entry.name));
|
|
263
|
+
}
|
|
264
|
+
|
|
168
265
|
function searchRelatedDeferredTools(tools, query, options = {}) {
|
|
169
266
|
const normalized = normalizeDeferredToolQuery(query).toLowerCase();
|
|
170
267
|
if (!normalized || normalized.startsWith('select:')) return [];
|
|
@@ -351,6 +448,7 @@ module.exports = {
|
|
|
351
448
|
mediaGenerationToolNamesForText,
|
|
352
449
|
mediaToolNamesForTurnText,
|
|
353
450
|
normalizeDeferredToolQuery,
|
|
451
|
+
rankedToolNamesForTurnText,
|
|
354
452
|
rememberDeferredToolAfterNotFound,
|
|
355
453
|
toolSchemaBudgetTokens,
|
|
356
454
|
};
|
package/blun.mjs
CHANGED
|
@@ -21447,6 +21447,7 @@ var { projectSoulText } = createRequire(import.meta.url)("./bin/soul-organizatio
|
|
|
21447
21447
|
var { soulFileInstruction } = createRequire(import.meta.url)("./bin/soul-preservation-policy.cjs");
|
|
21448
21448
|
var { readProfilePersona, resolveSoulFile } = createRequire(import.meta.url)("./bin/profile-identity-resolution.cjs");
|
|
21449
21449
|
var { advanceActionEvidenceReceipt, assertActionCheckpointEvidenceBasis, assertActionCheckpointRevision, emptyActionEvidenceReceipt, normalizeActionCheckpoint, projectActionCheckpoint } = createRequire(import.meta.url)("./bin/cognitive-action-checkpoint.cjs");
|
|
21450
|
+
var { evaluateGoalCompletionEvidence } = createRequire(import.meta.url)("./bin/goal-completion-evidence-policy.cjs");
|
|
21450
21451
|
async function prepareSystemPromptContext(kaos, brandHome, options) {
|
|
21451
21452
|
const additionalDirs = normalizeAdditionalDirs(options?.additionalDirs ?? []);
|
|
21452
21453
|
const [cwdListing, agentsMdResult, additionalDirsInfo] = await Promise.all([
|
|
@@ -230394,6 +230395,10 @@ var init_goal$1 = __esmMin((() => {
|
|
|
230394
230395
|
async markComplete(input = {}, actor = "model") {
|
|
230395
230396
|
const state = this.state;
|
|
230396
230397
|
if (state === void 0 || state.status !== "active") return null;
|
|
230398
|
+
const completionEvidence = evaluateGoalCompletionEvidence(state);
|
|
230399
|
+
if (!completionEvidence.allPassed) {
|
|
230400
|
+
throw new BlunError(ErrorCodes.GOAL_STATUS_INVALID, `Completion criterion needs revision: ${completionEvidence.gaps.join(" ")} Run the required verification, save a runtime-backed verify checkpoint, then mark the goal complete.`);
|
|
230401
|
+
}
|
|
230397
230402
|
const mcInjector = this.agent.injection?.getMissionContractInjector();
|
|
230398
230403
|
if (mcInjector) {
|
|
230399
230404
|
const evaluation = mcInjector.evaluate();
|
|
@@ -261514,7 +261519,7 @@ function toolResultText(result) {
|
|
|
261514
261519
|
function abandonedToolResultOutput(ended) {
|
|
261515
261520
|
return `Tool call did not complete: ${ended.reason === "cancelled" ? "the turn was cancelled" : ended.reason === "failed" ? `the turn failed${ended.error !== void 0 ? ` (${ended.error.message})` : ""}` : "the turn ended"} before its result was recorded. Do not assume the tool completed successfully.`;
|
|
261516
261521
|
}
|
|
261517
|
-
var BLUN_CORE_TOOL_NAMES, BLUN_LEAN_TOOL_NAMES, BLUN_ATTACHMENT_MARKER_RE, BLUN_TELEGRAM_OUTBOUND_TOOL_RE, BLUN_TELEGRAM_CHANNEL_RE, BLUN_TOOL_BUDGET_RATIO, createDeferredToolLoader, mediaToolNamesForTurnText, rememberDeferredToolAfterNotFound, toolSchemaBudgetTokens, projectRecurringCronHistory, TelegramDeliveryLedger, createRuntimeCognitiveTurnLifecycle, cognitiveFocusScopesForTurn, buildCognitiveWorkFocus, buildAttentionQueueItem, LLM_NOT_SET_MESSAGE, GOAL_CONTINUATION_ORIGIN, GOAL_COMPLETION_REMINDER_NAME, GOAL_BLOCKED_REMINDER_NAME, GOAL_RATE_LIMIT_PAUSE_REASON, GOAL_PROVIDER_CONNECTION_PAUSE_PREFIX, GOAL_PROVIDER_AUTH_PAUSE_PREFIX, GOAL_PROVIDER_API_PAUSE_PREFIX, GOAL_MODEL_CONFIG_PAUSE_PREFIX, GOAL_RUNTIME_PAUSE_PREFIX, GOAL_PROVIDER_FILTERED_PAUSE_REASON, GOAL_CONTINUATION_PROMPT, TurnFlow;
|
|
261522
|
+
var BLUN_CORE_TOOL_NAMES, BLUN_LEAN_TOOL_NAMES, BLUN_ATTACHMENT_MARKER_RE, BLUN_TELEGRAM_OUTBOUND_TOOL_RE, BLUN_TELEGRAM_CHANNEL_RE, BLUN_TOOL_BUDGET_RATIO, createDeferredToolLoader, mediaToolNamesForTurnText, rankedToolNamesForTurnText, rememberDeferredToolAfterNotFound, toolSchemaBudgetTokens, projectRecurringCronHistory, TelegramDeliveryLedger, createRuntimeCognitiveTurnLifecycle, cognitiveFocusScopesForTurn, buildCognitiveWorkFocus, buildAttentionQueueItem, LLM_NOT_SET_MESSAGE, GOAL_CONTINUATION_ORIGIN, GOAL_COMPLETION_REMINDER_NAME, GOAL_BLOCKED_REMINDER_NAME, GOAL_RATE_LIMIT_PAUSE_REASON, GOAL_PROVIDER_CONNECTION_PAUSE_PREFIX, GOAL_PROVIDER_AUTH_PAUSE_PREFIX, GOAL_PROVIDER_API_PAUSE_PREFIX, GOAL_MODEL_CONFIG_PAUSE_PREFIX, GOAL_RUNTIME_PAUSE_PREFIX, GOAL_PROVIDER_FILTERED_PAUSE_REASON, GOAL_CONTINUATION_PROMPT, TurnFlow;
|
|
261518
261523
|
var init_turn = __esmMin((() => {
|
|
261519
261524
|
init_dist$4();
|
|
261520
261525
|
init_src$4();
|
|
@@ -261531,7 +261536,7 @@ var init_turn = __esmMin((() => {
|
|
|
261531
261536
|
init_tool_result_budget();
|
|
261532
261537
|
init_user_message_offload();
|
|
261533
261538
|
init_assistant_message_offload();
|
|
261534
|
-
({ CORE_TOOL_NAMES: BLUN_CORE_TOOL_NAMES, createDeferredToolLoader, mediaToolNamesForTurnText, rememberDeferredToolAfterNotFound, toolSchemaBudgetTokens } = createRequire(import.meta.url)("./bin/turn-tool-performance-policy.cjs"));
|
|
261539
|
+
({ CORE_TOOL_NAMES: BLUN_CORE_TOOL_NAMES, createDeferredToolLoader, mediaToolNamesForTurnText, rankedToolNamesForTurnText, rememberDeferredToolAfterNotFound, toolSchemaBudgetTokens } = createRequire(import.meta.url)("./bin/turn-tool-performance-policy.cjs"));
|
|
261535
261540
|
({ projectRecurringCronHistory } = createRequire(import.meta.url)("./bin/recurring-cron-history-policy.cjs"));
|
|
261536
261541
|
({ TelegramDeliveryLedger } = createRequire(import.meta.url)("./bin/repeated-user-message-projection.cjs"));
|
|
261537
261542
|
({ createRuntimeCognitiveTurnLifecycle } = createRequire(import.meta.url)("./bin/cognitive-turn-lifecycle.cjs"));
|
|
@@ -262265,12 +262270,13 @@ var init_turn = __esmMin((() => {
|
|
|
262265
262270
|
variant: "cognitive_continuity"
|
|
262266
262271
|
});
|
|
262267
262272
|
this.setActiveSteerAcceptance(turnId, true);
|
|
262273
|
+
const turnText = blunExtractText(input);
|
|
262268
262274
|
const turnNeedsTools = blunTurnNeedsTools(input, origin);
|
|
262269
262275
|
const turnHasAttachment = blunTurnHasAttachment(input);
|
|
262270
262276
|
const turnThinkingEffort = turnHasAttachment ? void 0 : selectThinkingEffortForTurn(blunExtractText(blunThinkingIntentInput(input)), origin.kind);
|
|
262271
262277
|
const fastConversation = turnThinkingEffort === "off" || turnThinkingEffort === "low";
|
|
262272
262278
|
const pendingMediaJobIds = this.agent.toolServices?.media?.pendingMediaJobIds?.() ?? [];
|
|
262273
|
-
const requiredToolNames = mediaToolNamesForTurnText(
|
|
262279
|
+
const requiredToolNames = mediaToolNamesForTurnText(turnText);
|
|
262274
262280
|
const turnSystemPrompt = pendingMediaJobIds.length > 0 ? blunPendingMediaSystemPrompt(fastConversation ? this.agent.fastConversationSystemPrompt : this.agent.effectiveSystemPrompt, pendingMediaJobIds) : fastConversation ? this.agent.fastConversationSystemPrompt : void 0;
|
|
262275
262281
|
const turnLLM = this.agent.llmForTurn(turnThinkingEffort, turnSystemPrompt);
|
|
262276
262282
|
let previousStepToolOutcome = "initial";
|
|
@@ -262285,10 +262291,13 @@ var init_turn = __esmMin((() => {
|
|
|
262285
262291
|
const originTools = blunToolsForOrigin(this.agent.injection.filterPersonalMemoryToolsForTurn(turnId, input, origin, this.agent.tools.loopTools), origin);
|
|
262286
262292
|
const compactConversationTool = originTools.find((tool) => tool.name === "CompactConversation");
|
|
262287
262293
|
const eligibleTools = originTools.filter((tool) => tool.name !== "CompactConversation" || this.agent.fullCompaction.isProactiveCompactionEligible());
|
|
262294
|
+
const turnRequiredToolNames = new Set(requiredToolNames);
|
|
262295
|
+
const rankedToolNames = rankedToolNamesForTurnText(eligibleTools, turnText);
|
|
262296
|
+
for (const name of rankedToolNames) turnRequiredToolNames.add(name);
|
|
262288
262297
|
const toolSelection = fastConversation ? {
|
|
262289
|
-
tools: [...blunFastConversationTools(eligibleTools, input, pendingMediaJobIds,
|
|
262298
|
+
tools: [...blunFastConversationTools(eligibleTools, input, pendingMediaJobIds, turnRequiredToolNames)],
|
|
262290
262299
|
deferredToolCount: 0
|
|
262291
|
-
} : turnNeedsTools ? blunSelectTurnTools(eligibleTools, this.agent.config.modelCapabilities?.max_context_tokens, this.loadedToolNames,
|
|
262300
|
+
} : turnNeedsTools ? blunSelectTurnTools(eligibleTools, this.agent.config.modelCapabilities?.max_context_tokens, this.loadedToolNames, turnRequiredToolNames) : {
|
|
262292
262301
|
tools: [],
|
|
262293
262302
|
deferredToolCount: 0
|
|
262294
262303
|
};
|
|
@@ -262356,7 +262365,9 @@ var init_turn = __esmMin((() => {
|
|
|
262356
262365
|
const steerThinkingEffort = "low";
|
|
262357
262366
|
const steerPendingMediaJobIds = this.agent.toolServices?.media?.pendingMediaJobIds?.() ?? [];
|
|
262358
262367
|
const steerLLM = this.agent.llmForTurn(steerThinkingEffort, blunPendingMediaSystemPrompt(this.agent.fastConversationSystemPrompt, steerPendingMediaJobIds));
|
|
262359
|
-
const
|
|
262368
|
+
const steerText = blunExtractText(steerInput);
|
|
262369
|
+
const steerRequiredToolNames = mediaToolNamesForTurnText(steerText);
|
|
262370
|
+
for (const name of rankedToolNamesForTurnText(eligibleTools, steerText)) steerRequiredToolNames.add(name);
|
|
262360
262371
|
const steerTools = [...blunFastConversationTools(eligibleTools, steerInput, steerPendingMediaJobIds, steerRequiredToolNames)];
|
|
262361
262372
|
const steerHistory = () => blunFastConversationHistory(this.agent.context.history);
|
|
262362
262373
|
const buildSteerMessages = () => this.agent.context.project(steerHistory(), { dropOrphanResults: true });
|
|
@@ -262704,7 +262715,7 @@ var init_outcome_prompts = __esmMin((() => {}));
|
|
|
262704
262715
|
//#region ../../packages/agent-core/src/tools/builtin/goal/update-goal.md?raw
|
|
262705
262716
|
var update_goal_default;
|
|
262706
262717
|
var init_update_goal$1 = __esmMin((() => {
|
|
262707
|
-
update_goal_default = "Update the current autonomous goal. Set `status` only for a lifecycle change. After a coherent work slice, save `actionCheckpoint` with a monotone revision, the last verified result, exact next action, expected evidence, and an explicit evidence basis. Use `runtime_tool` only when a successful tool in this turn measured the result; use `user_statement` for a direct user assertion, `external_report` for a report not independently measured here, and `carried_forward` only when the last verified text is unchanged. Classify knowledge as `verified`, `credible_unverified`, `hypothesis`, `uncertain_memory`, `stale`, or `unknown`; never present a weaker state as verified, and preserve the state on carry-forward. Start at revision 1 and increment the currently projected revision by exactly one; stale writers fail closed. This is durable progress state, not permission, and should change only when the facts change. A checkpoint-only call keeps the goal active.\n\n- `active` — resume a paused or blocked goal when the user explicitly asks you to work on that goal.\n- `complete` — the objective is fully satisfied, all files are written, all tests pass, and any stated validation has passed.\n- `blocked` — a genuine external condition or required user decision prevents progress.\n- `paused` — set the goal aside for now.\n\nDo not mark complete after a plan or partial result. If useful work remains, checkpoint it and continue. Do not ask for permission merely to execute an already authorized checkpoint; ask only at a real rights boundary or missing user decision.\n";
|
|
262718
|
+
update_goal_default = "Update the current autonomous goal. Set `status` only for a lifecycle change. After a coherent work slice, save `actionCheckpoint` with a monotone revision, the last verified result, exact next action, expected evidence, and an explicit evidence basis. Use `runtime_tool` only when a successful tool in this turn measured the result; use `user_statement` for a direct user assertion, `external_report` for a report not independently measured here, and `carried_forward` only when the last verified text is unchanged. Classify knowledge as `verified`, `credible_unverified`, `hypothesis`, `uncertain_memory`, `stale`, or `unknown`; never present a weaker state as verified, and preserve the state on carry-forward. Start at revision 1 and increment the currently projected revision by exactly one; stale writers fail closed. This is durable progress state, not permission, and should change only when the facts change. A checkpoint-only call keeps the goal active.\n\n- `active` — resume a paused or blocked goal when the user explicitly asks you to work on that goal.\n- `complete` — the objective is fully satisfied, all files are written, all tests pass, and any stated validation has passed. When the goal has a completion criterion, first save a `verify` checkpoint with `runtime_tool`, `verified`, and a successful runtime evidence receipt.\n- `blocked` — a genuine external condition or required user decision prevents progress.\n- `paused` — set the goal aside for now.\n\nDo not mark complete after a plan or partial result. If useful work remains, checkpoint it and continue. Do not ask for permission merely to execute an already authorized checkpoint; ask only at a real rights boundary or missing user decision.\n";
|
|
262708
262719
|
}));
|
|
262709
262720
|
//#endregion
|
|
262710
262721
|
//#region ../../packages/agent-core/src/tools/builtin/goal/update-goal.ts
|