blun-king-cli 9.1.288 → 9.1.290
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/context-doctor-policy.cjs +70 -0
- package/bin/launcher-runtime.js +1 -0
- package/bin/mnemo-connect-heartbeat.cjs +35 -2
- package/blun.mjs +166 -9
- package/package.json +2 -3
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function wholeNonNegative(value) {
|
|
4
|
+
if (!Number.isFinite(value) || value <= 0) return 0;
|
|
5
|
+
return Math.floor(value);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function claimTokens(remaining, value) {
|
|
9
|
+
return Math.min(remaining, wholeNonNegative(value));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function buildContextDoctor(input = {}) {
|
|
13
|
+
const projectedTokens = wholeNonNegative(input.projectedTokenCount);
|
|
14
|
+
const maxTokens = wholeNonNegative(input.effectiveMaxContextTokens);
|
|
15
|
+
const conversationTokens = wholeNonNegative(input.conversationTokens);
|
|
16
|
+
|
|
17
|
+
const systemTotal = wholeNonNegative(input.systemPromptTokens);
|
|
18
|
+
let systemRemaining = systemTotal;
|
|
19
|
+
const personalityTokens = claimTokens(systemRemaining, input.personalityPromptTokens);
|
|
20
|
+
systemRemaining -= personalityTokens;
|
|
21
|
+
const socialTokens = claimTokens(systemRemaining, input.socialPromptTokens);
|
|
22
|
+
systemRemaining -= socialTokens;
|
|
23
|
+
const skillTokens = claimTokens(systemRemaining, input.skillPromptTokens);
|
|
24
|
+
systemRemaining -= skillTokens;
|
|
25
|
+
const runtimeTokens = claimTokens(systemRemaining, input.runtimePromptTokens);
|
|
26
|
+
systemRemaining -= runtimeTokens;
|
|
27
|
+
|
|
28
|
+
const toolTotal = wholeNonNegative(input.toolSchemaTokens);
|
|
29
|
+
let toolRemaining = toolTotal;
|
|
30
|
+
const builtinTokens = claimTokens(toolRemaining, input.builtinToolSchemaTokens);
|
|
31
|
+
toolRemaining -= builtinTokens;
|
|
32
|
+
const userTokens = claimTokens(toolRemaining, input.userToolSchemaTokens);
|
|
33
|
+
toolRemaining -= userTokens;
|
|
34
|
+
const mcpTokens = claimTokens(toolRemaining, input.mcpToolSchemaTokens);
|
|
35
|
+
toolRemaining -= mcpTokens;
|
|
36
|
+
|
|
37
|
+
const accountedTokens = systemTotal + conversationTokens + toolTotal;
|
|
38
|
+
const providerOverheadTokens = Math.max(0, projectedTokens - accountedTokens);
|
|
39
|
+
const freeTokens = Math.max(0, maxTokens - projectedTokens);
|
|
40
|
+
const ratio = maxTokens > 0 ? Math.min(1, projectedTokens / maxTokens) : 0;
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
projectedTokens,
|
|
44
|
+
maxTokens,
|
|
45
|
+
freeTokens,
|
|
46
|
+
ratio,
|
|
47
|
+
providerOverheadTokens,
|
|
48
|
+
conversationTokens,
|
|
49
|
+
system: {
|
|
50
|
+
coreTokens: systemRemaining,
|
|
51
|
+
personalityTokens,
|
|
52
|
+
socialTokens,
|
|
53
|
+
skillTokens,
|
|
54
|
+
runtimeTokens,
|
|
55
|
+
totalTokens: systemTotal,
|
|
56
|
+
},
|
|
57
|
+
tools: {
|
|
58
|
+
builtinTokens,
|
|
59
|
+
userTokens,
|
|
60
|
+
mcpTokens,
|
|
61
|
+
otherTokens: toolRemaining,
|
|
62
|
+
totalTokens: toolTotal,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = {
|
|
68
|
+
buildContextDoctor,
|
|
69
|
+
wholeNonNegative,
|
|
70
|
+
};
|
package/bin/launcher-runtime.js
CHANGED
|
@@ -927,6 +927,7 @@ async function runLauncher(options = {}) {
|
|
|
927
927
|
const mnemoConnect = startMnemoConnectHeartbeat({
|
|
928
928
|
env,
|
|
929
929
|
profileName: PROFILE.profileName,
|
|
930
|
+
mcpConfigPath: path.join(profilePaths.home, 'mcp.json'),
|
|
930
931
|
version: readPackageVersion(),
|
|
931
932
|
});
|
|
932
933
|
try {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const fs = require('node:fs');
|
|
3
4
|
const os = require('node:os');
|
|
4
5
|
|
|
5
6
|
const DEFAULT_HEARTBEAT_MS = 60_000;
|
|
6
7
|
const DEFAULT_TIMEOUT_MS = 5_000;
|
|
8
|
+
const DEFAULT_INTERNAL_HUB_URL = 'http://100.85.21.103:7117';
|
|
7
9
|
|
|
8
10
|
function resolveMnemoHubUrl(env = process.env) {
|
|
9
11
|
const raw = [
|
|
@@ -32,6 +34,29 @@ function resolveMnemoAgentName(profileName, env = process.env) {
|
|
|
32
34
|
return configured || String(profileName || '').trim();
|
|
33
35
|
}
|
|
34
36
|
|
|
37
|
+
function resolveMnemoProfileConnectConfig(configPath) {
|
|
38
|
+
if (typeof configPath !== 'string' || configPath.trim().length === 0) return null;
|
|
39
|
+
try {
|
|
40
|
+
const stat = fs.statSync(configPath);
|
|
41
|
+
if (!stat.isFile() || stat.size > 1024 * 1024) return null;
|
|
42
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
43
|
+
const server = config?.mcpServers?.mnemo;
|
|
44
|
+
if (!server || server.enabled === false || !server.env || typeof server.env !== 'object') return null;
|
|
45
|
+
const agentName = String(server.env.BLUN_MNEMO_AGENT || server.env.MNEMO_AGENT || '').trim();
|
|
46
|
+
if (!agentName || /[\u0000-\u001f\u007f]/u.test(agentName) || agentName.length > 128) return null;
|
|
47
|
+
const configuredUrl = [
|
|
48
|
+
server.env.BLUN_MNEMO_HUB_URL,
|
|
49
|
+
server.env.MNEMO_HUB_URL,
|
|
50
|
+
server.env.MNEMO_URL,
|
|
51
|
+
].some((value) => typeof value === 'string' && value.trim().length > 0);
|
|
52
|
+
const baseUrl = resolveMnemoHubUrl(server.env);
|
|
53
|
+
if (configuredUrl && !baseUrl) return null;
|
|
54
|
+
return { agentName, baseUrl: baseUrl || DEFAULT_INTERNAL_HUB_URL };
|
|
55
|
+
} catch {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
35
60
|
async function postMnemoTool(baseUrl, tool, payload, options = {}) {
|
|
36
61
|
const controller = new AbortController();
|
|
37
62
|
const timeout = (options.setTimeoutImpl || setTimeout)(
|
|
@@ -62,8 +87,14 @@ async function postMnemoTool(baseUrl, tool, payload, options = {}) {
|
|
|
62
87
|
|
|
63
88
|
function startMnemoConnectHeartbeat(options = {}) {
|
|
64
89
|
const env = options.env || process.env;
|
|
65
|
-
const
|
|
66
|
-
|
|
90
|
+
const profileConfig = options.profileConfig
|
|
91
|
+
|| resolveMnemoProfileConnectConfig(options.mcpConfigPath);
|
|
92
|
+
const baseUrl = options.baseUrl || resolveMnemoHubUrl(env) || profileConfig?.baseUrl;
|
|
93
|
+
const configuredAgentName = resolveMnemoAgentName('', env);
|
|
94
|
+
const agentName = options.agentName
|
|
95
|
+
|| configuredAgentName
|
|
96
|
+
|| profileConfig?.agentName
|
|
97
|
+
|| resolveMnemoAgentName(options.profileName, {});
|
|
67
98
|
if (!baseUrl || !agentName) {
|
|
68
99
|
return Object.freeze({ enabled: false, ready: Promise.resolve(false), stop: async () => {} });
|
|
69
100
|
}
|
|
@@ -165,9 +196,11 @@ function startMnemoConnectHeartbeat(options = {}) {
|
|
|
165
196
|
|
|
166
197
|
module.exports = {
|
|
167
198
|
DEFAULT_HEARTBEAT_MS,
|
|
199
|
+
DEFAULT_INTERNAL_HUB_URL,
|
|
168
200
|
DEFAULT_TIMEOUT_MS,
|
|
169
201
|
postMnemoTool,
|
|
170
202
|
resolveMnemoAgentName,
|
|
171
203
|
resolveMnemoHubUrl,
|
|
204
|
+
resolveMnemoProfileConnectConfig,
|
|
172
205
|
startMnemoConnectHeartbeat,
|
|
173
206
|
};
|
package/blun.mjs
CHANGED
|
@@ -264324,6 +264324,16 @@ var init_tool$1 = __esmMin((() => {
|
|
|
264324
264324
|
data() {
|
|
264325
264325
|
return Array.from(this.toolInfos());
|
|
264326
264326
|
}
|
|
264327
|
+
contextSchemaTokenBreakdown() {
|
|
264328
|
+
const totals = { builtin: 0, user: 0, mcp: 0 };
|
|
264329
|
+
for (const tool of this.loopTools) {
|
|
264330
|
+
const tokens = estimateTokensForTools([tool]);
|
|
264331
|
+
if (this.mcpTools.has(tool.name)) totals.mcp += tokens;
|
|
264332
|
+
else if (this.userTools.has(tool.name)) totals.user += tokens;
|
|
264333
|
+
else totals.builtin += tokens;
|
|
264334
|
+
}
|
|
264335
|
+
return totals;
|
|
264336
|
+
}
|
|
264327
264337
|
storeData() {
|
|
264328
264338
|
return { ...this.store };
|
|
264329
264339
|
}
|
|
@@ -265275,15 +265285,30 @@ var init_agent = __esmMin((() => {
|
|
|
265275
265285
|
resumeGoal: () => this.goal.resumeGoal(),
|
|
265276
265286
|
cancelGoal: () => this.goal.cancelGoal(),
|
|
265277
265287
|
getBackgroundOutput: (payload) => this.background.readOutput(payload.taskId, payload.tail),
|
|
265278
|
-
getContext: () =>
|
|
265279
|
-
|
|
265280
|
-
|
|
265281
|
-
|
|
265282
|
-
|
|
265283
|
-
|
|
265284
|
-
|
|
265285
|
-
|
|
265286
|
-
|
|
265288
|
+
getContext: () => {
|
|
265289
|
+
const systemPrompt = this.effectiveSystemPrompt;
|
|
265290
|
+
const includedTokens = (block) => block.length > 0 && systemPrompt.includes(block) ? estimateTokens$1(block) : 0;
|
|
265291
|
+
const personalityPromptTokens = includedTokens(personaSystemBlock()) + includedTokens(soulSystemBlock());
|
|
265292
|
+
const socialPromptTokens = includedTokens(identitySystemBlock()) + includedTokens(naturalPresenceSystemBlock());
|
|
265293
|
+
const skillPrompt = this.skills?.registry.getModelSkillListing() ?? "";
|
|
265294
|
+
const toolBreakdown = this.tools.contextSchemaTokenBreakdown();
|
|
265295
|
+
return {
|
|
265296
|
+
...this.context.data(),
|
|
265297
|
+
projectedTokenCount: this.fullCompaction.estimateCurrentRequestTokens(),
|
|
265298
|
+
effectiveMaxContextTokens: this.fullCompaction.getEffectiveMaxContextTokens(),
|
|
265299
|
+
compactionBudgetTokens: this.fullCompaction.getCompactionBudgetTokens(),
|
|
265300
|
+
systemPromptTokens: estimateTokens$1(systemPrompt),
|
|
265301
|
+
personalityPromptTokens,
|
|
265302
|
+
socialPromptTokens,
|
|
265303
|
+
skillPromptTokens: includedTokens(skillPrompt),
|
|
265304
|
+
runtimePromptTokens: includedTokens(this.runtimeSystemPromptAppend),
|
|
265305
|
+
conversationTokens: estimateTokensForMessages(this.context.messages),
|
|
265306
|
+
toolSchemaTokens: estimateTokensForTools(this.tools.loopTools),
|
|
265307
|
+
builtinToolSchemaTokens: toolBreakdown.builtin,
|
|
265308
|
+
userToolSchemaTokens: toolBreakdown.user,
|
|
265309
|
+
mcpToolSchemaTokens: toolBreakdown.mcp
|
|
265310
|
+
};
|
|
265311
|
+
},
|
|
265287
265312
|
getConfig: () => this.config.data(),
|
|
265288
265313
|
getPermission: () => this.permission.data(),
|
|
265289
265314
|
getPlan: () => this.planMode.data(),
|
|
@@ -403318,6 +403343,13 @@ const BUILTIN_SLASH_COMMAND_DEFINITIONS = [
|
|
|
403318
403343
|
priority: 65,
|
|
403319
403344
|
availability: "always"
|
|
403320
403345
|
},
|
|
403346
|
+
{
|
|
403347
|
+
name: "context-doctor",
|
|
403348
|
+
aliases: [],
|
|
403349
|
+
descriptionKey: "contextDoctor.description",
|
|
403350
|
+
priority: 66,
|
|
403351
|
+
availability: "always"
|
|
403352
|
+
},
|
|
403321
403353
|
{
|
|
403322
403354
|
name: "improve",
|
|
403323
403355
|
aliases: ["learning"],
|
|
@@ -416989,6 +417021,92 @@ registerUiCatalogFragment({
|
|
|
416989
417021
|
"usage.context.title": "Kontextové okno"
|
|
416990
417022
|
}
|
|
416991
417023
|
});
|
|
417024
|
+
registerUiCatalogFragment({
|
|
417025
|
+
en: {
|
|
417026
|
+
"contextDoctor.title": "Context doctor",
|
|
417027
|
+
"contextDoctor.description": "Break down injected context without calling the model",
|
|
417028
|
+
"contextDoctor.core": "Core instructions",
|
|
417029
|
+
"contextDoctor.personality": "Personality and soul",
|
|
417030
|
+
"contextDoctor.social": "Relationships and presence",
|
|
417031
|
+
"contextDoctor.skills": "Skills index",
|
|
417032
|
+
"contextDoctor.runtime": "Runtime additions",
|
|
417033
|
+
"contextDoctor.builtinTools": "Built-in tools",
|
|
417034
|
+
"contextDoctor.userTools": "User tools",
|
|
417035
|
+
"contextDoctor.mcpTools": "MCP tools",
|
|
417036
|
+
"contextDoctor.otherTools": "Other tool schemas",
|
|
417037
|
+
"contextDoctor.providerOverhead": "Provider overhead"
|
|
417038
|
+
},
|
|
417039
|
+
de: {
|
|
417040
|
+
"contextDoctor.title": "Kontextdiagnose",
|
|
417041
|
+
"contextDoctor.description": "Aufschlüsselung des eingefügten Kontexts ohne Modellaufruf",
|
|
417042
|
+
"contextDoctor.core": "Kernanweisungen",
|
|
417043
|
+
"contextDoctor.personality": "Persönlichkeit und Seele",
|
|
417044
|
+
"contextDoctor.social": "Beziehungen und Präsenz",
|
|
417045
|
+
"contextDoctor.skills": "Fähigkeitenverzeichnis",
|
|
417046
|
+
"contextDoctor.runtime": "Laufzeitergänzungen",
|
|
417047
|
+
"contextDoctor.builtinTools": "Integrierte Werkzeuge",
|
|
417048
|
+
"contextDoctor.userTools": "Benutzerwerkzeuge",
|
|
417049
|
+
"contextDoctor.mcpTools": "MCP-Werkzeuge",
|
|
417050
|
+
"contextDoctor.otherTools": "Weitere Werkzeugschemata",
|
|
417051
|
+
"contextDoctor.providerOverhead": "Anbieterbedingter Zusatzaufwand"
|
|
417052
|
+
},
|
|
417053
|
+
es: {
|
|
417054
|
+
"contextDoctor.title": "Diagnóstico del contexto",
|
|
417055
|
+
"contextDoctor.description": "Desglose del contexto insertado sin llamar al modelo",
|
|
417056
|
+
"contextDoctor.core": "Instrucciones principales",
|
|
417057
|
+
"contextDoctor.personality": "Personalidad y esencia",
|
|
417058
|
+
"contextDoctor.social": "Relaciones y presencia",
|
|
417059
|
+
"contextDoctor.skills": "Índice de habilidades",
|
|
417060
|
+
"contextDoctor.runtime": "Adiciones en tiempo de ejecución",
|
|
417061
|
+
"contextDoctor.builtinTools": "Herramientas integradas",
|
|
417062
|
+
"contextDoctor.userTools": "Herramientas del usuario",
|
|
417063
|
+
"contextDoctor.mcpTools": "Herramientas MCP",
|
|
417064
|
+
"contextDoctor.otherTools": "Otros esquemas de herramientas",
|
|
417065
|
+
"contextDoctor.providerOverhead": "Sobrecarga del proveedor"
|
|
417066
|
+
},
|
|
417067
|
+
fr: {
|
|
417068
|
+
"contextDoctor.title": "Diagnostic du contexte",
|
|
417069
|
+
"contextDoctor.description": "Répartition du contexte injecté sans appel au modèle",
|
|
417070
|
+
"contextDoctor.core": "Instructions principales",
|
|
417071
|
+
"contextDoctor.personality": "Personnalité et identité",
|
|
417072
|
+
"contextDoctor.social": "Relations et présence",
|
|
417073
|
+
"contextDoctor.skills": "Index des compétences",
|
|
417074
|
+
"contextDoctor.runtime": "Ajouts à l’exécution",
|
|
417075
|
+
"contextDoctor.builtinTools": "Outils intégrés",
|
|
417076
|
+
"contextDoctor.userTools": "Outils de l’utilisateur",
|
|
417077
|
+
"contextDoctor.mcpTools": "Outils MCP",
|
|
417078
|
+
"contextDoctor.otherTools": "Autres schémas d’outils",
|
|
417079
|
+
"contextDoctor.providerOverhead": "Surcoût du fournisseur"
|
|
417080
|
+
},
|
|
417081
|
+
sv: {
|
|
417082
|
+
"contextDoctor.title": "Kontextdiagnos",
|
|
417083
|
+
"contextDoctor.description": "Uppdelning av infogad kontext utan modellanrop",
|
|
417084
|
+
"contextDoctor.core": "Grundinstruktioner",
|
|
417085
|
+
"contextDoctor.personality": "Personlighet och identitet",
|
|
417086
|
+
"contextDoctor.social": "Relationer och närvaro",
|
|
417087
|
+
"contextDoctor.skills": "Färdighetsindex",
|
|
417088
|
+
"contextDoctor.runtime": "Körtidstillägg",
|
|
417089
|
+
"contextDoctor.builtinTools": "Inbyggda verktyg",
|
|
417090
|
+
"contextDoctor.userTools": "Användarverktyg",
|
|
417091
|
+
"contextDoctor.mcpTools": "MCP-verktyg",
|
|
417092
|
+
"contextDoctor.otherTools": "Övriga verktygsscheman",
|
|
417093
|
+
"contextDoctor.providerOverhead": "Leverantörspåslag"
|
|
417094
|
+
},
|
|
417095
|
+
cs: {
|
|
417096
|
+
"contextDoctor.title": "Diagnostika kontextu",
|
|
417097
|
+
"contextDoctor.description": "Rozpis vloženého kontextu bez volání modelu",
|
|
417098
|
+
"contextDoctor.core": "Základní pokyny",
|
|
417099
|
+
"contextDoctor.personality": "Osobnost a identita",
|
|
417100
|
+
"contextDoctor.social": "Vztahy a přítomnost",
|
|
417101
|
+
"contextDoctor.skills": "Přehled dovedností",
|
|
417102
|
+
"contextDoctor.runtime": "Doplňky za běhu",
|
|
417103
|
+
"contextDoctor.builtinTools": "Vestavěné nástroje",
|
|
417104
|
+
"contextDoctor.userTools": "Uživatelské nástroje",
|
|
417105
|
+
"contextDoctor.mcpTools": "Nástroje MCP",
|
|
417106
|
+
"contextDoctor.otherTools": "Ostatní schémata nástrojů",
|
|
417107
|
+
"contextDoctor.providerOverhead": "Režie poskytovatele"
|
|
417108
|
+
}
|
|
417109
|
+
});
|
|
416992
417110
|
const LEFT_MARGIN$1 = 2;
|
|
416993
417111
|
const SIDE_PADDING$1 = 1;
|
|
416994
417112
|
const BOX_OVERHEAD = LEFT_MARGIN$1 + 2 + 2 * SIDE_PADDING$1;
|
|
@@ -417117,6 +417235,7 @@ function buildManagedUsageReportLines(options) {
|
|
|
417117
417235
|
var { buildApprovalRejectionStop } = createRequire(import.meta.url)("./bin/approval-rejection-stop.cjs");
|
|
417118
417236
|
var { reconcileContextBudget } = createRequire(import.meta.url)("./bin/context-budget-ledger.cjs");
|
|
417119
417237
|
var { buildContextInsight } = createRequire(import.meta.url)("./bin/context-insight-policy.cjs");
|
|
417238
|
+
var { buildContextDoctor } = createRequire(import.meta.url)("./bin/context-doctor-policy.cjs");
|
|
417120
417239
|
var { buildValidatedLearningInsight } = createRequire(import.meta.url)("./bin/validated-learning-insight-policy.cjs");
|
|
417121
417240
|
var { readValidatedLearningCandidates } = createRequire(import.meta.url)("./bin/validated-learning-signal.cjs");
|
|
417122
417241
|
function buildUsageReportLines(options) {
|
|
@@ -418210,6 +418329,41 @@ async function showContextInsight(host) {
|
|
|
418210
418329
|
host.state.transcriptContainer.addChild(panel);
|
|
418211
418330
|
host.state.ui.requestRender();
|
|
418212
418331
|
}
|
|
418332
|
+
function buildContextDoctorLines(doctor) {
|
|
418333
|
+
const value = (text) => currentTheme.fg("text", text);
|
|
418334
|
+
const muted = (text) => currentTheme.fg("textDim", text);
|
|
418335
|
+
const locale = getCurrentUiLocale();
|
|
418336
|
+
const tokenValue = (tokens) => value(formatExactTokenCount(tokens, locale));
|
|
418337
|
+
const line = (key, tokens, indent = 2) => `${" ".repeat(indent)}${muted(`${uiText(key)}:`)} ${tokenValue(tokens)}`;
|
|
418338
|
+
const bar = currentTheme.fg(doctor.ratio >= 0.9 ? "error" : doctor.ratio >= 0.75 ? "warning" : "success", renderProgressBar(doctor.ratio, 20));
|
|
418339
|
+
const lines = [
|
|
418340
|
+
` ${bar} ${value(`${(doctor.ratio * 100).toFixed(1)}%`.padStart(6, " "))} ${muted(`(${formatExactTokenCount(doctor.projectedTokens, locale)} / ${formatExactTokenCount(doctor.maxTokens, locale)})`)}`,
|
|
418341
|
+
"",
|
|
418342
|
+
line("export.system", doctor.system.totalTokens),
|
|
418343
|
+
line("contextDoctor.core", doctor.system.coreTokens, 4),
|
|
418344
|
+
line("contextDoctor.personality", doctor.system.personalityTokens, 4),
|
|
418345
|
+
line("contextDoctor.social", doctor.system.socialTokens, 4),
|
|
418346
|
+
line("contextDoctor.skills", doctor.system.skillTokens, 4),
|
|
418347
|
+
line("contextDoctor.runtime", doctor.system.runtimeTokens, 4),
|
|
418348
|
+
"",
|
|
418349
|
+
line("mcp.capability.tools", doctor.tools.totalTokens),
|
|
418350
|
+
line("contextDoctor.builtinTools", doctor.tools.builtinTokens, 4),
|
|
418351
|
+
line("contextDoctor.userTools", doctor.tools.userTokens, 4),
|
|
418352
|
+
line("contextDoctor.mcpTools", doctor.tools.mcpTokens, 4),
|
|
418353
|
+
line("contextDoctor.otherTools", doctor.tools.otherTokens, 4),
|
|
418354
|
+
"",
|
|
418355
|
+
line("export.conversation", doctor.conversationTokens),
|
|
418356
|
+
line("contextDoctor.providerOverhead", doctor.providerOverheadTokens),
|
|
418357
|
+
` ${muted(uiText("usage.plan.metric.remaining", { count: formatExactTokenCount(doctor.freeTokens, locale) }))}`
|
|
418358
|
+
];
|
|
418359
|
+
return lines;
|
|
418360
|
+
}
|
|
418361
|
+
async function showContextDoctor(host) {
|
|
418362
|
+
const doctor = buildContextDoctor(await host.requireSession().getContext());
|
|
418363
|
+
const panel = new UsagePanelComponent(() => buildContextDoctorLines(doctor), "primary", uiText("contextDoctor.title"));
|
|
418364
|
+
host.state.transcriptContainer.addChild(panel);
|
|
418365
|
+
host.state.ui.requestRender();
|
|
418366
|
+
}
|
|
418213
418367
|
async function showUsage(host) {
|
|
418214
418368
|
const [sessionUsage, managedUsage, runtimeStatus] = await Promise.all([
|
|
418215
418369
|
loadSessionUsageReport(host),
|
|
@@ -495460,6 +495614,9 @@ async function handleBuiltInSlashCommand(host, name, args) {
|
|
|
495460
495614
|
case "context":
|
|
495461
495615
|
await showContextInsight(host);
|
|
495462
495616
|
return;
|
|
495617
|
+
case "context-doctor":
|
|
495618
|
+
await showContextDoctor(host);
|
|
495619
|
+
return;
|
|
495463
495620
|
case "usage":
|
|
495464
495621
|
await showUsage(host);
|
|
495465
495622
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blun-king-cli",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.290",
|
|
4
4
|
"description": "BLUN CLI - your own AI agent with a Telegram channel. Get it done. With BLUN.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -56,6 +56,5 @@
|
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"blun-king-cli": "^9.1.62",
|
|
58
58
|
"node-addon-api": "^7.1.1"
|
|
59
|
-
}
|
|
60
|
-
"devDependencies": {}
|
|
59
|
+
}
|
|
61
60
|
}
|