blun-king-cli 9.1.18 → 9.1.19
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 +54 -50
- package/package.json +1 -1
package/blun.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// BLUN_BUILD_INPUT_SHA256:
|
|
2
|
+
// BLUN_BUILD_INPUT_SHA256:b991ad9b5744a4c7edb806fc71b837f5d58205791bc5979c4e05b6b5f3564456
|
|
3
3
|
import { fileURLToPath as __cjsShimFileURLToPath } from 'node:url';
|
|
4
4
|
import { dirname as __cjsShimDirname } from 'node:path';
|
|
5
5
|
const __filename = __cjsShimFileURLToPath(import.meta.url);
|
|
@@ -336453,6 +336453,7 @@ function buildSkillSlashCommands(skills) {
|
|
|
336453
336453
|
const ACCOUNT_MEMORY_READ_URL = "https://chat.blun.ai/api/blun-memory?persona_id=king&surface=global";
|
|
336454
336454
|
const ACCOUNT_MEMORY_EXTRACT_URL = "https://chat.blun.ai/api/blun-memory/extract?persona_id=king&surface=global";
|
|
336455
336455
|
const ACCOUNT_MEMORY_PREFERENCES_URL = "https://account.blun.ai/api/me/preferences";
|
|
336456
|
+
const ACCOUNT_MEMORY_SETTINGS_URL = "https://account.blun.ai/api/account/settings";
|
|
336456
336457
|
const ACCOUNT_MEMORY_MAX_FACT_CHARS = 1e3;
|
|
336457
336458
|
//#endregion
|
|
336458
336459
|
//#region src/utils/account-memory.ts
|
|
@@ -336469,24 +336470,34 @@ function describeAccountMemoryError(error) {
|
|
|
336469
336470
|
function createAccountMemoryClient(auth, options = {}) {
|
|
336470
336471
|
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
336471
336472
|
const timeoutMs = options.timeoutMs ?? 4e3;
|
|
336473
|
+
let consentStatus;
|
|
336474
|
+
const getConsentStatus = async () => {
|
|
336475
|
+
consentStatus = readAccountMemoryConsentStatus(await requestWithOAuth(auth, fetchImpl, ACCOUNT_MEMORY_PREFERENCES_URL, { method: "GET" }, timeoutMs, readBoundedJson));
|
|
336476
|
+
return consentStatus;
|
|
336477
|
+
};
|
|
336478
|
+
const hasExplicitConsent = async () => {
|
|
336479
|
+
return (consentStatus ?? await getConsentStatus()) === "enabled";
|
|
336480
|
+
};
|
|
336472
336481
|
return {
|
|
336473
|
-
|
|
336474
|
-
return readAccountMemoryConsentStatus(await requestWithOAuth(auth, fetchImpl, ACCOUNT_MEMORY_PREFERENCES_URL, { method: "GET" }, timeoutMs, readBoundedJson));
|
|
336475
|
-
},
|
|
336482
|
+
getConsentStatus,
|
|
336476
336483
|
async setConsent(enabled) {
|
|
336477
|
-
|
|
336484
|
+
const stored = readAccountMemoryConsentStatus(await requestWithOAuth(auth, fetchImpl, ACCOUNT_MEMORY_SETTINGS_URL, {
|
|
336478
336485
|
method: "PATCH",
|
|
336479
336486
|
headers: { "Content-Type": "application/json" },
|
|
336480
336487
|
body: JSON.stringify({ data_controls: {
|
|
336481
336488
|
allow_memory: enabled,
|
|
336482
336489
|
memory_consent_asked: true
|
|
336483
336490
|
} })
|
|
336484
|
-
}, timeoutMs, readBoundedJson))
|
|
336491
|
+
}, timeoutMs, readBoundedJson));
|
|
336492
|
+
if (stored !== (enabled ? "enabled" : "disabled")) throw new Error("Account memory returned an invalid response.");
|
|
336493
|
+
consentStatus = stored;
|
|
336485
336494
|
},
|
|
336486
336495
|
async loadSystemContext() {
|
|
336496
|
+
if (!await hasExplicitConsent()) return void 0;
|
|
336487
336497
|
return renderAccountMemoryContext(await requestWithOAuth(auth, fetchImpl, ACCOUNT_MEMORY_READ_URL, { method: "GET" }, timeoutMs, readBoundedJson));
|
|
336488
336498
|
},
|
|
336489
336499
|
async extract(text) {
|
|
336500
|
+
if (!await hasExplicitConsent()) return;
|
|
336490
336501
|
await requestWithOAuth(auth, fetchImpl, ACCOUNT_MEMORY_EXTRACT_URL, {
|
|
336491
336502
|
method: "POST",
|
|
336492
336503
|
headers: { "Content-Type": "application/json" },
|
|
@@ -397175,42 +397186,42 @@ registerUiCatalogFragment({
|
|
|
397175
397186
|
registerUiCatalogFragment({
|
|
397176
397187
|
en: {
|
|
397177
397188
|
"startupPersonalMemory.title": "Personal memory",
|
|
397178
|
-
"startupPersonalMemory.details": "When
|
|
397189
|
+
"startupPersonalMemory.details": "When personal memory is enabled, BLUN automatically extracts useful information from your chats and can use it in future conversations. This stays off until you enable it.",
|
|
397179
397190
|
"startupPersonalMemory.enable": "Enable memory",
|
|
397180
397191
|
"startupPersonalMemory.decline": "Do not enable",
|
|
397181
397192
|
"startupPersonalMemory.persistenceFailed": "Memory settings could not be saved. Personal memory remains off."
|
|
397182
397193
|
},
|
|
397183
397194
|
de: {
|
|
397184
397195
|
"startupPersonalMemory.title": "Persönliches Gedächtnis",
|
|
397185
|
-
"startupPersonalMemory.details": "Wenn
|
|
397196
|
+
"startupPersonalMemory.details": "Wenn das persönliche Gedächtnis aktiviert ist, übernimmt BLUN automatisch nützliche Informationen aus deinen Chats und kann sie in späteren Gesprächen verwenden. Die Funktion bleibt deaktiviert, bis du sie einschaltest.",
|
|
397186
397197
|
"startupPersonalMemory.enable": "Gedächtnis aktivieren",
|
|
397187
397198
|
"startupPersonalMemory.decline": "Nicht aktivieren",
|
|
397188
397199
|
"startupPersonalMemory.persistenceFailed": "Die Gedächtniseinstellungen konnten nicht gespeichert werden. Das persönliche Gedächtnis bleibt deaktiviert."
|
|
397189
397200
|
},
|
|
397190
397201
|
es: {
|
|
397191
397202
|
"startupPersonalMemory.title": "Memoria personal",
|
|
397192
|
-
"startupPersonalMemory.details": "Cuando
|
|
397203
|
+
"startupPersonalMemory.details": "Cuando activas la memoria personal, BLUN extrae automáticamente información útil de tus chats y puede utilizarla en conversaciones futuras. La función permanece desactivada hasta que la actives.",
|
|
397193
397204
|
"startupPersonalMemory.enable": "Activar la memoria",
|
|
397194
397205
|
"startupPersonalMemory.decline": "No activar",
|
|
397195
397206
|
"startupPersonalMemory.persistenceFailed": "No se pudo guardar la configuración de la memoria. La memoria personal permanece desactivada."
|
|
397196
397207
|
},
|
|
397197
397208
|
fr: {
|
|
397198
397209
|
"startupPersonalMemory.title": "Mémoire personnelle",
|
|
397199
|
-
"startupPersonalMemory.details": "Lorsque vous
|
|
397210
|
+
"startupPersonalMemory.details": "Lorsque vous activez la mémoire personnelle, BLUN extrait automatiquement les informations utiles de vos conversations et peut les réutiliser ultérieurement. La fonction reste désactivée tant que vous ne l’activez pas.",
|
|
397200
397211
|
"startupPersonalMemory.enable": "Activer la mémoire",
|
|
397201
397212
|
"startupPersonalMemory.decline": "Ne pas activer",
|
|
397202
397213
|
"startupPersonalMemory.persistenceFailed": "Les réglages de la mémoire n’ont pas pu être enregistrés. La mémoire personnelle reste désactivée."
|
|
397203
397214
|
},
|
|
397204
397215
|
sv: {
|
|
397205
397216
|
"startupPersonalMemory.title": "Personligt minne",
|
|
397206
|
-
"startupPersonalMemory.details": "När du
|
|
397217
|
+
"startupPersonalMemory.details": "När du aktiverar det personliga minnet hämtar BLUN automatiskt användbar information från dina chattar och kan använda den i framtida samtal. Funktionen är avstängd tills du aktiverar den.",
|
|
397207
397218
|
"startupPersonalMemory.enable": "Aktivera minnet",
|
|
397208
397219
|
"startupPersonalMemory.decline": "Aktivera inte",
|
|
397209
397220
|
"startupPersonalMemory.persistenceFailed": "Minnesinställningarna kunde inte sparas. Det personliga minnet förblir avstängt."
|
|
397210
397221
|
},
|
|
397211
397222
|
cs: {
|
|
397212
397223
|
"startupPersonalMemory.title": "Osobní paměť",
|
|
397213
|
-
"startupPersonalMemory.details": "Když
|
|
397224
|
+
"startupPersonalMemory.details": "Když zapnete osobní paměť, BLUN automaticky získává užitečné informace z vašich chatů a může je použít v budoucích konverzacích. Funkce zůstává vypnutá, dokud ji nezapnete.",
|
|
397214
397225
|
"startupPersonalMemory.enable": "Zapnout paměť",
|
|
397215
397226
|
"startupPersonalMemory.decline": "Nezapínat",
|
|
397216
397227
|
"startupPersonalMemory.persistenceFailed": "Nastavení paměti se nepodařilo uložit. Osobní paměť zůstává vypnutá."
|
|
@@ -397469,8 +397480,8 @@ const BUILTIN_SLASH_COMMAND_DEFINITIONS = [
|
|
|
397469
397480
|
aliases: [],
|
|
397470
397481
|
descriptionKey: "startupPersonalMemory.title",
|
|
397471
397482
|
priority: 60,
|
|
397472
|
-
argumentHint: "
|
|
397473
|
-
availability: "
|
|
397483
|
+
argumentHint: "status|on|off",
|
|
397484
|
+
availability: "always"
|
|
397474
397485
|
},
|
|
397475
397486
|
{
|
|
397476
397487
|
name: "plugins",
|
|
@@ -416533,37 +416544,26 @@ registerUiCatalogFragment({
|
|
|
416533
416544
|
//#region src/tui/commands/memory.ts
|
|
416534
416545
|
async function handleMemoryCommand(host, args, dependencies) {
|
|
416535
416546
|
const parsed = parseMemoryCommand(args);
|
|
416536
|
-
if (parsed === void 0)
|
|
416537
|
-
|
|
416538
|
-
|
|
416539
|
-
|
|
416540
|
-
|
|
416541
|
-
|
|
416542
|
-
|
|
416543
|
-
|
|
416544
|
-
}
|
|
416545
|
-
|
|
416547
|
+
if (parsed === void 0) {
|
|
416548
|
+
host.showStatus("/memory status|on|off");
|
|
416549
|
+
return;
|
|
416550
|
+
}
|
|
416551
|
+
const client = (dependencies ?? defaultDependencies()).createClient(host);
|
|
416552
|
+
if (parsed.action === "status") {
|
|
416553
|
+
host.showStatus(`/memory ${await client.getConsentStatus()}`);
|
|
416554
|
+
return;
|
|
416555
|
+
}
|
|
416556
|
+
const enabled = parsed.action === "on";
|
|
416557
|
+
await client.setConsent(enabled);
|
|
416558
|
+
await host.refreshPersonalMemory?.(false);
|
|
416559
|
+
host.showStatus(`/memory ${enabled ? "enabled" : "disabled"}`);
|
|
416546
416560
|
}
|
|
416547
416561
|
function parseMemoryCommand(args) {
|
|
416548
|
-
const
|
|
416549
|
-
if (
|
|
416550
|
-
return {
|
|
416551
|
-
action: "remember",
|
|
416552
|
-
content
|
|
416553
|
-
};
|
|
416562
|
+
const action = args.trim().toLowerCase();
|
|
416563
|
+
if (action === "status" || action === "on" || action === "off") return { action };
|
|
416554
416564
|
}
|
|
416555
|
-
function defaultDependencies(
|
|
416556
|
-
return {
|
|
416557
|
-
remember: rememberExplicitPersonalMemory,
|
|
416558
|
-
createClient: () => {
|
|
416559
|
-
const client = createPersonalMemoryBrokerClient(host.harness);
|
|
416560
|
-
return {
|
|
416561
|
-
getSettings: () => client.getSettings(),
|
|
416562
|
-
request: (method, path, body) => client.request(method, path, body)
|
|
416563
|
-
};
|
|
416564
|
-
},
|
|
416565
|
-
getManagedQuota: () => host.harness.auth.getManagedQuota(DEFAULT_OAUTH_PROVIDER_NAME)
|
|
416566
|
-
};
|
|
416565
|
+
function defaultDependencies() {
|
|
416566
|
+
return { createClient: (host) => createAccountMemoryClient(host.harness.auth) };
|
|
416567
416567
|
}
|
|
416568
416568
|
//#endregion
|
|
416569
416569
|
//#region src/tui/utils/sanitize-mcp-display.copy.ts
|
|
@@ -417648,9 +417648,9 @@ function pluginTrustLabel(plugin) {
|
|
|
417648
417648
|
if (plugin.source !== "zip-url" || plugin.originalSource === void 0) return "third-party";
|
|
417649
417649
|
try {
|
|
417650
417650
|
const url = new URL(plugin.originalSource);
|
|
417651
|
-
if (url.protocol !== "https:"
|
|
417652
|
-
if (url
|
|
417653
|
-
if (url.pathname.startsWith("/blun/plugins/curated/")) return "curated";
|
|
417651
|
+
if (url.protocol !== "https:") return "third-party";
|
|
417652
|
+
if (isOfficialPluginUrl(url)) return "official";
|
|
417653
|
+
if (url.hostname === "blun.ai" && url.pathname.startsWith("/blun/plugins/curated/") || url.hostname === "cdn.blun.ai" && url.pathname.startsWith("/blun-king/plugins/curated/")) return "curated";
|
|
417654
417654
|
return "third-party";
|
|
417655
417655
|
} catch {
|
|
417656
417656
|
return "third-party";
|
|
@@ -417666,12 +417666,14 @@ function isOfficialPluginSource(source) {
|
|
|
417666
417666
|
const trimmed = source.trim();
|
|
417667
417667
|
if (!trimmed.startsWith("https://")) return false;
|
|
417668
417668
|
try {
|
|
417669
|
-
|
|
417670
|
-
return url.hostname === "blun.ai" && url.pathname.startsWith("/blun/plugins/official/");
|
|
417669
|
+
return isOfficialPluginUrl(new URL(trimmed));
|
|
417671
417670
|
} catch {
|
|
417672
417671
|
return false;
|
|
417673
417672
|
}
|
|
417674
417673
|
}
|
|
417674
|
+
function isOfficialPluginUrl(url) {
|
|
417675
|
+
return url.hostname === "blun.ai" && url.pathname.startsWith("/blun/plugins/official/") || url.hostname === "cdn.blun.ai" && url.pathname.startsWith("/blun-king/plugins/official/");
|
|
417676
|
+
}
|
|
417675
417677
|
function hostFromUrl(raw) {
|
|
417676
417678
|
try {
|
|
417677
417679
|
const url = new URL(raw);
|
|
@@ -488752,9 +488754,11 @@ function webSessionUrl(origin, sessionId, token) {
|
|
|
488752
488754
|
//#endregion
|
|
488753
488755
|
//#region src/tui/commands/dispatch.ts
|
|
488754
488756
|
function dispatchInput(host, text) {
|
|
488755
|
-
|
|
488757
|
+
const parsed = parseSlashInput(text);
|
|
488758
|
+
if (parsed !== null) {
|
|
488756
488759
|
const isBusy = host.state.appState.streamingPhase !== "idle" || host.state.appState.isCompacting;
|
|
488757
|
-
|
|
488760
|
+
const canRunAlongsideMain = (parsed.name === "btw" || parsed.name === "memory") && !host.state.appState.isCompacting;
|
|
488761
|
+
if (host.deferUserMessages || isBusy && !canRunAlongsideMain) {
|
|
488758
488762
|
host.enqueueSlashCommand(text);
|
|
488759
488763
|
return Promise.resolve();
|
|
488760
488764
|
}
|
|
@@ -507798,8 +507802,8 @@ var BlunTUI = class {
|
|
|
507798
507802
|
ui.addChild(this.state.activityContainer);
|
|
507799
507803
|
ui.addChild(this.state.todoPanelContainer);
|
|
507800
507804
|
ui.addChild(this.state.queueContainer);
|
|
507801
|
-
ui.addChild(this.state.btwPanelContainer);
|
|
507802
507805
|
ui.addChild(this.state.quotaWarningContainer);
|
|
507806
|
+
ui.addChild(this.state.btwPanelContainer);
|
|
507803
507807
|
ui.addChild(this.state.editorContainer);
|
|
507804
507808
|
if (ui instanceof BottomPinnedTUI) {
|
|
507805
507809
|
ui.pinFromIndex = ui.children.indexOf(this.state.quotaWarningContainer);
|