blun-king-cli 9.1.106 → 9.1.107
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/blun.mjs +87 -13
- package/package.json +1 -1
package/blun.mjs
CHANGED
|
@@ -412849,27 +412849,45 @@ const STREAMING_ARGS_PREVIEW_MAX_CHARS = 64 * 1024;
|
|
|
412849
412849
|
registerUiCatalogFragment({
|
|
412850
412850
|
en: {
|
|
412851
412851
|
"eventPayload.providerFiltered": "Provider filtered the response before visible output (finishReason={finishReason}{raw}).",
|
|
412852
|
-
"eventPayload.modelEmptyResponse": "King ended twice without producing content. Please send the message again."
|
|
412852
|
+
"eventPayload.modelEmptyResponse": "King ended twice without producing content. Please send the message again.",
|
|
412853
|
+
"eventPayload.providerBusy": "King is busy right now. Please try again shortly.",
|
|
412854
|
+
"eventPayload.providerUnavailable": "King could not complete this response. Please try again.",
|
|
412855
|
+
"eventPayload.providerAuthRequired": "Your King connection needs to be renewed. Please sign in again."
|
|
412853
412856
|
},
|
|
412854
412857
|
de: {
|
|
412855
412858
|
"eventPayload.providerFiltered": "Der Anbieter hat die Antwort vor der sichtbaren Ausgabe gefiltert (finishReason={finishReason}{raw}).",
|
|
412856
|
-
"eventPayload.modelEmptyResponse": "King hat die Antwort zweimal ohne Inhalt beendet. Bitte sende die Nachricht noch einmal."
|
|
412859
|
+
"eventPayload.modelEmptyResponse": "King hat die Antwort zweimal ohne Inhalt beendet. Bitte sende die Nachricht noch einmal.",
|
|
412860
|
+
"eventPayload.providerBusy": "King ist gerade ausgelastet. Bitte versuche es gleich noch einmal.",
|
|
412861
|
+
"eventPayload.providerUnavailable": "King konnte diese Antwort nicht abschließen. Bitte versuche es noch einmal.",
|
|
412862
|
+
"eventPayload.providerAuthRequired": "Die Verbindung zu King muss erneuert werden. Bitte melde dich erneut an."
|
|
412857
412863
|
},
|
|
412858
412864
|
es: {
|
|
412859
412865
|
"eventPayload.providerFiltered": "El proveedor filtró la respuesta antes de que se mostrara la salida (finishReason={finishReason}{raw}).",
|
|
412860
|
-
"eventPayload.modelEmptyResponse": "King terminó dos veces sin generar contenido. Envía el mensaje de nuevo."
|
|
412866
|
+
"eventPayload.modelEmptyResponse": "King terminó dos veces sin generar contenido. Envía el mensaje de nuevo.",
|
|
412867
|
+
"eventPayload.providerBusy": "King está ocupado en este momento. Vuelve a intentarlo en unos instantes.",
|
|
412868
|
+
"eventPayload.providerUnavailable": "King no ha podido completar esta respuesta. Vuelve a intentarlo.",
|
|
412869
|
+
"eventPayload.providerAuthRequired": "Es necesario renovar la conexión con King. Vuelve a iniciar sesión."
|
|
412861
412870
|
},
|
|
412862
412871
|
fr: {
|
|
412863
412872
|
"eventPayload.providerFiltered": "Le fournisseur a filtré la réponse avant l’affichage de la sortie (finishReason={finishReason}{raw}).",
|
|
412864
|
-
"eventPayload.modelEmptyResponse": "King a terminé deux fois sans produire de contenu. Envoyez à nouveau le message."
|
|
412873
|
+
"eventPayload.modelEmptyResponse": "King a terminé deux fois sans produire de contenu. Envoyez à nouveau le message.",
|
|
412874
|
+
"eventPayload.providerBusy": "King est occupé pour le moment. Réessayez dans quelques instants.",
|
|
412875
|
+
"eventPayload.providerUnavailable": "King n’a pas pu terminer cette réponse. Réessayez.",
|
|
412876
|
+
"eventPayload.providerAuthRequired": "La connexion à King doit être renouvelée. Reconnectez-vous."
|
|
412865
412877
|
},
|
|
412866
412878
|
sv: {
|
|
412867
412879
|
"eventPayload.providerFiltered": "Leverantören filtrerade svaret innan någon utdata visades (finishReason={finishReason}{raw}).",
|
|
412868
|
-
"eventPayload.modelEmptyResponse": "King avslutade två gånger utan att skapa något innehåll. Skicka meddelandet igen."
|
|
412880
|
+
"eventPayload.modelEmptyResponse": "King avslutade två gånger utan att skapa något innehåll. Skicka meddelandet igen.",
|
|
412881
|
+
"eventPayload.providerBusy": "King är upptagen just nu. Försök igen om en liten stund.",
|
|
412882
|
+
"eventPayload.providerUnavailable": "King kunde inte slutföra svaret. Försök igen.",
|
|
412883
|
+
"eventPayload.providerAuthRequired": "Anslutningen till King behöver förnyas. Logga in igen."
|
|
412869
412884
|
},
|
|
412870
412885
|
cs: {
|
|
412871
412886
|
"eventPayload.providerFiltered": "Poskytovatel filtroval odpověď před viditelným výstupem (finishReason={finishReason}{raw}).",
|
|
412872
|
-
"eventPayload.modelEmptyResponse": "King dvakrát ukončil odpověď bez obsahu. Odešlete zprávu znovu."
|
|
412887
|
+
"eventPayload.modelEmptyResponse": "King dvakrát ukončil odpověď bez obsahu. Odešlete zprávu znovu.",
|
|
412888
|
+
"eventPayload.providerBusy": "King je právě zaneprázdněný. Zkuste to za chvíli znovu.",
|
|
412889
|
+
"eventPayload.providerUnavailable": "King nemohl tuto odpověď dokončit. Zkuste to znovu.",
|
|
412890
|
+
"eventPayload.providerAuthRequired": "Připojení ke Kingovi je potřeba obnovit. Přihlaste se znovu."
|
|
412873
412891
|
}
|
|
412874
412892
|
});
|
|
412875
412893
|
//#endregion
|
|
@@ -412944,10 +412962,24 @@ function formatErrorMessage$2(error) {
|
|
|
412944
412962
|
}
|
|
412945
412963
|
function formatErrorPayload(error) {
|
|
412946
412964
|
if (error.code === "model.empty_response") return uiText("eventPayload.modelEmptyResponse");
|
|
412965
|
+
if (error.code === "provider.rate_limit") return uiText("eventPayload.providerBusy");
|
|
412966
|
+
if (error.code === "provider.api_error" || error.code === "provider.connection_error") return uiText("eventPayload.providerUnavailable");
|
|
412967
|
+
if (error.code === "provider.auth_error") return uiText("eventPayload.providerAuthRequired");
|
|
412947
412968
|
const filteredMessage = formatProviderFilteredMessage(error.details);
|
|
412948
|
-
if (filteredMessage !== void 0) return projectBlunIdentity(
|
|
412969
|
+
if (filteredMessage !== void 0) return projectBlunIdentity(filteredMessage);
|
|
412949
412970
|
return projectBlunIdentity(`[${error.code}] ${error.message}`);
|
|
412950
412971
|
}
|
|
412972
|
+
|
|
412973
|
+
const CUSTOMER_FACING_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
412974
|
+
"provider.rate_limit",
|
|
412975
|
+
"provider.api_error",
|
|
412976
|
+
"provider.connection_error",
|
|
412977
|
+
"provider.auth_error",
|
|
412978
|
+
"model.empty_response"
|
|
412979
|
+
]);
|
|
412980
|
+
function shouldShowErrorReportHint(event) {
|
|
412981
|
+
return !CUSTOMER_FACING_ERROR_CODES.has(event.code);
|
|
412982
|
+
}
|
|
412951
412983
|
function formatProviderFilteredMessage(details) {
|
|
412952
412984
|
const finishReason = stringDetail(details, "finishReason");
|
|
412953
412985
|
const rawFinishReason = stringDetail(details, "rawFinishReason");
|
|
@@ -497195,29 +497227,41 @@ var HelpPanelComponent = class extends Container {
|
|
|
497195
497227
|
focused = false;
|
|
497196
497228
|
opts;
|
|
497197
497229
|
scrollTop = 0;
|
|
497230
|
+
selectedCommandIndex = 0;
|
|
497231
|
+
showCommandDetail = false;
|
|
497198
497232
|
constructor(opts) {
|
|
497199
497233
|
super();
|
|
497200
497234
|
this.opts = opts;
|
|
497201
497235
|
}
|
|
497202
497236
|
handleInput(data) {
|
|
497203
497237
|
const printable = decodeKittyPrintable(data) ?? data;
|
|
497204
|
-
if (matchesKey(data, Key.escape) ||
|
|
497238
|
+
if (matchesKey(data, Key.escape) || printable === "q" || printable === "Q") {
|
|
497205
497239
|
this.opts.onClose();
|
|
497206
497240
|
return;
|
|
497207
497241
|
}
|
|
497242
|
+
const sortedCmds = [...this.opts.commands].toSorted(compareSlashCommandsForDisplay);
|
|
497243
|
+
if (sortedCmds.length === 0) return;
|
|
497244
|
+
if (matchesKey(data, Key.right) || matchesKey(data, Key.enter)) {
|
|
497245
|
+
this.showCommandDetail = true;
|
|
497246
|
+
return;
|
|
497247
|
+
}
|
|
497248
|
+
if (matchesKey(data, Key.left)) {
|
|
497249
|
+
this.showCommandDetail = false;
|
|
497250
|
+
return;
|
|
497251
|
+
}
|
|
497208
497252
|
if (matchesKey(data, Key.up)) {
|
|
497209
|
-
this.
|
|
497253
|
+
this.selectedCommandIndex = Math.max(0, this.selectedCommandIndex - 1);
|
|
497210
497254
|
return;
|
|
497211
497255
|
}
|
|
497212
497256
|
if (matchesKey(data, Key.down)) {
|
|
497213
|
-
this.
|
|
497257
|
+
this.selectedCommandIndex = Math.min(sortedCmds.length - 1, this.selectedCommandIndex + 1);
|
|
497214
497258
|
return;
|
|
497215
497259
|
}
|
|
497216
497260
|
if (matchesKey(data, Key.pageUp)) {
|
|
497217
|
-
this.
|
|
497261
|
+
this.selectedCommandIndex = Math.max(0, this.selectedCommandIndex - 10);
|
|
497218
497262
|
return;
|
|
497219
497263
|
}
|
|
497220
|
-
if (matchesKey(data, Key.pageDown)) this.
|
|
497264
|
+
if (matchesKey(data, Key.pageDown)) this.selectedCommandIndex = Math.min(sortedCmds.length - 1, this.selectedCommandIndex + 10);
|
|
497221
497265
|
}
|
|
497222
497266
|
render(width) {
|
|
497223
497267
|
const accent = (text) => currentTheme.fg("primary", text);
|
|
@@ -497228,6 +497272,8 @@ var HelpPanelComponent = class extends Container {
|
|
|
497228
497272
|
const shortcuts = this.opts.shortcuts ?? DEFAULT_KEYBOARD_SHORTCUTS;
|
|
497229
497273
|
const kbdWidth = Math.max(8, ...shortcuts.map((s) => s.keys.length));
|
|
497230
497274
|
const sortedCmds = [...this.opts.commands].toSorted(compareSlashCommandsForDisplay);
|
|
497275
|
+
this.selectedCommandIndex = Math.max(0, Math.min(this.selectedCommandIndex, Math.max(0, sortedCmds.length - 1)));
|
|
497276
|
+
if (this.showCommandDetail && sortedCmds.length > 0) return this.renderCommandDetail(width, sortedCmds);
|
|
497231
497277
|
const cmdLabels = sortedCmds.map((c) => {
|
|
497232
497278
|
const aliases = c.aliases.length > 0 ? ` (${c.aliases.map((a) => "/" + a).join(", ")})` : "";
|
|
497233
497279
|
return `/${c.name}${aliases}`;
|
|
@@ -497244,7 +497290,10 @@ var HelpPanelComponent = class extends Container {
|
|
|
497244
497290
|
"",
|
|
497245
497291
|
` ${currentTheme.bold(uiText("help.slashCommands"))}`,
|
|
497246
497292
|
...sortedCmds.map((cmd, i) => {
|
|
497247
|
-
|
|
497293
|
+
const marker = i === this.selectedCommandIndex ? accent("â–¶") : " ";
|
|
497294
|
+
const label = (cmdLabels[i] ?? `/${cmd.name}`).padEnd(cmdWidth);
|
|
497295
|
+
const commandText = i === this.selectedCommandIndex ? currentTheme.boldFg("primary", label) : slashColor(label);
|
|
497296
|
+
return ` ${marker} ${commandText} ${dim(cmd.description)}`;
|
|
497248
497297
|
}),
|
|
497249
497298
|
"",
|
|
497250
497299
|
accent("─".repeat(width))
|
|
@@ -497252,6 +497301,9 @@ var HelpPanelComponent = class extends Container {
|
|
|
497252
497301
|
const content = lines.slice(1, lines.length - 1);
|
|
497253
497302
|
const maxVisible = Math.max(5, this.opts.maxVisible ?? 24);
|
|
497254
497303
|
if (content.length > maxVisible) {
|
|
497304
|
+
const selectedLine = 7 + shortcuts.length + this.selectedCommandIndex;
|
|
497305
|
+
if (selectedLine < this.scrollTop) this.scrollTop = selectedLine;
|
|
497306
|
+
if (selectedLine >= this.scrollTop + maxVisible) this.scrollTop = selectedLine - maxVisible + 1;
|
|
497255
497307
|
this.scrollTop = Math.max(0, Math.min(this.scrollTop, content.length - maxVisible));
|
|
497256
497308
|
const slice = content.slice(this.scrollTop, this.scrollTop + maxVisible);
|
|
497257
497309
|
const scrollInfo = muted(` ${uiText("help.scrollInfo", {
|
|
@@ -497269,6 +497321,27 @@ var HelpPanelComponent = class extends Container {
|
|
|
497269
497321
|
this.scrollTop = 0;
|
|
497270
497322
|
return lines.map((line) => truncateToWidth(line, width));
|
|
497271
497323
|
}
|
|
497324
|
+
renderCommandDetail(width, sortedCmds) {
|
|
497325
|
+
const accent = (text) => currentTheme.fg("primary", text);
|
|
497326
|
+
const dim = (text) => currentTheme.fg("textDim", text);
|
|
497327
|
+
const muted = (text) => currentTheme.fg("textMuted", text);
|
|
497328
|
+
const command = sortedCmds[this.selectedCommandIndex];
|
|
497329
|
+
if (command === void 0) return [];
|
|
497330
|
+
const argumentHint = typeof command.argumentHint === "string" && command.argumentHint.length > 0 ? ` ${command.argumentHint}` : "";
|
|
497331
|
+
const aliases = command.aliases.length > 0 ? command.aliases.map((alias) => `/${alias}`).join(", ") : "—";
|
|
497332
|
+
const descriptionLines = wrapTextWithAnsi(dim(command.description), Math.max(10, width - 4)).map((line) => ` ${line}`);
|
|
497333
|
+
return [
|
|
497334
|
+
accent("─".repeat(width)),
|
|
497335
|
+
currentTheme.boldFg("primary", ` /${command.name}${argumentHint}`),
|
|
497336
|
+
"",
|
|
497337
|
+
...descriptionLines,
|
|
497338
|
+
"",
|
|
497339
|
+
` ${muted("=")} ${dim(aliases)}`,
|
|
497340
|
+
"",
|
|
497341
|
+
muted(` ${this.selectedCommandIndex + 1}/${sortedCmds.length} · ↑↓ · ↠· Esc / q`),
|
|
497342
|
+
accent("─".repeat(width))
|
|
497343
|
+
].map((line) => truncateToWidth(line, width));
|
|
497344
|
+
}
|
|
497272
497345
|
};
|
|
497273
497346
|
function localizedShortcut(keys, descriptionKey) {
|
|
497274
497347
|
return {
|
|
@@ -506756,6 +506829,7 @@ var SessionEventHandler = class {
|
|
|
506756
506829
|
this.showErrorReportHint(event);
|
|
506757
506830
|
}
|
|
506758
506831
|
showErrorReportHint(event) {
|
|
506832
|
+
if (!shouldShowErrorReportHint(event)) return;
|
|
506759
506833
|
const { appState } = this.host.state;
|
|
506760
506834
|
if (appState.sessionId.length === 0) return;
|
|
506761
506835
|
this.host.showStatus(errorReportHintLine({
|