blun-king-cli 9.1.24 → 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/blun.mjs +698 -248
- package/package.json +1 -1
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();
|
|
@@ -292370,7 +292377,7 @@ var init_proxy = __esmMin((() => {
|
|
|
292370
292377
|
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
292371
292378
|
module.exports = isexe;
|
|
292372
292379
|
isexe.sync = sync;
|
|
292373
|
-
var fs$
|
|
292380
|
+
var fs$9 = __require("fs");
|
|
292374
292381
|
function checkPathExt(path, options) {
|
|
292375
292382
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
292376
292383
|
if (!pathext) return true;
|
|
@@ -292387,12 +292394,12 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
292387
292394
|
return checkPathExt(path, options);
|
|
292388
292395
|
}
|
|
292389
292396
|
function isexe(path, options, cb) {
|
|
292390
|
-
fs$
|
|
292397
|
+
fs$9.stat(path, function(er, stat) {
|
|
292391
292398
|
cb(er, er ? false : checkStat(stat, path, options));
|
|
292392
292399
|
});
|
|
292393
292400
|
}
|
|
292394
292401
|
function sync(path, options) {
|
|
292395
|
-
return checkStat(fs$
|
|
292402
|
+
return checkStat(fs$9.statSync(path), path, options);
|
|
292396
292403
|
}
|
|
292397
292404
|
}));
|
|
292398
292405
|
//#endregion
|
|
@@ -292400,14 +292407,14 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
292400
292407
|
var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
292401
292408
|
module.exports = isexe;
|
|
292402
292409
|
isexe.sync = sync;
|
|
292403
|
-
var fs$
|
|
292410
|
+
var fs$8 = __require("fs");
|
|
292404
292411
|
function isexe(path, options, cb) {
|
|
292405
|
-
fs$
|
|
292412
|
+
fs$8.stat(path, function(er, stat) {
|
|
292406
292413
|
cb(er, er ? false : checkStat(stat, options));
|
|
292407
292414
|
});
|
|
292408
292415
|
}
|
|
292409
292416
|
function sync(path, options) {
|
|
292410
|
-
return checkStat(fs$
|
|
292417
|
+
return checkStat(fs$8.statSync(path), options);
|
|
292411
292418
|
}
|
|
292412
292419
|
function checkStat(stat, options) {
|
|
292413
292420
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -292622,16 +292629,16 @@ var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
292622
292629
|
//#endregion
|
|
292623
292630
|
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
|
|
292624
292631
|
var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
292625
|
-
const fs$
|
|
292632
|
+
const fs$7 = __require("fs");
|
|
292626
292633
|
const shebangCommand = require_shebang_command();
|
|
292627
292634
|
function readShebang(command) {
|
|
292628
292635
|
const size = 150;
|
|
292629
292636
|
const buffer = Buffer.alloc(size);
|
|
292630
292637
|
let fd;
|
|
292631
292638
|
try {
|
|
292632
|
-
fd = fs$
|
|
292633
|
-
fs$
|
|
292634
|
-
fs$
|
|
292639
|
+
fd = fs$7.openSync(command, "r");
|
|
292640
|
+
fs$7.readSync(fd, buffer, 0, size, 0);
|
|
292641
|
+
fs$7.closeSync(fd);
|
|
292635
292642
|
} catch (e) {}
|
|
292636
292643
|
return shebangCommand(buffer.toString());
|
|
292637
292644
|
}
|
|
@@ -309801,7 +309808,7 @@ var require_dist$5 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
309801
309808
|
//#endregion
|
|
309802
309809
|
//#region ../../node_modules/.pnpm/yazl@3.3.1/node_modules/yazl/index.js
|
|
309803
309810
|
var require_yazl = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
309804
|
-
var fs$
|
|
309811
|
+
var fs$6 = __require("fs");
|
|
309805
309812
|
var Transform$2 = __require("stream").Transform;
|
|
309806
309813
|
var PassThrough$2 = __require("stream").PassThrough;
|
|
309807
309814
|
var zlib$1 = __require("zlib");
|
|
@@ -309830,14 +309837,14 @@ var require_yazl = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
309830
309837
|
if (shouldIgnoreAdding(self)) return;
|
|
309831
309838
|
var entry = new Entry(metadataPath, false, options);
|
|
309832
309839
|
self.entries.push(entry);
|
|
309833
|
-
fs$
|
|
309840
|
+
fs$6.stat(realPath, function(err, stats) {
|
|
309834
309841
|
if (err) return self.emit("error", err);
|
|
309835
309842
|
if (!stats.isFile()) return self.emit("error", /* @__PURE__ */ new Error("not a file: " + realPath));
|
|
309836
309843
|
entry.uncompressedSize = stats.size;
|
|
309837
309844
|
if (options.mtime == null) entry.setLastModDate(stats.mtime);
|
|
309838
309845
|
if (options.mode == null) entry.setFileAttributesMode(stats.mode);
|
|
309839
309846
|
entry.setFileDataPumpFunction(function() {
|
|
309840
|
-
var readStream = fs$
|
|
309847
|
+
var readStream = fs$6.createReadStream(realPath);
|
|
309841
309848
|
entry.state = Entry.FILE_DATA_IN_PROGRESS;
|
|
309842
309849
|
readStream.on("error", function(err) {
|
|
309843
309850
|
self.emit("error", err);
|
|
@@ -311169,10 +311176,10 @@ async function appendForkedMarkers(state) {
|
|
|
311169
311176
|
time: Date.now()
|
|
311170
311177
|
};
|
|
311171
311178
|
const agents = state["agents"];
|
|
311172
|
-
if (!isRecord$
|
|
311179
|
+
if (!isRecord$16(agents)) return;
|
|
311173
311180
|
const paths = /* @__PURE__ */ new Set();
|
|
311174
311181
|
for (const agentMeta of Object.values(agents)) {
|
|
311175
|
-
if (!isRecord$
|
|
311182
|
+
if (!isRecord$16(agentMeta)) continue;
|
|
311176
311183
|
const homedir = agentMeta["homedir"];
|
|
311177
311184
|
if (typeof homedir !== "string") continue;
|
|
311178
311185
|
paths.add(join$4(homedir, "wire.jsonl"));
|
|
@@ -311184,7 +311191,7 @@ async function appendForkedMarkers(state) {
|
|
|
311184
311191
|
}));
|
|
311185
311192
|
}
|
|
311186
311193
|
function customMetadataForFork(value) {
|
|
311187
|
-
if (!isRecord$
|
|
311194
|
+
if (!isRecord$16(value)) return {};
|
|
311188
311195
|
const custom = {};
|
|
311189
311196
|
for (const [key, entry] of Object.entries(value)) {
|
|
311190
311197
|
if (key === "goal" || key === "managedQuotaWarningThreshold") continue;
|
|
@@ -311239,10 +311246,10 @@ function normalizeForkTitle(title, fallback) {
|
|
|
311239
311246
|
return typeof fallback === "string" && fallback.trim().length > 0 ? fallback : "New Session";
|
|
311240
311247
|
}
|
|
311241
311248
|
function rewriteAgentHomedirs(value, sourceDir, targetDir) {
|
|
311242
|
-
if (!isRecord$
|
|
311249
|
+
if (!isRecord$16(value)) return {};
|
|
311243
311250
|
const agents = {};
|
|
311244
311251
|
for (const [agentId, agentMeta] of Object.entries(value)) {
|
|
311245
|
-
if (!isRecord$
|
|
311252
|
+
if (!isRecord$16(agentMeta)) {
|
|
311246
311253
|
agents[agentId] = agentMeta;
|
|
311247
311254
|
continue;
|
|
311248
311255
|
}
|
|
@@ -311260,7 +311267,7 @@ function remapSessionPath(value, sourceDir, targetDir) {
|
|
|
311260
311267
|
if (rel.startsWith("..") || isAbsolute$2(rel)) return value;
|
|
311261
311268
|
return join$4(targetDir, rel);
|
|
311262
311269
|
}
|
|
311263
|
-
function isRecord$
|
|
311270
|
+
function isRecord$16(value) {
|
|
311264
311271
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
311265
311272
|
}
|
|
311266
311273
|
async function statIfExists(path) {
|
|
@@ -311508,7 +311515,7 @@ var init_session_store$1 = __esmMin((() => {
|
|
|
311508
311515
|
} catch (error) {
|
|
311509
311516
|
throw new BlunError(ErrorCodes.SESSION_STATE_NOT_FOUND, `Session "${input.sourceId}" state.json was not found`, { cause: error });
|
|
311510
311517
|
}
|
|
311511
|
-
if (!isRecord$
|
|
311518
|
+
if (!isRecord$16(parsed)) throw new BlunError(ErrorCodes.SESSION_STATE_INVALID, `Session "${input.sourceId}" state.json is invalid`);
|
|
311512
311519
|
const title = normalizeForkTitle(input.title, parsed["title"]);
|
|
311513
311520
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
311514
311521
|
const next = {
|
|
@@ -326416,7 +326423,7 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
326416
326423
|
const EventEmitter$12 = __require("node:events").EventEmitter;
|
|
326417
326424
|
const childProcess = __require("node:child_process");
|
|
326418
326425
|
const path$7 = __require("node:path");
|
|
326419
|
-
const fs$
|
|
326426
|
+
const fs$5 = __require("node:fs");
|
|
326420
326427
|
const process$2 = __require("node:process");
|
|
326421
326428
|
const { Argument, humanReadableArgName } = require_argument();
|
|
326422
326429
|
const { CommanderError } = require_error$2();
|
|
@@ -327299,7 +327306,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
327299
327306
|
* @param {string} subcommandName
|
|
327300
327307
|
*/
|
|
327301
327308
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
327302
|
-
if (fs$
|
|
327309
|
+
if (fs$5.existsSync(executableFile)) return;
|
|
327303
327310
|
const executableMissing = `'${executableFile}' does not exist
|
|
327304
327311
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
327305
327312
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
@@ -327323,9 +327330,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
327323
327330
|
];
|
|
327324
327331
|
function findFile(baseDir, baseName) {
|
|
327325
327332
|
const localBin = path$7.resolve(baseDir, baseName);
|
|
327326
|
-
if (fs$
|
|
327333
|
+
if (fs$5.existsSync(localBin)) return localBin;
|
|
327327
327334
|
if (sourceExt.includes(path$7.extname(baseName))) return void 0;
|
|
327328
|
-
const foundExt = sourceExt.find((ext) => fs$
|
|
327335
|
+
const foundExt = sourceExt.find((ext) => fs$5.existsSync(`${localBin}${ext}`));
|
|
327329
327336
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
327330
327337
|
}
|
|
327331
327338
|
this._checkForMissingMandatoryOptions();
|
|
@@ -327335,7 +327342,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
327335
327342
|
if (this._scriptPath) {
|
|
327336
327343
|
let resolvedScriptPath;
|
|
327337
327344
|
try {
|
|
327338
|
-
resolvedScriptPath = fs$
|
|
327345
|
+
resolvedScriptPath = fs$5.realpathSync(this._scriptPath);
|
|
327339
327346
|
} catch {
|
|
327340
327347
|
resolvedScriptPath = this._scriptPath;
|
|
327341
327348
|
}
|
|
@@ -337013,8 +337020,8 @@ function createAccountMemoryClient(auth, options = {}) {
|
|
|
337013
337020
|
}
|
|
337014
337021
|
function readAccountMemoryConsentStatus(payload) {
|
|
337015
337022
|
const settings = unwrapPayload(payload)?.["settings"];
|
|
337016
|
-
const dataControls = isRecord$
|
|
337017
|
-
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.");
|
|
337018
337025
|
if (dataControls["memory_consent_asked"] !== true) return "never_asked";
|
|
337019
337026
|
if (dataControls["allow_memory"] === true) return "enabled";
|
|
337020
337027
|
if (dataControls["allow_memory"] === false) return "disabled";
|
|
@@ -337137,8 +337144,8 @@ function memoryContextSummary(facts, included) {
|
|
|
337137
337144
|
})}`;
|
|
337138
337145
|
}
|
|
337139
337146
|
function unwrapPayload(value) {
|
|
337140
|
-
if (!isRecord$
|
|
337141
|
-
return isRecord$
|
|
337147
|
+
if (!isRecord$15(value)) return void 0;
|
|
337148
|
+
return isRecord$15(value["data"]) ? value["data"] : value;
|
|
337142
337149
|
}
|
|
337143
337150
|
function readFacts(root) {
|
|
337144
337151
|
let rawFacts = [];
|
|
@@ -337146,7 +337153,7 @@ function readFacts(root) {
|
|
|
337146
337153
|
else {
|
|
337147
337154
|
const factsJson = parseFactsJson(root["facts_json"]);
|
|
337148
337155
|
if (Array.isArray(factsJson)) rawFacts = factsJson;
|
|
337149
|
-
else if (isRecord$
|
|
337156
|
+
else if (isRecord$15(factsJson) && Array.isArray(factsJson["facts"])) rawFacts = factsJson["facts"];
|
|
337150
337157
|
}
|
|
337151
337158
|
const facts = [];
|
|
337152
337159
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -337175,7 +337182,7 @@ function parseFactsJson(value) {
|
|
|
337175
337182
|
}
|
|
337176
337183
|
}
|
|
337177
337184
|
function normalizeFact(value) {
|
|
337178
|
-
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;
|
|
337179
337186
|
if (raw === void 0) return void 0;
|
|
337180
337187
|
const normalized = raw.replaceAll(/\s+/gu, " ").trim();
|
|
337181
337188
|
if (normalized.length === 0) return void 0;
|
|
@@ -337184,7 +337191,7 @@ function normalizeFact(value) {
|
|
|
337184
337191
|
truncated: normalized.length > ACCOUNT_MEMORY_MAX_FACT_CHARS
|
|
337185
337192
|
};
|
|
337186
337193
|
}
|
|
337187
|
-
function isRecord$
|
|
337194
|
+
function isRecord$15(value) {
|
|
337188
337195
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
337189
337196
|
}
|
|
337190
337197
|
//#endregion
|
|
@@ -338625,7 +338632,7 @@ function formatErrorMessage$4(error, filePath) {
|
|
|
338625
338632
|
function findValidationIssues(error) {
|
|
338626
338633
|
if (!(error instanceof Error)) return void 0;
|
|
338627
338634
|
const details = "details" in error ? error.details : void 0;
|
|
338628
|
-
if (!isRecord$
|
|
338635
|
+
if (!isRecord$14(details)) return void 0;
|
|
338629
338636
|
const validationIssues = details["validationIssues"];
|
|
338630
338637
|
return isValidationIssueArray(validationIssues) ? validationIssues : void 0;
|
|
338631
338638
|
}
|
|
@@ -338633,11 +338640,11 @@ function isValidationIssueArray(value) {
|
|
|
338633
338640
|
return Array.isArray(value) && value.every(isValidationIssue);
|
|
338634
338641
|
}
|
|
338635
338642
|
function isValidationIssue(value) {
|
|
338636
|
-
if (!isRecord$
|
|
338643
|
+
if (!isRecord$14(value) || typeof value["message"] !== "string") return false;
|
|
338637
338644
|
const path = value["path"];
|
|
338638
338645
|
return Array.isArray(path) && path.every((segment) => typeof segment === "string" || typeof segment === "number");
|
|
338639
338646
|
}
|
|
338640
|
-
function isRecord$
|
|
338647
|
+
function isRecord$14(value) {
|
|
338641
338648
|
return typeof value === "object" && value !== null;
|
|
338642
338649
|
}
|
|
338643
338650
|
function findZodError(error) {
|
|
@@ -339132,7 +339139,7 @@ function assertEntryCount(value) {
|
|
|
339132
339139
|
return value;
|
|
339133
339140
|
}
|
|
339134
339141
|
function parseMistakeRecordDeclarations(value, sourceId, declaredRecordTypes) {
|
|
339135
|
-
if (!isRecord$
|
|
339142
|
+
if (!isRecord$13(value) || !hasOnlyKeys(value, [
|
|
339136
339143
|
"version",
|
|
339137
339144
|
"records",
|
|
339138
339145
|
"relations"
|
|
@@ -339145,7 +339152,7 @@ function parseMistakeRecordDeclarations(value, sourceId, declaredRecordTypes) {
|
|
|
339145
339152
|
return {
|
|
339146
339153
|
version: 1,
|
|
339147
339154
|
records: value["records"].map((candidate, index) => {
|
|
339148
|
-
if (!isRecord$
|
|
339155
|
+
if (!isRecord$13(candidate) || !hasOnlyKeys(candidate, [
|
|
339149
339156
|
"source_record_id",
|
|
339150
339157
|
"type",
|
|
339151
339158
|
"raw_locator"
|
|
@@ -339165,7 +339172,7 @@ function parseMistakeRecordDeclarations(value, sourceId, declaredRecordTypes) {
|
|
|
339165
339172
|
};
|
|
339166
339173
|
}),
|
|
339167
339174
|
relations: value["relations"].map((candidate, index) => {
|
|
339168
|
-
if (!isRecord$
|
|
339175
|
+
if (!isRecord$13(candidate) || !hasOnlyKeys(candidate, [
|
|
339169
339176
|
"from_source_record_id",
|
|
339170
339177
|
"type",
|
|
339171
339178
|
"to"
|
|
@@ -339175,7 +339182,7 @@ function parseMistakeRecordDeclarations(value, sourceId, declaredRecordTypes) {
|
|
|
339175
339182
|
const target = candidate["to"];
|
|
339176
339183
|
if (typeof fromRecordId !== "string" || !isValidRecordId(fromRecordId) || !recordIds.has(fromRecordId)) throw new Error(`record relation ${index} must start at a declared local record`);
|
|
339177
339184
|
if (typeof type !== "string" || !MISTAKE_RELATION_TYPES.includes(type)) throw new Error(`record relation ${index} has an invalid relation type`);
|
|
339178
|
-
if (!isRecord$
|
|
339185
|
+
if (!isRecord$13(target) || !hasOnlyKeys(target, ["source_id", "source_record_id"])) throw new Error(`record relation ${index} has an invalid target`);
|
|
339179
339186
|
const targetSourceId = target["source_id"];
|
|
339180
339187
|
const targetRecordId = target["source_record_id"];
|
|
339181
339188
|
if (typeof targetSourceId !== "string" || !isNormalizedSourceId(targetSourceId)) throw new Error(`record relation ${index} has an invalid target source id`);
|
|
@@ -339445,7 +339452,7 @@ function receiptsEqual(left, right) {
|
|
|
339445
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;
|
|
339446
339453
|
}
|
|
339447
339454
|
function isStateActionReceipt(value) {
|
|
339448
|
-
if (!isRecord$
|
|
339455
|
+
if (!isRecord$13(value) || !hasOnlyKeys(value, STATE_ACTION_KEYS)) return false;
|
|
339449
339456
|
const reason = value["reason"];
|
|
339450
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;
|
|
339451
339458
|
}
|
|
@@ -339548,7 +339555,7 @@ function assertInventoryInvariants(bestandsstatus, aktualitaetsstatus, declaredE
|
|
|
339548
339555
|
if (aktualitaetsstatus === "fresh" && lastRawObservedAt === null) throw new Error("fresh inventory requires a last raw observed timestamp");
|
|
339549
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");
|
|
339550
339557
|
}
|
|
339551
|
-
function isRecord$
|
|
339558
|
+
function isRecord$13(value) {
|
|
339552
339559
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
339553
339560
|
}
|
|
339554
339561
|
function hasOnlyKeys(value, allowedKeys) {
|
|
@@ -340454,6 +340461,9 @@ function resolveDeps(overrides) {
|
|
|
340454
340461
|
};
|
|
340455
340462
|
}
|
|
340456
340463
|
//#endregion
|
|
340464
|
+
//#region src/constant/account-consent.ts
|
|
340465
|
+
const ACCOUNT_CONSENT_PATH = "/api/account/consent";
|
|
340466
|
+
//#endregion
|
|
340457
340467
|
//#region src/personal-memory/phase1-contract.json
|
|
340458
340468
|
var clientOperations = {
|
|
340459
340469
|
"settingsRead": {
|
|
@@ -340509,7 +340519,7 @@ var PersonalMemoryBrokerError = class extends Error {
|
|
|
340509
340519
|
}
|
|
340510
340520
|
};
|
|
340511
340521
|
function parsePersonalMemorySettings(payload) {
|
|
340512
|
-
if (!isRecord$
|
|
340522
|
+
if (!isRecord$12(payload)) return void 0;
|
|
340513
340523
|
const status = payload["status"];
|
|
340514
340524
|
if (status !== "configured" && status !== "never_asked") return void 0;
|
|
340515
340525
|
const memoryEnabled = payload["memory_enabled"];
|
|
@@ -340556,6 +340566,10 @@ var PersonalMemoryBrokerClient = class {
|
|
|
340556
340566
|
async updateSettings(patch) {
|
|
340557
340567
|
await this.request("PUT", PERSONAL_MEMORY_SETTINGS_PATH, patch);
|
|
340558
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
|
+
}
|
|
340559
340573
|
async request(method, path, body) {
|
|
340560
340574
|
if (!isAllowedBrokerRequest(method, path)) throw new PersonalMemoryBrokerError("INVALID_PAYLOAD");
|
|
340561
340575
|
const idempotencyKey = method === "GET" ? void 0 : this.idempotencyKey();
|
|
@@ -340620,15 +340634,15 @@ async function brokerHttpError(response) {
|
|
|
340620
340634
|
async function safeBrokerResponseCode(response) {
|
|
340621
340635
|
try {
|
|
340622
340636
|
const payload = await response.json();
|
|
340623
|
-
if (!isRecord$
|
|
340624
|
-
const nested = isRecord$
|
|
340637
|
+
if (!isRecord$12(payload)) return void 0;
|
|
340638
|
+
const nested = isRecord$12(payload["error"]) ? payload["error"]["code"] : void 0;
|
|
340625
340639
|
const candidate = payload["code"] ?? payload["error_code"] ?? nested;
|
|
340626
340640
|
return typeof candidate === "string" && SAFE_BROKER_ERROR_CODES.has(candidate) ? candidate : void 0;
|
|
340627
340641
|
} catch {
|
|
340628
340642
|
return;
|
|
340629
340643
|
}
|
|
340630
340644
|
}
|
|
340631
|
-
function isRecord$
|
|
340645
|
+
function isRecord$12(value) {
|
|
340632
340646
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
340633
340647
|
}
|
|
340634
340648
|
function isAllowedBrokerRequest(method, path) {
|
|
@@ -340642,6 +340656,7 @@ function isAllowedBrokerRequest(method, path) {
|
|
|
340642
340656
|
if (url.search.length > 0 || url.hash.length > 0) return false;
|
|
340643
340657
|
const pathname = url.pathname;
|
|
340644
340658
|
if (pathname === PERSONAL_MEMORY_SETTINGS_PATH) return method === "GET" || method === "PUT";
|
|
340659
|
+
if (pathname === "/api/account/consent") return method === "POST";
|
|
340645
340660
|
if (pathname === PERSONAL_MEMORY_MEMORIES_PATH) return method === "GET" || method === "POST";
|
|
340646
340661
|
if (/^\/v1\/me\/memories\/[0-9a-f-]{36}$/i.test(pathname)) return false;
|
|
340647
340662
|
if (pathname === PERSONAL_MEMORY_RECALL_PATH) return method === PERSONAL_MEMORY_RECALL_METHOD;
|
|
@@ -341334,7 +341349,7 @@ function createAttestation(value, createdAt) {
|
|
|
341334
341349
|
};
|
|
341335
341350
|
}
|
|
341336
341351
|
function parseProof(value) {
|
|
341337
|
-
if (!isRecord$
|
|
341352
|
+
if (!isRecord$11(value) || value["schema"] !== "blun.proof" || value["schemaVersion"] !== 1) throw new Error("Unsupported proof document.");
|
|
341338
341353
|
assertObjectKeys(value, [
|
|
341339
341354
|
"schema",
|
|
341340
341355
|
"schemaVersion",
|
|
@@ -341354,12 +341369,12 @@ function parseProof(value) {
|
|
|
341354
341369
|
"incomplete",
|
|
341355
341370
|
"failed"
|
|
341356
341371
|
].includes(proof.outcome)) throw new Error("Invalid proof outcome.");
|
|
341357
|
-
if (!isRecord$
|
|
341372
|
+
if (!isRecord$11(proof.source) || proof.source.kind !== "workspace") throw new Error("Invalid proof source.");
|
|
341358
341373
|
assertObjectKeys(proof.source, ["kind"], ["git"], "proof source");
|
|
341359
341374
|
if (proof.source.git !== void 0) validateGitSnapshot(proof.source.git);
|
|
341360
341375
|
if (!Array.isArray(proof.checks) || !Array.isArray(proof.artifacts)) throw new TypeError("Invalid proof collections.");
|
|
341361
341376
|
if (proof.checks.length > MAX_COMMANDS || proof.artifacts.length > MAX_ARTIFACTS) throw new Error("Proof collections exceed their limits.");
|
|
341362
|
-
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.");
|
|
341363
341378
|
assertObjectKeys(proof.attestation, [
|
|
341364
341379
|
"algorithm",
|
|
341365
341380
|
"scope",
|
|
@@ -341374,7 +341389,7 @@ function parseProof(value) {
|
|
|
341374
341389
|
screenshot: 0
|
|
341375
341390
|
};
|
|
341376
341391
|
for (const artifact of proof.artifacts) {
|
|
341377
|
-
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.");
|
|
341378
341393
|
assertObjectKeys(artifact, [
|
|
341379
341394
|
"id",
|
|
341380
341395
|
"kind",
|
|
@@ -341391,14 +341406,14 @@ function parseProof(value) {
|
|
|
341391
341406
|
return proof;
|
|
341392
341407
|
}
|
|
341393
341408
|
function validateGitSnapshot(value) {
|
|
341394
|
-
if (!isRecord$
|
|
341409
|
+
if (!isRecord$11(value)) throw new Error("Invalid proof git snapshot.");
|
|
341395
341410
|
assertObjectKeys(value, ["dirty", "changedCount"], [], "proof git snapshot");
|
|
341396
341411
|
if (typeof value["dirty"] !== "boolean") throw new TypeError("Invalid proof git dirty flag.");
|
|
341397
341412
|
if (typeof value["changedCount"] !== "number" || !Number.isSafeInteger(value["changedCount"]) || value["changedCount"] < 0) throw new Error("Invalid proof git changed count.");
|
|
341398
341413
|
if (value["dirty"] !== value["changedCount"] > 0) throw new Error("Inconsistent proof git state.");
|
|
341399
341414
|
}
|
|
341400
341415
|
function validateProofCheck(value, index) {
|
|
341401
|
-
if (!isRecord$
|
|
341416
|
+
if (!isRecord$11(value)) throw new Error("Invalid proof check.");
|
|
341402
341417
|
assertObjectKeys(value, [
|
|
341403
341418
|
"id",
|
|
341404
341419
|
"outcome",
|
|
@@ -341410,13 +341425,13 @@ function validateProofCheck(value, index) {
|
|
|
341410
341425
|
if (value["outcome"] !== expectedOutcome) throw new Error("Invalid proof check outcome.");
|
|
341411
341426
|
}
|
|
341412
341427
|
function attestedContent(value) {
|
|
341413
|
-
if (!isRecord$
|
|
341428
|
+
if (!isRecord$11(value)) return value;
|
|
341414
341429
|
const { attestation: _attestation, createdAt: _createdAt, ...content } = value;
|
|
341415
341430
|
return content;
|
|
341416
341431
|
}
|
|
341417
341432
|
function canonicalize(value) {
|
|
341418
341433
|
if (Array.isArray(value)) return value.map(canonicalize);
|
|
341419
|
-
if (!isRecord$
|
|
341434
|
+
if (!isRecord$11(value)) return value;
|
|
341420
341435
|
return Object.keys(value).toSorted().reduce((result, key) => {
|
|
341421
341436
|
result[key] = canonicalize(value[key]);
|
|
341422
341437
|
return result;
|
|
@@ -341493,7 +341508,7 @@ function sameFileIdentity$1(left, right) {
|
|
|
341493
341508
|
function sameFileSnapshot(left, right) {
|
|
341494
341509
|
return sameFileIdentity$1(left, right) && left.size === right.size && left.mtimeMs === right.mtimeMs && left.ctimeMs === right.ctimeMs;
|
|
341495
341510
|
}
|
|
341496
|
-
function isRecord$
|
|
341511
|
+
function isRecord$11(value) {
|
|
341497
341512
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
341498
341513
|
}
|
|
341499
341514
|
//#endregion
|
|
@@ -345765,7 +345780,7 @@ var require_atomic_sleep = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
345765
345780
|
//#endregion
|
|
345766
345781
|
//#region ../../node_modules/.pnpm/sonic-boom@4.2.1/node_modules/sonic-boom/index.js
|
|
345767
345782
|
var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
345768
|
-
const fs$
|
|
345783
|
+
const fs$4 = __require("fs");
|
|
345769
345784
|
const EventEmitter$10 = __require("events");
|
|
345770
345785
|
const inherits$6 = __require("util").inherits;
|
|
345771
345786
|
const path$6 = __require("path");
|
|
@@ -345808,17 +345823,17 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
345808
345823
|
const flags = sonic.append ? "a" : "w";
|
|
345809
345824
|
const mode = sonic.mode;
|
|
345810
345825
|
if (sonic.sync) try {
|
|
345811
|
-
if (sonic.mkdir) fs$
|
|
345812
|
-
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));
|
|
345813
345828
|
} catch (err) {
|
|
345814
345829
|
fileOpened(err);
|
|
345815
345830
|
throw err;
|
|
345816
345831
|
}
|
|
345817
|
-
else if (sonic.mkdir) fs$
|
|
345832
|
+
else if (sonic.mkdir) fs$4.mkdir(path$6.dirname(file), { recursive: true }, (err) => {
|
|
345818
345833
|
if (err) return fileOpened(err);
|
|
345819
|
-
fs$
|
|
345834
|
+
fs$4.open(file, flags, mode, fileOpened);
|
|
345820
345835
|
});
|
|
345821
|
-
else fs$
|
|
345836
|
+
else fs$4.open(file, flags, mode, fileOpened);
|
|
345822
345837
|
}
|
|
345823
345838
|
function SonicBoom(opts) {
|
|
345824
345839
|
if (!(this instanceof SonicBoom)) return new SonicBoom(opts);
|
|
@@ -345856,8 +345871,8 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
345856
345871
|
this.flush = flushBuffer;
|
|
345857
345872
|
this.flushSync = flushBufferSync;
|
|
345858
345873
|
this._actualWrite = actualWriteBuffer;
|
|
345859
|
-
fsWriteSync = () => fs$
|
|
345860
|
-
fsWrite = () => fs$
|
|
345874
|
+
fsWriteSync = () => fs$4.writeSync(this.fd, this._writingBuf);
|
|
345875
|
+
fsWrite = () => fs$4.write(this.fd, this._writingBuf, this.release);
|
|
345861
345876
|
} else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
|
|
345862
345877
|
this._writingBuf = "";
|
|
345863
345878
|
this.write = write;
|
|
@@ -345865,12 +345880,12 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
345865
345880
|
this.flushSync = flushSync;
|
|
345866
345881
|
this._actualWrite = actualWrite;
|
|
345867
345882
|
fsWriteSync = () => {
|
|
345868
|
-
if (Buffer.isBuffer(this._writingBuf)) return fs$
|
|
345869
|
-
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");
|
|
345870
345885
|
};
|
|
345871
345886
|
fsWrite = () => {
|
|
345872
|
-
if (Buffer.isBuffer(this._writingBuf)) return fs$
|
|
345873
|
-
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);
|
|
345874
345889
|
};
|
|
345875
345890
|
} else throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
|
|
345876
345891
|
if (typeof fd === "number") {
|
|
@@ -345915,7 +345930,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
345915
345930
|
return;
|
|
345916
345931
|
}
|
|
345917
345932
|
}
|
|
345918
|
-
if (this._fsync) fs$
|
|
345933
|
+
if (this._fsync) fs$4.fsyncSync(this.fd);
|
|
345919
345934
|
const len = this._len;
|
|
345920
345935
|
if (this._reopening) {
|
|
345921
345936
|
this._writing = false;
|
|
@@ -346012,7 +346027,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
346012
346027
|
this._flushPending = true;
|
|
346013
346028
|
const onDrain = () => {
|
|
346014
346029
|
if (!this._fsync) try {
|
|
346015
|
-
fs$
|
|
346030
|
+
fs$4.fsync(this.fd, (err) => {
|
|
346016
346031
|
this._flushPending = false;
|
|
346017
346032
|
cb(err);
|
|
346018
346033
|
});
|
|
@@ -346089,7 +346104,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
346089
346104
|
if (this._writing) return;
|
|
346090
346105
|
const fd = this.fd;
|
|
346091
346106
|
this.once("ready", () => {
|
|
346092
|
-
if (fd !== this.fd) fs$
|
|
346107
|
+
if (fd !== this.fd) fs$4.close(fd, (err) => {
|
|
346093
346108
|
if (err) return this.emit("error", err);
|
|
346094
346109
|
});
|
|
346095
346110
|
});
|
|
@@ -346120,7 +346135,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
346120
346135
|
while (this._bufs.length || buf.length) {
|
|
346121
346136
|
if (buf.length <= 0) buf = this._bufs[0];
|
|
346122
346137
|
try {
|
|
346123
|
-
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");
|
|
346124
346139
|
const releasedBufObj = releaseWritingBuf(buf, this._len, n);
|
|
346125
346140
|
buf = releasedBufObj.writingBuf;
|
|
346126
346141
|
this._len = releasedBufObj.len;
|
|
@@ -346131,7 +346146,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
346131
346146
|
}
|
|
346132
346147
|
}
|
|
346133
346148
|
try {
|
|
346134
|
-
fs$
|
|
346149
|
+
fs$4.fsyncSync(this.fd);
|
|
346135
346150
|
} catch {}
|
|
346136
346151
|
}
|
|
346137
346152
|
function flushBufferSync() {
|
|
@@ -346145,7 +346160,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
346145
346160
|
while (this._bufs.length || buf.length) {
|
|
346146
346161
|
if (buf.length <= 0) buf = mergeBuf(this._bufs[0], this._lens[0]);
|
|
346147
346162
|
try {
|
|
346148
|
-
const n = fs$
|
|
346163
|
+
const n = fs$4.writeSync(this.fd, buf);
|
|
346149
346164
|
buf = buf.subarray(n);
|
|
346150
346165
|
this._len = Math.max(this._len - n, 0);
|
|
346151
346166
|
if (buf.length <= 0) {
|
|
@@ -346167,24 +346182,24 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
346167
346182
|
this._writing = true;
|
|
346168
346183
|
this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
|
|
346169
346184
|
if (this.sync) try {
|
|
346170
|
-
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"));
|
|
346171
346186
|
} catch (err) {
|
|
346172
346187
|
release(err);
|
|
346173
346188
|
}
|
|
346174
|
-
else fs$
|
|
346189
|
+
else fs$4.write(this.fd, this._writingBuf, release);
|
|
346175
346190
|
}
|
|
346176
346191
|
function actualWriteBuffer() {
|
|
346177
346192
|
const release = this.release;
|
|
346178
346193
|
this._writing = true;
|
|
346179
346194
|
this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
|
|
346180
346195
|
if (this.sync) try {
|
|
346181
|
-
release(null, fs$
|
|
346196
|
+
release(null, fs$4.writeSync(this.fd, this._writingBuf));
|
|
346182
346197
|
} catch (err) {
|
|
346183
346198
|
release(err);
|
|
346184
346199
|
}
|
|
346185
346200
|
else {
|
|
346186
346201
|
if (kCopyBuffer) this._writingBuf = Buffer.from(this._writingBuf);
|
|
346187
|
-
fs$
|
|
346202
|
+
fs$4.write(this.fd, this._writingBuf, release);
|
|
346188
346203
|
}
|
|
346189
346204
|
}
|
|
346190
346205
|
function actualClose(sonic) {
|
|
@@ -346198,10 +346213,10 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
346198
346213
|
sonic._lens = [];
|
|
346199
346214
|
assert$8(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
|
|
346200
346215
|
try {
|
|
346201
|
-
fs$
|
|
346216
|
+
fs$4.fsync(sonic.fd, closeWrapped);
|
|
346202
346217
|
} catch {}
|
|
346203
346218
|
function closeWrapped() {
|
|
346204
|
-
if (sonic.fd !== 1 && sonic.fd !== 2) fs$
|
|
346219
|
+
if (sonic.fd !== 1 && sonic.fd !== 2) fs$4.close(sonic.fd, done);
|
|
346205
346220
|
else done();
|
|
346206
346221
|
}
|
|
346207
346222
|
function done(err) {
|
|
@@ -368824,7 +368839,7 @@ var require_constants$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
368824
368839
|
//#endregion
|
|
368825
368840
|
//#region ../../../../node_modules/node-gyp-build/node-gyp-build.js
|
|
368826
368841
|
var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
368827
|
-
var fs$
|
|
368842
|
+
var fs$3 = __require("fs");
|
|
368828
368843
|
var path$5 = __require("path");
|
|
368829
368844
|
var os$3 = __require("os");
|
|
368830
368845
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
@@ -368880,7 +368895,7 @@ var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
368880
368895
|
};
|
|
368881
368896
|
function readdirSync(dir) {
|
|
368882
368897
|
try {
|
|
368883
|
-
return fs$
|
|
368898
|
+
return fs$3.readdirSync(dir);
|
|
368884
368899
|
} catch (err) {
|
|
368885
368900
|
return [];
|
|
368886
368901
|
}
|
|
@@ -368968,7 +368983,7 @@ var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
368968
368983
|
return typeof window !== "undefined" && window.process && window.process.type === "renderer";
|
|
368969
368984
|
}
|
|
368970
368985
|
function isAlpine(platform) {
|
|
368971
|
-
return platform === "linux" && fs$
|
|
368986
|
+
return platform === "linux" && fs$3.existsSync("/etc/alpine-release");
|
|
368972
368987
|
}
|
|
368973
368988
|
load.parseTags = parseTags;
|
|
368974
368989
|
load.matchTags = matchTags;
|
|
@@ -389121,7 +389136,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
389121
389136
|
//#region ../../node_modules/.pnpm/@fastify+swagger@9.7.0/node_modules/@fastify/swagger/lib/mode/static.js
|
|
389122
389137
|
var require_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
389123
389138
|
const path$3 = __require("node:path");
|
|
389124
|
-
const fs$
|
|
389139
|
+
const fs$2 = __require("node:fs");
|
|
389125
389140
|
const yaml = require_dist$1();
|
|
389126
389141
|
module.exports = function(fastify, opts, done) {
|
|
389127
389142
|
if (!opts.specification) return done(/* @__PURE__ */ new Error("specification is missing in the module options"));
|
|
@@ -389130,14 +389145,14 @@ var require_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
389130
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"));
|
|
389131
389146
|
else if (opts.specification.path) {
|
|
389132
389147
|
if (typeof opts.specification.path !== "string") return done(/* @__PURE__ */ new Error("specification.path is not a string"));
|
|
389133
|
-
if (!fs$
|
|
389148
|
+
if (!fs$2.existsSync(path$3.resolve(opts.specification.path))) return done(/* @__PURE__ */ new Error(`${opts.specification.path} does not exist`));
|
|
389134
389149
|
const extName = path$3.extname(opts.specification.path).toLowerCase();
|
|
389135
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']"));
|
|
389136
389151
|
if (opts.specification.postProcessor && typeof opts.specification.postProcessor !== "function") return done(/* @__PURE__ */ new Error("specification.postProcessor should be a function"));
|
|
389137
389152
|
if (opts.specification.baseDir && typeof opts.specification.baseDir !== "string") return done(/* @__PURE__ */ new Error("specification.baseDir should be string"));
|
|
389138
389153
|
if (!opts.specification.baseDir) opts.specification.baseDir = path$3.resolve(path$3.dirname(opts.specification.path));
|
|
389139
389154
|
else while (opts.specification.baseDir.endsWith("/")) opts.specification.baseDir = opts.specification.baseDir.slice(0, -1);
|
|
389140
|
-
const source = fs$
|
|
389155
|
+
const source = fs$2.readFileSync(path$3.resolve(opts.specification.path), "utf8");
|
|
389141
389156
|
switch (extName) {
|
|
389142
389157
|
case ".yaml":
|
|
389143
389158
|
swaggerObject = yaml.parse(source);
|
|
@@ -389404,11 +389419,11 @@ var require_should_route_hide = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
389404
389419
|
//#endregion
|
|
389405
389420
|
//#region ../../node_modules/.pnpm/@fastify+swagger@9.7.0/node_modules/@fastify/swagger/lib/util/read-package-json.js
|
|
389406
389421
|
var require_read_package_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
389407
|
-
const fs = __require("node:fs");
|
|
389422
|
+
const fs$1 = __require("node:fs");
|
|
389408
389423
|
const path$2 = __require("node:path");
|
|
389409
389424
|
function readPackageJson() {
|
|
389410
389425
|
try {
|
|
389411
|
-
return JSON.parse(fs.readFileSync(path$2.join(__dirname, "..", "..", "package.json")));
|
|
389426
|
+
return JSON.parse(fs$1.readFileSync(path$2.join(__dirname, "..", "..", "package.json")));
|
|
389412
389427
|
} catch {
|
|
389413
389428
|
return {};
|
|
389414
389429
|
}
|
|
@@ -396535,12 +396550,12 @@ function legacyStatusToCurrent(task) {
|
|
|
396535
396550
|
return task.status;
|
|
396536
396551
|
}
|
|
396537
396552
|
function isReadablePersistedTask(obj) {
|
|
396538
|
-
return isRecord$
|
|
396553
|
+
return isRecord$10(obj) && (typeof obj["taskId"] === "string" || typeof obj["task_id"] === "string");
|
|
396539
396554
|
}
|
|
396540
396555
|
function isLegacyPersistedTask(task) {
|
|
396541
396556
|
return "task_id" in task;
|
|
396542
396557
|
}
|
|
396543
|
-
function isRecord$
|
|
396558
|
+
function isRecord$10(value) {
|
|
396544
396559
|
return typeof value === "object" && value !== null;
|
|
396545
396560
|
}
|
|
396546
396561
|
function optionalNonEmptyString(value) {
|
|
@@ -396949,11 +396964,11 @@ const WINDOWS_RESERVED_NAMES = new Set([
|
|
|
396949
396964
|
...Array.from({ length: 9 }, (_value, index) => `COM${String(index + 1)}`),
|
|
396950
396965
|
...Array.from({ length: 9 }, (_value, index) => `LPT${String(index + 1)}`)
|
|
396951
396966
|
]);
|
|
396952
|
-
function isRecord$
|
|
396967
|
+
function isRecord$9(value) {
|
|
396953
396968
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
396954
396969
|
}
|
|
396955
396970
|
function assertRecord(value, label) {
|
|
396956
|
-
if (!isRecord$
|
|
396971
|
+
if (!isRecord$9(value)) throw new Error(`${label} must be an object.`);
|
|
396957
396972
|
}
|
|
396958
396973
|
function assertExactKeys(value, required, optional, label) {
|
|
396959
396974
|
const allowed = new Set([...required, ...optional]);
|
|
@@ -397244,7 +397259,7 @@ function currentArtifactRecord(artifacts) {
|
|
|
397244
397259
|
return result;
|
|
397245
397260
|
}
|
|
397246
397261
|
function readAttestationHash(value) {
|
|
397247
|
-
if (!isRecord$
|
|
397262
|
+
if (!isRecord$9(value) || !isRecord$9(value["attestation"])) return null;
|
|
397248
397263
|
const hash = value["attestation"]["hash"];
|
|
397249
397264
|
return typeof hash === "string" && /^[a-f0-9]{64}$/.test(hash) ? hash : null;
|
|
397250
397265
|
}
|
|
@@ -398016,26 +398031,26 @@ async function ensureSafeDirectory(path, create, recursive) {
|
|
|
398016
398031
|
return true;
|
|
398017
398032
|
}
|
|
398018
398033
|
function validateRegistry(value, context) {
|
|
398019
|
-
if (!isRecord$
|
|
398020
|
-
if (!hasExactKeys(value, REGISTRY_KEYS)) throw new WorkspaceError("registry_invalid", "Workspace registry contains unknown fields.");
|
|
398021
|
-
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.");
|
|
398022
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.");
|
|
398023
398038
|
return value;
|
|
398024
398039
|
}
|
|
398025
398040
|
function isWorkspaceRecord(value) {
|
|
398026
|
-
if (!isRecord$
|
|
398041
|
+
if (!isRecord$8(value) || !hasExactKeys$1(value, WORKSPACE_RECORD_KEYS)) return false;
|
|
398027
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"]);
|
|
398028
398043
|
}
|
|
398029
398044
|
function isCanonicalIsoTimestamp(value) {
|
|
398030
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;
|
|
398031
398046
|
return new Date(value).toISOString() === value;
|
|
398032
398047
|
}
|
|
398033
|
-
function isRecord$
|
|
398048
|
+
function isRecord$8(value) {
|
|
398034
398049
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
398035
398050
|
const prototype = Object.getPrototypeOf(value);
|
|
398036
398051
|
return prototype === Object.prototype || prototype === null;
|
|
398037
398052
|
}
|
|
398038
|
-
function hasExactKeys(value, keys) {
|
|
398053
|
+
function hasExactKeys$1(value, keys) {
|
|
398039
398054
|
return Object.keys(value).length === keys.length && keys.every((key) => Object.hasOwn(value, key));
|
|
398040
398055
|
}
|
|
398041
398056
|
async function writeRegistryAtomic(repoStorageRoot, registry) {
|
|
@@ -398121,7 +398136,7 @@ async function readRegistryLockMetadata(lockPath) {
|
|
|
398121
398136
|
if (error.code !== void 0) throw error;
|
|
398122
398137
|
return;
|
|
398123
398138
|
}
|
|
398124
|
-
if (!isRecord$
|
|
398139
|
+
if (!isRecord$8(value) || !hasExactKeys$1(value, [
|
|
398125
398140
|
"version",
|
|
398126
398141
|
"pid",
|
|
398127
398142
|
"createdAt",
|
|
@@ -404358,7 +404373,7 @@ var TUI = class TUI extends Container {
|
|
|
404358
404373
|
if (!debugRedraw) return;
|
|
404359
404374
|
const logPath = path$17.join(nodeOs.homedir(), ".pi", "agent", "pi-debug.log");
|
|
404360
404375
|
const msg = `[${(/* @__PURE__ */ new Date()).toISOString()}] fullRender: ${reason} (prev=${this.previousLines.length}, new=${newLines.length}, height=${height})\n`;
|
|
404361
|
-
fs$
|
|
404376
|
+
fs$17.appendFileSync(logPath, msg);
|
|
404362
404377
|
};
|
|
404363
404378
|
if (this.previousLines.length === 0 && !widthChanged && !heightChanged) {
|
|
404364
404379
|
logRedraw("first render");
|
|
@@ -404505,7 +404520,7 @@ var TUI = class TUI extends Container {
|
|
|
404505
404520
|
buffer += "\x1B[?2026l";
|
|
404506
404521
|
if (process.env["PI_TUI_DEBUG"] === "1") {
|
|
404507
404522
|
const debugDir = "/tmp/tui";
|
|
404508
|
-
fs$
|
|
404523
|
+
fs$17.mkdirSync(debugDir, { recursive: true });
|
|
404509
404524
|
const debugPath = path$17.join(debugDir, `render-${Date.now()}-${Math.random().toString(36).slice(2)}.log`);
|
|
404510
404525
|
const debugData = [
|
|
404511
404526
|
`firstChanged: ${firstChanged}`,
|
|
@@ -404529,7 +404544,7 @@ var TUI = class TUI extends Container {
|
|
|
404529
404544
|
"=== buffer ===",
|
|
404530
404545
|
JSON.stringify(buffer)
|
|
404531
404546
|
].join("\n");
|
|
404532
|
-
fs$
|
|
404547
|
+
fs$17.writeFileSync(debugPath, debugData);
|
|
404533
404548
|
}
|
|
404534
404549
|
this.terminal.write(buffer);
|
|
404535
404550
|
this.cursorRow = Math.max(0, newLines.length - 1);
|
|
@@ -409188,7 +409203,7 @@ var ProcessTerminal = class {
|
|
|
409188
409203
|
const env = process.env["PI_TUI_WRITE_LOG"] || "";
|
|
409189
409204
|
if (!env) return "";
|
|
409190
409205
|
try {
|
|
409191
|
-
if (fs$
|
|
409206
|
+
if (fs$17.statSync(env).isDirectory()) {
|
|
409192
409207
|
const now = /* @__PURE__ */ new Date();
|
|
409193
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")}`;
|
|
409194
409209
|
return path$17.join(env, `tui-${ts}-${process.pid}.log`);
|
|
@@ -409471,7 +409486,7 @@ var ProcessTerminal = class {
|
|
|
409471
409486
|
write(data) {
|
|
409472
409487
|
process.stdout.write(data);
|
|
409473
409488
|
if (this.writeLogPath) try {
|
|
409474
|
-
fs$
|
|
409489
|
+
fs$17.appendFileSync(this.writeLogPath, data, { encoding: "utf8" });
|
|
409475
409490
|
} catch {}
|
|
409476
409491
|
}
|
|
409477
409492
|
get columns() {
|
|
@@ -413799,7 +413814,7 @@ const execFileAsync = promisify(execFile);
|
|
|
413799
413814
|
async function scanCodebase(rootInput, options = {}) {
|
|
413800
413815
|
const root = resolve(rootInput);
|
|
413801
413816
|
const limits = resolveLimits(options.limits);
|
|
413802
|
-
throwIfAborted(options.signal);
|
|
413817
|
+
throwIfAborted$1(options.signal);
|
|
413803
413818
|
const usedGitIgnore = await isInsideGitWorkTree(root);
|
|
413804
413819
|
const collected = usedGitIgnore ? await scanWithGit(root, limits, options.signal) : await scanWithoutFilter(root, limits, options.signal);
|
|
413805
413820
|
const sortedFiles = collected.files.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
@@ -413844,13 +413859,13 @@ async function scanWithGit(root, limits, signal) {
|
|
|
413844
413859
|
maxBuffer: 1024 * 1024 * 64,
|
|
413845
413860
|
signal
|
|
413846
413861
|
});
|
|
413847
|
-
throwIfAborted(signal);
|
|
413862
|
+
throwIfAborted$1(signal);
|
|
413848
413863
|
const relativePaths = splitNull(stdout);
|
|
413849
413864
|
const files = [];
|
|
413850
413865
|
let exceedsLimit;
|
|
413851
413866
|
let totalSize = 0;
|
|
413852
413867
|
for (const relativePath of relativePaths) {
|
|
413853
|
-
throwIfAborted(signal);
|
|
413868
|
+
throwIfAborted$1(signal);
|
|
413854
413869
|
if (files.length >= limits.maxFiles) {
|
|
413855
413870
|
exceedsLimit = {
|
|
413856
413871
|
reason: "file-count",
|
|
@@ -413885,11 +413900,11 @@ async function scanWithoutFilter(root, limits, signal) {
|
|
|
413885
413900
|
let totalSize = 0;
|
|
413886
413901
|
async function walk(dir) {
|
|
413887
413902
|
if (stopped) return;
|
|
413888
|
-
throwIfAborted(signal);
|
|
413903
|
+
throwIfAborted$1(signal);
|
|
413889
413904
|
const entries = await readdir(dir, { withFileTypes: true });
|
|
413890
413905
|
for (const entry of entries) {
|
|
413891
413906
|
if (stopped) return;
|
|
413892
|
-
throwIfAborted(signal);
|
|
413907
|
+
throwIfAborted$1(signal);
|
|
413893
413908
|
if (files.length >= limits.maxFiles) {
|
|
413894
413909
|
exceedsLimit = {
|
|
413895
413910
|
reason: "file-count",
|
|
@@ -413942,7 +413957,7 @@ async function statFile(root, relativePath) {
|
|
|
413942
413957
|
mtimeMs: stat.mtimeMs
|
|
413943
413958
|
};
|
|
413944
413959
|
}
|
|
413945
|
-
function throwIfAborted(signal) {
|
|
413960
|
+
function throwIfAborted$1(signal) {
|
|
413946
413961
|
if (signal?.aborted) {
|
|
413947
413962
|
const error = /* @__PURE__ */ new Error("Codebase scan aborted.");
|
|
413948
413963
|
error.name = "AbortError";
|
|
@@ -417882,14 +417897,14 @@ function findGoalIndex(file, goalId) {
|
|
|
417882
417897
|
return index;
|
|
417883
417898
|
}
|
|
417884
417899
|
function isGoalQueueFile(value) {
|
|
417885
|
-
if (!isRecord$
|
|
417900
|
+
if (!isRecord$7(value)) return false;
|
|
417886
417901
|
return value["version"] === GOAL_QUEUE_VERSION && Array.isArray(value["goals"]) && value["goals"].every(isUpcomingGoal);
|
|
417887
417902
|
}
|
|
417888
417903
|
function isUpcomingGoal(value) {
|
|
417889
|
-
if (!isRecord$
|
|
417904
|
+
if (!isRecord$7(value)) return false;
|
|
417890
417905
|
return isNonEmptyString(value["id"]) && isNonEmptyString(value["objective"]) && isNonEmptyString(value["createdAt"]) && isNonEmptyString(value["updatedAt"]);
|
|
417891
417906
|
}
|
|
417892
|
-
function isRecord$
|
|
417907
|
+
function isRecord$7(value) {
|
|
417893
417908
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
417894
417909
|
}
|
|
417895
417910
|
function isNonEmptyString(value) {
|
|
@@ -417902,7 +417917,7 @@ function timestampAfter(previous) {
|
|
|
417902
417917
|
return now.toISOString();
|
|
417903
417918
|
}
|
|
417904
417919
|
function isErrno(error, code) {
|
|
417905
|
-
return isRecord$
|
|
417920
|
+
return isRecord$7(error) && error["code"] === code;
|
|
417906
417921
|
}
|
|
417907
417922
|
function describeError(error) {
|
|
417908
417923
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -419874,7 +419889,7 @@ function parsePluginMarketplace(raw, location) {
|
|
|
419874
419889
|
} catch (error) {
|
|
419875
419890
|
throw new Error(`Plugin marketplace is not valid JSON: ${formatParseError(error)}`, { cause: error });
|
|
419876
419891
|
}
|
|
419877
|
-
if (!isRecord$
|
|
419892
|
+
if (!isRecord$6(parsed)) throw new TypeError("Plugin marketplace must be an object.");
|
|
419878
419893
|
const rawPlugins = parsed["plugins"];
|
|
419879
419894
|
if (!Array.isArray(rawPlugins)) throw new TypeError("Plugin marketplace must contain a \"plugins\" array.");
|
|
419880
419895
|
return {
|
|
@@ -419918,7 +419933,7 @@ async function readMarketplaceText(location, fetchImpl) {
|
|
|
419918
419933
|
return response.text();
|
|
419919
419934
|
}
|
|
419920
419935
|
function parseMarketplaceEntry(value, index, location) {
|
|
419921
|
-
if (!isRecord$
|
|
419936
|
+
if (!isRecord$6(value)) throw new TypeError(`Plugin marketplace entry ${index + 1} must be an object.`);
|
|
419922
419937
|
const id = requiredString(value, "id", index);
|
|
419923
419938
|
validateMarketplaceEntryType(value, id);
|
|
419924
419939
|
const source = stringField$2(value, "source") ?? stringField$2(value, "url") ?? stringField$2(value, "downloadUrl");
|
|
@@ -420054,7 +420069,7 @@ function stringArrayField(value, field) {
|
|
|
420054
420069
|
const out = raw.filter((item) => typeof item === "string").map((item) => item.trim()).filter((item) => item.length > 0);
|
|
420055
420070
|
return out.length > 0 ? out : void 0;
|
|
420056
420071
|
}
|
|
420057
|
-
function isRecord$
|
|
420072
|
+
function isRecord$6(value) {
|
|
420058
420073
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
420059
420074
|
}
|
|
420060
420075
|
function formatParseError(error) {
|
|
@@ -487941,10 +487956,10 @@ function parseGoalValue(output) {
|
|
|
487941
487956
|
} catch {
|
|
487942
487957
|
return;
|
|
487943
487958
|
}
|
|
487944
|
-
if (!isRecord$
|
|
487959
|
+
if (!isRecord$5(parsed) || !("goal" in parsed)) return void 0;
|
|
487945
487960
|
const goal = parsed["goal"];
|
|
487946
487961
|
if (goal === null) return null;
|
|
487947
|
-
if (!isRecord$
|
|
487962
|
+
if (!isRecord$5(goal)) return void 0;
|
|
487948
487963
|
return goal;
|
|
487949
487964
|
}
|
|
487950
487965
|
function formatGoalStats(goal) {
|
|
@@ -487966,7 +487981,7 @@ function stringArg(args, key) {
|
|
|
487966
487981
|
const value = args[key];
|
|
487967
487982
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
487968
487983
|
}
|
|
487969
|
-
function isRecord$
|
|
487984
|
+
function isRecord$5(value) {
|
|
487970
487985
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
487971
487986
|
}
|
|
487972
487987
|
function stringField$1(record, key) {
|
|
@@ -490832,6 +490847,7 @@ function webSessionUrl(origin, sessionId, token) {
|
|
|
490832
490847
|
function dispatchInput(host, text) {
|
|
490833
490848
|
const parsed = parseSlashInput(text);
|
|
490834
490849
|
if (parsed !== null) {
|
|
490850
|
+
if (parsed.name === "goal" || parsed.name === "loop") return executeSlashCommand(host, text);
|
|
490835
490851
|
const isBusy = host.state.appState.streamingPhase !== "idle" || host.state.appState.isCompacting;
|
|
490836
490852
|
const canRunAlongsideMain = (parsed.name === "btw" || parsed.name === "memory") && !host.state.appState.isCompacting;
|
|
490837
490853
|
if (host.deferUserMessages || isBusy && !canRunAlongsideMain) {
|
|
@@ -491839,6 +491855,320 @@ function formatTurnEndedFailure(event) {
|
|
|
491839
491855
|
return `Prompt turn ended with reason: ${event.reason}`;
|
|
491840
491856
|
}
|
|
491841
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
|
|
491842
492172
|
//#region src/native/native-require.ts
|
|
491843
492173
|
function createNativePackageRequire(packageName, options = {}) {
|
|
491844
492174
|
if (getNativePackageRoot(packageName, options) === null) return null;
|
|
@@ -499206,7 +499536,11 @@ var PersonalMemoryController = class {
|
|
|
499206
499536
|
host: this.host,
|
|
499207
499537
|
consentStatus: preparation.consentStatus,
|
|
499208
499538
|
copy: startupPersonalMemoryConsentCopy(),
|
|
499209
|
-
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
|
+
}
|
|
499210
499544
|
});
|
|
499211
499545
|
if (!this.isCurrent(generation, session)) {
|
|
499212
499546
|
resetPersonalMemorySession();
|
|
@@ -503994,6 +504328,7 @@ var FooterComponent = class {
|
|
|
503994
504328
|
const key = this.backgroundAgentCount === 1 ? "footer.backgroundAgent.one" : "footer.backgroundAgent.other";
|
|
503995
504329
|
left.push(chalk.hex(colors.primary)(uiText(key, { count: this.backgroundAgentCount })));
|
|
503996
504330
|
}
|
|
504331
|
+
const priorityLeftLine = left.join(" ");
|
|
503997
504332
|
const cwd = shortenCwd(state.workDir);
|
|
503998
504333
|
if (cwd) left.push(chalk.hex(colors.textDim)(cwd));
|
|
503999
504334
|
const git = this.gitCache.getStatus();
|
|
@@ -504009,7 +504344,8 @@ var FooterComponent = class {
|
|
|
504009
504344
|
const pad = width - leftWidth - rightWidth;
|
|
504010
504345
|
line1 = leftLine + " ".repeat(Math.max(0, pad)) + right;
|
|
504011
504346
|
} else {
|
|
504012
|
-
const
|
|
504347
|
+
const availLeft = Math.max(0, width - rightWidth - 2);
|
|
504348
|
+
const shownLeft = truncateToWidth(visibleWidth(priorityLeftLine) <= availLeft ? priorityLeftLine : leftLine, availLeft, "…");
|
|
504013
504349
|
const pad = Math.max(0, width - visibleWidth(shownLeft) - rightWidth);
|
|
504014
504350
|
line1 = shownLeft + " ".repeat(pad) + right;
|
|
504015
504351
|
}
|
|
@@ -506423,6 +506759,101 @@ var TasksBrowserController = class {
|
|
|
506423
506759
|
}
|
|
506424
506760
|
};
|
|
506425
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
|
|
506426
506857
|
//#region src/tui/reverse-rpc/base-controller.ts
|
|
506427
506858
|
var ReverseRpcController = class {
|
|
506428
506859
|
uiHooks = null;
|
|
@@ -509309,6 +509740,7 @@ var BlunTUI = class {
|
|
|
509309
509740
|
editorKeyboard;
|
|
509310
509741
|
scrollbackController;
|
|
509311
509742
|
personalMemoryController;
|
|
509743
|
+
customerMistakeController;
|
|
509312
509744
|
managedQuotaWarningController;
|
|
509313
509745
|
managedQuotaWarningPersistence = Promise.resolve();
|
|
509314
509746
|
footerMounted = false;
|
|
@@ -509380,6 +509812,7 @@ var BlunTUI = class {
|
|
|
509380
509812
|
this.streamingUI = new StreamingUIController(this);
|
|
509381
509813
|
this.authFlow = new AuthFlowController(this);
|
|
509382
509814
|
this.personalMemoryController = new PersonalMemoryController(this);
|
|
509815
|
+
this.customerMistakeController = new CustomerMistakeHostController();
|
|
509383
509816
|
this.btwPanelController = new BtwPanelController(this);
|
|
509384
509817
|
this.sessionEventHandler = new SessionEventHandler(this);
|
|
509385
509818
|
this.sessionReplay = new SessionReplayRenderer(this);
|
|
@@ -509622,6 +510055,7 @@ var BlunTUI = class {
|
|
|
509622
510055
|
if (this.session === void 0 && this.state.startupState !== "picker") return;
|
|
509623
510056
|
if (this.session !== void 0) {
|
|
509624
510057
|
await this.refreshPersonalMemory(true);
|
|
510058
|
+
await this.refreshCustomerMistakeConsent();
|
|
509625
510059
|
await this.authFlow.refreshManagedQuotaWindows();
|
|
509626
510060
|
}
|
|
509627
510061
|
this.showTmuxKeyboardWarningIfNeeded();
|
|
@@ -510654,6 +511088,21 @@ var BlunTUI = class {
|
|
|
510654
511088
|
async refreshPersonalMemory(promptIfNeverAsked = false) {
|
|
510655
511089
|
await this.personalMemoryController.refresh({ promptIfNeverAsked });
|
|
510656
511090
|
}
|
|
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));
|
|
511105
|
+
}
|
|
510657
511106
|
patchLivePane(patch) {
|
|
510658
511107
|
if (!hasPatchChanges(this.state.livePane, patch)) return;
|
|
510659
511108
|
Object.assign(this.state.livePane, patch);
|
|
@@ -511800,6 +512249,7 @@ var BlunTUI = class {
|
|
|
511800
512249
|
this.hideSessionPicker();
|
|
511801
512250
|
if (applyStartupModes) {
|
|
511802
512251
|
await this.refreshPersonalMemory(true);
|
|
512252
|
+
await this.refreshCustomerMistakeConsent();
|
|
511803
512253
|
await this.authFlow.refreshManagedQuotaWindows();
|
|
511804
512254
|
await this.promptStartupResumeGoalIfNeeded();
|
|
511805
512255
|
}
|