blun-king-cli 9.1.23 → 9.1.25
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/blun.js +11 -12
- package/bin/king.js +11 -12
- package/bin/launcher-runtime.js +1 -1
- package/bin/update-notice.js +93 -17
- package/blun.mjs +860 -313
- package/package.json +1 -1
- package/telegram-plugin/dist/bridge.mjs +10 -2
package/blun.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// BLUN_BUILD_INPUT_SHA256:
|
|
2
|
+
// BLUN_BUILD_INPUT_SHA256:390518244a4c2f3bd6dba9ae2b00963abb0416572bc276f8c933f99a17ae0d33
|
|
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);
|
|
6
6
|
const __dirname = __cjsShimDirname(__filename);
|
|
7
7
|
import { createRequire } from "node:module";
|
|
8
8
|
import crypto$1, { createHash, randomBytes, randomInt, randomUUID, timingSafeEqual } from "node:crypto";
|
|
9
|
-
import * as fs$
|
|
9
|
+
import * as fs$17 from "node:fs";
|
|
10
10
|
import Kt, { accessSync, appendFileSync, chmodSync, closeSync, constants, copyFileSync, createReadStream, createWriteStream, existsSync, fsyncSync, linkSync, lstatSync, mkdirSync, openSync, promises, readFileSync, readSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
11
11
|
import * as path$17 from "node:path";
|
|
12
12
|
import path, { basename, dirname, extname, isAbsolute, join, normalize, posix, relative, resolve, sep, win32 } from "node:path";
|
|
13
13
|
import { Blob as Blob$1, Buffer as Buffer$1, File as File$1 } from "node:buffer";
|
|
14
14
|
import * as nodeOs from "node:os";
|
|
15
15
|
import os, { arch, homedir, hostname, networkInterfaces, platform, release, tmpdir, type, userInfo } from "node:os";
|
|
16
|
-
import
|
|
16
|
+
import fs, { access, appendFile, chmod, constants as constants$1, copyFile, cp, link, lstat, mkdir, mkdtemp, open, readFile, readdir, realpath, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
|
|
17
17
|
import { execFile, execFileSync, execSync, spawn, spawnSync } from "node:child_process";
|
|
18
18
|
import * as sysPath from "path";
|
|
19
19
|
import path$1, { basename as basename$1, dirname as dirname$1, join as join$1, parse } from "path";
|
|
@@ -1167,7 +1167,7 @@ function normalizeBlunToolSchema(schema) {
|
|
|
1167
1167
|
}
|
|
1168
1168
|
function ensureBlunPropertyTypes(schema) {
|
|
1169
1169
|
const normalized = cloneJsonValue(schema);
|
|
1170
|
-
if (!isRecord$
|
|
1170
|
+
if (!isRecord$24(normalized)) throw new Error("JSON Schema root must normalize to an object.");
|
|
1171
1171
|
recurseSchema(normalized);
|
|
1172
1172
|
return normalized;
|
|
1173
1173
|
}
|
|
@@ -1228,7 +1228,7 @@ function resolveLocalJsonPointer(root, ref) {
|
|
|
1228
1228
|
let current = root;
|
|
1229
1229
|
for (const rawPart of ref.slice(2).split("/")) {
|
|
1230
1230
|
const part = unescapeJsonPointerPart(rawPart);
|
|
1231
|
-
if (isRecord$
|
|
1231
|
+
if (isRecord$24(current)) {
|
|
1232
1232
|
if (!hasOwn(current, part)) return { found: false };
|
|
1233
1233
|
current = current[part];
|
|
1234
1234
|
} else if (Array.isArray(current)) {
|
|
@@ -1250,20 +1250,20 @@ function parseJsonPointerArrayIndex(part) {
|
|
|
1250
1250
|
return Number(part);
|
|
1251
1251
|
}
|
|
1252
1252
|
function recurseSchema(node) {
|
|
1253
|
-
if (!isRecord$
|
|
1253
|
+
if (!isRecord$24(node)) return;
|
|
1254
1254
|
visitChildSchemas(node, normalizeProperty);
|
|
1255
1255
|
}
|
|
1256
1256
|
function visitChildSchemas(node, visit) {
|
|
1257
1257
|
for (const { key, kind } of CHILD_SCHEMA_SLOTS) {
|
|
1258
1258
|
const value = node[key];
|
|
1259
1259
|
if (kind === "single") {
|
|
1260
|
-
if (isRecord$
|
|
1260
|
+
if (isRecord$24(value)) visit(value);
|
|
1261
1261
|
} else if (kind === "array") {
|
|
1262
1262
|
if (Array.isArray(value)) for (const item of value) visit(item);
|
|
1263
1263
|
} else if (kind === "map") {
|
|
1264
|
-
if (isRecord$
|
|
1264
|
+
if (isRecord$24(value)) for (const item of Object.values(value)) visit(item);
|
|
1265
1265
|
} else if (kind === "schema-or-array") {
|
|
1266
|
-
if (isRecord$
|
|
1266
|
+
if (isRecord$24(value)) visit(value);
|
|
1267
1267
|
else if (Array.isArray(value)) for (const item of value) visit(item);
|
|
1268
1268
|
}
|
|
1269
1269
|
}
|
|
@@ -1275,7 +1275,7 @@ function childSchemaKeysForParentType(parentType) {
|
|
|
1275
1275
|
});
|
|
1276
1276
|
}
|
|
1277
1277
|
function normalizeProperty(node) {
|
|
1278
|
-
if (!isRecord$
|
|
1278
|
+
if (!isRecord$24(node)) return;
|
|
1279
1279
|
if (!hasOwn(node, "type") && !hasAnyKey(node, TYPE_COMPLETION_SKIP_KEYS)) {
|
|
1280
1280
|
const enumValues = node["enum"];
|
|
1281
1281
|
if (Array.isArray(enumValues) && enumValues.length > 0) node["type"] = inferTypeFromValues(enumValues);
|
|
@@ -1359,14 +1359,14 @@ function hasAnyKey(obj, keys) {
|
|
|
1359
1359
|
}
|
|
1360
1360
|
function cloneJsonValue(value) {
|
|
1361
1361
|
if (Array.isArray(value)) return value.map((item) => cloneJsonValue(item));
|
|
1362
|
-
if (isRecord$
|
|
1362
|
+
if (isRecord$24(value)) {
|
|
1363
1363
|
const cloned = {};
|
|
1364
1364
|
for (const [key, child] of Object.entries(value)) cloned[key] = cloneJsonValue(child);
|
|
1365
1365
|
return cloned;
|
|
1366
1366
|
}
|
|
1367
1367
|
return value;
|
|
1368
1368
|
}
|
|
1369
|
-
function isRecord$
|
|
1369
|
+
function isRecord$24(value) {
|
|
1370
1370
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1371
1371
|
}
|
|
1372
1372
|
function hasOwn(obj, key) {
|
|
@@ -2072,11 +2072,11 @@ var init_blun_files = __esmMin((() => {
|
|
|
2072
2072
|
async uploadVideo(input, options) {
|
|
2073
2073
|
let file;
|
|
2074
2074
|
if (typeof input === "string") {
|
|
2075
|
-
if (!fs$
|
|
2075
|
+
if (!fs$17.existsSync(input)) throw new ChatProviderError(`Video file not found: ${input}`);
|
|
2076
2076
|
const filename = path$17.basename(input);
|
|
2077
2077
|
const mimeType = guessMimeTypeFromExt(filename);
|
|
2078
2078
|
if (mimeType === void 0 || !mimeType.startsWith("video/")) throw new ChatProviderError(`BlunFiles.uploadVideo: file extension does not indicate a video type: ${filename}`);
|
|
2079
|
-
const data = await fs$
|
|
2079
|
+
const data = await fs$17.promises.readFile(input);
|
|
2080
2080
|
file = new File$1([new Blob$1([new Uint8Array(data)], { type: mimeType })], filename, { type: mimeType });
|
|
2081
2081
|
} else {
|
|
2082
2082
|
if (!input.mimeType.startsWith("video/")) throw new ChatProviderError(`Expected a video mime type, got ${input.mimeType}`);
|
|
@@ -2428,6 +2428,10 @@ function isEffectivelyEmptyContent(parts) {
|
|
|
2428
2428
|
}
|
|
2429
2429
|
return true;
|
|
2430
2430
|
}
|
|
2431
|
+
function isEmptyAssistantHistoryMessage(message) {
|
|
2432
|
+
if (message.role !== "assistant" || message.toolCalls.length > 0) return false;
|
|
2433
|
+
return message.content.every((part) => part.type === "think" || part.type === "text" && part.text.trim() === "");
|
|
2434
|
+
}
|
|
2431
2435
|
function collectBlunVisionAttachments(messages) {
|
|
2432
2436
|
const attachments = [];
|
|
2433
2437
|
for (const message of messages) for (const part of message.content) {
|
|
@@ -2690,7 +2694,10 @@ var init_blun = __esmMin((() => {
|
|
|
2690
2694
|
content: systemPrompt
|
|
2691
2695
|
});
|
|
2692
2696
|
const normalizedHistory = normalizeToolCallIdsForProvider(history, BLUN_TOOL_CALL_ID_POLICY);
|
|
2693
|
-
for (const msg of normalizedHistory)
|
|
2697
|
+
for (const msg of normalizedHistory) {
|
|
2698
|
+
if (isEmptyAssistantHistoryMessage(msg)) continue;
|
|
2699
|
+
messages.push(convertMessage(msg));
|
|
2700
|
+
}
|
|
2694
2701
|
const kwargs = { ...this._generationKwargs };
|
|
2695
2702
|
for (const key of Object.keys(kwargs)) if (kwargs[key] === void 0) delete kwargs[key];
|
|
2696
2703
|
if (kwargs["max_completion_tokens"] === void 0 && kwargs["max_tokens"] !== void 0) kwargs["max_completion_tokens"] = kwargs["max_tokens"];
|
|
@@ -2911,7 +2918,7 @@ async function generate(provider, systemPrompt, tools, history, callbacks, optio
|
|
|
2911
2918
|
if (signal?.aborted) throwAbortError();
|
|
2912
2919
|
options?.onRequestStart?.();
|
|
2913
2920
|
const stream = await provider.generate(systemPrompt, tools, history, options);
|
|
2914
|
-
await throwIfAborted$
|
|
2921
|
+
await throwIfAborted$2(signal, stream);
|
|
2915
2922
|
const abortListener = () => {
|
|
2916
2923
|
cancelStream(stream);
|
|
2917
2924
|
};
|
|
@@ -2957,10 +2964,10 @@ async function generate(provider, systemPrompt, tools, history, callbacks, optio
|
|
|
2957
2964
|
if (firstPartAt === void 0) firstPartAt = arrivedAt;
|
|
2958
2965
|
else serverDecodeMs += arrivedAt - lastResumeAt;
|
|
2959
2966
|
try {
|
|
2960
|
-
await throwIfAborted$
|
|
2967
|
+
await throwIfAborted$2(signal, stream);
|
|
2961
2968
|
if (callbacks?.onMessagePart !== void 0) {
|
|
2962
2969
|
await callbacks.onMessagePart(deepCopyPart(part));
|
|
2963
|
-
await throwIfAborted$
|
|
2970
|
+
await throwIfAborted$2(signal, stream);
|
|
2964
2971
|
}
|
|
2965
2972
|
if (isToolCallPart(part) && part.index !== void 0 && !isPendingToolCallAtIndex(pendingPart, part.index)) {
|
|
2966
2973
|
const arrayIdx = toolCallIndexMap.get(part.index);
|
|
@@ -2980,7 +2987,7 @@ async function generate(provider, systemPrompt, tools, history, callbacks, optio
|
|
|
2980
2987
|
clientConsumeMs += lastResumeAt - arrivedAt;
|
|
2981
2988
|
}
|
|
2982
2989
|
}
|
|
2983
|
-
await throwIfAborted$
|
|
2990
|
+
await throwIfAborted$2(signal, stream);
|
|
2984
2991
|
if (firstPartAt !== void 0) serverDecodeMs += Date.now() - lastResumeAt;
|
|
2985
2992
|
options?.onStreamEnd?.(firstPartAt === void 0 ? void 0 : {
|
|
2986
2993
|
serverDecodeMs,
|
|
@@ -2999,7 +3006,7 @@ async function generate(provider, systemPrompt, tools, history, callbacks, optio
|
|
|
2999
3006
|
rawFinishReason: stream.rawFinishReason
|
|
3000
3007
|
});
|
|
3001
3008
|
if (callbacks?.onToolCall !== void 0) for (const toolCall of message.toolCalls) {
|
|
3002
|
-
await throwIfAborted$
|
|
3009
|
+
await throwIfAborted$2(signal, stream);
|
|
3003
3010
|
await callbacks.onToolCall(toolCall);
|
|
3004
3011
|
}
|
|
3005
3012
|
return {
|
|
@@ -3027,7 +3034,7 @@ async function cancelStream(stream) {
|
|
|
3027
3034
|
await cancelable.return?.();
|
|
3028
3035
|
} catch {}
|
|
3029
3036
|
}
|
|
3030
|
-
async function throwIfAborted$
|
|
3037
|
+
async function throwIfAborted$2(signal, stream) {
|
|
3031
3038
|
if (!signal?.aborted) return;
|
|
3032
3039
|
if (stream !== void 0) await cancelStream(stream);
|
|
3033
3040
|
throwAbortError();
|
|
@@ -10433,7 +10440,7 @@ function tokenFromWire(wire) {
|
|
|
10433
10440
|
var init_types$17 = __esmMin((() => {}));
|
|
10434
10441
|
//#endregion
|
|
10435
10442
|
//#region ../../packages/oauth/src/utils.ts
|
|
10436
|
-
function isRecord$
|
|
10443
|
+
function isRecord$23(value) {
|
|
10437
10444
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10438
10445
|
}
|
|
10439
10446
|
var init_utils$1 = __esmMin((() => {}));
|
|
@@ -10757,7 +10764,7 @@ var init_storage = __esmMin((() => {
|
|
|
10757
10764
|
} catch {
|
|
10758
10765
|
return;
|
|
10759
10766
|
}
|
|
10760
|
-
if (!isRecord$
|
|
10767
|
+
if (!isRecord$23(parsed)) return void 0;
|
|
10761
10768
|
return tokenFromWire(parsed);
|
|
10762
10769
|
}
|
|
10763
10770
|
async save(name, token) {
|
|
@@ -10851,7 +10858,7 @@ function extractApiErrorMessage(value) {
|
|
|
10851
10858
|
}
|
|
10852
10859
|
return;
|
|
10853
10860
|
}
|
|
10854
|
-
if (!isRecord$
|
|
10861
|
+
if (!isRecord$23(value)) return void 0;
|
|
10855
10862
|
for (const key of DIRECT_ERROR_KEYS) {
|
|
10856
10863
|
const message = stringField$4(value, key);
|
|
10857
10864
|
if (message !== void 0) return message;
|
|
@@ -10859,7 +10866,7 @@ function extractApiErrorMessage(value) {
|
|
|
10859
10866
|
const error = value["error"];
|
|
10860
10867
|
const errorString = nonEmptyString$7(error);
|
|
10861
10868
|
if (errorString !== void 0) return errorString;
|
|
10862
|
-
if (isRecord$
|
|
10869
|
+
if (isRecord$23(error)) for (const key of NESTED_ERROR_KEYS) {
|
|
10863
10870
|
const message = stringField$4(error, key);
|
|
10864
10871
|
if (message !== void 0) return message;
|
|
10865
10872
|
}
|
|
@@ -10949,7 +10956,7 @@ async function postForm(url, params, deviceHeaders, options) {
|
|
|
10949
10956
|
let data = {};
|
|
10950
10957
|
try {
|
|
10951
10958
|
const parsed = await response.json();
|
|
10952
|
-
if (isRecord$
|
|
10959
|
+
if (isRecord$23(parsed)) data = parsed;
|
|
10953
10960
|
} catch {}
|
|
10954
10961
|
return {
|
|
10955
10962
|
status,
|
|
@@ -11425,7 +11432,7 @@ var require_clone$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
11425
11432
|
//#endregion
|
|
11426
11433
|
//#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
|
|
11427
11434
|
var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
11428
|
-
var fs$
|
|
11435
|
+
var fs$16 = __require("fs");
|
|
11429
11436
|
var polyfills = require_polyfills();
|
|
11430
11437
|
var legacy = require_legacy_streams();
|
|
11431
11438
|
var clone = require_clone$1();
|
|
@@ -11454,36 +11461,36 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
11454
11461
|
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
11455
11462
|
console.error(m);
|
|
11456
11463
|
};
|
|
11457
|
-
if (!fs$
|
|
11458
|
-
publishQueue(fs$
|
|
11459
|
-
fs$
|
|
11464
|
+
if (!fs$16[gracefulQueue]) {
|
|
11465
|
+
publishQueue(fs$16, global[gracefulQueue] || []);
|
|
11466
|
+
fs$16.close = (function(fs$close) {
|
|
11460
11467
|
function close(fd, cb) {
|
|
11461
|
-
return fs$close.call(fs$
|
|
11468
|
+
return fs$close.call(fs$16, fd, function(err) {
|
|
11462
11469
|
if (!err) resetQueue();
|
|
11463
11470
|
if (typeof cb === "function") cb.apply(this, arguments);
|
|
11464
11471
|
});
|
|
11465
11472
|
}
|
|
11466
11473
|
Object.defineProperty(close, previousSymbol, { value: fs$close });
|
|
11467
11474
|
return close;
|
|
11468
|
-
})(fs$
|
|
11469
|
-
fs$
|
|
11475
|
+
})(fs$16.close);
|
|
11476
|
+
fs$16.closeSync = (function(fs$closeSync) {
|
|
11470
11477
|
function closeSync(fd) {
|
|
11471
|
-
fs$closeSync.apply(fs$
|
|
11478
|
+
fs$closeSync.apply(fs$16, arguments);
|
|
11472
11479
|
resetQueue();
|
|
11473
11480
|
}
|
|
11474
11481
|
Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
|
|
11475
11482
|
return closeSync;
|
|
11476
|
-
})(fs$
|
|
11483
|
+
})(fs$16.closeSync);
|
|
11477
11484
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
|
|
11478
|
-
debug(fs$
|
|
11479
|
-
__require("assert").equal(fs$
|
|
11485
|
+
debug(fs$16[gracefulQueue]);
|
|
11486
|
+
__require("assert").equal(fs$16[gracefulQueue].length, 0);
|
|
11480
11487
|
});
|
|
11481
11488
|
}
|
|
11482
|
-
if (!global[gracefulQueue]) publishQueue(global, fs$
|
|
11483
|
-
module.exports = patch(clone(fs$
|
|
11484
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$
|
|
11485
|
-
module.exports = patch(fs$
|
|
11486
|
-
fs$
|
|
11489
|
+
if (!global[gracefulQueue]) publishQueue(global, fs$16[gracefulQueue]);
|
|
11490
|
+
module.exports = patch(clone(fs$16));
|
|
11491
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$16.__patched) {
|
|
11492
|
+
module.exports = patch(fs$16);
|
|
11493
|
+
fs$16.__patched = true;
|
|
11487
11494
|
}
|
|
11488
11495
|
function patch(fs) {
|
|
11489
11496
|
polyfills(fs);
|
|
@@ -11738,23 +11745,23 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
11738
11745
|
}
|
|
11739
11746
|
function enqueue(elem) {
|
|
11740
11747
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
11741
|
-
fs$
|
|
11748
|
+
fs$16[gracefulQueue].push(elem);
|
|
11742
11749
|
retry();
|
|
11743
11750
|
}
|
|
11744
11751
|
var retryTimer;
|
|
11745
11752
|
function resetQueue() {
|
|
11746
11753
|
var now = Date.now();
|
|
11747
|
-
for (var i = 0; i < fs$
|
|
11748
|
-
fs$
|
|
11749
|
-
fs$
|
|
11754
|
+
for (var i = 0; i < fs$16[gracefulQueue].length; ++i) if (fs$16[gracefulQueue][i].length > 2) {
|
|
11755
|
+
fs$16[gracefulQueue][i][3] = now;
|
|
11756
|
+
fs$16[gracefulQueue][i][4] = now;
|
|
11750
11757
|
}
|
|
11751
11758
|
retry();
|
|
11752
11759
|
}
|
|
11753
11760
|
function retry() {
|
|
11754
11761
|
clearTimeout(retryTimer);
|
|
11755
11762
|
retryTimer = void 0;
|
|
11756
|
-
if (fs$
|
|
11757
|
-
var elem = fs$
|
|
11763
|
+
if (fs$16[gracefulQueue].length === 0) return;
|
|
11764
|
+
var elem = fs$16[gracefulQueue].shift();
|
|
11758
11765
|
var fn = elem[0];
|
|
11759
11766
|
var args = elem[1];
|
|
11760
11767
|
var err = elem[2];
|
|
@@ -11773,7 +11780,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
11773
11780
|
if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
|
|
11774
11781
|
debug("RETRY", fn.name, args);
|
|
11775
11782
|
fn.apply(null, args.concat([startTime]));
|
|
11776
|
-
} else fs$
|
|
11783
|
+
} else fs$16[gracefulQueue].push(elem);
|
|
11777
11784
|
}
|
|
11778
11785
|
if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
|
|
11779
11786
|
}
|
|
@@ -12861,9 +12868,9 @@ function blunContextWindowsUrl(oauthHost) {
|
|
|
12861
12868
|
return `${(oauthHost ?? process.env["BLUN_OAUTH_HOST"] ?? "https://account.blun.ai").replace(/\/+$/, "")}/api/verbrauch/tarife`;
|
|
12862
12869
|
}
|
|
12863
12870
|
function parseManagedContextWindow(payload, plan) {
|
|
12864
|
-
if (!isRecord$
|
|
12871
|
+
if (!isRecord$23(payload)) return void 0;
|
|
12865
12872
|
const contextWindows = payload["kontext"];
|
|
12866
|
-
if (!isRecord$
|
|
12873
|
+
if (!isRecord$23(contextWindows)) return void 0;
|
|
12867
12874
|
const value = contextWindows[plan];
|
|
12868
12875
|
return typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : void 0;
|
|
12869
12876
|
}
|
|
@@ -12898,7 +12905,7 @@ function parseManagedUsagePayload(payload) {
|
|
|
12898
12905
|
const plan = typeof rec["plan"] === "string" && rec["plan"].trim().length > 0 ? rec["plan"].trim() : void 0;
|
|
12899
12906
|
const contextWindowTokens = managedContextWindowFrom(rec);
|
|
12900
12907
|
const unlimited = rec["unlimited"] === true;
|
|
12901
|
-
const stand = isRecord$
|
|
12908
|
+
const stand = isRecord$23(rec["stand"]) ? rec["stand"] : void 0;
|
|
12902
12909
|
if (stand !== void 0) for (const [sourceKey, id, label] of ACCOUNT_USAGE_WINDOWS) {
|
|
12903
12910
|
const row = toAccountUsageRow(stand[sourceKey], id, label, unlimited);
|
|
12904
12911
|
if (row !== null) limits.push(row);
|
|
@@ -12908,9 +12915,9 @@ function parseManagedUsagePayload(payload) {
|
|
|
12908
12915
|
const item = rawLimits[idx];
|
|
12909
12916
|
if (!item || typeof item !== "object") continue;
|
|
12910
12917
|
const detailRaw = item["detail"];
|
|
12911
|
-
const detail = isRecord$
|
|
12918
|
+
const detail = isRecord$23(detailRaw) ? detailRaw : item;
|
|
12912
12919
|
const windowRaw = item["window"];
|
|
12913
|
-
const row = toUsageRow(detail, limitLabel(item, detail, isRecord$
|
|
12920
|
+
const row = toUsageRow(detail, limitLabel(item, detail, isRecord$23(windowRaw) ? windowRaw : {}, idx));
|
|
12914
12921
|
if (row !== null) limits.push(row);
|
|
12915
12922
|
}
|
|
12916
12923
|
return {
|
|
@@ -12934,7 +12941,7 @@ function managedContextWindowFrom(payload) {
|
|
|
12934
12941
|
return values.every((value) => value === first) ? first : void 0;
|
|
12935
12942
|
}
|
|
12936
12943
|
function toAccountUsageRow(raw, id, label, accountUnlimited) {
|
|
12937
|
-
if (!isRecord$
|
|
12944
|
+
if (!isRecord$23(raw)) return null;
|
|
12938
12945
|
const used = toInt(raw["verbraucht"]);
|
|
12939
12946
|
const unlimited = accountUnlimited || raw["unlimited"] === true;
|
|
12940
12947
|
const fraction = raw["anteil"];
|
|
@@ -12967,7 +12974,7 @@ function toAccountUsageRow(raw, id, label, accountUnlimited) {
|
|
|
12967
12974
|
};
|
|
12968
12975
|
}
|
|
12969
12976
|
function toUsageRow(raw, defaultLabel) {
|
|
12970
|
-
if (!isRecord$
|
|
12977
|
+
if (!isRecord$23(raw)) return null;
|
|
12971
12978
|
const unlimited = raw["unlimited"] === true;
|
|
12972
12979
|
const limit = toInt(raw["limit"]);
|
|
12973
12980
|
let used = toInt(raw["used"]);
|
|
@@ -13088,7 +13095,7 @@ function isManagedQuotaErrorMessage(message) {
|
|
|
13088
13095
|
return /you(?:'|’)?ve reached your usage limit/.test(normalized) && /billing cycle|quota will be (?:refreshed|reset)|purchase extra usage/.test(normalized);
|
|
13089
13096
|
}
|
|
13090
13097
|
function hasManagedUsageShape(payload) {
|
|
13091
|
-
if (!isRecord$
|
|
13098
|
+
if (!isRecord$23(payload)) return false;
|
|
13092
13099
|
let recognized = false;
|
|
13093
13100
|
if ("context_window_tokens" in payload || "contextWindowTokens" in payload) {
|
|
13094
13101
|
recognized = true;
|
|
@@ -13104,15 +13111,15 @@ function hasManagedUsageShape(payload) {
|
|
|
13104
13111
|
if (!Array.isArray(limits)) return false;
|
|
13105
13112
|
for (let index = 0; index < limits.length; index++) {
|
|
13106
13113
|
const item = limits[index];
|
|
13107
|
-
if (!isRecord$
|
|
13108
|
-
const detail = isRecord$
|
|
13109
|
-
if (toUsageRow(detail, limitLabel(item, detail, isRecord$
|
|
13114
|
+
if (!isRecord$23(item)) return false;
|
|
13115
|
+
const detail = isRecord$23(item["detail"]) ? item["detail"] : item;
|
|
13116
|
+
if (toUsageRow(detail, limitLabel(item, detail, isRecord$23(item["window"]) ? item["window"] : {}, index)) === null) return false;
|
|
13110
13117
|
}
|
|
13111
13118
|
}
|
|
13112
13119
|
if ("stand" in payload) {
|
|
13113
13120
|
recognized = true;
|
|
13114
13121
|
const stand = payload["stand"];
|
|
13115
|
-
if (!isRecord$
|
|
13122
|
+
if (!isRecord$23(stand)) return false;
|
|
13116
13123
|
const windows = ACCOUNT_USAGE_WINDOWS.filter(([sourceKey]) => sourceKey in stand);
|
|
13117
13124
|
if (windows.length === 0) return false;
|
|
13118
13125
|
const unlimited = payload["unlimited"] === true;
|
|
@@ -13208,8 +13215,8 @@ function userExtras(existing, remoteOwnedFields) {
|
|
|
13208
13215
|
return out;
|
|
13209
13216
|
}
|
|
13210
13217
|
function mergeRefreshedModelAlias(existing, remote, remoteOwnedFields) {
|
|
13211
|
-
const current = isRecord$
|
|
13212
|
-
const overrides = cloneOverrides(isRecord$
|
|
13218
|
+
const current = isRecord$23(existing) ? existing : {};
|
|
13219
|
+
const overrides = cloneOverrides(isRecord$23(current["overrides"]) ? current["overrides"] : void 0);
|
|
13213
13220
|
return {
|
|
13214
13221
|
...userExtras(current, remoteOwnedFields),
|
|
13215
13222
|
...remote,
|
|
@@ -13260,16 +13267,16 @@ function capabilitiesForModel(model) {
|
|
|
13260
13267
|
function defaultBaseUrl(baseUrl) {
|
|
13261
13268
|
return (baseUrl ?? blunCodeBaseUrl()).replace(/\/+$/, "");
|
|
13262
13269
|
}
|
|
13263
|
-
function normalizeBaseUrl(baseUrl) {
|
|
13270
|
+
function normalizeBaseUrl$1(baseUrl) {
|
|
13264
13271
|
return baseUrl.replace(/\/+$/, "");
|
|
13265
13272
|
}
|
|
13266
|
-
function normalizeEndpoint(value) {
|
|
13273
|
+
function normalizeEndpoint$1(value) {
|
|
13267
13274
|
return value.trim().replace(/\/+$/, "");
|
|
13268
13275
|
}
|
|
13269
13276
|
function persistedOAuthHost(options) {
|
|
13270
13277
|
const oauthHost = options.oauthHost;
|
|
13271
|
-
const normalized = normalizeEndpoint(oauthHost ?? "https://account.blun.ai");
|
|
13272
|
-
if (options.key === "oauth/blun" && normalized === normalizeEndpoint("https://account.blun.ai")) return;
|
|
13278
|
+
const normalized = normalizeEndpoint$1(oauthHost ?? "https://account.blun.ai");
|
|
13279
|
+
if (options.key === "oauth/blun" && normalized === normalizeEndpoint$1("https://account.blun.ai")) return;
|
|
13273
13280
|
return normalized;
|
|
13274
13281
|
}
|
|
13275
13282
|
function managedOAuthRef(options) {
|
|
@@ -13297,7 +13304,7 @@ function blunCodeEnvOAuthHost(env = process.env) {
|
|
|
13297
13304
|
return env.BLUN_OAUTH_HOST;
|
|
13298
13305
|
}
|
|
13299
13306
|
function resolveBlunCodeOAuthKey(options) {
|
|
13300
|
-
const oauthHost = normalizeEndpoint(options.oauthHost ?? "https://account.blun.ai");
|
|
13307
|
+
const oauthHost = normalizeEndpoint$1(options.oauthHost ?? "https://account.blun.ai");
|
|
13301
13308
|
const baseUrl = defaultBaseUrl(options.baseUrl);
|
|
13302
13309
|
if (SHARED_DEFAULT_OAUTH_HOSTS.has(oauthHost) && SHARED_DEFAULT_BASE_URLS.has(baseUrl)) return BLUN_OAUTH_KEY;
|
|
13303
13310
|
return `${BLUN_SCOPED_OAUTH_KEY_PREFIX}${createHash("sha256").update(JSON.stringify({
|
|
@@ -13326,7 +13333,7 @@ function resolveBlunCodeRuntimeAuth(options) {
|
|
|
13326
13333
|
const envBaseUrl = blunCodeEnvBaseUrl(env);
|
|
13327
13334
|
const envOAuthHost = blunCodeEnvOAuthHost(env);
|
|
13328
13335
|
const hasEnvOverride = envBaseUrl !== void 0 || envOAuthHost !== void 0;
|
|
13329
|
-
const baseUrl = envBaseUrl !== void 0 ? normalizeBaseUrl(envBaseUrl) : options.configuredBaseUrl;
|
|
13336
|
+
const baseUrl = envBaseUrl !== void 0 ? normalizeBaseUrl$1(envBaseUrl) : options.configuredBaseUrl;
|
|
13330
13337
|
const expected = resolveBlunCodeOAuthRef({
|
|
13331
13338
|
oauthHost: hasEnvOverride ? envOAuthHost : options.configuredOAuthRef?.oauthHost,
|
|
13332
13339
|
baseUrl
|
|
@@ -13354,7 +13361,7 @@ function resolveBlunCodeLoginAuth(options) {
|
|
|
13354
13361
|
const envBaseUrl = blunCodeEnvBaseUrl(env);
|
|
13355
13362
|
const envOAuthHost = blunCodeEnvOAuthHost(env);
|
|
13356
13363
|
const hasOverride = options.requestedBaseUrl !== void 0 || options.requestedOAuthHost !== void 0 || envBaseUrl !== void 0 || envOAuthHost !== void 0;
|
|
13357
|
-
const baseUrl = options.requestedBaseUrl !== void 0 ? normalizeBaseUrl(options.requestedBaseUrl) : envBaseUrl !== void 0 ? normalizeBaseUrl(envBaseUrl) : options.configuredBaseUrl;
|
|
13364
|
+
const baseUrl = options.requestedBaseUrl !== void 0 ? normalizeBaseUrl$1(options.requestedBaseUrl) : envBaseUrl !== void 0 ? normalizeBaseUrl$1(envBaseUrl) : options.configuredBaseUrl;
|
|
13358
13365
|
const oauthHost = options.requestedOAuthHost ?? envOAuthHost;
|
|
13359
13366
|
if (hasOverride) return {
|
|
13360
13367
|
baseUrl,
|
|
@@ -13391,7 +13398,7 @@ function parseModelContextLength(item, modelId) {
|
|
|
13391
13398
|
return values[0];
|
|
13392
13399
|
}
|
|
13393
13400
|
function toModelInfo(item) {
|
|
13394
|
-
if (!isRecord$
|
|
13401
|
+
if (!isRecord$23(item) || typeof item["id"] !== "string" || item["id"].length === 0) return;
|
|
13395
13402
|
const contextLength = parseModelContextLength(item, item["id"]);
|
|
13396
13403
|
const displayName = item["display_name"];
|
|
13397
13404
|
const normalizedDisplayName = typeof displayName === "string" && displayName.length > 0 ? displayName : void 0;
|
|
@@ -13478,7 +13485,7 @@ async function fetchManagedBlunCodeModels(options) {
|
|
|
13478
13485
|
throw new Error(message);
|
|
13479
13486
|
}
|
|
13480
13487
|
const payload = await response.json();
|
|
13481
|
-
if (!isRecord$
|
|
13488
|
+
if (!isRecord$23(payload) || !Array.isArray(payload["data"])) throw new Error(`Unexpected models response for ${baseUrl}.`);
|
|
13482
13489
|
return payload["data"].map((item) => toModelInfo(item)).filter((item) => item !== void 0);
|
|
13483
13490
|
}
|
|
13484
13491
|
throw new Error(`Failed to list BLUN models for ${baseUrl}.`);
|
|
@@ -13521,11 +13528,11 @@ function applyManagedBlunCodeConfig(config, options) {
|
|
|
13521
13528
|
apiKey
|
|
13522
13529
|
};
|
|
13523
13530
|
const upstreamKeys = new Set(options.models.map((m) => managedModelKey(m.id)));
|
|
13524
|
-
for (const [key, model] of Object.entries(existingModels)) if (RETIRED_BLUN_MODEL_KEYS.has(key) || isRecord$
|
|
13531
|
+
for (const [key, model] of Object.entries(existingModels)) if (RETIRED_BLUN_MODEL_KEYS.has(key) || isRecord$23(model) && model["provider"] === "managed:blun" && !upstreamKeys.has(key)) delete existingModels[key];
|
|
13525
13532
|
for (const model of options.models) {
|
|
13526
13533
|
const capabilities = capabilitiesForModel(model);
|
|
13527
13534
|
const key = managedModelKey(model.id);
|
|
13528
|
-
const existing = isRecord$
|
|
13535
|
+
const existing = isRecord$23(existingModels[key]) ? existingModels[key] : {};
|
|
13529
13536
|
const supportsAdaptiveThinking = capabilities?.includes("thinking") === true || capabilities?.includes("always_thinking") === true;
|
|
13530
13537
|
existingModels[key] = mergeRefreshedModelAlias(existing, {
|
|
13531
13538
|
provider: BLUN_PROVIDER_NAME$1,
|
|
@@ -13573,7 +13580,7 @@ function applyManagedBlunCodeLogoutConfig(config) {
|
|
|
13573
13580
|
let removedDefaultModel = false;
|
|
13574
13581
|
const existingModels = config.models ?? {};
|
|
13575
13582
|
for (const [key, model] of Object.entries(existingModels)) {
|
|
13576
|
-
if (!isRecord$
|
|
13583
|
+
if (!isRecord$23(model) || model["provider"] !== "managed:blun") continue;
|
|
13577
13584
|
delete existingModels[key];
|
|
13578
13585
|
if (config.defaultModel === key) removedDefaultModel = true;
|
|
13579
13586
|
}
|
|
@@ -13613,7 +13620,7 @@ function selectDefaultModel(config, models, options) {
|
|
|
13613
13620
|
function canPreserveDefaultModel(existingModels, defaultModel, managedModels) {
|
|
13614
13621
|
if (managedModels.has(defaultModel)) return true;
|
|
13615
13622
|
const existing = existingModels[defaultModel];
|
|
13616
|
-
return isRecord$
|
|
13623
|
+
return isRecord$23(existing) && existing["provider"] !== "managed:blun";
|
|
13617
13624
|
}
|
|
13618
13625
|
function assertPositiveContextLength(model) {
|
|
13619
13626
|
if (!Number.isInteger(model.contextLength) || model.contextLength <= 0) throw new Error(`BLUN model "${model.id}" must include a positive context_length.`);
|
|
@@ -13677,8 +13684,8 @@ var init_managed_blun = __esmMin((() => {
|
|
|
13677
13684
|
this.baseUrl = options.baseUrl;
|
|
13678
13685
|
}
|
|
13679
13686
|
};
|
|
13680
|
-
SHARED_DEFAULT_BASE_URLS = new Set([normalizeEndpoint(DEFAULT_BLUN_BASE_URL), normalizeEndpoint("https://api.blun.ai/coding/v1")]);
|
|
13681
|
-
SHARED_DEFAULT_OAUTH_HOSTS = new Set([normalizeEndpoint(DEFAULT_BLUN_OAUTH_HOST), normalizeEndpoint("https://auth.blun.ai")]);
|
|
13687
|
+
SHARED_DEFAULT_BASE_URLS = new Set([normalizeEndpoint$1(DEFAULT_BLUN_BASE_URL), normalizeEndpoint$1("https://api.blun.ai/coding/v1")]);
|
|
13688
|
+
SHARED_DEFAULT_OAUTH_HOSTS = new Set([normalizeEndpoint$1(DEFAULT_BLUN_OAUTH_HOST), normalizeEndpoint$1("https://auth.blun.ai")]);
|
|
13682
13689
|
MODEL_CONTEXT_LENGTH_FIELDS = [
|
|
13683
13690
|
"context_length",
|
|
13684
13691
|
"max_model_len",
|
|
@@ -13691,13 +13698,13 @@ function blunManagedQuotaUrl(oauthHost) {
|
|
|
13691
13698
|
return `${(oauthHost ?? process.env["BLUN_OAUTH_HOST"] ?? "https://account.blun.ai").replace(/\/+$/, "")}${MANAGED_QUOTA_PATH}`;
|
|
13692
13699
|
}
|
|
13693
13700
|
function parseManagedQuotaPayload(payload) {
|
|
13694
|
-
if (!isRecord$
|
|
13701
|
+
if (!isRecord$23(payload)) return void 0;
|
|
13695
13702
|
const plan = nonEmptyString$6(payload["plan"]);
|
|
13696
13703
|
const paid = payload["bezahlt"];
|
|
13697
13704
|
const creditCents = payload["guthaben_cent"];
|
|
13698
13705
|
const billingKind = nonEmptyString$6(payload["art"]);
|
|
13699
13706
|
const globalUnlimited = payload["unlimited"];
|
|
13700
|
-
if (plan === void 0 || typeof paid !== "boolean" || !Number.isSafeInteger(creditCents) || creditCents < 0 || billingKind === void 0 || globalUnlimited !== void 0 && typeof globalUnlimited !== "boolean" || !isRecord$
|
|
13707
|
+
if (plan === void 0 || typeof paid !== "boolean" || !Number.isSafeInteger(creditCents) || creditCents < 0 || billingKind === void 0 || globalUnlimited !== void 0 && typeof globalUnlimited !== "boolean" || !isRecord$23(payload["stand"])) return;
|
|
13701
13708
|
if (!hasStrictQuotaStand(payload["stand"], globalUnlimited === true)) return void 0;
|
|
13702
13709
|
const limits = parseManagedUsagePayload(payload).limits;
|
|
13703
13710
|
if (limits.length !== REQUIRED_WINDOWS.length || REQUIRED_WINDOWS.some(([, id]) => limits.filter((row) => row.id === id).length !== 1)) return;
|
|
@@ -13767,7 +13774,7 @@ function nonEmptyString$6(value) {
|
|
|
13767
13774
|
function hasStrictQuotaStand(stand, globalUnlimited) {
|
|
13768
13775
|
return REQUIRED_WINDOWS.every(([sourceKey]) => {
|
|
13769
13776
|
const row = stand[sourceKey];
|
|
13770
|
-
if (!isRecord$
|
|
13777
|
+
if (!isRecord$23(row)) return false;
|
|
13771
13778
|
const used = row["verbraucht"];
|
|
13772
13779
|
const rowUnlimited = row["unlimited"];
|
|
13773
13780
|
if (rowUnlimited !== void 0 && typeof rowUnlimited !== "boolean") return false;
|
|
@@ -14609,7 +14616,7 @@ async function syncDir(dirPath) {
|
|
|
14609
14616
|
*/
|
|
14610
14617
|
function syncFd(fd) {
|
|
14611
14618
|
return new Promise((resolve, reject) => {
|
|
14612
|
-
fs$
|
|
14619
|
+
fs$17.fsync(fd, (err) => {
|
|
14613
14620
|
if (err) {
|
|
14614
14621
|
reject(err);
|
|
14615
14622
|
return;
|
|
@@ -20943,7 +20950,7 @@ function parseSkillText(options) {
|
|
|
20943
20950
|
throw error;
|
|
20944
20951
|
}
|
|
20945
20952
|
const frontmatter = parsed.data ?? {};
|
|
20946
|
-
if (!isRecord$
|
|
20953
|
+
if (!isRecord$22(frontmatter)) throw new SkillParseError(`Frontmatter in ${options.skillMdPath} must be a mapping at the top level`);
|
|
20947
20954
|
const metadata = normalizeMetadata(frontmatter);
|
|
20948
20955
|
if (!isSupportedSkillType(metadata.type)) throw new UnsupportedSkillTypeError(metadata.type ?? String(frontmatter["type"]));
|
|
20949
20956
|
const name = nonEmptyString$4(metadata.name);
|
|
@@ -21056,7 +21063,7 @@ function tokenizeArgs(raw) {
|
|
|
21056
21063
|
function nonEmptyString$4(value) {
|
|
21057
21064
|
return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
|
|
21058
21065
|
}
|
|
21059
|
-
function isRecord$
|
|
21066
|
+
function isRecord$22(value) {
|
|
21060
21067
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21061
21068
|
}
|
|
21062
21069
|
var import_regexp_escape, FrontmatterError, SkillParseError, UnsupportedSkillTypeError, FENCE, METADATA_ALIASES;
|
|
@@ -21105,7 +21112,7 @@ var init_parser$1 = __esmMin((() => {
|
|
|
21105
21112
|
function parseCommandText(input) {
|
|
21106
21113
|
const { text, commandPath, pluginId } = input;
|
|
21107
21114
|
const parsed = parseFrontmatter(text);
|
|
21108
|
-
const frontmatter = isRecord$
|
|
21115
|
+
const frontmatter = isRecord$21(parsed.data) ? parsed.data : {};
|
|
21109
21116
|
const baseName = input.fallbackName ?? path.basename(commandPath).replace(/\.md$/i, "");
|
|
21110
21117
|
const name = nonEmptyString$3(frontmatter["name"]) ?? baseName;
|
|
21111
21118
|
const body = parsed.body.trim();
|
|
@@ -21147,7 +21154,7 @@ function descriptionFromBody(body) {
|
|
|
21147
21154
|
if (firstLine === void 0) return "No description provided.";
|
|
21148
21155
|
return firstLine.length > 240 ? `${firstLine.slice(0, 239)}…` : firstLine;
|
|
21149
21156
|
}
|
|
21150
|
-
function isRecord$
|
|
21157
|
+
function isRecord$21(value) {
|
|
21151
21158
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21152
21159
|
}
|
|
21153
21160
|
var init_commands = __esmMin((() => {
|
|
@@ -26786,7 +26793,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
26786
26793
|
};
|
|
26787
26794
|
return _setPrototypeOf(o, p);
|
|
26788
26795
|
}
|
|
26789
|
-
var fs$
|
|
26796
|
+
var fs$15 = __require("fs");
|
|
26790
26797
|
var path$14 = __require("path");
|
|
26791
26798
|
var Loader = require_loader();
|
|
26792
26799
|
var PrecompiledLoader = require_precompiled_loader().PrecompiledLoader;
|
|
@@ -26810,7 +26817,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
26810
26817
|
} catch (e) {
|
|
26811
26818
|
throw new Error("watch requires chokidar to be installed");
|
|
26812
26819
|
}
|
|
26813
|
-
var paths = _this.searchPaths.filter(fs$
|
|
26820
|
+
var paths = _this.searchPaths.filter(fs$15.existsSync);
|
|
26814
26821
|
var watcher = chokidar.watch(paths);
|
|
26815
26822
|
watcher.on("all", function(event, fullname) {
|
|
26816
26823
|
fullname = path$14.resolve(fullname);
|
|
@@ -26829,7 +26836,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
26829
26836
|
for (var i = 0; i < paths.length; i++) {
|
|
26830
26837
|
var basePath = path$14.resolve(paths[i]);
|
|
26831
26838
|
var p = path$14.resolve(paths[i], name);
|
|
26832
|
-
if (p.indexOf(basePath) === 0 && fs$
|
|
26839
|
+
if (p.indexOf(basePath) === 0 && fs$15.existsSync(p)) {
|
|
26833
26840
|
fullpath = p;
|
|
26834
26841
|
break;
|
|
26835
26842
|
}
|
|
@@ -26837,7 +26844,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
26837
26844
|
if (!fullpath) return null;
|
|
26838
26845
|
this.pathsToNames[fullpath] = name;
|
|
26839
26846
|
var source = {
|
|
26840
|
-
src: fs$
|
|
26847
|
+
src: fs$15.readFileSync(fullpath, "utf-8"),
|
|
26841
26848
|
path: fullpath,
|
|
26842
26849
|
noCache: this.noCache
|
|
26843
26850
|
};
|
|
@@ -26885,7 +26892,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
26885
26892
|
}
|
|
26886
26893
|
this.pathsToNames[fullpath] = name;
|
|
26887
26894
|
var source = {
|
|
26888
|
-
src: fs$
|
|
26895
|
+
src: fs$15.readFileSync(fullpath, "utf-8"),
|
|
26889
26896
|
path: fullpath,
|
|
26890
26897
|
noCache: this.noCache
|
|
26891
26898
|
};
|
|
@@ -27629,7 +27636,7 @@ var require_precompile_global = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
27629
27636
|
//#endregion
|
|
27630
27637
|
//#region ../../node_modules/.pnpm/nunjucks@3.2.4_chokidar@4.0.3/node_modules/nunjucks/src/precompile.js
|
|
27631
27638
|
var require_precompile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
27632
|
-
var fs$
|
|
27639
|
+
var fs$14 = __require("fs");
|
|
27633
27640
|
var path$12 = __require("path");
|
|
27634
27641
|
var _prettifyError = require_lib$7()._prettifyError;
|
|
27635
27642
|
var compiler = require_compiler();
|
|
@@ -27654,27 +27661,27 @@ var require_precompile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
27654
27661
|
var env = opts.env || new Environment([]);
|
|
27655
27662
|
var wrapper = opts.wrapper || precompileGlobal;
|
|
27656
27663
|
if (opts.isString) return precompileString(input, opts);
|
|
27657
|
-
var pathStats = fs$
|
|
27664
|
+
var pathStats = fs$14.existsSync(input) && fs$14.statSync(input);
|
|
27658
27665
|
var precompiled = [];
|
|
27659
27666
|
var templates = [];
|
|
27660
27667
|
function addTemplates(dir) {
|
|
27661
|
-
fs$
|
|
27668
|
+
fs$14.readdirSync(dir).forEach(function(file) {
|
|
27662
27669
|
var filepath = path$12.join(dir, file);
|
|
27663
27670
|
var subpath = filepath.substr(path$12.join(input, "/").length);
|
|
27664
|
-
var stat = fs$
|
|
27671
|
+
var stat = fs$14.statSync(filepath);
|
|
27665
27672
|
if (stat && stat.isDirectory()) {
|
|
27666
27673
|
subpath += "/";
|
|
27667
27674
|
if (!match(subpath, opts.exclude)) addTemplates(filepath);
|
|
27668
27675
|
} else if (match(subpath, opts.include)) templates.push(filepath);
|
|
27669
27676
|
});
|
|
27670
27677
|
}
|
|
27671
|
-
if (pathStats.isFile()) precompiled.push(_precompile(fs$
|
|
27678
|
+
if (pathStats.isFile()) precompiled.push(_precompile(fs$14.readFileSync(input, "utf-8"), opts.name || input, env));
|
|
27672
27679
|
else if (pathStats.isDirectory()) {
|
|
27673
27680
|
addTemplates(input);
|
|
27674
27681
|
for (var i = 0; i < templates.length; i++) {
|
|
27675
27682
|
var name = templates[i].replace(path$12.join(input, "/"), "");
|
|
27676
27683
|
try {
|
|
27677
|
-
precompiled.push(_precompile(fs$
|
|
27684
|
+
precompiled.push(_precompile(fs$14.readFileSync(templates[i], "utf-8"), name, env));
|
|
27678
27685
|
} catch (e) {
|
|
27679
27686
|
if (opts.force) console.error(e);
|
|
27680
27687
|
else throw e;
|
|
@@ -28750,12 +28757,12 @@ function legacyStatusToCurrent$1(task) {
|
|
|
28750
28757
|
return task.status;
|
|
28751
28758
|
}
|
|
28752
28759
|
function isReadablePersistedTask$1(obj) {
|
|
28753
|
-
return isRecord$
|
|
28760
|
+
return isRecord$20(obj) && (typeof obj["taskId"] === "string" || typeof obj["task_id"] === "string");
|
|
28754
28761
|
}
|
|
28755
28762
|
function isLegacyPersistedTask$1(task) {
|
|
28756
28763
|
return "task_id" in task;
|
|
28757
28764
|
}
|
|
28758
|
-
function isRecord$
|
|
28765
|
+
function isRecord$20(value) {
|
|
28759
28766
|
return typeof value === "object" && value !== null;
|
|
28760
28767
|
}
|
|
28761
28768
|
function optionalNonEmptyString$2(value) {
|
|
@@ -36239,7 +36246,7 @@ var require_gifframe = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
36239
36246
|
//#region ../../node_modules/.pnpm/gifwrap@0.10.1/node_modules/gifwrap/src/gifutil.js
|
|
36240
36247
|
var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
36241
36248
|
/** @namespace GifUtil */
|
|
36242
|
-
const fs$
|
|
36249
|
+
const fs$13 = __require("fs");
|
|
36243
36250
|
const ImageQ = require_image_q();
|
|
36244
36251
|
const BitmapImage = require_bitmapimage();
|
|
36245
36252
|
const { GifFrame } = require_gifframe();
|
|
@@ -36506,7 +36513,7 @@ var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
36506
36513
|
}
|
|
36507
36514
|
function _readBinary(path) {
|
|
36508
36515
|
return new Promise((resolve, reject) => {
|
|
36509
|
-
fs$
|
|
36516
|
+
fs$13.readFile(path, (err, buffer) => {
|
|
36510
36517
|
if (err) return reject(err);
|
|
36511
36518
|
return resolve(buffer);
|
|
36512
36519
|
});
|
|
@@ -36514,7 +36521,7 @@ var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
36514
36521
|
}
|
|
36515
36522
|
function _writeBinary(path, buffer) {
|
|
36516
36523
|
return new Promise((resolve, reject) => {
|
|
36517
|
-
fs$
|
|
36524
|
+
fs$13.writeFile(path, buffer, (err) => {
|
|
36518
36525
|
if (err) return reject(err);
|
|
36519
36526
|
return resolve();
|
|
36520
36527
|
});
|
|
@@ -50319,7 +50326,7 @@ function addIssueToContext(ctx, issueData) {
|
|
|
50319
50326
|
});
|
|
50320
50327
|
ctx.common.issues.push(issue);
|
|
50321
50328
|
}
|
|
50322
|
-
var makeIssue, EMPTY_PATH, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid$1, isAsync;
|
|
50329
|
+
var makeIssue, EMPTY_PATH, ParseStatus, INVALID, DIRTY, OK, isAborted$1, isDirty, isValid$1, isAsync;
|
|
50323
50330
|
var init_parseUtil = __esmMin((() => {
|
|
50324
50331
|
init_errors$3();
|
|
50325
50332
|
init_en();
|
|
@@ -50407,7 +50414,7 @@ var init_parseUtil = __esmMin((() => {
|
|
|
50407
50414
|
status: "valid",
|
|
50408
50415
|
value
|
|
50409
50416
|
});
|
|
50410
|
-
isAborted = (x) => x.status === "aborted";
|
|
50417
|
+
isAborted$1 = (x) => x.status === "aborted";
|
|
50411
50418
|
isDirty = (x) => x.status === "dirty";
|
|
50412
50419
|
isValid$1 = (x) => x.status === "valid";
|
|
50413
50420
|
isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
@@ -52624,7 +52631,7 @@ var init_types$11 = __esmMin((() => {
|
|
|
52624
52631
|
_parse(input) {
|
|
52625
52632
|
const { status, ctx } = this._processInputParams(input);
|
|
52626
52633
|
const handleParsed = (parsedLeft, parsedRight) => {
|
|
52627
|
-
if (isAborted(parsedLeft) || isAborted(parsedRight)) return INVALID;
|
|
52634
|
+
if (isAborted$1(parsedLeft) || isAborted$1(parsedRight)) return INVALID;
|
|
52628
52635
|
const merged = mergeValues(parsedLeft.value, parsedRight.value);
|
|
52629
52636
|
if (!merged.valid) {
|
|
52630
52637
|
addIssueToContext(ctx, { code: ZodIssueCode.invalid_intersection_types });
|
|
@@ -53712,7 +53719,7 @@ var external_exports = /* @__PURE__ */ __exportAll({
|
|
|
53712
53719
|
getParsedType: () => getParsedType,
|
|
53713
53720
|
instanceof: () => instanceOfType,
|
|
53714
53721
|
intersection: () => intersectionType,
|
|
53715
|
-
isAborted: () => isAborted,
|
|
53722
|
+
isAborted: () => isAborted$1,
|
|
53716
53723
|
isAsync: () => isAsync,
|
|
53717
53724
|
isDirty: () => isDirty,
|
|
53718
53725
|
isValid: () => isValid$1,
|
|
@@ -62332,7 +62339,7 @@ var init_file_type = __esmMin((() => {
|
|
|
62332
62339
|
}
|
|
62333
62340
|
async fromFile(path) {
|
|
62334
62341
|
this.options.signal?.throwIfAborted();
|
|
62335
|
-
const fileHandle = await
|
|
62342
|
+
const fileHandle = await fs.open(path, constants.O_RDONLY | constants.O_NONBLOCK);
|
|
62336
62343
|
const fileStat = await fileHandle.stat();
|
|
62337
62344
|
if (!fileStat.isFile()) {
|
|
62338
62345
|
await fileHandle.close();
|
|
@@ -73854,7 +73861,7 @@ function escapeXml(value) {
|
|
|
73854
73861
|
function locationKey(messageIndex, partIndex) {
|
|
73855
73862
|
return `${String(messageIndex)}:${String(partIndex)}`;
|
|
73856
73863
|
}
|
|
73857
|
-
function isRecord$
|
|
73864
|
+
function isRecord$19(value) {
|
|
73858
73865
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
73859
73866
|
}
|
|
73860
73867
|
function isNonNegativeInteger$1(value) {
|
|
@@ -74053,7 +74060,7 @@ var init_vision_reader = __esmMin((() => {
|
|
|
74053
74060
|
reason: "malformed"
|
|
74054
74061
|
};
|
|
74055
74062
|
}
|
|
74056
|
-
if (!isRecord$
|
|
74063
|
+
if (!isRecord$19(payload) || payload["done"] !== true || typeof payload["response"] !== "string" || !isNonNegativeInteger$1(payload["prompt_eval_count"]) || !isNonNegativeInteger$1(payload["eval_count"])) return {
|
|
74057
74064
|
ok: false,
|
|
74058
74065
|
reason: "malformed"
|
|
74059
74066
|
};
|
|
@@ -229885,7 +229892,7 @@ function killProcessTreeWindows(child, force) {
|
|
|
229885
229892
|
} catch {}
|
|
229886
229893
|
}
|
|
229887
229894
|
}
|
|
229888
|
-
function isRecord$
|
|
229895
|
+
function isRecord$18(value) {
|
|
229889
229896
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
229890
229897
|
}
|
|
229891
229898
|
function errorMessage$11(error) {
|
|
@@ -229901,7 +229908,7 @@ var init_runner = __esmMin((() => {
|
|
|
229901
229908
|
if (typeof value === "string") return value;
|
|
229902
229909
|
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return String(value);
|
|
229903
229910
|
}, string().optional());
|
|
229904
|
-
HookSpecificOutputSchema = preprocess((value) => isRecord$
|
|
229911
|
+
HookSpecificOutputSchema = preprocess((value) => isRecord$18(value) ? value : void 0, looseObject({
|
|
229905
229912
|
message: OptionalStringSchema,
|
|
229906
229913
|
permissionDecision: unknown().optional(),
|
|
229907
229914
|
permissionDecisionReason: OptionalStringSchema
|
|
@@ -230811,7 +230818,7 @@ function parsePersonalMemoryRecall(output) {
|
|
|
230811
230818
|
} catch {
|
|
230812
230819
|
return { kind: "invalid" };
|
|
230813
230820
|
}
|
|
230814
|
-
if (!isRecord$
|
|
230821
|
+
if (!isRecord$17(parsed) || !isRecord$17(parsed["personal_memory"])) return { kind: "invalid" };
|
|
230815
230822
|
const memory = parsed["personal_memory"];
|
|
230816
230823
|
const savedRaw = memory["saved"];
|
|
230817
230824
|
const threadsRaw = memory["threads"];
|
|
@@ -230820,7 +230827,7 @@ function parsePersonalMemoryRecall(output) {
|
|
|
230820
230827
|
if (savedRaw.length > MAX_SAVED_MEMORIES || threadsRaw.length > MAX_THREADS || historyRaw.length > 0) return { kind: "invalid" };
|
|
230821
230828
|
const saved = [];
|
|
230822
230829
|
for (const value of savedRaw) {
|
|
230823
|
-
if (!isRecord$
|
|
230830
|
+
if (!isRecord$17(value)) return { kind: "invalid" };
|
|
230824
230831
|
const text = boundedTrimmedString(value["text"], MAX_MEMORY_TEXT_CHARS);
|
|
230825
230832
|
const confidence = value["confidence"];
|
|
230826
230833
|
if (text === void 0 || typeof confidence !== "string" || !CONFIDENCE_VALUES.has(confidence)) return { kind: "invalid" };
|
|
@@ -230831,7 +230838,7 @@ function parsePersonalMemoryRecall(output) {
|
|
|
230831
230838
|
}
|
|
230832
230839
|
const threads = [];
|
|
230833
230840
|
for (const value of threadsRaw) {
|
|
230834
|
-
if (!isRecord$
|
|
230841
|
+
if (!isRecord$17(value)) return { kind: "invalid" };
|
|
230835
230842
|
const title = boundedTrimmedString(value["title"], MAX_THREAD_TITLE_CHARS);
|
|
230836
230843
|
const summary = boundedTrimmedString(value["summary"], MAX_THREAD_SUMMARY_CHARS);
|
|
230837
230844
|
if (title === void 0 || summary === void 0) return { kind: "invalid" };
|
|
@@ -230885,7 +230892,7 @@ function boundedTrimmedString(value, maxChars) {
|
|
|
230885
230892
|
const trimmed = value.trim();
|
|
230886
230893
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
230887
230894
|
}
|
|
230888
|
-
function isRecord$
|
|
230895
|
+
function isRecord$17(value) {
|
|
230889
230896
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
230890
230897
|
}
|
|
230891
230898
|
var PERSONAL_MEMORY_HOST_RECALL_HANDLER$1, RECALL_LIMIT, RECALL_TIMEOUT_MS, MAX_QUERY_CHARS, MAX_WIRE_CHARS, MAX_SAVED_MEMORIES, MAX_THREADS, MAX_MEMORY_TEXT_CHARS, MAX_THREAD_TITLE_CHARS, MAX_THREAD_SUMMARY_CHARS, CONFIDENCE_VALUES, TELEGRAM_GROUP_MARKER_RE, TELEGRAM_MARKER_RE, TELEGRAM_CHANNEL_RE, TELEGRAM_SOURCE_RE, TELEGRAM_CHAT_ID_RE, TELEGRAM_SENDER_LINE_RE, TELEGRAM_ATTACHMENT_BLOCK_RE, TELEGRAM_ATTACHMENT_NOTICE_RE, TELEGRAM_IMAGE_ATTACHMENT_RE, GENERIC_IMAGE_QUERY, GENERIC_FILE_QUERY, GENERIC_EMPTY_QUERY, PERSONAL_MEMORY_RECALL_VARIANT, PersonalMemoryRecallInjector;
|
|
@@ -252333,7 +252340,7 @@ function Yn(s, t) {
|
|
|
252333
252340
|
function Kn(s, t) {
|
|
252334
252341
|
s.head = new ue$1(t, void 0, s.head, s), s.tail || (s.tail = s.head), s.length++;
|
|
252335
252342
|
}
|
|
252336
|
-
var zr, Ur, Ds, Wr, Gr, Zr, Q$1, J$1, nt$1, De$1, qt, Ne$1, Ns, Ae$1, As, z$1, Mt, g$1, Qt, Bt, b$1, N$1, _$1, bi, Ie$1, L$1, S, _i, Oi, Is, Ti, Z$1, xi, Ce$1, Jt$1, Rt, C, jt, Yr, Kr, Vr, $r, Fe$1, Li, Xr, qr, A$1, Jr, ht, H$1, te, m$1, Ni, tt$1, Ai, ki, vi, ie$1, ke$1, Ut$1, Ht, Ii, Pt, at, U$1, ot, Y$1, zt, Ci, j$1, ee$1, Fi, ve$1, gt$2, Me, bt, _t, Be$1, et$1, Wt$1, jr, Fs, ks, vs, Ms, Bs, tn, se$1, K$1, sn, M$1, rn, zs, nn, Bi, Tt, Gt, Pi, re, Pe$1, ze$1, Ue, He$1, We$1, Ge$1, Ze$1, Ye$1, Ke$1, Us, hn, an, Hs, ln, cn, Ws, Gs, Hi, ne, dn, Ui, oe$1, Ve$1, un, F$1, mn, xt, Wi, pn, lt, En, wn, Sn, ct, yn, Rn, gn, Gi, bn, Lt, ft, On, Tn, xn, f, $e$1, Dt, Nn, Xi, qi, An, B$1, Nt, it, Zi, Zs, V$1, he$1, dt, Ys, p, st$1, ut, Yi, At, w$1, Xe$1, qe$1, Ki, Ks, Vs, ae$1, Vi, Qe$1, Yt$1, $$1, Je$1, It, je$1, ti, $s, In, le$1, $i, Xs, Cn, rt$1, mt, vn, Qi, Mn, Bn, Ct, Ji, zn, qs, ce$1, ei, ji, Un, Hn, ts, Qs, rr, Wn, tr, er, ir, is$2, sr, fe$1, ii, ss, si, rs, ns, os$6, hs, pt, ri, as, es, q$1, de$1, ni, oi, Gn, hi, ue$1, pi, nr, li, me$1, W$1, pe$2, Et, Ft$1, Ee$1, ai, G, ls, ci, or, ds, us, fi, di, hr, cs, ui, lr, fs$
|
|
252343
|
+
var zr, Ur, Ds, Wr, Gr, Zr, Q$1, J$1, nt$1, De$1, qt, Ne$1, Ns, Ae$1, As, z$1, Mt, g$1, Qt, Bt, b$1, N$1, _$1, bi, Ie$1, L$1, S, _i, Oi, Is, Ti, Z$1, xi, Ce$1, Jt$1, Rt, C, jt, Yr, Kr, Vr, $r, Fe$1, Li, Xr, qr, A$1, Jr, ht, H$1, te, m$1, Ni, tt$1, Ai, ki, vi, ie$1, ke$1, Ut$1, Ht, Ii, Pt, at, U$1, ot, Y$1, zt, Ci, j$1, ee$1, Fi, ve$1, gt$2, Me, bt, _t, Be$1, et$1, Wt$1, jr, Fs, ks, vs, Ms, Bs, tn, se$1, K$1, sn, M$1, rn, zs, nn, Bi, Tt, Gt, Pi, re, Pe$1, ze$1, Ue, He$1, We$1, Ge$1, Ze$1, Ye$1, Ke$1, Us, hn, an, Hs, ln, cn, Ws, Gs, Hi, ne, dn, Ui, oe$1, Ve$1, un, F$1, mn, xt, Wi, pn, lt, En, wn, Sn, ct, yn, Rn, gn, Gi, bn, Lt, ft, On, Tn, xn, f, $e$1, Dt, Nn, Xi, qi, An, B$1, Nt, it, Zi, Zs, V$1, he$1, dt, Ys, p, st$1, ut, Yi, At, w$1, Xe$1, qe$1, Ki, Ks, Vs, ae$1, Vi, Qe$1, Yt$1, $$1, Je$1, It, je$1, ti, $s, In, le$1, $i, Xs, Cn, rt$1, mt, vn, Qi, Mn, Bn, Ct, Ji, zn, qs, ce$1, ei, ji, Un, Hn, ts, Qs, rr, Wn, tr, er, ir, is$2, sr, fe$1, ii, ss, si, rs, ns, os$6, hs, pt, ri, as, es, q$1, de$1, ni, oi, Gn, hi, ue$1, pi, nr, li, me$1, W$1, pe$2, Et, Ft$1, Ee$1, ai, G, ls, ci, or, ds, us, fi, di, hr, cs, ui, lr, fs$12, wt, kt, Vn, $n, fr, dr, Xn, qn, Er, wr, ur, Sr, yr, Rr, jn, to, eo, mr, ms, ps, Ei, io, Es, so, ws, Se$1, St, no, gr, Ss, br, oo, _r, ys, Or, Vt$1, Tr, ao, lo, yi, Lr, Dr, _s, Nr, Os, P$1, Ts, xs, gi, Ar, Ir, Re, Cr, Fr, Rs, yt, O$1, Ri, kr, $t, gs, bs, Ls, ge$1, be, _e$1, Oe$1, Te$1, uo, mo, po, vr, Xt$1, ye$1, xe$1, Eo, wo, So, yo, Ro, go, bo, _o, vt, To;
|
|
252337
252344
|
var init_index_min = __esmMin((() => {
|
|
252338
252345
|
zr = Object.defineProperty;
|
|
252339
252346
|
Ur = (s, t) => {
|
|
@@ -254303,7 +254310,7 @@ while (this[Zs](this[st$1].shift()));
|
|
|
254303
254310
|
constructor(t, e) {
|
|
254304
254311
|
this.path = t || "./", this.absolute = e;
|
|
254305
254312
|
}
|
|
254306
|
-
}, nr = Buffer.alloc(1024), li = Symbol("onStat"), me$1 = Symbol("ended"), W$1 = Symbol("queue"), pe$2 = Symbol("pendingLinks"), Et = Symbol("current"), Ft$1 = Symbol("process"), Ee$1 = Symbol("processing"), ai = Symbol("processJob"), G = Symbol("jobs"), ls = Symbol("jobDone"), ci = Symbol("addFSEntry"), or = Symbol("addTarEntry"), ds = Symbol("stat"), us = Symbol("readdir"), fi = Symbol("onreaddir"), di = Symbol("pipe"), hr = Symbol("entry"), cs = Symbol("entryOpt"), ui = Symbol("writeEntryClass"), lr = Symbol("write"), fs$
|
|
254313
|
+
}, nr = Buffer.alloc(1024), li = Symbol("onStat"), me$1 = Symbol("ended"), W$1 = Symbol("queue"), pe$2 = Symbol("pendingLinks"), Et = Symbol("current"), Ft$1 = Symbol("process"), Ee$1 = Symbol("processing"), ai = Symbol("processJob"), G = Symbol("jobs"), ls = Symbol("jobDone"), ci = Symbol("addFSEntry"), or = Symbol("addTarEntry"), ds = Symbol("stat"), us = Symbol("readdir"), fi = Symbol("onreaddir"), di = Symbol("pipe"), hr = Symbol("entry"), cs = Symbol("entryOpt"), ui = Symbol("writeEntryClass"), lr = Symbol("write"), fs$12 = Symbol("ondrain"), wt = class extends A$1 {
|
|
254307
254314
|
sync = !1;
|
|
254308
254315
|
opt;
|
|
254309
254316
|
cwd;
|
|
@@ -254336,8 +254343,8 @@ while (this[Zs](this[st$1].shift()));
|
|
|
254336
254343
|
if ((t.gzip ? 1 : 0) + (t.brotli ? 1 : 0) + (t.zstd ? 1 : 0) > 1) throw new TypeError("gzip, brotli, zstd are mutually exclusive");
|
|
254337
254344
|
if (t.gzip && (typeof t.gzip != "object" && (t.gzip = {}), this.portable && (t.gzip.portable = !0), this.zip = new ze$1(t.gzip)), t.brotli && (typeof t.brotli != "object" && (t.brotli = {}), this.zip = new We$1(t.brotli)), t.zstd && (typeof t.zstd != "object" && (t.zstd = {}), this.zip = new Ye$1(t.zstd)), !this.zip) throw new Error("impossible");
|
|
254338
254345
|
let e = this.zip;
|
|
254339
|
-
e.on("data", (i) => super.write(i)), e.on("end", () => super.end()), e.on("drain", () => this[fs$
|
|
254340
|
-
} else this.on("drain", this[fs$
|
|
254346
|
+
e.on("data", (i) => super.write(i)), e.on("end", () => super.end()), e.on("drain", () => this[fs$12]()), this.on("resume", () => e.resume());
|
|
254347
|
+
} else this.on("drain", this[fs$12]);
|
|
254341
254348
|
this.noDirRecurse = !!t.noDirRecurse, this.follow = !!t.follow, this.noMtime = !!t.noMtime, t.mtime && (this.mtime = t.mtime), this.filter = typeof t.filter == "function" ? t.filter : () => !0, this[W$1] = new hi(), this[G] = 0, this.jobs = Number(t.jobs) || 4, this[Ee$1] = !1, this[me$1] = !1;
|
|
254342
254349
|
}
|
|
254343
254350
|
[lr](t) {
|
|
@@ -254464,7 +254471,7 @@ while (this[Zs](this[st$1].shift()));
|
|
|
254464
254471
|
this.emit("error", e);
|
|
254465
254472
|
}
|
|
254466
254473
|
}
|
|
254467
|
-
[fs$
|
|
254474
|
+
[fs$12]() {
|
|
254468
254475
|
this[Et] && this[Et].entry && this[Et].entry.resume();
|
|
254469
254476
|
}
|
|
254470
254477
|
[di](t) {
|
|
@@ -254630,7 +254637,7 @@ while (this[Zs](this[st$1].shift()));
|
|
|
254630
254637
|
E ? e(E) : x && a ? Es(x, o, h, (Le) => y(Le)) : n ? Kt.chmod(s, r, e) : e();
|
|
254631
254638
|
};
|
|
254632
254639
|
if (s === d) return no(s, y);
|
|
254633
|
-
if (l) return
|
|
254640
|
+
if (l) return fs.mkdir(s, {
|
|
254634
254641
|
mode: r,
|
|
254635
254642
|
recursive: !0
|
|
254636
254643
|
}).then((E) => y(null, E ?? void 0), y);
|
|
@@ -255389,7 +255396,7 @@ var require_pend = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
255389
255396
|
//#endregion
|
|
255390
255397
|
//#region ../../node_modules/.pnpm/yauzl@3.3.0/node_modules/yauzl/fd-slicer.js
|
|
255391
255398
|
var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
255392
|
-
var fs$
|
|
255399
|
+
var fs$11 = __require("fs");
|
|
255393
255400
|
var util$6 = __require("util");
|
|
255394
255401
|
var stream$2 = __require("stream");
|
|
255395
255402
|
var Readable = stream$2.Readable;
|
|
@@ -255414,7 +255421,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
255414
255421
|
FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
|
|
255415
255422
|
var self = this;
|
|
255416
255423
|
self.pend.go(function(cb) {
|
|
255417
|
-
fs$
|
|
255424
|
+
fs$11.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer) {
|
|
255418
255425
|
cb();
|
|
255419
255426
|
callback(err, bytesRead, buffer);
|
|
255420
255427
|
});
|
|
@@ -255423,7 +255430,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
255423
255430
|
FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
|
|
255424
255431
|
var self = this;
|
|
255425
255432
|
self.pend.go(function(cb) {
|
|
255426
|
-
fs$
|
|
255433
|
+
fs$11.write(self.fd, buffer, offset, length, position, function(err, written, buffer) {
|
|
255427
255434
|
cb();
|
|
255428
255435
|
callback(err, written, buffer);
|
|
255429
255436
|
});
|
|
@@ -255443,7 +255450,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
255443
255450
|
self.refCount -= 1;
|
|
255444
255451
|
if (self.refCount > 0) return;
|
|
255445
255452
|
if (self.refCount < 0) throw new Error("invalid unref");
|
|
255446
|
-
if (self.autoClose) fs$
|
|
255453
|
+
if (self.autoClose) fs$11.close(self.fd, onCloseDone);
|
|
255447
255454
|
function onCloseDone(err) {
|
|
255448
255455
|
if (err) self.emit("error", err);
|
|
255449
255456
|
else self.emit("close");
|
|
@@ -255474,7 +255481,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
255474
255481
|
self.context.pend.go(function(cb) {
|
|
255475
255482
|
if (self.destroyed) return cb();
|
|
255476
255483
|
var buffer = Buffer.allocUnsafe(toRead);
|
|
255477
|
-
fs$
|
|
255484
|
+
fs$11.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
|
|
255478
255485
|
if (err) self.destroy(err);
|
|
255479
255486
|
else if (bytesRead === 0) {
|
|
255480
255487
|
self.destroyed = true;
|
|
@@ -255520,7 +255527,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
255520
255527
|
}
|
|
255521
255528
|
self.context.pend.go(function(cb) {
|
|
255522
255529
|
if (self.destroyed) return cb();
|
|
255523
|
-
fs$
|
|
255530
|
+
fs$11.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err, bytes) {
|
|
255524
255531
|
if (err) {
|
|
255525
255532
|
self.destroy();
|
|
255526
255533
|
cb();
|
|
@@ -261328,6 +261335,10 @@ var init_blun_media$1 = __esmMin((() => {
|
|
|
261328
261335
|
isError: terminalError
|
|
261329
261336
|
};
|
|
261330
261337
|
}
|
|
261338
|
+
if (result.kind === "text") return {
|
|
261339
|
+
output: result.text,
|
|
261340
|
+
isError: false
|
|
261341
|
+
};
|
|
261331
261342
|
const url = `data:${result.mimeType};base64,${Buffer.from(result.data).toString("base64")}`;
|
|
261332
261343
|
const mediaPart = contentPartFor(result.mimeType, url);
|
|
261333
261344
|
if (mediaPart === void 0) return {
|
|
@@ -292366,7 +292377,7 @@ var init_proxy = __esmMin((() => {
|
|
|
292366
292377
|
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
292367
292378
|
module.exports = isexe;
|
|
292368
292379
|
isexe.sync = sync;
|
|
292369
|
-
var fs$
|
|
292380
|
+
var fs$9 = __require("fs");
|
|
292370
292381
|
function checkPathExt(path, options) {
|
|
292371
292382
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
292372
292383
|
if (!pathext) return true;
|
|
@@ -292383,12 +292394,12 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
292383
292394
|
return checkPathExt(path, options);
|
|
292384
292395
|
}
|
|
292385
292396
|
function isexe(path, options, cb) {
|
|
292386
|
-
fs$
|
|
292397
|
+
fs$9.stat(path, function(er, stat) {
|
|
292387
292398
|
cb(er, er ? false : checkStat(stat, path, options));
|
|
292388
292399
|
});
|
|
292389
292400
|
}
|
|
292390
292401
|
function sync(path, options) {
|
|
292391
|
-
return checkStat(fs$
|
|
292402
|
+
return checkStat(fs$9.statSync(path), path, options);
|
|
292392
292403
|
}
|
|
292393
292404
|
}));
|
|
292394
292405
|
//#endregion
|
|
@@ -292396,14 +292407,14 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
292396
292407
|
var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
292397
292408
|
module.exports = isexe;
|
|
292398
292409
|
isexe.sync = sync;
|
|
292399
|
-
var fs$
|
|
292410
|
+
var fs$8 = __require("fs");
|
|
292400
292411
|
function isexe(path, options, cb) {
|
|
292401
|
-
fs$
|
|
292412
|
+
fs$8.stat(path, function(er, stat) {
|
|
292402
292413
|
cb(er, er ? false : checkStat(stat, options));
|
|
292403
292414
|
});
|
|
292404
292415
|
}
|
|
292405
292416
|
function sync(path, options) {
|
|
292406
|
-
return checkStat(fs$
|
|
292417
|
+
return checkStat(fs$8.statSync(path), options);
|
|
292407
292418
|
}
|
|
292408
292419
|
function checkStat(stat, options) {
|
|
292409
292420
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -292618,16 +292629,16 @@ var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
292618
292629
|
//#endregion
|
|
292619
292630
|
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
|
|
292620
292631
|
var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
292621
|
-
const fs$
|
|
292632
|
+
const fs$7 = __require("fs");
|
|
292622
292633
|
const shebangCommand = require_shebang_command();
|
|
292623
292634
|
function readShebang(command) {
|
|
292624
292635
|
const size = 150;
|
|
292625
292636
|
const buffer = Buffer.alloc(size);
|
|
292626
292637
|
let fd;
|
|
292627
292638
|
try {
|
|
292628
|
-
fd = fs$
|
|
292629
|
-
fs$
|
|
292630
|
-
fs$
|
|
292639
|
+
fd = fs$7.openSync(command, "r");
|
|
292640
|
+
fs$7.readSync(fd, buffer, 0, size, 0);
|
|
292641
|
+
fs$7.closeSync(fd);
|
|
292631
292642
|
} catch (e) {}
|
|
292632
292643
|
return shebangCommand(buffer.toString());
|
|
292633
292644
|
}
|
|
@@ -309372,6 +309383,12 @@ var init_blun_media = __esmMin((() => {
|
|
|
309372
309383
|
await assertSuccess(response, "Media lookup");
|
|
309373
309384
|
const mimeType = response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase() ?? "";
|
|
309374
309385
|
if (mimeType === "application/json" || mimeType.endsWith("+json")) return parseStatus(await response.json(), id);
|
|
309386
|
+
if (mimeType === "text/plain") return {
|
|
309387
|
+
kind: "text",
|
|
309388
|
+
id,
|
|
309389
|
+
mimeType,
|
|
309390
|
+
text: await response.text()
|
|
309391
|
+
};
|
|
309375
309392
|
if (!mimeType.startsWith("image/") && !mimeType.startsWith("audio/") && !mimeType.startsWith("video/")) throw new Error(`Media lookup returned unsupported content type ${mimeType || "(missing)"}`);
|
|
309376
309393
|
return {
|
|
309377
309394
|
kind: "file",
|
|
@@ -309791,7 +309808,7 @@ var require_dist$5 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
309791
309808
|
//#endregion
|
|
309792
309809
|
//#region ../../node_modules/.pnpm/yazl@3.3.1/node_modules/yazl/index.js
|
|
309793
309810
|
var require_yazl = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
309794
|
-
var fs$
|
|
309811
|
+
var fs$6 = __require("fs");
|
|
309795
309812
|
var Transform$2 = __require("stream").Transform;
|
|
309796
309813
|
var PassThrough$2 = __require("stream").PassThrough;
|
|
309797
309814
|
var zlib$1 = __require("zlib");
|
|
@@ -309820,14 +309837,14 @@ var require_yazl = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
309820
309837
|
if (shouldIgnoreAdding(self)) return;
|
|
309821
309838
|
var entry = new Entry(metadataPath, false, options);
|
|
309822
309839
|
self.entries.push(entry);
|
|
309823
|
-
fs$
|
|
309840
|
+
fs$6.stat(realPath, function(err, stats) {
|
|
309824
309841
|
if (err) return self.emit("error", err);
|
|
309825
309842
|
if (!stats.isFile()) return self.emit("error", /* @__PURE__ */ new Error("not a file: " + realPath));
|
|
309826
309843
|
entry.uncompressedSize = stats.size;
|
|
309827
309844
|
if (options.mtime == null) entry.setLastModDate(stats.mtime);
|
|
309828
309845
|
if (options.mode == null) entry.setFileAttributesMode(stats.mode);
|
|
309829
309846
|
entry.setFileDataPumpFunction(function() {
|
|
309830
|
-
var readStream = fs$
|
|
309847
|
+
var readStream = fs$6.createReadStream(realPath);
|
|
309831
309848
|
entry.state = Entry.FILE_DATA_IN_PROGRESS;
|
|
309832
309849
|
readStream.on("error", function(err) {
|
|
309833
309850
|
self.emit("error", err);
|
|
@@ -311159,10 +311176,10 @@ async function appendForkedMarkers(state) {
|
|
|
311159
311176
|
time: Date.now()
|
|
311160
311177
|
};
|
|
311161
311178
|
const agents = state["agents"];
|
|
311162
|
-
if (!isRecord$
|
|
311179
|
+
if (!isRecord$16(agents)) return;
|
|
311163
311180
|
const paths = /* @__PURE__ */ new Set();
|
|
311164
311181
|
for (const agentMeta of Object.values(agents)) {
|
|
311165
|
-
if (!isRecord$
|
|
311182
|
+
if (!isRecord$16(agentMeta)) continue;
|
|
311166
311183
|
const homedir = agentMeta["homedir"];
|
|
311167
311184
|
if (typeof homedir !== "string") continue;
|
|
311168
311185
|
paths.add(join$4(homedir, "wire.jsonl"));
|
|
@@ -311174,7 +311191,7 @@ async function appendForkedMarkers(state) {
|
|
|
311174
311191
|
}));
|
|
311175
311192
|
}
|
|
311176
311193
|
function customMetadataForFork(value) {
|
|
311177
|
-
if (!isRecord$
|
|
311194
|
+
if (!isRecord$16(value)) return {};
|
|
311178
311195
|
const custom = {};
|
|
311179
311196
|
for (const [key, entry] of Object.entries(value)) {
|
|
311180
311197
|
if (key === "goal" || key === "managedQuotaWarningThreshold") continue;
|
|
@@ -311229,10 +311246,10 @@ function normalizeForkTitle(title, fallback) {
|
|
|
311229
311246
|
return typeof fallback === "string" && fallback.trim().length > 0 ? fallback : "New Session";
|
|
311230
311247
|
}
|
|
311231
311248
|
function rewriteAgentHomedirs(value, sourceDir, targetDir) {
|
|
311232
|
-
if (!isRecord$
|
|
311249
|
+
if (!isRecord$16(value)) return {};
|
|
311233
311250
|
const agents = {};
|
|
311234
311251
|
for (const [agentId, agentMeta] of Object.entries(value)) {
|
|
311235
|
-
if (!isRecord$
|
|
311252
|
+
if (!isRecord$16(agentMeta)) {
|
|
311236
311253
|
agents[agentId] = agentMeta;
|
|
311237
311254
|
continue;
|
|
311238
311255
|
}
|
|
@@ -311250,7 +311267,7 @@ function remapSessionPath(value, sourceDir, targetDir) {
|
|
|
311250
311267
|
if (rel.startsWith("..") || isAbsolute$2(rel)) return value;
|
|
311251
311268
|
return join$4(targetDir, rel);
|
|
311252
311269
|
}
|
|
311253
|
-
function isRecord$
|
|
311270
|
+
function isRecord$16(value) {
|
|
311254
311271
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
311255
311272
|
}
|
|
311256
311273
|
async function statIfExists(path) {
|
|
@@ -311498,7 +311515,7 @@ var init_session_store$1 = __esmMin((() => {
|
|
|
311498
311515
|
} catch (error) {
|
|
311499
311516
|
throw new BlunError(ErrorCodes.SESSION_STATE_NOT_FOUND, `Session "${input.sourceId}" state.json was not found`, { cause: error });
|
|
311500
311517
|
}
|
|
311501
|
-
if (!isRecord$
|
|
311518
|
+
if (!isRecord$16(parsed)) throw new BlunError(ErrorCodes.SESSION_STATE_INVALID, `Session "${input.sourceId}" state.json is invalid`);
|
|
311502
311519
|
const title = normalizeForkTitle(input.title, parsed["title"]);
|
|
311503
311520
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
311504
311521
|
const next = {
|
|
@@ -326406,7 +326423,7 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
326406
326423
|
const EventEmitter$12 = __require("node:events").EventEmitter;
|
|
326407
326424
|
const childProcess = __require("node:child_process");
|
|
326408
326425
|
const path$7 = __require("node:path");
|
|
326409
|
-
const fs$
|
|
326426
|
+
const fs$5 = __require("node:fs");
|
|
326410
326427
|
const process$2 = __require("node:process");
|
|
326411
326428
|
const { Argument, humanReadableArgName } = require_argument();
|
|
326412
326429
|
const { CommanderError } = require_error$2();
|
|
@@ -327289,7 +327306,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
327289
327306
|
* @param {string} subcommandName
|
|
327290
327307
|
*/
|
|
327291
327308
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
327292
|
-
if (fs$
|
|
327309
|
+
if (fs$5.existsSync(executableFile)) return;
|
|
327293
327310
|
const executableMissing = `'${executableFile}' does not exist
|
|
327294
327311
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
327295
327312
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
@@ -327313,9 +327330,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
327313
327330
|
];
|
|
327314
327331
|
function findFile(baseDir, baseName) {
|
|
327315
327332
|
const localBin = path$7.resolve(baseDir, baseName);
|
|
327316
|
-
if (fs$
|
|
327333
|
+
if (fs$5.existsSync(localBin)) return localBin;
|
|
327317
327334
|
if (sourceExt.includes(path$7.extname(baseName))) return void 0;
|
|
327318
|
-
const foundExt = sourceExt.find((ext) => fs$
|
|
327335
|
+
const foundExt = sourceExt.find((ext) => fs$5.existsSync(`${localBin}${ext}`));
|
|
327319
327336
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
327320
327337
|
}
|
|
327321
327338
|
this._checkForMissingMandatoryOptions();
|
|
@@ -327325,7 +327342,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
327325
327342
|
if (this._scriptPath) {
|
|
327326
327343
|
let resolvedScriptPath;
|
|
327327
327344
|
try {
|
|
327328
|
-
resolvedScriptPath = fs$
|
|
327345
|
+
resolvedScriptPath = fs$5.realpathSync(this._scriptPath);
|
|
327329
327346
|
} catch {
|
|
327330
327347
|
resolvedScriptPath = this._scriptPath;
|
|
327331
327348
|
}
|
|
@@ -337003,8 +337020,8 @@ function createAccountMemoryClient(auth, options = {}) {
|
|
|
337003
337020
|
}
|
|
337004
337021
|
function readAccountMemoryConsentStatus(payload) {
|
|
337005
337022
|
const settings = unwrapPayload(payload)?.["settings"];
|
|
337006
|
-
const dataControls = isRecord$
|
|
337007
|
-
if (!isRecord$
|
|
337023
|
+
const dataControls = isRecord$15(settings) ? settings["data_controls"] : void 0;
|
|
337024
|
+
if (!isRecord$15(dataControls)) throw new Error("Account memory returned an invalid response.");
|
|
337008
337025
|
if (dataControls["memory_consent_asked"] !== true) return "never_asked";
|
|
337009
337026
|
if (dataControls["allow_memory"] === true) return "enabled";
|
|
337010
337027
|
if (dataControls["allow_memory"] === false) return "disabled";
|
|
@@ -337127,8 +337144,8 @@ function memoryContextSummary(facts, included) {
|
|
|
337127
337144
|
})}`;
|
|
337128
337145
|
}
|
|
337129
337146
|
function unwrapPayload(value) {
|
|
337130
|
-
if (!isRecord$
|
|
337131
|
-
return isRecord$
|
|
337147
|
+
if (!isRecord$15(value)) return void 0;
|
|
337148
|
+
return isRecord$15(value["data"]) ? value["data"] : value;
|
|
337132
337149
|
}
|
|
337133
337150
|
function readFacts(root) {
|
|
337134
337151
|
let rawFacts = [];
|
|
@@ -337136,7 +337153,7 @@ function readFacts(root) {
|
|
|
337136
337153
|
else {
|
|
337137
337154
|
const factsJson = parseFactsJson(root["facts_json"]);
|
|
337138
337155
|
if (Array.isArray(factsJson)) rawFacts = factsJson;
|
|
337139
|
-
else if (isRecord$
|
|
337156
|
+
else if (isRecord$15(factsJson) && Array.isArray(factsJson["facts"])) rawFacts = factsJson["facts"];
|
|
337140
337157
|
}
|
|
337141
337158
|
const facts = [];
|
|
337142
337159
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -337165,7 +337182,7 @@ function parseFactsJson(value) {
|
|
|
337165
337182
|
}
|
|
337166
337183
|
}
|
|
337167
337184
|
function normalizeFact(value) {
|
|
337168
|
-
const raw = typeof value === "string" ? value : isRecord$
|
|
337185
|
+
const raw = typeof value === "string" ? value : isRecord$15(value) && typeof value["text"] === "string" ? value["text"] : void 0;
|
|
337169
337186
|
if (raw === void 0) return void 0;
|
|
337170
337187
|
const normalized = raw.replaceAll(/\s+/gu, " ").trim();
|
|
337171
337188
|
if (normalized.length === 0) return void 0;
|
|
@@ -337174,7 +337191,7 @@ function normalizeFact(value) {
|
|
|
337174
337191
|
truncated: normalized.length > ACCOUNT_MEMORY_MAX_FACT_CHARS
|
|
337175
337192
|
};
|
|
337176
337193
|
}
|
|
337177
|
-
function isRecord$
|
|
337194
|
+
function isRecord$15(value) {
|
|
337178
337195
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
337179
337196
|
}
|
|
337180
337197
|
//#endregion
|
|
@@ -338615,7 +338632,7 @@ function formatErrorMessage$4(error, filePath) {
|
|
|
338615
338632
|
function findValidationIssues(error) {
|
|
338616
338633
|
if (!(error instanceof Error)) return void 0;
|
|
338617
338634
|
const details = "details" in error ? error.details : void 0;
|
|
338618
|
-
if (!isRecord$
|
|
338635
|
+
if (!isRecord$14(details)) return void 0;
|
|
338619
338636
|
const validationIssues = details["validationIssues"];
|
|
338620
338637
|
return isValidationIssueArray(validationIssues) ? validationIssues : void 0;
|
|
338621
338638
|
}
|
|
@@ -338623,11 +338640,11 @@ function isValidationIssueArray(value) {
|
|
|
338623
338640
|
return Array.isArray(value) && value.every(isValidationIssue);
|
|
338624
338641
|
}
|
|
338625
338642
|
function isValidationIssue(value) {
|
|
338626
|
-
if (!isRecord$
|
|
338643
|
+
if (!isRecord$14(value) || typeof value["message"] !== "string") return false;
|
|
338627
338644
|
const path = value["path"];
|
|
338628
338645
|
return Array.isArray(path) && path.every((segment) => typeof segment === "string" || typeof segment === "number");
|
|
338629
338646
|
}
|
|
338630
|
-
function isRecord$
|
|
338647
|
+
function isRecord$14(value) {
|
|
338631
338648
|
return typeof value === "object" && value !== null;
|
|
338632
338649
|
}
|
|
338633
338650
|
function findZodError(error) {
|
|
@@ -339122,7 +339139,7 @@ function assertEntryCount(value) {
|
|
|
339122
339139
|
return value;
|
|
339123
339140
|
}
|
|
339124
339141
|
function parseMistakeRecordDeclarations(value, sourceId, declaredRecordTypes) {
|
|
339125
|
-
if (!isRecord$
|
|
339142
|
+
if (!isRecord$13(value) || !hasOnlyKeys(value, [
|
|
339126
339143
|
"version",
|
|
339127
339144
|
"records",
|
|
339128
339145
|
"relations"
|
|
@@ -339135,7 +339152,7 @@ function parseMistakeRecordDeclarations(value, sourceId, declaredRecordTypes) {
|
|
|
339135
339152
|
return {
|
|
339136
339153
|
version: 1,
|
|
339137
339154
|
records: value["records"].map((candidate, index) => {
|
|
339138
|
-
if (!isRecord$
|
|
339155
|
+
if (!isRecord$13(candidate) || !hasOnlyKeys(candidate, [
|
|
339139
339156
|
"source_record_id",
|
|
339140
339157
|
"type",
|
|
339141
339158
|
"raw_locator"
|
|
@@ -339155,7 +339172,7 @@ function parseMistakeRecordDeclarations(value, sourceId, declaredRecordTypes) {
|
|
|
339155
339172
|
};
|
|
339156
339173
|
}),
|
|
339157
339174
|
relations: value["relations"].map((candidate, index) => {
|
|
339158
|
-
if (!isRecord$
|
|
339175
|
+
if (!isRecord$13(candidate) || !hasOnlyKeys(candidate, [
|
|
339159
339176
|
"from_source_record_id",
|
|
339160
339177
|
"type",
|
|
339161
339178
|
"to"
|
|
@@ -339165,7 +339182,7 @@ function parseMistakeRecordDeclarations(value, sourceId, declaredRecordTypes) {
|
|
|
339165
339182
|
const target = candidate["to"];
|
|
339166
339183
|
if (typeof fromRecordId !== "string" || !isValidRecordId(fromRecordId) || !recordIds.has(fromRecordId)) throw new Error(`record relation ${index} must start at a declared local record`);
|
|
339167
339184
|
if (typeof type !== "string" || !MISTAKE_RELATION_TYPES.includes(type)) throw new Error(`record relation ${index} has an invalid relation type`);
|
|
339168
|
-
if (!isRecord$
|
|
339185
|
+
if (!isRecord$13(target) || !hasOnlyKeys(target, ["source_id", "source_record_id"])) throw new Error(`record relation ${index} has an invalid target`);
|
|
339169
339186
|
const targetSourceId = target["source_id"];
|
|
339170
339187
|
const targetRecordId = target["source_record_id"];
|
|
339171
339188
|
if (typeof targetSourceId !== "string" || !isNormalizedSourceId(targetSourceId)) throw new Error(`record relation ${index} has an invalid target source id`);
|
|
@@ -339435,7 +339452,7 @@ function receiptsEqual(left, right) {
|
|
|
339435
339452
|
return left.version === right.version && left.accepted === right.accepted && left.event_id === right.event_id && left.client_event_id === right.client_event_id && left.source_id === right.source_id && left.canonical_agent_id === right.canonical_agent_id && left.received_at === right.received_at && left.raw_count === right.raw_count && left.accepted_count === right.accepted_count && left.rejected_count === right.rejected_count && left.raw_bytes === right.raw_bytes && left.raw_sha256 === right.raw_sha256 && left.declared_entry_count === right.declared_entry_count;
|
|
339436
339453
|
}
|
|
339437
339454
|
function isStateActionReceipt(value) {
|
|
339438
|
-
if (!isRecord$
|
|
339455
|
+
if (!isRecord$13(value) || !hasOnlyKeys(value, STATE_ACTION_KEYS)) return false;
|
|
339439
339456
|
const reason = value["reason"];
|
|
339440
339457
|
return value["version"] === 1 && typeof value["action_id"] === "string" && UUID_RE$1.test(value["action_id"]) && (value["action"] === "remove" || value["action"] === "restore") && typeof value["target_event_id"] === "string" && UUID_RE$1.test(value["target_event_id"]) && typeof value["acted_at"] === "string" && isIsoTimestamp(value["acted_at"]) && Number.isSafeInteger(value["server_sequence"]) && value["server_sequence"] >= 1 && typeof value["principal_id"] === "string" && isNormalizedSourceId(value["principal_id"]) && typeof reason === "string" && reason.trim() === reason && reason.length >= 3 && reason.length <= 500;
|
|
339441
339458
|
}
|
|
@@ -339538,7 +339555,7 @@ function assertInventoryInvariants(bestandsstatus, aktualitaetsstatus, declaredE
|
|
|
339538
339555
|
if (aktualitaetsstatus === "fresh" && lastRawObservedAt === null) throw new Error("fresh inventory requires a last raw observed timestamp");
|
|
339539
339556
|
if (capturedAt !== void 0 && lastRawObservedAt !== null && Date.parse(lastRawObservedAt) > Date.parse(capturedAt)) throw new Error("last raw observed timestamp must not be later than captured at");
|
|
339540
339557
|
}
|
|
339541
|
-
function isRecord$
|
|
339558
|
+
function isRecord$13(value) {
|
|
339542
339559
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
339543
339560
|
}
|
|
339544
339561
|
function hasOnlyKeys(value, allowedKeys) {
|
|
@@ -340444,6 +340461,9 @@ function resolveDeps(overrides) {
|
|
|
340444
340461
|
};
|
|
340445
340462
|
}
|
|
340446
340463
|
//#endregion
|
|
340464
|
+
//#region src/constant/account-consent.ts
|
|
340465
|
+
const ACCOUNT_CONSENT_PATH = "/api/account/consent";
|
|
340466
|
+
//#endregion
|
|
340447
340467
|
//#region src/personal-memory/phase1-contract.json
|
|
340448
340468
|
var clientOperations = {
|
|
340449
340469
|
"settingsRead": {
|
|
@@ -340476,6 +340496,18 @@ const PERSONAL_MEMORY_MEMORY_CREATE_METHOD = "POST";
|
|
|
340476
340496
|
const PERSONAL_MEMORY_RECALL_METHOD = "POST";
|
|
340477
340497
|
const PERSONAL_MEMORY_EXPLICIT_KEY = "explicit_user_memory";
|
|
340478
340498
|
const PERSONAL_MEMORY_EXPLICIT_CATEGORY = "user_explicit";
|
|
340499
|
+
const SAFE_BROKER_ERROR_CODES = new Set([
|
|
340500
|
+
"AUTHENTICATION_REQUIRED",
|
|
340501
|
+
"EXPLICIT_CONSENT_REQUIRED",
|
|
340502
|
+
"INTERNAL_ERROR",
|
|
340503
|
+
"INTERACTIVE_CONFIRMATION_REQUIRED",
|
|
340504
|
+
"INSUFFICIENT_SCOPE",
|
|
340505
|
+
"INVALID_PAYLOAD",
|
|
340506
|
+
"MEMORY_NOT_FOUND",
|
|
340507
|
+
"MEMORY_WRITE_DISABLED",
|
|
340508
|
+
"SECRET_REJECTED",
|
|
340509
|
+
"UNAVAILABLE"
|
|
340510
|
+
]);
|
|
340479
340511
|
var PersonalMemoryBrokerError = class extends Error {
|
|
340480
340512
|
code;
|
|
340481
340513
|
status;
|
|
@@ -340487,7 +340519,7 @@ var PersonalMemoryBrokerError = class extends Error {
|
|
|
340487
340519
|
}
|
|
340488
340520
|
};
|
|
340489
340521
|
function parsePersonalMemorySettings(payload) {
|
|
340490
|
-
if (!isRecord$
|
|
340522
|
+
if (!isRecord$12(payload)) return void 0;
|
|
340491
340523
|
const status = payload["status"];
|
|
340492
340524
|
if (status !== "configured" && status !== "never_asked") return void 0;
|
|
340493
340525
|
const memoryEnabled = payload["memory_enabled"];
|
|
@@ -340513,9 +340545,123 @@ function explicitPersonalMemoryBody(content) {
|
|
|
340513
340545
|
kategorie: PERSONAL_MEMORY_EXPLICIT_CATEGORY
|
|
340514
340546
|
};
|
|
340515
340547
|
}
|
|
340516
|
-
|
|
340548
|
+
var PersonalMemoryBrokerClient = class {
|
|
340549
|
+
options;
|
|
340550
|
+
baseUrl;
|
|
340551
|
+
fetchImpl;
|
|
340552
|
+
idempotencyKey;
|
|
340553
|
+
timeoutMs;
|
|
340554
|
+
constructor(options) {
|
|
340555
|
+
this.options = options;
|
|
340556
|
+
this.baseUrl = options.baseUrl.replace(/\/+$/, "");
|
|
340557
|
+
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
340558
|
+
this.idempotencyKey = options.idempotencyKey ?? randomUUID;
|
|
340559
|
+
this.timeoutMs = options.timeoutMs ?? 1e4;
|
|
340560
|
+
}
|
|
340561
|
+
async getSettings() {
|
|
340562
|
+
const parsed = parsePersonalMemorySettings(await this.request("GET", PERSONAL_MEMORY_SETTINGS_PATH));
|
|
340563
|
+
if (parsed === void 0) throw new PersonalMemoryBrokerError("INVALID_PAYLOAD");
|
|
340564
|
+
return parsed;
|
|
340565
|
+
}
|
|
340566
|
+
async updateSettings(patch) {
|
|
340567
|
+
await this.request("PUT", PERSONAL_MEMORY_SETTINGS_PATH, patch);
|
|
340568
|
+
}
|
|
340569
|
+
async putConsent(allowed) {
|
|
340570
|
+
if (typeof allowed !== "boolean") throw new PersonalMemoryBrokerError("INVALID_PAYLOAD");
|
|
340571
|
+
await this.request("POST", ACCOUNT_CONSENT_PATH, { memory: allowed });
|
|
340572
|
+
}
|
|
340573
|
+
async request(method, path, body) {
|
|
340574
|
+
if (!isAllowedBrokerRequest(method, path)) throw new PersonalMemoryBrokerError("INVALID_PAYLOAD");
|
|
340575
|
+
const idempotencyKey = method === "GET" ? void 0 : this.idempotencyKey();
|
|
340576
|
+
const firstToken = await this.accessToken();
|
|
340577
|
+
let response = await this.fetchWithToken(method, path, firstToken, body, idempotencyKey);
|
|
340578
|
+
if (response.status === 401) {
|
|
340579
|
+
const refreshed = await this.accessToken({ force: true });
|
|
340580
|
+
response = await this.fetchWithToken(method, path, refreshed, body, idempotencyKey);
|
|
340581
|
+
}
|
|
340582
|
+
if (!response.ok) throw await brokerHttpError(response);
|
|
340583
|
+
if (response.status === 204) return null;
|
|
340584
|
+
const text = await response.text();
|
|
340585
|
+
if (text.trim().length === 0) return null;
|
|
340586
|
+
try {
|
|
340587
|
+
return JSON.parse(text);
|
|
340588
|
+
} catch {
|
|
340589
|
+
throw new PersonalMemoryBrokerError("INVALID_PAYLOAD");
|
|
340590
|
+
}
|
|
340591
|
+
}
|
|
340592
|
+
async accessToken(options) {
|
|
340593
|
+
try {
|
|
340594
|
+
const token = await this.options.tokenProvider.getAccessToken(options);
|
|
340595
|
+
if (token.trim().length === 0) throw new Error("empty token");
|
|
340596
|
+
return token;
|
|
340597
|
+
} catch {
|
|
340598
|
+
throw new PersonalMemoryBrokerError("AUTHENTICATION_REQUIRED");
|
|
340599
|
+
}
|
|
340600
|
+
}
|
|
340601
|
+
async fetchWithToken(method, path, accessToken, body, idempotencyKey) {
|
|
340602
|
+
const controller = new AbortController();
|
|
340603
|
+
const timer = setTimeout(() => {
|
|
340604
|
+
controller.abort();
|
|
340605
|
+
}, this.timeoutMs);
|
|
340606
|
+
timer.unref?.();
|
|
340607
|
+
const headers = new Headers();
|
|
340608
|
+
headers.set("Accept", "application/json");
|
|
340609
|
+
headers.set("Authorization", `Bearer ${accessToken}`);
|
|
340610
|
+
if (body !== void 0) headers.set("Content-Type", "application/json");
|
|
340611
|
+
if (idempotencyKey !== void 0) headers.set("Idempotency-Key", idempotencyKey);
|
|
340612
|
+
try {
|
|
340613
|
+
return await this.fetchImpl(`${this.baseUrl}${path}`, {
|
|
340614
|
+
method,
|
|
340615
|
+
headers,
|
|
340616
|
+
body: body === void 0 ? void 0 : JSON.stringify(body),
|
|
340617
|
+
signal: controller.signal
|
|
340618
|
+
});
|
|
340619
|
+
} catch {
|
|
340620
|
+
throw new PersonalMemoryBrokerError("UNAVAILABLE");
|
|
340621
|
+
} finally {
|
|
340622
|
+
clearTimeout(timer);
|
|
340623
|
+
}
|
|
340624
|
+
}
|
|
340625
|
+
};
|
|
340626
|
+
async function brokerHttpError(response) {
|
|
340627
|
+
const status = response.status;
|
|
340628
|
+
const responseCode = await safeBrokerResponseCode(response);
|
|
340629
|
+
if (responseCode !== void 0) return new PersonalMemoryBrokerError(responseCode, status);
|
|
340630
|
+
if (status === 401) return new PersonalMemoryBrokerError("AUTHENTICATION_REQUIRED", status);
|
|
340631
|
+
if (status === 403) return new PersonalMemoryBrokerError("INSUFFICIENT_SCOPE", status);
|
|
340632
|
+
return new PersonalMemoryBrokerError("UNAVAILABLE", status);
|
|
340633
|
+
}
|
|
340634
|
+
async function safeBrokerResponseCode(response) {
|
|
340635
|
+
try {
|
|
340636
|
+
const payload = await response.json();
|
|
340637
|
+
if (!isRecord$12(payload)) return void 0;
|
|
340638
|
+
const nested = isRecord$12(payload["error"]) ? payload["error"]["code"] : void 0;
|
|
340639
|
+
const candidate = payload["code"] ?? payload["error_code"] ?? nested;
|
|
340640
|
+
return typeof candidate === "string" && SAFE_BROKER_ERROR_CODES.has(candidate) ? candidate : void 0;
|
|
340641
|
+
} catch {
|
|
340642
|
+
return;
|
|
340643
|
+
}
|
|
340644
|
+
}
|
|
340645
|
+
function isRecord$12(value) {
|
|
340517
340646
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
340518
340647
|
}
|
|
340648
|
+
function isAllowedBrokerRequest(method, path) {
|
|
340649
|
+
let url;
|
|
340650
|
+
try {
|
|
340651
|
+
url = new URL(path, "https://personal-memory.invalid");
|
|
340652
|
+
} catch {
|
|
340653
|
+
return false;
|
|
340654
|
+
}
|
|
340655
|
+
if (url.origin !== "https://personal-memory.invalid") return false;
|
|
340656
|
+
if (url.search.length > 0 || url.hash.length > 0) return false;
|
|
340657
|
+
const pathname = url.pathname;
|
|
340658
|
+
if (pathname === PERSONAL_MEMORY_SETTINGS_PATH) return method === "GET" || method === "PUT";
|
|
340659
|
+
if (pathname === "/api/account/consent") return method === "POST";
|
|
340660
|
+
if (pathname === PERSONAL_MEMORY_MEMORIES_PATH) return method === "GET" || method === "POST";
|
|
340661
|
+
if (/^\/v1\/me\/memories\/[0-9a-f-]{36}$/i.test(pathname)) return false;
|
|
340662
|
+
if (pathname === PERSONAL_MEMORY_RECALL_PATH) return method === PERSONAL_MEMORY_RECALL_METHOD;
|
|
340663
|
+
return false;
|
|
340664
|
+
}
|
|
340519
340665
|
//#endregion
|
|
340520
340666
|
//#region src/personal-memory/explicit-remember.ts
|
|
340521
340667
|
/** The sole Phase-1 write path: invoked by an explicit host command, never by the model. */
|
|
@@ -340539,7 +340685,17 @@ async function rememberExplicitPersonalMemory(options) {
|
|
|
340539
340685
|
//#region src/personal-memory/runtime.ts
|
|
340540
340686
|
init_src$3();
|
|
340541
340687
|
function createPersonalMemoryBrokerClient(harness) {
|
|
340542
|
-
|
|
340688
|
+
const provider = loadRuntimeConfigSafe(harness.configPath).config.providers[DEFAULT_OAUTH_PROVIDER_NAME];
|
|
340689
|
+
const runtime = resolveBlunCodeRuntimeAuth({
|
|
340690
|
+
configuredBaseUrl: provider?.baseUrl,
|
|
340691
|
+
configuredOAuthRef: provider?.oauth
|
|
340692
|
+
});
|
|
340693
|
+
const brokerBaseUrl = runtime.oauthRef.oauthHost ?? BLUN_FLOW_CONFIG.oauthHost;
|
|
340694
|
+
if (brokerBaseUrl.trim().length === 0) throw new PersonalMemoryBrokerError("UNAVAILABLE");
|
|
340695
|
+
return new PersonalMemoryBrokerClient({
|
|
340696
|
+
baseUrl: brokerBaseUrl,
|
|
340697
|
+
tokenProvider: harness.auth.resolveOAuthTokenProvider(DEFAULT_OAUTH_PROVIDER_NAME, runtime.oauthRef)
|
|
340698
|
+
});
|
|
340543
340699
|
}
|
|
340544
340700
|
//#endregion
|
|
340545
340701
|
//#region src/cli/sub/personal-memory.ts
|
|
@@ -341193,7 +341349,7 @@ function createAttestation(value, createdAt) {
|
|
|
341193
341349
|
};
|
|
341194
341350
|
}
|
|
341195
341351
|
function parseProof(value) {
|
|
341196
|
-
if (!isRecord$
|
|
341352
|
+
if (!isRecord$11(value) || value["schema"] !== "blun.proof" || value["schemaVersion"] !== 1) throw new Error("Unsupported proof document.");
|
|
341197
341353
|
assertObjectKeys(value, [
|
|
341198
341354
|
"schema",
|
|
341199
341355
|
"schemaVersion",
|
|
@@ -341213,12 +341369,12 @@ function parseProof(value) {
|
|
|
341213
341369
|
"incomplete",
|
|
341214
341370
|
"failed"
|
|
341215
341371
|
].includes(proof.outcome)) throw new Error("Invalid proof outcome.");
|
|
341216
|
-
if (!isRecord$
|
|
341372
|
+
if (!isRecord$11(proof.source) || proof.source.kind !== "workspace") throw new Error("Invalid proof source.");
|
|
341217
341373
|
assertObjectKeys(proof.source, ["kind"], ["git"], "proof source");
|
|
341218
341374
|
if (proof.source.git !== void 0) validateGitSnapshot(proof.source.git);
|
|
341219
341375
|
if (!Array.isArray(proof.checks) || !Array.isArray(proof.artifacts)) throw new TypeError("Invalid proof collections.");
|
|
341220
341376
|
if (proof.checks.length > MAX_COMMANDS || proof.artifacts.length > MAX_ARTIFACTS) throw new Error("Proof collections exceed their limits.");
|
|
341221
|
-
if (!isRecord$
|
|
341377
|
+
if (!isRecord$11(proof.attestation) || proof.attestation.algorithm !== "SHA-256" || proof.attestation.scope !== "content-integrity-only" || !SHA256_PATTERN.test(proof.attestation.hash)) throw new Error("Invalid proof attestation.");
|
|
341222
341378
|
assertObjectKeys(proof.attestation, [
|
|
341223
341379
|
"algorithm",
|
|
341224
341380
|
"scope",
|
|
@@ -341233,7 +341389,7 @@ function parseProof(value) {
|
|
|
341233
341389
|
screenshot: 0
|
|
341234
341390
|
};
|
|
341235
341391
|
for (const artifact of proof.artifacts) {
|
|
341236
|
-
if (!isRecord$
|
|
341392
|
+
if (!isRecord$11(artifact) || artifact.kind !== "file" && artifact.kind !== "screenshot" || typeof artifact.id !== "string" || typeof artifact.size !== "number" || !Number.isSafeInteger(artifact.size) || artifact.size < 0 || typeof artifact.sha256 !== "string" || !SHA256_PATTERN.test(artifact.sha256)) throw new Error("Invalid proof artifact.");
|
|
341237
341393
|
assertObjectKeys(artifact, [
|
|
341238
341394
|
"id",
|
|
341239
341395
|
"kind",
|
|
@@ -341250,14 +341406,14 @@ function parseProof(value) {
|
|
|
341250
341406
|
return proof;
|
|
341251
341407
|
}
|
|
341252
341408
|
function validateGitSnapshot(value) {
|
|
341253
|
-
if (!isRecord$
|
|
341409
|
+
if (!isRecord$11(value)) throw new Error("Invalid proof git snapshot.");
|
|
341254
341410
|
assertObjectKeys(value, ["dirty", "changedCount"], [], "proof git snapshot");
|
|
341255
341411
|
if (typeof value["dirty"] !== "boolean") throw new TypeError("Invalid proof git dirty flag.");
|
|
341256
341412
|
if (typeof value["changedCount"] !== "number" || !Number.isSafeInteger(value["changedCount"]) || value["changedCount"] < 0) throw new Error("Invalid proof git changed count.");
|
|
341257
341413
|
if (value["dirty"] !== value["changedCount"] > 0) throw new Error("Inconsistent proof git state.");
|
|
341258
341414
|
}
|
|
341259
341415
|
function validateProofCheck(value, index) {
|
|
341260
|
-
if (!isRecord$
|
|
341416
|
+
if (!isRecord$11(value)) throw new Error("Invalid proof check.");
|
|
341261
341417
|
assertObjectKeys(value, [
|
|
341262
341418
|
"id",
|
|
341263
341419
|
"outcome",
|
|
@@ -341269,13 +341425,13 @@ function validateProofCheck(value, index) {
|
|
|
341269
341425
|
if (value["outcome"] !== expectedOutcome) throw new Error("Invalid proof check outcome.");
|
|
341270
341426
|
}
|
|
341271
341427
|
function attestedContent(value) {
|
|
341272
|
-
if (!isRecord$
|
|
341428
|
+
if (!isRecord$11(value)) return value;
|
|
341273
341429
|
const { attestation: _attestation, createdAt: _createdAt, ...content } = value;
|
|
341274
341430
|
return content;
|
|
341275
341431
|
}
|
|
341276
341432
|
function canonicalize(value) {
|
|
341277
341433
|
if (Array.isArray(value)) return value.map(canonicalize);
|
|
341278
|
-
if (!isRecord$
|
|
341434
|
+
if (!isRecord$11(value)) return value;
|
|
341279
341435
|
return Object.keys(value).toSorted().reduce((result, key) => {
|
|
341280
341436
|
result[key] = canonicalize(value[key]);
|
|
341281
341437
|
return result;
|
|
@@ -341352,7 +341508,7 @@ function sameFileIdentity$1(left, right) {
|
|
|
341352
341508
|
function sameFileSnapshot(left, right) {
|
|
341353
341509
|
return sameFileIdentity$1(left, right) && left.size === right.size && left.mtimeMs === right.mtimeMs && left.ctimeMs === right.ctimeMs;
|
|
341354
341510
|
}
|
|
341355
|
-
function isRecord$
|
|
341511
|
+
function isRecord$11(value) {
|
|
341356
341512
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
341357
341513
|
}
|
|
341358
341514
|
//#endregion
|
|
@@ -345624,7 +345780,7 @@ var require_atomic_sleep = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
345624
345780
|
//#endregion
|
|
345625
345781
|
//#region ../../node_modules/.pnpm/sonic-boom@4.2.1/node_modules/sonic-boom/index.js
|
|
345626
345782
|
var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
345627
|
-
const fs$
|
|
345783
|
+
const fs$4 = __require("fs");
|
|
345628
345784
|
const EventEmitter$10 = __require("events");
|
|
345629
345785
|
const inherits$6 = __require("util").inherits;
|
|
345630
345786
|
const path$6 = __require("path");
|
|
@@ -345667,17 +345823,17 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
345667
345823
|
const flags = sonic.append ? "a" : "w";
|
|
345668
345824
|
const mode = sonic.mode;
|
|
345669
345825
|
if (sonic.sync) try {
|
|
345670
|
-
if (sonic.mkdir) fs$
|
|
345671
|
-
fileOpened(null, fs$
|
|
345826
|
+
if (sonic.mkdir) fs$4.mkdirSync(path$6.dirname(file), { recursive: true });
|
|
345827
|
+
fileOpened(null, fs$4.openSync(file, flags, mode));
|
|
345672
345828
|
} catch (err) {
|
|
345673
345829
|
fileOpened(err);
|
|
345674
345830
|
throw err;
|
|
345675
345831
|
}
|
|
345676
|
-
else if (sonic.mkdir) fs$
|
|
345832
|
+
else if (sonic.mkdir) fs$4.mkdir(path$6.dirname(file), { recursive: true }, (err) => {
|
|
345677
345833
|
if (err) return fileOpened(err);
|
|
345678
|
-
fs$
|
|
345834
|
+
fs$4.open(file, flags, mode, fileOpened);
|
|
345679
345835
|
});
|
|
345680
|
-
else fs$
|
|
345836
|
+
else fs$4.open(file, flags, mode, fileOpened);
|
|
345681
345837
|
}
|
|
345682
345838
|
function SonicBoom(opts) {
|
|
345683
345839
|
if (!(this instanceof SonicBoom)) return new SonicBoom(opts);
|
|
@@ -345715,8 +345871,8 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
345715
345871
|
this.flush = flushBuffer;
|
|
345716
345872
|
this.flushSync = flushBufferSync;
|
|
345717
345873
|
this._actualWrite = actualWriteBuffer;
|
|
345718
|
-
fsWriteSync = () => fs$
|
|
345719
|
-
fsWrite = () => fs$
|
|
345874
|
+
fsWriteSync = () => fs$4.writeSync(this.fd, this._writingBuf);
|
|
345875
|
+
fsWrite = () => fs$4.write(this.fd, this._writingBuf, this.release);
|
|
345720
345876
|
} else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
|
|
345721
345877
|
this._writingBuf = "";
|
|
345722
345878
|
this.write = write;
|
|
@@ -345724,12 +345880,12 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
345724
345880
|
this.flushSync = flushSync;
|
|
345725
345881
|
this._actualWrite = actualWrite;
|
|
345726
345882
|
fsWriteSync = () => {
|
|
345727
|
-
if (Buffer.isBuffer(this._writingBuf)) return fs$
|
|
345728
|
-
return fs$
|
|
345883
|
+
if (Buffer.isBuffer(this._writingBuf)) return fs$4.writeSync(this.fd, this._writingBuf);
|
|
345884
|
+
return fs$4.writeSync(this.fd, this._writingBuf, "utf8");
|
|
345729
345885
|
};
|
|
345730
345886
|
fsWrite = () => {
|
|
345731
|
-
if (Buffer.isBuffer(this._writingBuf)) return fs$
|
|
345732
|
-
return fs$
|
|
345887
|
+
if (Buffer.isBuffer(this._writingBuf)) return fs$4.write(this.fd, this._writingBuf, this.release);
|
|
345888
|
+
return fs$4.write(this.fd, this._writingBuf, "utf8", this.release);
|
|
345733
345889
|
};
|
|
345734
345890
|
} else throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
|
|
345735
345891
|
if (typeof fd === "number") {
|
|
@@ -345774,7 +345930,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
345774
345930
|
return;
|
|
345775
345931
|
}
|
|
345776
345932
|
}
|
|
345777
|
-
if (this._fsync) fs$
|
|
345933
|
+
if (this._fsync) fs$4.fsyncSync(this.fd);
|
|
345778
345934
|
const len = this._len;
|
|
345779
345935
|
if (this._reopening) {
|
|
345780
345936
|
this._writing = false;
|
|
@@ -345871,7 +346027,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
345871
346027
|
this._flushPending = true;
|
|
345872
346028
|
const onDrain = () => {
|
|
345873
346029
|
if (!this._fsync) try {
|
|
345874
|
-
fs$
|
|
346030
|
+
fs$4.fsync(this.fd, (err) => {
|
|
345875
346031
|
this._flushPending = false;
|
|
345876
346032
|
cb(err);
|
|
345877
346033
|
});
|
|
@@ -345948,7 +346104,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
345948
346104
|
if (this._writing) return;
|
|
345949
346105
|
const fd = this.fd;
|
|
345950
346106
|
this.once("ready", () => {
|
|
345951
|
-
if (fd !== this.fd) fs$
|
|
346107
|
+
if (fd !== this.fd) fs$4.close(fd, (err) => {
|
|
345952
346108
|
if (err) return this.emit("error", err);
|
|
345953
346109
|
});
|
|
345954
346110
|
});
|
|
@@ -345979,7 +346135,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
345979
346135
|
while (this._bufs.length || buf.length) {
|
|
345980
346136
|
if (buf.length <= 0) buf = this._bufs[0];
|
|
345981
346137
|
try {
|
|
345982
|
-
const n = Buffer.isBuffer(buf) ? fs$
|
|
346138
|
+
const n = Buffer.isBuffer(buf) ? fs$4.writeSync(this.fd, buf) : fs$4.writeSync(this.fd, buf, "utf8");
|
|
345983
346139
|
const releasedBufObj = releaseWritingBuf(buf, this._len, n);
|
|
345984
346140
|
buf = releasedBufObj.writingBuf;
|
|
345985
346141
|
this._len = releasedBufObj.len;
|
|
@@ -345990,7 +346146,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
345990
346146
|
}
|
|
345991
346147
|
}
|
|
345992
346148
|
try {
|
|
345993
|
-
fs$
|
|
346149
|
+
fs$4.fsyncSync(this.fd);
|
|
345994
346150
|
} catch {}
|
|
345995
346151
|
}
|
|
345996
346152
|
function flushBufferSync() {
|
|
@@ -346004,7 +346160,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
346004
346160
|
while (this._bufs.length || buf.length) {
|
|
346005
346161
|
if (buf.length <= 0) buf = mergeBuf(this._bufs[0], this._lens[0]);
|
|
346006
346162
|
try {
|
|
346007
|
-
const n = fs$
|
|
346163
|
+
const n = fs$4.writeSync(this.fd, buf);
|
|
346008
346164
|
buf = buf.subarray(n);
|
|
346009
346165
|
this._len = Math.max(this._len - n, 0);
|
|
346010
346166
|
if (buf.length <= 0) {
|
|
@@ -346026,24 +346182,24 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
346026
346182
|
this._writing = true;
|
|
346027
346183
|
this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
|
|
346028
346184
|
if (this.sync) try {
|
|
346029
|
-
release(null, Buffer.isBuffer(this._writingBuf) ? fs$
|
|
346185
|
+
release(null, Buffer.isBuffer(this._writingBuf) ? fs$4.writeSync(this.fd, this._writingBuf) : fs$4.writeSync(this.fd, this._writingBuf, "utf8"));
|
|
346030
346186
|
} catch (err) {
|
|
346031
346187
|
release(err);
|
|
346032
346188
|
}
|
|
346033
|
-
else fs$
|
|
346189
|
+
else fs$4.write(this.fd, this._writingBuf, release);
|
|
346034
346190
|
}
|
|
346035
346191
|
function actualWriteBuffer() {
|
|
346036
346192
|
const release = this.release;
|
|
346037
346193
|
this._writing = true;
|
|
346038
346194
|
this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
|
|
346039
346195
|
if (this.sync) try {
|
|
346040
|
-
release(null, fs$
|
|
346196
|
+
release(null, fs$4.writeSync(this.fd, this._writingBuf));
|
|
346041
346197
|
} catch (err) {
|
|
346042
346198
|
release(err);
|
|
346043
346199
|
}
|
|
346044
346200
|
else {
|
|
346045
346201
|
if (kCopyBuffer) this._writingBuf = Buffer.from(this._writingBuf);
|
|
346046
|
-
fs$
|
|
346202
|
+
fs$4.write(this.fd, this._writingBuf, release);
|
|
346047
346203
|
}
|
|
346048
346204
|
}
|
|
346049
346205
|
function actualClose(sonic) {
|
|
@@ -346057,10 +346213,10 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
346057
346213
|
sonic._lens = [];
|
|
346058
346214
|
assert$8(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
|
|
346059
346215
|
try {
|
|
346060
|
-
fs$
|
|
346216
|
+
fs$4.fsync(sonic.fd, closeWrapped);
|
|
346061
346217
|
} catch {}
|
|
346062
346218
|
function closeWrapped() {
|
|
346063
|
-
if (sonic.fd !== 1 && sonic.fd !== 2) fs$
|
|
346219
|
+
if (sonic.fd !== 1 && sonic.fd !== 2) fs$4.close(sonic.fd, done);
|
|
346064
346220
|
else done();
|
|
346065
346221
|
}
|
|
346066
346222
|
function done(err) {
|
|
@@ -368683,7 +368839,7 @@ var require_constants$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
368683
368839
|
//#endregion
|
|
368684
368840
|
//#region ../../../../node_modules/node-gyp-build/node-gyp-build.js
|
|
368685
368841
|
var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
368686
|
-
var fs$
|
|
368842
|
+
var fs$3 = __require("fs");
|
|
368687
368843
|
var path$5 = __require("path");
|
|
368688
368844
|
var os$3 = __require("os");
|
|
368689
368845
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
@@ -368739,7 +368895,7 @@ var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
368739
368895
|
};
|
|
368740
368896
|
function readdirSync(dir) {
|
|
368741
368897
|
try {
|
|
368742
|
-
return fs$
|
|
368898
|
+
return fs$3.readdirSync(dir);
|
|
368743
368899
|
} catch (err) {
|
|
368744
368900
|
return [];
|
|
368745
368901
|
}
|
|
@@ -368827,7 +368983,7 @@ var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
368827
368983
|
return typeof window !== "undefined" && window.process && window.process.type === "renderer";
|
|
368828
368984
|
}
|
|
368829
368985
|
function isAlpine(platform) {
|
|
368830
|
-
return platform === "linux" && fs$
|
|
368986
|
+
return platform === "linux" && fs$3.existsSync("/etc/alpine-release");
|
|
368831
368987
|
}
|
|
368832
368988
|
load.parseTags = parseTags;
|
|
368833
368989
|
load.matchTags = matchTags;
|
|
@@ -388980,7 +389136,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
388980
389136
|
//#region ../../node_modules/.pnpm/@fastify+swagger@9.7.0/node_modules/@fastify/swagger/lib/mode/static.js
|
|
388981
389137
|
var require_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
388982
389138
|
const path$3 = __require("node:path");
|
|
388983
|
-
const fs$
|
|
389139
|
+
const fs$2 = __require("node:fs");
|
|
388984
389140
|
const yaml = require_dist$1();
|
|
388985
389141
|
module.exports = function(fastify, opts, done) {
|
|
388986
389142
|
if (!opts.specification) return done(/* @__PURE__ */ new Error("specification is missing in the module options"));
|
|
@@ -388989,14 +389145,14 @@ var require_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
388989
389145
|
if (!opts.specification.path && !opts.specification.document) return done(/* @__PURE__ */ new Error("both specification.path and specification.document are missing, should be path to the file or swagger document spec"));
|
|
388990
389146
|
else if (opts.specification.path) {
|
|
388991
389147
|
if (typeof opts.specification.path !== "string") return done(/* @__PURE__ */ new Error("specification.path is not a string"));
|
|
388992
|
-
if (!fs$
|
|
389148
|
+
if (!fs$2.existsSync(path$3.resolve(opts.specification.path))) return done(/* @__PURE__ */ new Error(`${opts.specification.path} does not exist`));
|
|
388993
389149
|
const extName = path$3.extname(opts.specification.path).toLowerCase();
|
|
388994
389150
|
if ([".yaml", ".json"].indexOf(extName) === -1) return done(/* @__PURE__ */ new Error("specification.path extension name is not supported, should be one from ['.yaml', '.json']"));
|
|
388995
389151
|
if (opts.specification.postProcessor && typeof opts.specification.postProcessor !== "function") return done(/* @__PURE__ */ new Error("specification.postProcessor should be a function"));
|
|
388996
389152
|
if (opts.specification.baseDir && typeof opts.specification.baseDir !== "string") return done(/* @__PURE__ */ new Error("specification.baseDir should be string"));
|
|
388997
389153
|
if (!opts.specification.baseDir) opts.specification.baseDir = path$3.resolve(path$3.dirname(opts.specification.path));
|
|
388998
389154
|
else while (opts.specification.baseDir.endsWith("/")) opts.specification.baseDir = opts.specification.baseDir.slice(0, -1);
|
|
388999
|
-
const source = fs$
|
|
389155
|
+
const source = fs$2.readFileSync(path$3.resolve(opts.specification.path), "utf8");
|
|
389000
389156
|
switch (extName) {
|
|
389001
389157
|
case ".yaml":
|
|
389002
389158
|
swaggerObject = yaml.parse(source);
|
|
@@ -389263,11 +389419,11 @@ var require_should_route_hide = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
389263
389419
|
//#endregion
|
|
389264
389420
|
//#region ../../node_modules/.pnpm/@fastify+swagger@9.7.0/node_modules/@fastify/swagger/lib/util/read-package-json.js
|
|
389265
389421
|
var require_read_package_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
389266
|
-
const fs = __require("node:fs");
|
|
389422
|
+
const fs$1 = __require("node:fs");
|
|
389267
389423
|
const path$2 = __require("node:path");
|
|
389268
389424
|
function readPackageJson() {
|
|
389269
389425
|
try {
|
|
389270
|
-
return JSON.parse(fs.readFileSync(path$2.join(__dirname, "..", "..", "package.json")));
|
|
389426
|
+
return JSON.parse(fs$1.readFileSync(path$2.join(__dirname, "..", "..", "package.json")));
|
|
389271
389427
|
} catch {
|
|
389272
389428
|
return {};
|
|
389273
389429
|
}
|
|
@@ -396394,12 +396550,12 @@ function legacyStatusToCurrent(task) {
|
|
|
396394
396550
|
return task.status;
|
|
396395
396551
|
}
|
|
396396
396552
|
function isReadablePersistedTask(obj) {
|
|
396397
|
-
return isRecord$
|
|
396553
|
+
return isRecord$10(obj) && (typeof obj["taskId"] === "string" || typeof obj["task_id"] === "string");
|
|
396398
396554
|
}
|
|
396399
396555
|
function isLegacyPersistedTask(task) {
|
|
396400
396556
|
return "task_id" in task;
|
|
396401
396557
|
}
|
|
396402
|
-
function isRecord$
|
|
396558
|
+
function isRecord$10(value) {
|
|
396403
396559
|
return typeof value === "object" && value !== null;
|
|
396404
396560
|
}
|
|
396405
396561
|
function optionalNonEmptyString(value) {
|
|
@@ -396808,11 +396964,11 @@ const WINDOWS_RESERVED_NAMES = new Set([
|
|
|
396808
396964
|
...Array.from({ length: 9 }, (_value, index) => `COM${String(index + 1)}`),
|
|
396809
396965
|
...Array.from({ length: 9 }, (_value, index) => `LPT${String(index + 1)}`)
|
|
396810
396966
|
]);
|
|
396811
|
-
function isRecord$
|
|
396967
|
+
function isRecord$9(value) {
|
|
396812
396968
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
396813
396969
|
}
|
|
396814
396970
|
function assertRecord(value, label) {
|
|
396815
|
-
if (!isRecord$
|
|
396971
|
+
if (!isRecord$9(value)) throw new Error(`${label} must be an object.`);
|
|
396816
396972
|
}
|
|
396817
396973
|
function assertExactKeys(value, required, optional, label) {
|
|
396818
396974
|
const allowed = new Set([...required, ...optional]);
|
|
@@ -397103,7 +397259,7 @@ function currentArtifactRecord(artifacts) {
|
|
|
397103
397259
|
return result;
|
|
397104
397260
|
}
|
|
397105
397261
|
function readAttestationHash(value) {
|
|
397106
|
-
if (!isRecord$
|
|
397262
|
+
if (!isRecord$9(value) || !isRecord$9(value["attestation"])) return null;
|
|
397107
397263
|
const hash = value["attestation"]["hash"];
|
|
397108
397264
|
return typeof hash === "string" && /^[a-f0-9]{64}$/.test(hash) ? hash : null;
|
|
397109
397265
|
}
|
|
@@ -397875,26 +398031,26 @@ async function ensureSafeDirectory(path, create, recursive) {
|
|
|
397875
398031
|
return true;
|
|
397876
398032
|
}
|
|
397877
398033
|
function validateRegistry(value, context) {
|
|
397878
|
-
if (!isRecord$
|
|
397879
|
-
if (!hasExactKeys(value, REGISTRY_KEYS)) throw new WorkspaceError("registry_invalid", "Workspace registry contains unknown fields.");
|
|
397880
|
-
if (value["repoFingerprint"] !== context.repoFingerprint || value["primaryRoot"] !== context.primaryRoot || !isRecord$
|
|
398034
|
+
if (!isRecord$8(value) || value["version"] !== 1) throw new WorkspaceError("registry_invalid", "Unsupported workspace registry version.");
|
|
398035
|
+
if (!hasExactKeys$1(value, REGISTRY_KEYS)) throw new WorkspaceError("registry_invalid", "Workspace registry contains unknown fields.");
|
|
398036
|
+
if (value["repoFingerprint"] !== context.repoFingerprint || value["primaryRoot"] !== context.primaryRoot || !isRecord$8(value["workspaces"])) throw new WorkspaceError("registry_invalid", "Workspace registry does not match this repository.");
|
|
397881
398037
|
for (const [name, record] of Object.entries(value["workspaces"])) if (!isWorkspaceRecord(record) || record.name !== name) throw new WorkspaceError("registry_invalid", "Workspace registry contains an invalid entry.");
|
|
397882
398038
|
return value;
|
|
397883
398039
|
}
|
|
397884
398040
|
function isWorkspaceRecord(value) {
|
|
397885
|
-
if (!isRecord$
|
|
398041
|
+
if (!isRecord$8(value) || !hasExactKeys$1(value, WORKSPACE_RECORD_KEYS)) return false;
|
|
397886
398042
|
return typeof value["name"] === "string" && typeof value["path"] === "string" && typeof value["branch"] === "string" && typeof value["baseCommit"] === "string" && typeof value["repoFingerprint"] === "string" && isCanonicalIsoTimestamp(value["createdAt"]);
|
|
397887
398043
|
}
|
|
397888
398044
|
function isCanonicalIsoTimestamp(value) {
|
|
397889
398045
|
if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(value)) return false;
|
|
397890
398046
|
return new Date(value).toISOString() === value;
|
|
397891
398047
|
}
|
|
397892
|
-
function isRecord$
|
|
398048
|
+
function isRecord$8(value) {
|
|
397893
398049
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
397894
398050
|
const prototype = Object.getPrototypeOf(value);
|
|
397895
398051
|
return prototype === Object.prototype || prototype === null;
|
|
397896
398052
|
}
|
|
397897
|
-
function hasExactKeys(value, keys) {
|
|
398053
|
+
function hasExactKeys$1(value, keys) {
|
|
397898
398054
|
return Object.keys(value).length === keys.length && keys.every((key) => Object.hasOwn(value, key));
|
|
397899
398055
|
}
|
|
397900
398056
|
async function writeRegistryAtomic(repoStorageRoot, registry) {
|
|
@@ -397980,7 +398136,7 @@ async function readRegistryLockMetadata(lockPath) {
|
|
|
397980
398136
|
if (error.code !== void 0) throw error;
|
|
397981
398137
|
return;
|
|
397982
398138
|
}
|
|
397983
|
-
if (!isRecord$
|
|
398139
|
+
if (!isRecord$8(value) || !hasExactKeys$1(value, [
|
|
397984
398140
|
"version",
|
|
397985
398141
|
"pid",
|
|
397986
398142
|
"createdAt",
|
|
@@ -399120,42 +399276,42 @@ registerUiCatalogFragment({
|
|
|
399120
399276
|
registerUiCatalogFragment({
|
|
399121
399277
|
en: {
|
|
399122
399278
|
"startupPersonalMemory.title": "Personal memory",
|
|
399123
|
-
"startupPersonalMemory.details": "When personal memory is enabled, BLUN
|
|
399279
|
+
"startupPersonalMemory.details": "When personal memory is enabled, BLUN can save information only when you explicitly ask it to remember something and can use saved information in later conversations. Your chats are not evaluated automatically. This stays off until you enable it.",
|
|
399124
399280
|
"startupPersonalMemory.enable": "Enable memory",
|
|
399125
399281
|
"startupPersonalMemory.decline": "Do not enable",
|
|
399126
399282
|
"startupPersonalMemory.persistenceFailed": "Memory settings could not be saved. Personal memory remains off."
|
|
399127
399283
|
},
|
|
399128
399284
|
de: {
|
|
399129
399285
|
"startupPersonalMemory.title": "Persönliches Gedächtnis",
|
|
399130
|
-
"startupPersonalMemory.details": "Wenn das persönliche Gedächtnis aktiviert ist,
|
|
399286
|
+
"startupPersonalMemory.details": "Wenn das persönliche Gedächtnis aktiviert ist, kann BLUN Informationen nur dann speichern, wenn du ausdrücklich darum bittest, sich etwas zu merken. Gespeicherte Informationen können in späteren Gesprächen verwendet werden. Deine Chats werden nicht automatisch ausgewertet. Die Funktion bleibt deaktiviert, bis du sie einschaltest.",
|
|
399131
399287
|
"startupPersonalMemory.enable": "Gedächtnis aktivieren",
|
|
399132
399288
|
"startupPersonalMemory.decline": "Nicht aktivieren",
|
|
399133
399289
|
"startupPersonalMemory.persistenceFailed": "Die Gedächtniseinstellungen konnten nicht gespeichert werden. Das persönliche Gedächtnis bleibt deaktiviert."
|
|
399134
399290
|
},
|
|
399135
399291
|
es: {
|
|
399136
399292
|
"startupPersonalMemory.title": "Memoria personal",
|
|
399137
|
-
"startupPersonalMemory.details": "Cuando
|
|
399293
|
+
"startupPersonalMemory.details": "Cuando la memoria personal está activada, BLUN solo puede guardar información si le pides expresamente que recuerde algo y puede utilizar la información guardada en conversaciones posteriores. Tus chats no se analizan automáticamente. Esta función permanece desactivada hasta que la actives.",
|
|
399138
399294
|
"startupPersonalMemory.enable": "Activar la memoria",
|
|
399139
399295
|
"startupPersonalMemory.decline": "No activar",
|
|
399140
399296
|
"startupPersonalMemory.persistenceFailed": "No se pudo guardar la configuración de la memoria. La memoria personal permanece desactivada."
|
|
399141
399297
|
},
|
|
399142
399298
|
fr: {
|
|
399143
399299
|
"startupPersonalMemory.title": "Mémoire personnelle",
|
|
399144
|
-
"startupPersonalMemory.details": "Lorsque
|
|
399300
|
+
"startupPersonalMemory.details": "Lorsque la mémoire personnelle est activée, BLUN ne peut enregistrer des informations que si vous lui demandez explicitement de retenir quelque chose. Il peut ensuite utiliser les informations enregistrées dans de futures conversations. Vos discussions ne sont pas analysées automatiquement. Cette fonction reste désactivée tant que vous ne l’activez pas.",
|
|
399145
399301
|
"startupPersonalMemory.enable": "Activer la mémoire",
|
|
399146
399302
|
"startupPersonalMemory.decline": "Ne pas activer",
|
|
399147
399303
|
"startupPersonalMemory.persistenceFailed": "Les réglages de la mémoire n’ont pas pu être enregistrés. La mémoire personnelle reste désactivée."
|
|
399148
399304
|
},
|
|
399149
399305
|
sv: {
|
|
399150
399306
|
"startupPersonalMemory.title": "Personligt minne",
|
|
399151
|
-
"startupPersonalMemory.details": "När
|
|
399307
|
+
"startupPersonalMemory.details": "När det personliga minnet är aktiverat kan BLUN bara spara information om du uttryckligen ber BLUN att komma ihåg något. Sparad information kan sedan användas i framtida samtal. Dina chattar analyseras inte automatiskt. Funktionen är avstängd tills du aktiverar den.",
|
|
399152
399308
|
"startupPersonalMemory.enable": "Aktivera minnet",
|
|
399153
399309
|
"startupPersonalMemory.decline": "Aktivera inte",
|
|
399154
399310
|
"startupPersonalMemory.persistenceFailed": "Minnesinställningarna kunde inte sparas. Det personliga minnet förblir avstängt."
|
|
399155
399311
|
},
|
|
399156
399312
|
cs: {
|
|
399157
399313
|
"startupPersonalMemory.title": "Osobní paměť",
|
|
399158
|
-
"startupPersonalMemory.details": "Když
|
|
399314
|
+
"startupPersonalMemory.details": "Když je osobní paměť zapnutá, BLUN může uložit informace pouze tehdy, když ho výslovně požádáte, aby si něco zapamatoval. Uložené informace pak může použít v budoucích konverzacích. Vaše chaty se automaticky nevyhodnocují. Funkce zůstává vypnutá, dokud ji nezapnete.",
|
|
399159
399315
|
"startupPersonalMemory.enable": "Zapnout paměť",
|
|
399160
399316
|
"startupPersonalMemory.decline": "Nezapínat",
|
|
399161
399317
|
"startupPersonalMemory.persistenceFailed": "Nastavení paměti se nepodařilo uložit. Osobní paměť zůstává vypnutá."
|
|
@@ -404217,7 +404373,7 @@ var TUI = class TUI extends Container {
|
|
|
404217
404373
|
if (!debugRedraw) return;
|
|
404218
404374
|
const logPath = path$17.join(nodeOs.homedir(), ".pi", "agent", "pi-debug.log");
|
|
404219
404375
|
const msg = `[${(/* @__PURE__ */ new Date()).toISOString()}] fullRender: ${reason} (prev=${this.previousLines.length}, new=${newLines.length}, height=${height})\n`;
|
|
404220
|
-
fs$
|
|
404376
|
+
fs$17.appendFileSync(logPath, msg);
|
|
404221
404377
|
};
|
|
404222
404378
|
if (this.previousLines.length === 0 && !widthChanged && !heightChanged) {
|
|
404223
404379
|
logRedraw("first render");
|
|
@@ -404364,7 +404520,7 @@ var TUI = class TUI extends Container {
|
|
|
404364
404520
|
buffer += "\x1B[?2026l";
|
|
404365
404521
|
if (process.env["PI_TUI_DEBUG"] === "1") {
|
|
404366
404522
|
const debugDir = "/tmp/tui";
|
|
404367
|
-
fs$
|
|
404523
|
+
fs$17.mkdirSync(debugDir, { recursive: true });
|
|
404368
404524
|
const debugPath = path$17.join(debugDir, `render-${Date.now()}-${Math.random().toString(36).slice(2)}.log`);
|
|
404369
404525
|
const debugData = [
|
|
404370
404526
|
`firstChanged: ${firstChanged}`,
|
|
@@ -404388,7 +404544,7 @@ var TUI = class TUI extends Container {
|
|
|
404388
404544
|
"=== buffer ===",
|
|
404389
404545
|
JSON.stringify(buffer)
|
|
404390
404546
|
].join("\n");
|
|
404391
|
-
fs$
|
|
404547
|
+
fs$17.writeFileSync(debugPath, debugData);
|
|
404392
404548
|
}
|
|
404393
404549
|
this.terminal.write(buffer);
|
|
404394
404550
|
this.cursorRow = Math.max(0, newLines.length - 1);
|
|
@@ -409047,7 +409203,7 @@ var ProcessTerminal = class {
|
|
|
409047
409203
|
const env = process.env["PI_TUI_WRITE_LOG"] || "";
|
|
409048
409204
|
if (!env) return "";
|
|
409049
409205
|
try {
|
|
409050
|
-
if (fs$
|
|
409206
|
+
if (fs$17.statSync(env).isDirectory()) {
|
|
409051
409207
|
const now = /* @__PURE__ */ new Date();
|
|
409052
409208
|
const ts = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}_${String(now.getHours()).padStart(2, "0")}-${String(now.getMinutes()).padStart(2, "0")}-${String(now.getSeconds()).padStart(2, "0")}`;
|
|
409053
409209
|
return path$17.join(env, `tui-${ts}-${process.pid}.log`);
|
|
@@ -409330,7 +409486,7 @@ var ProcessTerminal = class {
|
|
|
409330
409486
|
write(data) {
|
|
409331
409487
|
process.stdout.write(data);
|
|
409332
409488
|
if (this.writeLogPath) try {
|
|
409333
|
-
fs$
|
|
409489
|
+
fs$17.appendFileSync(this.writeLogPath, data, { encoding: "utf8" });
|
|
409334
409490
|
} catch {}
|
|
409335
409491
|
}
|
|
409336
409492
|
get columns() {
|
|
@@ -413658,7 +413814,7 @@ const execFileAsync = promisify(execFile);
|
|
|
413658
413814
|
async function scanCodebase(rootInput, options = {}) {
|
|
413659
413815
|
const root = resolve(rootInput);
|
|
413660
413816
|
const limits = resolveLimits(options.limits);
|
|
413661
|
-
throwIfAborted(options.signal);
|
|
413817
|
+
throwIfAborted$1(options.signal);
|
|
413662
413818
|
const usedGitIgnore = await isInsideGitWorkTree(root);
|
|
413663
413819
|
const collected = usedGitIgnore ? await scanWithGit(root, limits, options.signal) : await scanWithoutFilter(root, limits, options.signal);
|
|
413664
413820
|
const sortedFiles = collected.files.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
@@ -413703,13 +413859,13 @@ async function scanWithGit(root, limits, signal) {
|
|
|
413703
413859
|
maxBuffer: 1024 * 1024 * 64,
|
|
413704
413860
|
signal
|
|
413705
413861
|
});
|
|
413706
|
-
throwIfAborted(signal);
|
|
413862
|
+
throwIfAborted$1(signal);
|
|
413707
413863
|
const relativePaths = splitNull(stdout);
|
|
413708
413864
|
const files = [];
|
|
413709
413865
|
let exceedsLimit;
|
|
413710
413866
|
let totalSize = 0;
|
|
413711
413867
|
for (const relativePath of relativePaths) {
|
|
413712
|
-
throwIfAborted(signal);
|
|
413868
|
+
throwIfAborted$1(signal);
|
|
413713
413869
|
if (files.length >= limits.maxFiles) {
|
|
413714
413870
|
exceedsLimit = {
|
|
413715
413871
|
reason: "file-count",
|
|
@@ -413744,11 +413900,11 @@ async function scanWithoutFilter(root, limits, signal) {
|
|
|
413744
413900
|
let totalSize = 0;
|
|
413745
413901
|
async function walk(dir) {
|
|
413746
413902
|
if (stopped) return;
|
|
413747
|
-
throwIfAborted(signal);
|
|
413903
|
+
throwIfAborted$1(signal);
|
|
413748
413904
|
const entries = await readdir(dir, { withFileTypes: true });
|
|
413749
413905
|
for (const entry of entries) {
|
|
413750
413906
|
if (stopped) return;
|
|
413751
|
-
throwIfAborted(signal);
|
|
413907
|
+
throwIfAborted$1(signal);
|
|
413752
413908
|
if (files.length >= limits.maxFiles) {
|
|
413753
413909
|
exceedsLimit = {
|
|
413754
413910
|
reason: "file-count",
|
|
@@ -413801,7 +413957,7 @@ async function statFile(root, relativePath) {
|
|
|
413801
413957
|
mtimeMs: stat.mtimeMs
|
|
413802
413958
|
};
|
|
413803
413959
|
}
|
|
413804
|
-
function throwIfAborted(signal) {
|
|
413960
|
+
function throwIfAborted$1(signal) {
|
|
413805
413961
|
if (signal?.aborted) {
|
|
413806
413962
|
const error = /* @__PURE__ */ new Error("Codebase scan aborted.");
|
|
413807
413963
|
error.name = "AbortError";
|
|
@@ -417741,14 +417897,14 @@ function findGoalIndex(file, goalId) {
|
|
|
417741
417897
|
return index;
|
|
417742
417898
|
}
|
|
417743
417899
|
function isGoalQueueFile(value) {
|
|
417744
|
-
if (!isRecord$
|
|
417900
|
+
if (!isRecord$7(value)) return false;
|
|
417745
417901
|
return value["version"] === GOAL_QUEUE_VERSION && Array.isArray(value["goals"]) && value["goals"].every(isUpcomingGoal);
|
|
417746
417902
|
}
|
|
417747
417903
|
function isUpcomingGoal(value) {
|
|
417748
|
-
if (!isRecord$
|
|
417904
|
+
if (!isRecord$7(value)) return false;
|
|
417749
417905
|
return isNonEmptyString(value["id"]) && isNonEmptyString(value["objective"]) && isNonEmptyString(value["createdAt"]) && isNonEmptyString(value["updatedAt"]);
|
|
417750
417906
|
}
|
|
417751
|
-
function isRecord$
|
|
417907
|
+
function isRecord$7(value) {
|
|
417752
417908
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
417753
417909
|
}
|
|
417754
417910
|
function isNonEmptyString(value) {
|
|
@@ -417761,7 +417917,7 @@ function timestampAfter(previous) {
|
|
|
417761
417917
|
return now.toISOString();
|
|
417762
417918
|
}
|
|
417763
417919
|
function isErrno(error, code) {
|
|
417764
|
-
return isRecord$
|
|
417920
|
+
return isRecord$7(error) && error["code"] === code;
|
|
417765
417921
|
}
|
|
417766
417922
|
function describeError(error) {
|
|
417767
417923
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -419733,7 +419889,7 @@ function parsePluginMarketplace(raw, location) {
|
|
|
419733
419889
|
} catch (error) {
|
|
419734
419890
|
throw new Error(`Plugin marketplace is not valid JSON: ${formatParseError(error)}`, { cause: error });
|
|
419735
419891
|
}
|
|
419736
|
-
if (!isRecord$
|
|
419892
|
+
if (!isRecord$6(parsed)) throw new TypeError("Plugin marketplace must be an object.");
|
|
419737
419893
|
const rawPlugins = parsed["plugins"];
|
|
419738
419894
|
if (!Array.isArray(rawPlugins)) throw new TypeError("Plugin marketplace must contain a \"plugins\" array.");
|
|
419739
419895
|
return {
|
|
@@ -419777,7 +419933,7 @@ async function readMarketplaceText(location, fetchImpl) {
|
|
|
419777
419933
|
return response.text();
|
|
419778
419934
|
}
|
|
419779
419935
|
function parseMarketplaceEntry(value, index, location) {
|
|
419780
|
-
if (!isRecord$
|
|
419936
|
+
if (!isRecord$6(value)) throw new TypeError(`Plugin marketplace entry ${index + 1} must be an object.`);
|
|
419781
419937
|
const id = requiredString(value, "id", index);
|
|
419782
419938
|
validateMarketplaceEntryType(value, id);
|
|
419783
419939
|
const source = stringField$2(value, "source") ?? stringField$2(value, "url") ?? stringField$2(value, "downloadUrl");
|
|
@@ -419913,7 +420069,7 @@ function stringArrayField(value, field) {
|
|
|
419913
420069
|
const out = raw.filter((item) => typeof item === "string").map((item) => item.trim()).filter((item) => item.length > 0);
|
|
419914
420070
|
return out.length > 0 ? out : void 0;
|
|
419915
420071
|
}
|
|
419916
|
-
function isRecord$
|
|
420072
|
+
function isRecord$6(value) {
|
|
419917
420073
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
419918
420074
|
}
|
|
419919
420075
|
function formatParseError(error) {
|
|
@@ -487800,10 +487956,10 @@ function parseGoalValue(output) {
|
|
|
487800
487956
|
} catch {
|
|
487801
487957
|
return;
|
|
487802
487958
|
}
|
|
487803
|
-
if (!isRecord$
|
|
487959
|
+
if (!isRecord$5(parsed) || !("goal" in parsed)) return void 0;
|
|
487804
487960
|
const goal = parsed["goal"];
|
|
487805
487961
|
if (goal === null) return null;
|
|
487806
|
-
if (!isRecord$
|
|
487962
|
+
if (!isRecord$5(goal)) return void 0;
|
|
487807
487963
|
return goal;
|
|
487808
487964
|
}
|
|
487809
487965
|
function formatGoalStats(goal) {
|
|
@@ -487825,7 +487981,7 @@ function stringArg(args, key) {
|
|
|
487825
487981
|
const value = args[key];
|
|
487826
487982
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
487827
487983
|
}
|
|
487828
|
-
function isRecord$
|
|
487984
|
+
function isRecord$5(value) {
|
|
487829
487985
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
487830
487986
|
}
|
|
487831
487987
|
function stringField$1(record, key) {
|
|
@@ -490691,6 +490847,7 @@ function webSessionUrl(origin, sessionId, token) {
|
|
|
490691
490847
|
function dispatchInput(host, text) {
|
|
490692
490848
|
const parsed = parseSlashInput(text);
|
|
490693
490849
|
if (parsed !== null) {
|
|
490850
|
+
if (parsed.name === "goal" || parsed.name === "loop") return executeSlashCommand(host, text);
|
|
490694
490851
|
const isBusy = host.state.appState.streamingPhase !== "idle" || host.state.appState.isCompacting;
|
|
490695
490852
|
const canRunAlongsideMain = (parsed.name === "btw" || parsed.name === "memory") && !host.state.appState.isCompacting;
|
|
490696
490853
|
if (host.deferUserMessages || isBusy && !canRunAlongsideMain) {
|
|
@@ -491698,6 +491855,320 @@ function formatTurnEndedFailure(event) {
|
|
|
491698
491855
|
return `Prompt turn ended with reason: ${event.reason}`;
|
|
491699
491856
|
}
|
|
491700
491857
|
//#endregion
|
|
491858
|
+
//#region src/customer-mistake/client-state.ts
|
|
491859
|
+
var CustomerMistakeClientState = class {
|
|
491860
|
+
broker;
|
|
491861
|
+
effectiveStatus = "disabled";
|
|
491862
|
+
generation = 0;
|
|
491863
|
+
preparationController;
|
|
491864
|
+
constructor(broker) {
|
|
491865
|
+
this.broker = broker;
|
|
491866
|
+
}
|
|
491867
|
+
get status() {
|
|
491868
|
+
return this.effectiveStatus;
|
|
491869
|
+
}
|
|
491870
|
+
async prepareHeadless() {
|
|
491871
|
+
const operation = this.beginPreparation();
|
|
491872
|
+
try {
|
|
491873
|
+
const consent = await this.broker.getConsent(operation.controller.signal);
|
|
491874
|
+
if (!this.isCurrent(operation)) return "disabled";
|
|
491875
|
+
this.effectiveStatus = consent.status === "share_sanitized" ? "share_sanitized" : "disabled";
|
|
491876
|
+
} catch {
|
|
491877
|
+
if (this.isCurrent(operation)) this.effectiveStatus = "disabled";
|
|
491878
|
+
} finally {
|
|
491879
|
+
this.finishPreparation(operation);
|
|
491880
|
+
}
|
|
491881
|
+
return this.effectiveStatus;
|
|
491882
|
+
}
|
|
491883
|
+
async prepareInteractive(prompt) {
|
|
491884
|
+
const operation = this.beginPreparation();
|
|
491885
|
+
let persistenceAttempted = false;
|
|
491886
|
+
try {
|
|
491887
|
+
const consent = await this.broker.getConsent(operation.controller.signal);
|
|
491888
|
+
if (!this.isCurrent(operation)) return "disabled";
|
|
491889
|
+
if (consent.status === "share_sanitized") {
|
|
491890
|
+
this.effectiveStatus = "share_sanitized";
|
|
491891
|
+
return this.effectiveStatus;
|
|
491892
|
+
}
|
|
491893
|
+
this.effectiveStatus = "disabled";
|
|
491894
|
+
if (consent.status === "disabled") return this.effectiveStatus;
|
|
491895
|
+
const choice = await prompt();
|
|
491896
|
+
if (!this.isCurrent(operation)) return "disabled";
|
|
491897
|
+
if (choice === "exit") return "exit";
|
|
491898
|
+
if (choice === "cancelled") return "disabled";
|
|
491899
|
+
persistenceAttempted = true;
|
|
491900
|
+
await this.broker.putConsent(choice, operation.controller.signal);
|
|
491901
|
+
if (!this.isCurrent(operation)) return "disabled";
|
|
491902
|
+
const authoritative = await this.broker.getConsent(operation.controller.signal);
|
|
491903
|
+
if (!this.isCurrent(operation)) return "disabled";
|
|
491904
|
+
this.effectiveStatus = choice === "share_sanitized" && authoritative.status === "share_sanitized" ? "share_sanitized" : "disabled";
|
|
491905
|
+
return this.effectiveStatus;
|
|
491906
|
+
} catch {
|
|
491907
|
+
const isCurrent = this.isCurrent(operation);
|
|
491908
|
+
if (isCurrent) this.effectiveStatus = "disabled";
|
|
491909
|
+
return isCurrent && persistenceAttempted ? "persistence_failed" : "disabled";
|
|
491910
|
+
} finally {
|
|
491911
|
+
this.finishPreparation(operation);
|
|
491912
|
+
}
|
|
491913
|
+
}
|
|
491914
|
+
async disable() {
|
|
491915
|
+
this.generation += 1;
|
|
491916
|
+
this.effectiveStatus = "disabled";
|
|
491917
|
+
this.abortPreparation();
|
|
491918
|
+
const controller = new AbortController();
|
|
491919
|
+
this.preparationController = controller;
|
|
491920
|
+
try {
|
|
491921
|
+
await this.broker.putConsent("disabled", controller.signal);
|
|
491922
|
+
} finally {
|
|
491923
|
+
if (this.preparationController === controller) this.preparationController = void 0;
|
|
491924
|
+
}
|
|
491925
|
+
}
|
|
491926
|
+
reset() {
|
|
491927
|
+
this.generation += 1;
|
|
491928
|
+
this.effectiveStatus = "disabled";
|
|
491929
|
+
this.abortPreparation();
|
|
491930
|
+
}
|
|
491931
|
+
beginPreparation() {
|
|
491932
|
+
this.generation += 1;
|
|
491933
|
+
this.effectiveStatus = "disabled";
|
|
491934
|
+
this.abortPreparation();
|
|
491935
|
+
const controller = new AbortController();
|
|
491936
|
+
this.preparationController = controller;
|
|
491937
|
+
return {
|
|
491938
|
+
controller,
|
|
491939
|
+
generation: this.generation
|
|
491940
|
+
};
|
|
491941
|
+
}
|
|
491942
|
+
isCurrent(operation) {
|
|
491943
|
+
return !operation.controller.signal.aborted && operation.generation === this.generation && this.preparationController === operation.controller;
|
|
491944
|
+
}
|
|
491945
|
+
finishPreparation(operation) {
|
|
491946
|
+
if (this.preparationController === operation.controller) this.preparationController = void 0;
|
|
491947
|
+
}
|
|
491948
|
+
abortPreparation() {
|
|
491949
|
+
this.preparationController?.abort();
|
|
491950
|
+
this.preparationController = void 0;
|
|
491951
|
+
}
|
|
491952
|
+
};
|
|
491953
|
+
const MISTAKE_CONSENT_PATH = "/v1/me/mistake/consent";
|
|
491954
|
+
var CustomerMistakeBrokerError = class extends Error {
|
|
491955
|
+
code;
|
|
491956
|
+
status;
|
|
491957
|
+
constructor(code, status) {
|
|
491958
|
+
super(`Customer mistake broker request failed: ${code}.`);
|
|
491959
|
+
this.code = code;
|
|
491960
|
+
this.status = status;
|
|
491961
|
+
this.name = "CustomerMistakeBrokerError";
|
|
491962
|
+
}
|
|
491963
|
+
};
|
|
491964
|
+
function parseMistakeConsent(payload) {
|
|
491965
|
+
if (!isRecord$4(payload) || !hasExactKeys(payload, ["status"])) return void 0;
|
|
491966
|
+
const status = payload["status"];
|
|
491967
|
+
return status === "disabled" || status === "never_asked" || status === "share_sanitized" ? { status } : void 0;
|
|
491968
|
+
}
|
|
491969
|
+
var CustomerMistakeBrokerClient = class {
|
|
491970
|
+
options;
|
|
491971
|
+
baseUrl;
|
|
491972
|
+
fetchImpl;
|
|
491973
|
+
idempotencyKey;
|
|
491974
|
+
timeoutMs;
|
|
491975
|
+
constructor(options) {
|
|
491976
|
+
this.options = options;
|
|
491977
|
+
this.baseUrl = normalizeBaseUrl(options.baseUrl ?? "https://account.blun.ai");
|
|
491978
|
+
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
491979
|
+
this.idempotencyKey = options.idempotencyKey ?? randomUUID;
|
|
491980
|
+
this.timeoutMs = options.timeoutMs ?? 1e4;
|
|
491981
|
+
}
|
|
491982
|
+
async getConsent(signal) {
|
|
491983
|
+
throwIfAborted(signal);
|
|
491984
|
+
const parsed = parseMistakeConsent(await this.request("GET", MISTAKE_CONSENT_PATH, void 0, signal));
|
|
491985
|
+
if (parsed === void 0) throw new CustomerMistakeBrokerError("INVALID_PAYLOAD");
|
|
491986
|
+
return parsed;
|
|
491987
|
+
}
|
|
491988
|
+
async putConsent(status, signal) {
|
|
491989
|
+
throwIfAborted(signal);
|
|
491990
|
+
if (status !== "disabled" && status !== "share_sanitized") throw new CustomerMistakeBrokerError("INVALID_PAYLOAD");
|
|
491991
|
+
await this.request("POST", ACCOUNT_CONSENT_PATH, { mistake: status === "share_sanitized" }, signal);
|
|
491992
|
+
}
|
|
491993
|
+
async request(method, path, body, signal) {
|
|
491994
|
+
const response = await this.fetchAuthorized(method, path, body, signal);
|
|
491995
|
+
if (!response.ok) throw httpError(response.status);
|
|
491996
|
+
if (response.status === 204) return void 0;
|
|
491997
|
+
const text = await response.text();
|
|
491998
|
+
if (text.trim().length === 0) return void 0;
|
|
491999
|
+
try {
|
|
492000
|
+
return JSON.parse(text);
|
|
492001
|
+
} catch {
|
|
492002
|
+
throw new CustomerMistakeBrokerError("INVALID_PAYLOAD");
|
|
492003
|
+
}
|
|
492004
|
+
}
|
|
492005
|
+
async fetchAuthorized(method, path, body, signal) {
|
|
492006
|
+
const idempotencyKey = method === "GET" ? void 0 : this.idempotencyKey();
|
|
492007
|
+
const firstToken = await this.accessToken();
|
|
492008
|
+
let response = await this.fetchWithToken(method, path, body, firstToken, idempotencyKey, signal);
|
|
492009
|
+
if (response.status === 401) {
|
|
492010
|
+
throwIfAborted(signal);
|
|
492011
|
+
const refreshedToken = await this.accessToken({ force: true });
|
|
492012
|
+
throwIfAborted(signal);
|
|
492013
|
+
response = await this.fetchWithToken(method, path, body, refreshedToken, idempotencyKey, signal);
|
|
492014
|
+
}
|
|
492015
|
+
return response;
|
|
492016
|
+
}
|
|
492017
|
+
async accessToken(options) {
|
|
492018
|
+
try {
|
|
492019
|
+
const token = await this.options.tokenProvider.getAccessToken(options);
|
|
492020
|
+
if (token.trim().length === 0) throw new Error("empty account OAuth token");
|
|
492021
|
+
return token;
|
|
492022
|
+
} catch {
|
|
492023
|
+
throw new CustomerMistakeBrokerError("AUTHENTICATION_REQUIRED");
|
|
492024
|
+
}
|
|
492025
|
+
}
|
|
492026
|
+
async fetchWithToken(method, path, body, token, idempotencyKey, signal) {
|
|
492027
|
+
if (signal?.aborted === true) throw new CustomerMistakeBrokerError("CANCELLED");
|
|
492028
|
+
const timeoutController = new AbortController();
|
|
492029
|
+
const timeout = setTimeout(() => {
|
|
492030
|
+
timeoutController.abort();
|
|
492031
|
+
}, this.timeoutMs);
|
|
492032
|
+
timeout.unref?.();
|
|
492033
|
+
const requestSignal = signal === void 0 ? timeoutController.signal : AbortSignal.any([signal, timeoutController.signal]);
|
|
492034
|
+
const headers = new Headers({
|
|
492035
|
+
Accept: "application/json",
|
|
492036
|
+
Authorization: `Bearer ${token}`
|
|
492037
|
+
});
|
|
492038
|
+
if (body !== void 0) headers.set("Content-Type", "application/json");
|
|
492039
|
+
if (idempotencyKey !== void 0) headers.set("Idempotency-Key", idempotencyKey);
|
|
492040
|
+
try {
|
|
492041
|
+
return await this.fetchImpl(`${this.baseUrl}${path}`, {
|
|
492042
|
+
method,
|
|
492043
|
+
headers,
|
|
492044
|
+
body: body === void 0 ? void 0 : JSON.stringify(body),
|
|
492045
|
+
redirect: "error",
|
|
492046
|
+
signal: requestSignal
|
|
492047
|
+
});
|
|
492048
|
+
} catch {
|
|
492049
|
+
throw new CustomerMistakeBrokerError(isAborted(signal) ? "CANCELLED" : "UNAVAILABLE");
|
|
492050
|
+
} finally {
|
|
492051
|
+
clearTimeout(timeout);
|
|
492052
|
+
}
|
|
492053
|
+
}
|
|
492054
|
+
};
|
|
492055
|
+
function throwIfAborted(signal) {
|
|
492056
|
+
if (signal?.aborted === true) throw new CustomerMistakeBrokerError("CANCELLED");
|
|
492057
|
+
}
|
|
492058
|
+
function isAborted(signal) {
|
|
492059
|
+
return signal?.aborted ?? false;
|
|
492060
|
+
}
|
|
492061
|
+
function httpError(status) {
|
|
492062
|
+
if (status === 401) return new CustomerMistakeBrokerError("AUTHENTICATION_REQUIRED", status);
|
|
492063
|
+
if (status === 422) return new CustomerMistakeBrokerError("INVALID_PAYLOAD", status);
|
|
492064
|
+
return new CustomerMistakeBrokerError("UNAVAILABLE", status);
|
|
492065
|
+
}
|
|
492066
|
+
function normalizeBaseUrl(value) {
|
|
492067
|
+
let url;
|
|
492068
|
+
try {
|
|
492069
|
+
url = new URL(value);
|
|
492070
|
+
} catch {
|
|
492071
|
+
throw new CustomerMistakeBrokerError("INVALID_PAYLOAD");
|
|
492072
|
+
}
|
|
492073
|
+
if (url.protocol !== "https:" || url.username.length > 0 || url.password.length > 0 || url.search.length > 0 || url.hash.length > 0 || url.pathname !== "/" && url.pathname !== "") throw new CustomerMistakeBrokerError("INVALID_PAYLOAD");
|
|
492074
|
+
return url.origin;
|
|
492075
|
+
}
|
|
492076
|
+
function hasExactKeys(value, expected) {
|
|
492077
|
+
const keys = Object.keys(value);
|
|
492078
|
+
return keys.length === expected.length && expected.every((key) => keys.includes(key));
|
|
492079
|
+
}
|
|
492080
|
+
function isRecord$4(value) {
|
|
492081
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
492082
|
+
}
|
|
492083
|
+
//#endregion
|
|
492084
|
+
//#region src/customer-mistake/runtime.ts
|
|
492085
|
+
init_src$3();
|
|
492086
|
+
const OFFICIAL_BLUN_API_BASE_URL = "https://api.blun.ai/v1";
|
|
492087
|
+
const OFFICIAL_BLUN_OAUTH_HOST = "https://account.blun.ai";
|
|
492088
|
+
const OFFICIAL_BLUN_OAUTH_KEY = "oauth/blun";
|
|
492089
|
+
async function createCustomerMistakeBrokerClient(harness) {
|
|
492090
|
+
const provider = loadRuntimeConfigSafe(harness.configPath).config.providers[DEFAULT_OAUTH_PROVIDER_NAME];
|
|
492091
|
+
if (provider?.oauth === void 0 || typeof provider.apiKey === "string" && provider.apiKey.trim().length > 0) return void 0;
|
|
492092
|
+
const runtime = resolveBlunCodeRuntimeAuth({
|
|
492093
|
+
configuredBaseUrl: provider.baseUrl,
|
|
492094
|
+
configuredOAuthRef: provider.oauth
|
|
492095
|
+
});
|
|
492096
|
+
if (!isOfficialManagedOAuthRuntime(runtime)) return void 0;
|
|
492097
|
+
let status;
|
|
492098
|
+
try {
|
|
492099
|
+
status = await harness.auth.status(DEFAULT_OAUTH_PROVIDER_NAME);
|
|
492100
|
+
} catch {
|
|
492101
|
+
return;
|
|
492102
|
+
}
|
|
492103
|
+
if (status.providers.find((candidate) => candidate.providerName === "managed:blun")?.hasToken !== true) return void 0;
|
|
492104
|
+
return new CustomerMistakeBrokerClient({ tokenProvider: harness.auth.resolveOAuthTokenProvider(DEFAULT_OAUTH_PROVIDER_NAME, runtime.oauthRef) });
|
|
492105
|
+
}
|
|
492106
|
+
function isOfficialManagedOAuthRuntime(runtime) {
|
|
492107
|
+
return normalizeEndpoint(runtime.baseUrl) === OFFICIAL_BLUN_API_BASE_URL && runtime.oauthRef.key === OFFICIAL_BLUN_OAUTH_KEY && (runtime.oauthRef.oauthHost === void 0 || normalizeEndpoint(runtime.oauthRef.oauthHost) === OFFICIAL_BLUN_OAUTH_HOST);
|
|
492108
|
+
}
|
|
492109
|
+
function normalizeEndpoint(value) {
|
|
492110
|
+
if (value === void 0) return void 0;
|
|
492111
|
+
try {
|
|
492112
|
+
const url = new URL(value);
|
|
492113
|
+
if (url.username.length > 0 || url.password.length > 0 || url.search || url.hash) return;
|
|
492114
|
+
return `${url.origin}${url.pathname.replace(/\/+$/, "")}`;
|
|
492115
|
+
} catch {
|
|
492116
|
+
return;
|
|
492117
|
+
}
|
|
492118
|
+
}
|
|
492119
|
+
//#endregion
|
|
492120
|
+
//#region src/customer-mistake/host-controller.ts
|
|
492121
|
+
/**
|
|
492122
|
+
* Prepared host boundary for TUI and headless CLI. It intentionally exposes
|
|
492123
|
+
* consent state only; contribution POST remains unavailable until the local
|
|
492124
|
+
* provenance catalog and the independent server gates are both proven.
|
|
492125
|
+
*/
|
|
492126
|
+
var CustomerMistakeHostController = class {
|
|
492127
|
+
state;
|
|
492128
|
+
epoch = 0;
|
|
492129
|
+
get status() {
|
|
492130
|
+
return this.state?.status ?? "disabled";
|
|
492131
|
+
}
|
|
492132
|
+
async prepareInteractive(harness, prompt, onPersistenceFailed = () => {}) {
|
|
492133
|
+
this.reset();
|
|
492134
|
+
const epoch = this.epoch;
|
|
492135
|
+
const broker = await this.createBroker(harness);
|
|
492136
|
+
if (epoch !== this.epoch || broker === void 0) return "disabled";
|
|
492137
|
+
const state = new CustomerMistakeClientState(broker);
|
|
492138
|
+
this.state = state;
|
|
492139
|
+
const result = await state.prepareInteractive(prompt);
|
|
492140
|
+
if (epoch !== this.epoch) return "disabled";
|
|
492141
|
+
if (result === "persistence_failed") onPersistenceFailed();
|
|
492142
|
+
return result;
|
|
492143
|
+
}
|
|
492144
|
+
async prepareHeadless(harness) {
|
|
492145
|
+
this.reset();
|
|
492146
|
+
const epoch = this.epoch;
|
|
492147
|
+
const broker = await this.createBroker(harness);
|
|
492148
|
+
if (epoch !== this.epoch || broker === void 0) return "disabled";
|
|
492149
|
+
const state = new CustomerMistakeClientState(broker);
|
|
492150
|
+
this.state = state;
|
|
492151
|
+
const result = await state.prepareHeadless();
|
|
492152
|
+
return epoch === this.epoch ? result : "disabled";
|
|
492153
|
+
}
|
|
492154
|
+
async disable() {
|
|
492155
|
+
if (this.state === void 0) return;
|
|
492156
|
+
await this.state.disable();
|
|
492157
|
+
}
|
|
492158
|
+
reset() {
|
|
492159
|
+
this.epoch += 1;
|
|
492160
|
+
this.state?.reset();
|
|
492161
|
+
this.state = void 0;
|
|
492162
|
+
}
|
|
492163
|
+
async createBroker(harness) {
|
|
492164
|
+
try {
|
|
492165
|
+
return await createCustomerMistakeBrokerClient(harness);
|
|
492166
|
+
} catch {
|
|
492167
|
+
return;
|
|
492168
|
+
}
|
|
492169
|
+
}
|
|
492170
|
+
};
|
|
492171
|
+
//#endregion
|
|
491701
492172
|
//#region src/native/native-require.ts
|
|
491702
492173
|
function createNativePackageRequire(packageName, options = {}) {
|
|
491703
492174
|
if (getNativePackageRoot(packageName, options) === null) return null;
|
|
@@ -499065,7 +499536,11 @@ var PersonalMemoryController = class {
|
|
|
499065
499536
|
host: this.host,
|
|
499066
499537
|
consentStatus: preparation.consentStatus,
|
|
499067
499538
|
copy: startupPersonalMemoryConsentCopy(),
|
|
499068
|
-
updateSettings: (patch) =>
|
|
499539
|
+
updateSettings: async (patch) => {
|
|
499540
|
+
if (typeof patch.memory_enabled !== "boolean") throw new Error("Personal memory consent requires an explicit decision.");
|
|
499541
|
+
await client.putConsent(patch.memory_enabled);
|
|
499542
|
+
await client.updateSettings(patch);
|
|
499543
|
+
}
|
|
499069
499544
|
});
|
|
499070
499545
|
if (!this.isCurrent(generation, session)) {
|
|
499071
499546
|
resetPersonalMemorySession();
|
|
@@ -503853,6 +504328,7 @@ var FooterComponent = class {
|
|
|
503853
504328
|
const key = this.backgroundAgentCount === 1 ? "footer.backgroundAgent.one" : "footer.backgroundAgent.other";
|
|
503854
504329
|
left.push(chalk.hex(colors.primary)(uiText(key, { count: this.backgroundAgentCount })));
|
|
503855
504330
|
}
|
|
504331
|
+
const priorityLeftLine = left.join(" ");
|
|
503856
504332
|
const cwd = shortenCwd(state.workDir);
|
|
503857
504333
|
if (cwd) left.push(chalk.hex(colors.textDim)(cwd));
|
|
503858
504334
|
const git = this.gitCache.getStatus();
|
|
@@ -503868,7 +504344,8 @@ var FooterComponent = class {
|
|
|
503868
504344
|
const pad = width - leftWidth - rightWidth;
|
|
503869
504345
|
line1 = leftLine + " ".repeat(Math.max(0, pad)) + right;
|
|
503870
504346
|
} else {
|
|
503871
|
-
const
|
|
504347
|
+
const availLeft = Math.max(0, width - rightWidth - 2);
|
|
504348
|
+
const shownLeft = truncateToWidth(visibleWidth(priorityLeftLine) <= availLeft ? priorityLeftLine : leftLine, availLeft, "…");
|
|
503872
504349
|
const pad = Math.max(0, width - visibleWidth(shownLeft) - rightWidth);
|
|
503873
504350
|
line1 = shownLeft + " ".repeat(pad) + right;
|
|
503874
504351
|
}
|
|
@@ -506282,6 +506759,101 @@ var TasksBrowserController = class {
|
|
|
506282
506759
|
}
|
|
506283
506760
|
};
|
|
506284
506761
|
//#endregion
|
|
506762
|
+
//#region src/tui/startup/customer-mistake-consent.copy.ts
|
|
506763
|
+
registerUiCatalogFragment({
|
|
506764
|
+
en: {
|
|
506765
|
+
"startupCustomerMistake.title": "Improve BLUN from mistakes",
|
|
506766
|
+
"startupCustomerMistake.details": "Share only sanitized, general mistake patterns with BLUN. File paths, credentials, personal data, chat text, and code are not uploaded. This stays off until you enable it.",
|
|
506767
|
+
"startupCustomerMistake.enable": "Share sanitized patterns",
|
|
506768
|
+
"startupCustomerMistake.decline": "Do not share",
|
|
506769
|
+
"startupCustomerMistake.persistenceFailed": "Your choice could not be saved. Sharing remains off."
|
|
506770
|
+
},
|
|
506771
|
+
de: {
|
|
506772
|
+
"startupCustomerMistake.title": "BLUN aus Fehlern verbessern",
|
|
506773
|
+
"startupCustomerMistake.details": "Teile ausschließlich bereinigte, allgemeine Fehlermuster mit BLUN. Dateipfade, Zugangsdaten, personenbezogene Daten, Chattexte und Code werden nicht hochgeladen. Die Funktion bleibt deaktiviert, bis du sie einschaltest.",
|
|
506774
|
+
"startupCustomerMistake.enable": "Bereinigte Muster teilen",
|
|
506775
|
+
"startupCustomerMistake.decline": "Nicht teilen",
|
|
506776
|
+
"startupCustomerMistake.persistenceFailed": "Deine Auswahl konnte nicht gespeichert werden. Das Teilen bleibt deaktiviert."
|
|
506777
|
+
},
|
|
506778
|
+
es: {
|
|
506779
|
+
"startupCustomerMistake.title": "Mejorar BLUN a partir de los errores",
|
|
506780
|
+
"startupCustomerMistake.details": "Comparte con BLUN únicamente patrones generales de errores que hayan sido depurados. No se suben rutas de archivos, credenciales, datos personales, textos de chats ni código. Esta función permanece desactivada hasta que la actives.",
|
|
506781
|
+
"startupCustomerMistake.enable": "Compartir patrones depurados",
|
|
506782
|
+
"startupCustomerMistake.decline": "No compartir",
|
|
506783
|
+
"startupCustomerMistake.persistenceFailed": "No se pudo guardar tu elección. El uso compartido permanece desactivado."
|
|
506784
|
+
},
|
|
506785
|
+
fr: {
|
|
506786
|
+
"startupCustomerMistake.title": "Améliorer BLUN à partir des erreurs",
|
|
506787
|
+
"startupCustomerMistake.details": "Partagez avec BLUN uniquement des schémas d’erreurs généraux et nettoyés. Les chemins de fichiers, identifiants, données personnelles, textes de discussion et extraits de code ne sont pas envoyés. Cette fonction reste désactivée tant que vous ne l’activez pas.",
|
|
506788
|
+
"startupCustomerMistake.enable": "Partager les schémas nettoyés",
|
|
506789
|
+
"startupCustomerMistake.decline": "Ne pas partager",
|
|
506790
|
+
"startupCustomerMistake.persistenceFailed": "Votre choix n’a pas pu être enregistré. Le partage reste désactivé."
|
|
506791
|
+
},
|
|
506792
|
+
sv: {
|
|
506793
|
+
"startupCustomerMistake.title": "Förbättra BLUN med hjälp av misstag",
|
|
506794
|
+
"startupCustomerMistake.details": "Dela endast sanerade, allmänna felmönster med BLUN. Filsökvägar, inloggningsuppgifter, personuppgifter, chattmeddelanden och kod laddas inte upp. Funktionen är avstängd tills du aktiverar den.",
|
|
506795
|
+
"startupCustomerMistake.enable": "Dela sanerade mönster",
|
|
506796
|
+
"startupCustomerMistake.decline": "Dela inte",
|
|
506797
|
+
"startupCustomerMistake.persistenceFailed": "Ditt val kunde inte sparas. Delning förblir avstängd."
|
|
506798
|
+
},
|
|
506799
|
+
cs: {
|
|
506800
|
+
"startupCustomerMistake.title": "Zlepšování BLUN na základě chyb",
|
|
506801
|
+
"startupCustomerMistake.details": "Sdílejte s BLUN pouze očištěné obecné vzorce chyb. Cesty k souborům, přihlašovací údaje, osobní údaje, texty konverzací ani kód se neodesílají. Funkce zůstane vypnutá, dokud ji nezapnete.",
|
|
506802
|
+
"startupCustomerMistake.enable": "Sdílet očištěné vzorce",
|
|
506803
|
+
"startupCustomerMistake.decline": "Nesdílet",
|
|
506804
|
+
"startupCustomerMistake.persistenceFailed": "Vaši volbu se nepodařilo uložit. Sdílení zůstává vypnuté."
|
|
506805
|
+
}
|
|
506806
|
+
});
|
|
506807
|
+
//#endregion
|
|
506808
|
+
//#region src/tui/startup/customer-mistake-consent.ts
|
|
506809
|
+
function startupCustomerMistakeConsentCopy() {
|
|
506810
|
+
return {
|
|
506811
|
+
title: uiText("startupCustomerMistake.title"),
|
|
506812
|
+
details: uiText("startupCustomerMistake.details"),
|
|
506813
|
+
enable: uiText("startupCustomerMistake.enable"),
|
|
506814
|
+
decline: uiText("startupCustomerMistake.decline"),
|
|
506815
|
+
persistenceFailed: uiText("startupCustomerMistake.persistenceFailed")
|
|
506816
|
+
};
|
|
506817
|
+
}
|
|
506818
|
+
function showStartupCustomerMistakePersistenceFailure(host, copy) {
|
|
506819
|
+
host.showWarning(copy.persistenceFailed);
|
|
506820
|
+
}
|
|
506821
|
+
function promptStartupCustomerMistakeConsent(host, copy) {
|
|
506822
|
+
return new Promise((resolve) => {
|
|
506823
|
+
let settled = false;
|
|
506824
|
+
const finish = (choice) => {
|
|
506825
|
+
if (settled) return;
|
|
506826
|
+
settled = true;
|
|
506827
|
+
host.dismissEditorReplacement();
|
|
506828
|
+
resolve(choice);
|
|
506829
|
+
};
|
|
506830
|
+
host.mountEditorReplacement(new ChoicePickerComponent({
|
|
506831
|
+
title: copy.title,
|
|
506832
|
+
currentValue: "disabled",
|
|
506833
|
+
options: [{
|
|
506834
|
+
value: "disabled",
|
|
506835
|
+
label: copy.decline
|
|
506836
|
+
}, {
|
|
506837
|
+
value: "share_sanitized",
|
|
506838
|
+
label: copy.enable,
|
|
506839
|
+
description: copy.details
|
|
506840
|
+
}],
|
|
506841
|
+
onSelect: (value) => {
|
|
506842
|
+
finish(value === "share_sanitized" ? "share_sanitized" : "disabled");
|
|
506843
|
+
},
|
|
506844
|
+
onCancel: () => {
|
|
506845
|
+
finish("cancelled");
|
|
506846
|
+
},
|
|
506847
|
+
onCtrlC: () => {
|
|
506848
|
+
finish("exit");
|
|
506849
|
+
},
|
|
506850
|
+
onCtrlD: () => {
|
|
506851
|
+
finish("exit");
|
|
506852
|
+
}
|
|
506853
|
+
}));
|
|
506854
|
+
});
|
|
506855
|
+
}
|
|
506856
|
+
//#endregion
|
|
506285
506857
|
//#region src/tui/reverse-rpc/base-controller.ts
|
|
506286
506858
|
var ReverseRpcController = class {
|
|
506287
506859
|
uiHooks = null;
|
|
@@ -509168,11 +509740,10 @@ var BlunTUI = class {
|
|
|
509168
509740
|
editorKeyboard;
|
|
509169
509741
|
scrollbackController;
|
|
509170
509742
|
personalMemoryController;
|
|
509171
|
-
|
|
509172
|
-
accountMemoryEnabledForSession = false;
|
|
509173
|
-
pendingAccountMemoryExtractions = /* @__PURE__ */ new Set();
|
|
509743
|
+
customerMistakeController;
|
|
509174
509744
|
managedQuotaWarningController;
|
|
509175
509745
|
managedQuotaWarningPersistence = Promise.resolve();
|
|
509746
|
+
footerMounted = false;
|
|
509176
509747
|
/** Timer that auto-clears the one-shot "moved to background" footer hint. */
|
|
509177
509748
|
detachHintClearTimer;
|
|
509178
509749
|
telegramChannel;
|
|
@@ -509188,7 +509759,6 @@ var BlunTUI = class {
|
|
|
509188
509759
|
}
|
|
509189
509760
|
constructor(harness, startupInput) {
|
|
509190
509761
|
this.harness = harness;
|
|
509191
|
-
this.accountMemory = createAccountMemoryClient(harness.auth);
|
|
509192
509762
|
const initialAppState = createInitialAppState(startupInput);
|
|
509193
509763
|
setCurrentUiLocale(initialAppState.uiLocale);
|
|
509194
509764
|
const invalidAppearance = initialAppState.appearance !== void 0 && !validateAppearance(currentTheme.palette, initialAppState.appearance).valid;
|
|
@@ -509242,6 +509812,7 @@ var BlunTUI = class {
|
|
|
509242
509812
|
this.streamingUI = new StreamingUIController(this);
|
|
509243
509813
|
this.authFlow = new AuthFlowController(this);
|
|
509244
509814
|
this.personalMemoryController = new PersonalMemoryController(this);
|
|
509815
|
+
this.customerMistakeController = new CustomerMistakeHostController();
|
|
509245
509816
|
this.btwPanelController = new BtwPanelController(this);
|
|
509246
509817
|
this.sessionEventHandler = new SessionEventHandler(this);
|
|
509247
509818
|
this.sessionReplay = new SessionReplayRenderer(this);
|
|
@@ -509439,6 +510010,13 @@ var BlunTUI = class {
|
|
|
509439
510010
|
}), "warning");
|
|
509440
510011
|
} catch {}
|
|
509441
510012
|
}
|
|
510013
|
+
async refreshProviderModelsBeforeSession() {
|
|
510014
|
+
if ((await this.harness.getConfig()).models?.["blun/king"] === void 0) {
|
|
510015
|
+
await this.refreshProviderModelsInBackground();
|
|
510016
|
+
return;
|
|
510017
|
+
}
|
|
510018
|
+
this.refreshProviderModelsInBackground();
|
|
510019
|
+
}
|
|
509442
510020
|
async finishStartup(shouldReplayHistory) {
|
|
509443
510021
|
while (!this.aborted) {
|
|
509444
510022
|
await this.flushStartupNotice();
|
|
@@ -509477,6 +510055,7 @@ var BlunTUI = class {
|
|
|
509477
510055
|
if (this.session === void 0 && this.state.startupState !== "picker") return;
|
|
509478
510056
|
if (this.session !== void 0) {
|
|
509479
510057
|
await this.refreshPersonalMemory(true);
|
|
510058
|
+
await this.refreshCustomerMistakeConsent();
|
|
509480
510059
|
await this.authFlow.refreshManagedQuotaWindows();
|
|
509481
510060
|
}
|
|
509482
510061
|
this.showTmuxKeyboardWarningIfNeeded();
|
|
@@ -509540,7 +510119,7 @@ var BlunTUI = class {
|
|
|
509540
510119
|
return false;
|
|
509541
510120
|
}
|
|
509542
510121
|
if (this.startupWorkspaceSelectionPending) return false;
|
|
509543
|
-
this.
|
|
510122
|
+
await this.refreshProviderModelsBeforeSession();
|
|
509544
510123
|
const { startup } = this.options;
|
|
509545
510124
|
const { workDir } = this.state.appState;
|
|
509546
510125
|
let session;
|
|
@@ -509647,7 +510226,6 @@ var BlunTUI = class {
|
|
|
509647
510226
|
this.channelQueueDeadline?.dispose();
|
|
509648
510227
|
await this.telegramChannel?.stop();
|
|
509649
510228
|
this.telegramChannel = void 0;
|
|
509650
|
-
await Promise.allSettled(this.pendingAccountMemoryExtractions);
|
|
509651
510229
|
this.streamingUI.discardPending();
|
|
509652
510230
|
this.tasksBrowserController.close();
|
|
509653
510231
|
this.btwPanelController.clear();
|
|
@@ -509753,9 +510331,11 @@ var BlunTUI = class {
|
|
|
509753
510331
|
}
|
|
509754
510332
|
}
|
|
509755
510333
|
mountFooter() {
|
|
510334
|
+
if (this.footerMounted) return;
|
|
509756
510335
|
const footerWrap = new GutterContainer(1, 1);
|
|
509757
510336
|
footerWrap.addChild(this.state.footer);
|
|
509758
510337
|
this.state.ui.addChild(footerWrap);
|
|
510338
|
+
this.footerMounted = true;
|
|
509759
510339
|
}
|
|
509760
510340
|
handlePlanToggle(next) {
|
|
509761
510341
|
handlePlanCommand(this, next ? "on" : "off");
|
|
@@ -510155,9 +510735,7 @@ var BlunTUI = class {
|
|
|
510155
510735
|
type: "text",
|
|
510156
510736
|
text: modelInput
|
|
510157
510737
|
}, imagePart] : modelInput;
|
|
510158
|
-
session.promptAccepted(promptInput).
|
|
510159
|
-
if (result.accepted) this.extractAccountMemory(displayText);
|
|
510160
|
-
}).catch((error) => {
|
|
510738
|
+
session.promptAccepted(promptInput).catch((error) => {
|
|
510161
510739
|
this.failSessionRequest(uiText("blunTui.session.sendFailed", { error: formatErrorMessage$2(error) }));
|
|
510162
510740
|
});
|
|
510163
510741
|
this.updateQueueDisplay();
|
|
@@ -510368,9 +510946,7 @@ var BlunTUI = class {
|
|
|
510368
510946
|
model: BLUN_KING_MODEL_ALIAS,
|
|
510369
510947
|
modelFallbackAllowed: false
|
|
510370
510948
|
});
|
|
510371
|
-
session.promptAccepted(sdkInput).
|
|
510372
|
-
if (result.accepted) this.extractAccountMemory(input);
|
|
510373
|
-
}).catch((error) => {
|
|
510949
|
+
session.promptAccepted(sdkInput).catch((error) => {
|
|
510374
510950
|
finishPersonalMemoryRememberIntentTurn(session.id);
|
|
510375
510951
|
const message = formatErrorMessage$2(error);
|
|
510376
510952
|
this.failSessionRequest(uiText("blunTui.session.sendFailed", { error: message }));
|
|
@@ -510420,9 +510996,7 @@ var BlunTUI = class {
|
|
|
510420
510996
|
content: part
|
|
510421
510997
|
});
|
|
510422
510998
|
const text = input.join("\n\n");
|
|
510423
|
-
session.steer(text).
|
|
510424
|
-
this.extractAccountMemory(text);
|
|
510425
|
-
}).catch((error) => {
|
|
510999
|
+
session.steer(text).catch((error) => {
|
|
510426
511000
|
const message = formatErrorMessage$2(error);
|
|
510427
511001
|
this.showError(uiText("blunTui.steer.failed", { error: message }));
|
|
510428
511002
|
});
|
|
@@ -510512,51 +511086,23 @@ var BlunTUI = class {
|
|
|
510512
511086
|
this.authFlow.refreshManagedQuotaWindows();
|
|
510513
511087
|
}
|
|
510514
511088
|
async refreshPersonalMemory(promptIfNeverAsked = false) {
|
|
510515
|
-
|
|
510516
|
-
if (session === void 0) return;
|
|
510517
|
-
this.accountMemoryEnabledForSession = false;
|
|
510518
|
-
try {
|
|
510519
|
-
let consentStatus = await this.accountMemory.getConsentStatus();
|
|
510520
|
-
if (consentStatus === "never_asked" && promptIfNeverAsked) {
|
|
510521
|
-
const consent = await ensureStartupPersonalMemoryConsent({
|
|
510522
|
-
host: this,
|
|
510523
|
-
consentStatus,
|
|
510524
|
-
copy: startupPersonalMemoryConsentCopy(),
|
|
510525
|
-
updateSettings: async (patch) => {
|
|
510526
|
-
await this.accountMemory.setConsent(patch.memory_enabled === true);
|
|
510527
|
-
}
|
|
510528
|
-
});
|
|
510529
|
-
if (consent === "persistence-failed") this.showStatus(startupPersonalMemoryConsentCopy().persistenceFailed, "warning");
|
|
510530
|
-
consentStatus = consent === "enabled" || consent === "disabled" ? consent : "never_asked";
|
|
510531
|
-
}
|
|
510532
|
-
this.accountMemoryEnabledForSession = consentStatus === "enabled";
|
|
510533
|
-
} catch (error) {
|
|
510534
|
-
this.reportAccountMemoryIssue("Account memory consent unavailable", error);
|
|
510535
|
-
}
|
|
510536
|
-
await this.applyAccountMemoryContext(session);
|
|
511089
|
+
await this.personalMemoryController.refresh({ promptIfNeverAsked });
|
|
510537
511090
|
}
|
|
510538
|
-
async
|
|
510539
|
-
|
|
510540
|
-
|
|
510541
|
-
|
|
510542
|
-
|
|
510543
|
-
|
|
510544
|
-
|
|
510545
|
-
|
|
510546
|
-
|
|
510547
|
-
|
|
510548
|
-
|
|
510549
|
-
|
|
510550
|
-
|
|
510551
|
-
|
|
510552
|
-
pending = this.accountMemory.extract(text).catch((error) => {
|
|
510553
|
-
this.reportAccountMemoryIssue("Account memory update failed", error);
|
|
510554
|
-
}).finally(() => {
|
|
510555
|
-
this.pendingAccountMemoryExtractions.delete(pending);
|
|
510556
|
-
});
|
|
510557
|
-
this.pendingAccountMemoryExtractions.add(pending);
|
|
511091
|
+
async refreshCustomerMistakeConsent() {
|
|
511092
|
+
const copy = startupCustomerMistakeConsentCopy();
|
|
511093
|
+
const host = {
|
|
511094
|
+
mountEditorReplacement: (panel) => {
|
|
511095
|
+
this.mountEditorReplacement(panel);
|
|
511096
|
+
},
|
|
511097
|
+
dismissEditorReplacement: () => {
|
|
511098
|
+
this.dismissEditorReplacement();
|
|
511099
|
+
},
|
|
511100
|
+
showWarning: (message) => {
|
|
511101
|
+
this.showStatus(message, "warning");
|
|
511102
|
+
}
|
|
511103
|
+
};
|
|
511104
|
+
await this.customerMistakeController.prepareInteractive(this.harness, () => promptStartupCustomerMistakeConsent(host, copy), () => showStartupCustomerMistakePersistenceFailure(host, copy));
|
|
510558
511105
|
}
|
|
510559
|
-
reportAccountMemoryIssue(_label, _error) {}
|
|
510560
511106
|
patchLivePane(patch) {
|
|
510561
511107
|
if (!hasPatchChanges(this.state.livePane, patch)) return;
|
|
510562
511108
|
Object.assign(this.state.livePane, patch);
|
|
@@ -510607,7 +511153,7 @@ var BlunTUI = class {
|
|
|
510607
511153
|
this.registerSessionHandlers(session);
|
|
510608
511154
|
this.syncAdditionalDirs(session);
|
|
510609
511155
|
await this.authFlow.applyManagedAccountContextToSession();
|
|
510610
|
-
await this.
|
|
511156
|
+
await this.personalMemoryController.refresh();
|
|
510611
511157
|
}
|
|
510612
511158
|
async syncRuntimeState(session = this.requireSession()) {
|
|
510613
511159
|
const [status, goalResult] = await Promise.all([session.getStatus(), session.getGoal()]);
|
|
@@ -510816,7 +511362,7 @@ var BlunTUI = class {
|
|
|
510816
511362
|
this.session = session;
|
|
510817
511363
|
this.harness.setTelemetryContext({ sessionId: session.id });
|
|
510818
511364
|
this.registerSessionHandlers(session);
|
|
510819
|
-
await this.
|
|
511365
|
+
await this.personalMemoryController.refresh();
|
|
510820
511366
|
await this.syncRuntimeState(session);
|
|
510821
511367
|
this.updateTerminalTitle();
|
|
510822
511368
|
try {
|
|
@@ -511703,6 +512249,7 @@ var BlunTUI = class {
|
|
|
511703
512249
|
this.hideSessionPicker();
|
|
511704
512250
|
if (applyStartupModes) {
|
|
511705
512251
|
await this.refreshPersonalMemory(true);
|
|
512252
|
+
await this.refreshCustomerMistakeConsent();
|
|
511706
512253
|
await this.authFlow.refreshManagedQuotaWindows();
|
|
511707
512254
|
await this.promptStartupResumeGoalIfNeeded();
|
|
511708
512255
|
}
|