nairon-bench 0.0.37 → 0.0.40
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/dist/index.js +1562 -1316
- package/package.json +1 -14
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ var __export = (target, all) => {
|
|
|
30
30
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
31
31
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
32
32
|
|
|
33
|
-
// ../../node_modules
|
|
33
|
+
// ../../node_modules/consola/dist/core.mjs
|
|
34
34
|
function isPlainObject$1(value) {
|
|
35
35
|
if (value === null || typeof value !== "object") {
|
|
36
36
|
return false;
|
|
@@ -429,7 +429,7 @@ var init_core = __esm(() => {
|
|
|
429
429
|
Consola.prototype.resume = Consola.prototype.resumeLogs;
|
|
430
430
|
});
|
|
431
431
|
|
|
432
|
-
// ../../node_modules
|
|
432
|
+
// ../../node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
|
|
433
433
|
import { formatWithOptions } from "node:util";
|
|
434
434
|
import { sep } from "node:path";
|
|
435
435
|
function parseStack(stack, message) {
|
|
@@ -507,7 +507,7 @@ ${indent}`);
|
|
|
507
507
|
var bracket = (x) => x ? `[${x}]` : "";
|
|
508
508
|
var init_consola_DRwqZj3T = () => {};
|
|
509
509
|
|
|
510
|
-
// ../../node_modules
|
|
510
|
+
// ../../node_modules/consola/dist/shared/consola.DXBYu-KD.mjs
|
|
511
511
|
import * as tty from "node:tty";
|
|
512
512
|
function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
|
|
513
513
|
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
@@ -723,7 +723,7 @@ var init_consola_DXBYu_KD = __esm(() => {
|
|
|
723
723
|
};
|
|
724
724
|
});
|
|
725
725
|
|
|
726
|
-
// ../../node_modules
|
|
726
|
+
// ../../node_modules/consola/dist/chunks/prompt.mjs
|
|
727
727
|
var exports_prompt = {};
|
|
728
728
|
__export(exports_prompt, {
|
|
729
729
|
prompt: () => prompt,
|
|
@@ -1479,7 +1479,7 @@ var init_prompt = __esm(() => {
|
|
|
1479
1479
|
kCancel = Symbol.for("cancel");
|
|
1480
1480
|
});
|
|
1481
1481
|
|
|
1482
|
-
// ../../node_modules
|
|
1482
|
+
// ../../node_modules/consola/dist/index.mjs
|
|
1483
1483
|
import g$1 from "node:process";
|
|
1484
1484
|
function b() {
|
|
1485
1485
|
if (globalThis.process?.env)
|
|
@@ -1767,7 +1767,7 @@ ${indent}`);
|
|
|
1767
1767
|
consola = createConsola2();
|
|
1768
1768
|
});
|
|
1769
1769
|
|
|
1770
|
-
// ../../node_modules
|
|
1770
|
+
// ../../node_modules/ms/index.js
|
|
1771
1771
|
var require_ms = __commonJS((exports, module) => {
|
|
1772
1772
|
var s2 = 1000;
|
|
1773
1773
|
var m2 = s2 * 60;
|
|
@@ -1877,7 +1877,7 @@ var require_ms = __commonJS((exports, module) => {
|
|
|
1877
1877
|
}
|
|
1878
1878
|
});
|
|
1879
1879
|
|
|
1880
|
-
// ../../node_modules
|
|
1880
|
+
// ../../node_modules/debug/src/common.js
|
|
1881
1881
|
var require_common = __commonJS((exports, module) => {
|
|
1882
1882
|
function setup(env2) {
|
|
1883
1883
|
createDebug.debug = createDebug;
|
|
@@ -2052,7 +2052,7 @@ var require_common = __commonJS((exports, module) => {
|
|
|
2052
2052
|
module.exports = setup;
|
|
2053
2053
|
});
|
|
2054
2054
|
|
|
2055
|
-
// ../../node_modules
|
|
2055
|
+
// ../../node_modules/debug/src/browser.js
|
|
2056
2056
|
var require_browser = __commonJS((exports, module) => {
|
|
2057
2057
|
exports.formatArgs = formatArgs;
|
|
2058
2058
|
exports.save = save;
|
|
@@ -2212,7 +2212,7 @@ var require_browser = __commonJS((exports, module) => {
|
|
|
2212
2212
|
};
|
|
2213
2213
|
});
|
|
2214
2214
|
|
|
2215
|
-
// ../../node_modules
|
|
2215
|
+
// ../../node_modules/debug/src/node.js
|
|
2216
2216
|
var require_node = __commonJS((exports, module) => {
|
|
2217
2217
|
var tty2 = __require("tty");
|
|
2218
2218
|
var util = __require("util");
|
|
@@ -2383,7 +2383,7 @@ var require_node = __commonJS((exports, module) => {
|
|
|
2383
2383
|
};
|
|
2384
2384
|
});
|
|
2385
2385
|
|
|
2386
|
-
// ../../node_modules
|
|
2386
|
+
// ../../node_modules/debug/src/index.js
|
|
2387
2387
|
var require_src = __commonJS((exports, module) => {
|
|
2388
2388
|
if (typeof process === "undefined" || process.type === "renderer" || false || process.__nwjs) {
|
|
2389
2389
|
module.exports = require_browser();
|
|
@@ -2392,7 +2392,7 @@ var require_src = __commonJS((exports, module) => {
|
|
|
2392
2392
|
}
|
|
2393
2393
|
});
|
|
2394
2394
|
|
|
2395
|
-
// ../../node_modules
|
|
2395
|
+
// ../../node_modules/@kwsites/file-exists/dist/src/index.js
|
|
2396
2396
|
var require_src2 = __commonJS((exports) => {
|
|
2397
2397
|
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
2398
2398
|
return mod && mod.__esModule ? mod : { default: mod };
|
|
@@ -2433,7 +2433,7 @@ var require_src2 = __commonJS((exports) => {
|
|
|
2433
2433
|
exports.READABLE = exports.FILE + exports.FOLDER;
|
|
2434
2434
|
});
|
|
2435
2435
|
|
|
2436
|
-
// ../../node_modules
|
|
2436
|
+
// ../../node_modules/@kwsites/file-exists/dist/index.js
|
|
2437
2437
|
var require_dist = __commonJS((exports) => {
|
|
2438
2438
|
function __export2(m2) {
|
|
2439
2439
|
for (var p in m2)
|
|
@@ -2444,7 +2444,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
2444
2444
|
__export2(require_src2());
|
|
2445
2445
|
});
|
|
2446
2446
|
|
|
2447
|
-
// ../../node_modules
|
|
2447
|
+
// ../../node_modules/@kwsites/promise-deferred/dist/index.js
|
|
2448
2448
|
var require_dist2 = __commonJS((exports) => {
|
|
2449
2449
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2450
2450
|
exports.createDeferred = exports.deferred = undefined;
|
|
@@ -2483,10 +2483,10 @@ var require_dist2 = __commonJS((exports) => {
|
|
|
2483
2483
|
exports.default = deferred;
|
|
2484
2484
|
});
|
|
2485
2485
|
|
|
2486
|
-
// ../../node_modules
|
|
2486
|
+
// ../../node_modules/convex/dist/esm/index.js
|
|
2487
2487
|
var version = "1.31.7";
|
|
2488
2488
|
|
|
2489
|
-
// ../../node_modules
|
|
2489
|
+
// ../../node_modules/convex/dist/esm/values/base64.js
|
|
2490
2490
|
function getLens(b64) {
|
|
2491
2491
|
var len2 = b64.length;
|
|
2492
2492
|
if (len2 % 4 > 0) {
|
|
@@ -2570,7 +2570,7 @@ var init_base64 = __esm(() => {
|
|
|
2570
2570
|
revLookup[95] = 63;
|
|
2571
2571
|
});
|
|
2572
2572
|
|
|
2573
|
-
// ../../node_modules
|
|
2573
|
+
// ../../node_modules/convex/dist/esm/common/index.js
|
|
2574
2574
|
function parseArgs2(args) {
|
|
2575
2575
|
if (args === undefined) {
|
|
2576
2576
|
return {};
|
|
@@ -2606,7 +2606,7 @@ function isSimpleObject(value) {
|
|
|
2606
2606
|
return isObject && isSimple;
|
|
2607
2607
|
}
|
|
2608
2608
|
|
|
2609
|
-
// ../../node_modules
|
|
2609
|
+
// ../../node_modules/convex/dist/esm/values/value.js
|
|
2610
2610
|
function isSpecial(n2) {
|
|
2611
2611
|
return Number.isNaN(n2) || !Number.isFinite(n2) || Object.is(n2, -0);
|
|
2612
2612
|
}
|
|
@@ -2847,1241 +2847,959 @@ var init_value = __esm(() => {
|
|
|
2847
2847
|
base64ToBigInt = DataView.prototype.getBigInt64 ? modernBase64ToBigInt : slowBase64ToBigInt;
|
|
2848
2848
|
});
|
|
2849
2849
|
|
|
2850
|
-
// ../../node_modules
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
__defProp3 = Object.defineProperty;
|
|
2855
|
-
IDENTIFYING_FIELD = Symbol.for("ConvexError");
|
|
2856
|
-
ConvexError = class ConvexError extends (_b = Error, _a2 = IDENTIFYING_FIELD, _b) {
|
|
2857
|
-
constructor(data) {
|
|
2858
|
-
super(typeof data === "string" ? data : stringifyValueForError(data));
|
|
2859
|
-
__publicField(this, "name", "ConvexError");
|
|
2860
|
-
__publicField(this, "data");
|
|
2861
|
-
__publicField(this, _a2, true);
|
|
2862
|
-
this.data = data;
|
|
2863
|
-
}
|
|
2864
|
-
};
|
|
2865
|
-
});
|
|
2866
|
-
|
|
2867
|
-
// ../../node_modules/.bun/convex@1.31.7+b1ab299f0a400331/node_modules/convex/dist/esm/values/index.js
|
|
2868
|
-
var init_values = __esm(() => {
|
|
2869
|
-
init_value();
|
|
2870
|
-
init_errors();
|
|
2871
|
-
});
|
|
2872
|
-
|
|
2873
|
-
// ../../node_modules/.bun/convex@1.31.7+b1ab299f0a400331/node_modules/convex/dist/esm/browser/logging.js
|
|
2874
|
-
function prefix_for_source(source) {
|
|
2875
|
-
switch (source) {
|
|
2876
|
-
case "query":
|
|
2877
|
-
return "Q";
|
|
2878
|
-
case "mutation":
|
|
2879
|
-
return "M";
|
|
2880
|
-
case "action":
|
|
2881
|
-
return "A";
|
|
2882
|
-
case "any":
|
|
2883
|
-
return "?";
|
|
2884
|
-
}
|
|
2850
|
+
// ../../node_modules/convex/dist/esm/values/validators.js
|
|
2851
|
+
function throwUndefinedValidatorError(context, fieldName) {
|
|
2852
|
+
const fieldInfo = fieldName !== undefined ? ` for field "${fieldName}"` : "";
|
|
2853
|
+
throw new Error(`A validator is undefined${fieldInfo} in ${context}. This is often caused by circular imports. See ${UNDEFINED_VALIDATOR_ERROR_URL} for details.`);
|
|
2885
2854
|
}
|
|
2886
2855
|
|
|
2887
|
-
class
|
|
2888
|
-
constructor(
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
this
|
|
2892
|
-
this
|
|
2856
|
+
class BaseValidator {
|
|
2857
|
+
constructor({ isOptional }) {
|
|
2858
|
+
__publicField(this, "type");
|
|
2859
|
+
__publicField(this, "fieldPaths");
|
|
2860
|
+
__publicField(this, "isOptional");
|
|
2861
|
+
__publicField(this, "isConvexValidator");
|
|
2862
|
+
this.isOptional = isOptional;
|
|
2863
|
+
this.isConvexValidator = true;
|
|
2893
2864
|
}
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2865
|
+
}
|
|
2866
|
+
var __defProp3, __defNormalProp = (obj, key, value) => (key in obj) ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value, __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value), UNDEFINED_VALIDATOR_ERROR_URL = "https://docs.convex.dev/error#undefined-validator", VId, VFloat64, VInt64, VBoolean, VBytes, VString, VNull, VAny, VObject, VLiteral, VArray, VRecord, VUnion;
|
|
2867
|
+
var init_validators = __esm(() => {
|
|
2868
|
+
init_value();
|
|
2869
|
+
__defProp3 = Object.defineProperty;
|
|
2870
|
+
VId = class VId extends BaseValidator {
|
|
2871
|
+
constructor({
|
|
2872
|
+
isOptional,
|
|
2873
|
+
tableName
|
|
2874
|
+
}) {
|
|
2875
|
+
super({ isOptional });
|
|
2876
|
+
__publicField(this, "tableName");
|
|
2877
|
+
__publicField(this, "kind", "id");
|
|
2878
|
+
if (typeof tableName !== "string") {
|
|
2879
|
+
throw new Error("v.id(tableName) requires a string");
|
|
2899
2880
|
}
|
|
2900
|
-
|
|
2881
|
+
this.tableName = tableName;
|
|
2901
2882
|
}
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
delete this._onLogLineFuncs[id];
|
|
2905
|
-
};
|
|
2906
|
-
}
|
|
2907
|
-
logVerbose(...args) {
|
|
2908
|
-
if (this._verbose) {
|
|
2909
|
-
for (const func of Object.values(this._onLogLineFuncs)) {
|
|
2910
|
-
func("debug", `${(/* @__PURE__ */ new Date()).toISOString()}`, ...args);
|
|
2911
|
-
}
|
|
2883
|
+
get json() {
|
|
2884
|
+
return { type: "id", tableName: this.tableName };
|
|
2912
2885
|
}
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2886
|
+
asOptional() {
|
|
2887
|
+
return new VId({
|
|
2888
|
+
isOptional: "optional",
|
|
2889
|
+
tableName: this.tableName
|
|
2890
|
+
});
|
|
2917
2891
|
}
|
|
2918
|
-
}
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2892
|
+
};
|
|
2893
|
+
VFloat64 = class VFloat64 extends BaseValidator {
|
|
2894
|
+
constructor() {
|
|
2895
|
+
super(...arguments);
|
|
2896
|
+
__publicField(this, "kind", "float64");
|
|
2922
2897
|
}
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
for (const func of Object.values(this._onLogLineFuncs)) {
|
|
2926
|
-
func("error", ...args);
|
|
2898
|
+
get json() {
|
|
2899
|
+
return { type: "number" };
|
|
2927
2900
|
}
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
logger.addLogLineListener((level, ...args) => {
|
|
2933
|
-
switch (level) {
|
|
2934
|
-
case "debug":
|
|
2935
|
-
console.debug(...args);
|
|
2936
|
-
break;
|
|
2937
|
-
case "info":
|
|
2938
|
-
console.log(...args);
|
|
2939
|
-
break;
|
|
2940
|
-
case "warn":
|
|
2941
|
-
console.warn(...args);
|
|
2942
|
-
break;
|
|
2943
|
-
case "error":
|
|
2944
|
-
console.error(...args);
|
|
2945
|
-
break;
|
|
2946
|
-
default: {
|
|
2947
|
-
console.log(...args);
|
|
2948
|
-
}
|
|
2901
|
+
asOptional() {
|
|
2902
|
+
return new VFloat64({
|
|
2903
|
+
isOptional: "optional"
|
|
2904
|
+
});
|
|
2949
2905
|
}
|
|
2950
|
-
}
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
}
|
|
2956
|
-
function logForFunction(logger, type, source, udfPath, message) {
|
|
2957
|
-
const prefix = prefix_for_source(source);
|
|
2958
|
-
if (typeof message === "object") {
|
|
2959
|
-
message = `ConvexError ${JSON.stringify(message.errorData, null, 2)}`;
|
|
2960
|
-
}
|
|
2961
|
-
if (type === "info") {
|
|
2962
|
-
const match = message.match(/^\[.*?\] /);
|
|
2963
|
-
if (match === null) {
|
|
2964
|
-
logger.error(`[CONVEX ${prefix}(${udfPath})] Could not parse console.log`);
|
|
2965
|
-
return;
|
|
2906
|
+
};
|
|
2907
|
+
VInt64 = class VInt64 extends BaseValidator {
|
|
2908
|
+
constructor() {
|
|
2909
|
+
super(...arguments);
|
|
2910
|
+
__publicField(this, "kind", "int64");
|
|
2966
2911
|
}
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
logger.log(`%c[CONVEX ${prefix}(${udfPath})] [${level}]`, INFO_COLOR, args);
|
|
2970
|
-
} else {
|
|
2971
|
-
logger.error(`[CONVEX ${prefix}(${udfPath})] ${message}`);
|
|
2972
|
-
}
|
|
2973
|
-
}
|
|
2974
|
-
var __defProp4, __defNormalProp2 = (obj, key, value) => (key in obj) ? __defProp4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value, __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value), INFO_COLOR = "color:rgb(0, 145, 255)";
|
|
2975
|
-
var init_logging = __esm(() => {
|
|
2976
|
-
__defProp4 = Object.defineProperty;
|
|
2977
|
-
});
|
|
2978
|
-
|
|
2979
|
-
// ../../node_modules/.bun/convex@1.31.7+b1ab299f0a400331/node_modules/convex/dist/esm/server/functionName.js
|
|
2980
|
-
var functionName;
|
|
2981
|
-
var init_functionName = __esm(() => {
|
|
2982
|
-
functionName = Symbol.for("functionName");
|
|
2983
|
-
});
|
|
2984
|
-
|
|
2985
|
-
// ../../node_modules/.bun/convex@1.31.7+b1ab299f0a400331/node_modules/convex/dist/esm/server/components/paths.js
|
|
2986
|
-
function extractReferencePath(reference) {
|
|
2987
|
-
return reference[toReferencePath] ?? null;
|
|
2988
|
-
}
|
|
2989
|
-
function isFunctionHandle(s2) {
|
|
2990
|
-
return s2.startsWith("function://");
|
|
2991
|
-
}
|
|
2992
|
-
function getFunctionAddress(functionReference) {
|
|
2993
|
-
let functionAddress;
|
|
2994
|
-
if (typeof functionReference === "string") {
|
|
2995
|
-
if (isFunctionHandle(functionReference)) {
|
|
2996
|
-
functionAddress = { functionHandle: functionReference };
|
|
2997
|
-
} else {
|
|
2998
|
-
functionAddress = { name: functionReference };
|
|
2912
|
+
get json() {
|
|
2913
|
+
return { type: "bigint" };
|
|
2999
2914
|
}
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
} else {
|
|
3003
|
-
const referencePath = extractReferencePath(functionReference);
|
|
3004
|
-
if (!referencePath) {
|
|
3005
|
-
throw new Error(`${functionReference} is not a functionReference`);
|
|
2915
|
+
asOptional() {
|
|
2916
|
+
return new VInt64({ isOptional: "optional" });
|
|
3006
2917
|
}
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
var init_paths = __esm(() => {
|
|
3013
|
-
init_functionName();
|
|
3014
|
-
toReferencePath = Symbol.for("toReferencePath");
|
|
3015
|
-
});
|
|
3016
|
-
|
|
3017
|
-
// ../../node_modules/.bun/convex@1.31.7+b1ab299f0a400331/node_modules/convex/dist/esm/server/api.js
|
|
3018
|
-
function getFunctionName(functionReference) {
|
|
3019
|
-
const address = getFunctionAddress(functionReference);
|
|
3020
|
-
if (address.name === undefined) {
|
|
3021
|
-
if (address.functionHandle !== undefined) {
|
|
3022
|
-
throw new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${address.functionHandle}`);
|
|
3023
|
-
} else if (address.reference !== undefined) {
|
|
3024
|
-
throw new Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${address.reference}`);
|
|
2918
|
+
};
|
|
2919
|
+
VBoolean = class VBoolean extends BaseValidator {
|
|
2920
|
+
constructor() {
|
|
2921
|
+
super(...arguments);
|
|
2922
|
+
__publicField(this, "kind", "boolean");
|
|
3025
2923
|
}
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
}
|
|
3034
|
-
return name;
|
|
3035
|
-
}
|
|
3036
|
-
function createApi(pathParts = []) {
|
|
3037
|
-
const handler = {
|
|
3038
|
-
get(_3, prop) {
|
|
3039
|
-
if (typeof prop === "string") {
|
|
3040
|
-
const newParts = [...pathParts, prop];
|
|
3041
|
-
return createApi(newParts);
|
|
3042
|
-
} else if (prop === functionName) {
|
|
3043
|
-
if (pathParts.length < 2) {
|
|
3044
|
-
const found = ["api", ...pathParts].join(".");
|
|
3045
|
-
throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${found}\``);
|
|
3046
|
-
}
|
|
3047
|
-
const path = pathParts.slice(0, -1).join("/");
|
|
3048
|
-
const exportName = pathParts[pathParts.length - 1];
|
|
3049
|
-
if (exportName === "default") {
|
|
3050
|
-
return path;
|
|
3051
|
-
} else {
|
|
3052
|
-
return path + ":" + exportName;
|
|
3053
|
-
}
|
|
3054
|
-
} else if (prop === Symbol.toStringTag) {
|
|
3055
|
-
return "FunctionReference";
|
|
3056
|
-
} else {
|
|
3057
|
-
return;
|
|
3058
|
-
}
|
|
2924
|
+
get json() {
|
|
2925
|
+
return { type: this.kind };
|
|
2926
|
+
}
|
|
2927
|
+
asOptional() {
|
|
2928
|
+
return new VBoolean({
|
|
2929
|
+
isOptional: "optional"
|
|
2930
|
+
});
|
|
3059
2931
|
}
|
|
3060
2932
|
};
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
init_functionName();
|
|
3066
|
-
init_paths();
|
|
3067
|
-
anyApi = createApi();
|
|
3068
|
-
});
|
|
3069
|
-
|
|
3070
|
-
// ../../node_modules/.bun/convex@1.31.7+b1ab299f0a400331/node_modules/convex/dist/esm/browser/http_client.js
|
|
3071
|
-
class ConvexHttpClient {
|
|
3072
|
-
constructor(address, options) {
|
|
3073
|
-
__publicField3(this, "address");
|
|
3074
|
-
__publicField3(this, "auth");
|
|
3075
|
-
__publicField3(this, "adminAuth");
|
|
3076
|
-
__publicField3(this, "encodedTsPromise");
|
|
3077
|
-
__publicField3(this, "debug");
|
|
3078
|
-
__publicField3(this, "fetchOptions");
|
|
3079
|
-
__publicField3(this, "fetch");
|
|
3080
|
-
__publicField3(this, "logger");
|
|
3081
|
-
__publicField3(this, "mutationQueue", []);
|
|
3082
|
-
__publicField3(this, "isProcessingQueue", false);
|
|
3083
|
-
if (typeof options === "boolean") {
|
|
3084
|
-
throw new Error("skipConvexDeploymentUrlCheck as the second argument is no longer supported. Please pass an options object, `{ skipConvexDeploymentUrlCheck: true }`.");
|
|
2933
|
+
VBytes = class VBytes extends BaseValidator {
|
|
2934
|
+
constructor() {
|
|
2935
|
+
super(...arguments);
|
|
2936
|
+
__publicField(this, "kind", "bytes");
|
|
3085
2937
|
}
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
validateDeploymentUrl(address);
|
|
2938
|
+
get json() {
|
|
2939
|
+
return { type: this.kind };
|
|
3089
2940
|
}
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
this.debug = true;
|
|
3093
|
-
this.auth = undefined;
|
|
3094
|
-
this.adminAuth = undefined;
|
|
3095
|
-
this.fetch = options?.fetch;
|
|
3096
|
-
if (options?.auth) {
|
|
3097
|
-
this.setAuth(options.auth);
|
|
2941
|
+
asOptional() {
|
|
2942
|
+
return new VBytes({ isOptional: "optional" });
|
|
3098
2943
|
}
|
|
3099
|
-
}
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
return this.address;
|
|
3105
|
-
}
|
|
3106
|
-
setAuth(value) {
|
|
3107
|
-
this.clearAuth();
|
|
3108
|
-
this.auth = value;
|
|
3109
|
-
}
|
|
3110
|
-
setAdminAuth(token, actingAsIdentity) {
|
|
3111
|
-
this.clearAuth();
|
|
3112
|
-
if (actingAsIdentity !== undefined) {
|
|
3113
|
-
const bytes = new TextEncoder().encode(JSON.stringify(actingAsIdentity));
|
|
3114
|
-
const actingAsIdentityEncoded = btoa(String.fromCodePoint(...bytes));
|
|
3115
|
-
this.adminAuth = `${token}:${actingAsIdentityEncoded}`;
|
|
3116
|
-
} else {
|
|
3117
|
-
this.adminAuth = token;
|
|
2944
|
+
};
|
|
2945
|
+
VString = class VString extends BaseValidator {
|
|
2946
|
+
constructor() {
|
|
2947
|
+
super(...arguments);
|
|
2948
|
+
__publicField(this, "kind", "string");
|
|
3118
2949
|
}
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
this.auth = undefined;
|
|
3122
|
-
this.adminAuth = undefined;
|
|
3123
|
-
}
|
|
3124
|
-
setDebug(debug2) {
|
|
3125
|
-
this.debug = debug2;
|
|
3126
|
-
}
|
|
3127
|
-
setFetchOptions(fetchOptions) {
|
|
3128
|
-
this.fetchOptions = fetchOptions;
|
|
3129
|
-
}
|
|
3130
|
-
async consistentQuery(query, ...args) {
|
|
3131
|
-
const queryArgs = parseArgs2(args[0]);
|
|
3132
|
-
const timestampPromise = this.getTimestamp();
|
|
3133
|
-
return await this.queryInner(query, queryArgs, { timestampPromise });
|
|
3134
|
-
}
|
|
3135
|
-
async getTimestamp() {
|
|
3136
|
-
if (this.encodedTsPromise) {
|
|
3137
|
-
return this.encodedTsPromise;
|
|
2950
|
+
get json() {
|
|
2951
|
+
return { type: this.kind };
|
|
3138
2952
|
}
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
const headers = {
|
|
3144
|
-
"Content-Type": "application/json",
|
|
3145
|
-
"Convex-Client": `npm-${version}`
|
|
3146
|
-
};
|
|
3147
|
-
const response = await localFetch(`${this.address}/api/query_ts`, {
|
|
3148
|
-
...this.fetchOptions,
|
|
3149
|
-
method: "POST",
|
|
3150
|
-
headers
|
|
3151
|
-
});
|
|
3152
|
-
if (!response.ok) {
|
|
3153
|
-
throw new Error(await response.text());
|
|
2953
|
+
asOptional() {
|
|
2954
|
+
return new VString({
|
|
2955
|
+
isOptional: "optional"
|
|
2956
|
+
});
|
|
3154
2957
|
}
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
return await this.queryInner(query, queryArgs, {});
|
|
3161
|
-
}
|
|
3162
|
-
async queryInner(query, queryArgs, options) {
|
|
3163
|
-
const name = getFunctionName(query);
|
|
3164
|
-
const args = [convexToJson(queryArgs)];
|
|
3165
|
-
const headers = {
|
|
3166
|
-
"Content-Type": "application/json",
|
|
3167
|
-
"Convex-Client": `npm-${version}`
|
|
3168
|
-
};
|
|
3169
|
-
if (this.adminAuth) {
|
|
3170
|
-
headers["Authorization"] = `Convex ${this.adminAuth}`;
|
|
3171
|
-
} else if (this.auth) {
|
|
3172
|
-
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
2958
|
+
};
|
|
2959
|
+
VNull = class VNull extends BaseValidator {
|
|
2960
|
+
constructor() {
|
|
2961
|
+
super(...arguments);
|
|
2962
|
+
__publicField(this, "kind", "null");
|
|
3173
2963
|
}
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
const body = JSON.stringify({
|
|
3177
|
-
path: name,
|
|
3178
|
-
format: "convex_encoded_json",
|
|
3179
|
-
args,
|
|
3180
|
-
...timestamp ? { ts: timestamp } : {}
|
|
3181
|
-
});
|
|
3182
|
-
const endpoint = timestamp ? `${this.address}/api/query_at_ts` : `${this.address}/api/query`;
|
|
3183
|
-
const response = await localFetch(endpoint, {
|
|
3184
|
-
...this.fetchOptions,
|
|
3185
|
-
body,
|
|
3186
|
-
method: "POST",
|
|
3187
|
-
headers
|
|
3188
|
-
});
|
|
3189
|
-
if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
|
|
3190
|
-
throw new Error(await response.text());
|
|
2964
|
+
get json() {
|
|
2965
|
+
return { type: this.kind };
|
|
3191
2966
|
}
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
for (const line of respJSON.logLines ?? []) {
|
|
3195
|
-
logForFunction(this.logger, "info", "query", name, line);
|
|
3196
|
-
}
|
|
2967
|
+
asOptional() {
|
|
2968
|
+
return new VNull({ isOptional: "optional" });
|
|
3197
2969
|
}
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
2970
|
+
};
|
|
2971
|
+
VAny = class VAny extends BaseValidator {
|
|
2972
|
+
constructor() {
|
|
2973
|
+
super(...arguments);
|
|
2974
|
+
__publicField(this, "kind", "any");
|
|
2975
|
+
}
|
|
2976
|
+
get json() {
|
|
2977
|
+
return {
|
|
2978
|
+
type: this.kind
|
|
2979
|
+
};
|
|
2980
|
+
}
|
|
2981
|
+
asOptional() {
|
|
2982
|
+
return new VAny({
|
|
2983
|
+
isOptional: "optional"
|
|
2984
|
+
});
|
|
2985
|
+
}
|
|
2986
|
+
};
|
|
2987
|
+
VObject = class VObject extends BaseValidator {
|
|
2988
|
+
constructor({
|
|
2989
|
+
isOptional,
|
|
2990
|
+
fields
|
|
2991
|
+
}) {
|
|
2992
|
+
super({ isOptional });
|
|
2993
|
+
__publicField(this, "fields");
|
|
2994
|
+
__publicField(this, "kind", "object");
|
|
2995
|
+
globalThis.Object.entries(fields).forEach(([fieldName, validator]) => {
|
|
2996
|
+
if (validator === undefined) {
|
|
2997
|
+
throwUndefinedValidatorError("v.object()", fieldName);
|
|
3204
2998
|
}
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
2999
|
+
if (!validator.isConvexValidator) {
|
|
3000
|
+
throw new Error("v.object() entries must be validators");
|
|
3001
|
+
}
|
|
3002
|
+
});
|
|
3003
|
+
this.fields = fields;
|
|
3208
3004
|
}
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
};
|
|
3221
|
-
if (this.adminAuth) {
|
|
3222
|
-
headers["Authorization"] = `Convex ${this.adminAuth}`;
|
|
3223
|
-
} else if (this.auth) {
|
|
3224
|
-
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
3005
|
+
get json() {
|
|
3006
|
+
return {
|
|
3007
|
+
type: this.kind,
|
|
3008
|
+
value: globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([k2, v2]) => [
|
|
3009
|
+
k2,
|
|
3010
|
+
{
|
|
3011
|
+
fieldType: v2.json,
|
|
3012
|
+
optional: v2.isOptional === "optional" ? true : false
|
|
3013
|
+
}
|
|
3014
|
+
]))
|
|
3015
|
+
};
|
|
3225
3016
|
}
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
headers
|
|
3232
|
-
});
|
|
3233
|
-
if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
|
|
3234
|
-
throw new Error(await response.text());
|
|
3017
|
+
asOptional() {
|
|
3018
|
+
return new VObject({
|
|
3019
|
+
isOptional: "optional",
|
|
3020
|
+
fields: this.fields
|
|
3021
|
+
});
|
|
3235
3022
|
}
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
for (const
|
|
3239
|
-
|
|
3023
|
+
omit(...fields) {
|
|
3024
|
+
const newFields = { ...this.fields };
|
|
3025
|
+
for (const field of fields) {
|
|
3026
|
+
delete newFields[field];
|
|
3240
3027
|
}
|
|
3028
|
+
return new VObject({
|
|
3029
|
+
isOptional: this.isOptional,
|
|
3030
|
+
fields: newFields
|
|
3031
|
+
});
|
|
3241
3032
|
}
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
|
|
3252
|
-
}
|
|
3253
|
-
}
|
|
3254
|
-
async processMutationQueue() {
|
|
3255
|
-
if (this.isProcessingQueue) {
|
|
3256
|
-
return;
|
|
3033
|
+
pick(...fields) {
|
|
3034
|
+
const newFields = {};
|
|
3035
|
+
for (const field of fields) {
|
|
3036
|
+
newFields[field] = this.fields[field];
|
|
3037
|
+
}
|
|
3038
|
+
return new VObject({
|
|
3039
|
+
isOptional: this.isOptional,
|
|
3040
|
+
fields: newFields
|
|
3041
|
+
});
|
|
3257
3042
|
}
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
const
|
|
3261
|
-
|
|
3262
|
-
const result = await this.mutationInner(mutation, args);
|
|
3263
|
-
resolve(result);
|
|
3264
|
-
} catch (error) {
|
|
3265
|
-
reject(error);
|
|
3043
|
+
partial() {
|
|
3044
|
+
const newFields = {};
|
|
3045
|
+
for (const [key, validator] of globalThis.Object.entries(this.fields)) {
|
|
3046
|
+
newFields[key] = validator.asOptional();
|
|
3266
3047
|
}
|
|
3048
|
+
return new VObject({
|
|
3049
|
+
isOptional: this.isOptional,
|
|
3050
|
+
fields: newFields
|
|
3051
|
+
});
|
|
3267
3052
|
}
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
this.processMutationQueue();
|
|
3274
|
-
});
|
|
3275
|
-
}
|
|
3276
|
-
async mutation(mutation, ...args) {
|
|
3277
|
-
const [fnArgs, options] = args;
|
|
3278
|
-
const mutationArgs = parseArgs2(fnArgs);
|
|
3279
|
-
const queued = !options?.skipQueue;
|
|
3280
|
-
if (queued) {
|
|
3281
|
-
return await this.enqueueMutation(mutation, mutationArgs);
|
|
3282
|
-
} else {
|
|
3283
|
-
return await this.mutationInner(mutation, mutationArgs);
|
|
3053
|
+
extend(fields) {
|
|
3054
|
+
return new VObject({
|
|
3055
|
+
isOptional: this.isOptional,
|
|
3056
|
+
fields: { ...this.fields, ...fields }
|
|
3057
|
+
});
|
|
3284
3058
|
}
|
|
3285
|
-
}
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
"Content-Type": "application/json",
|
|
3296
|
-
"Convex-Client": `npm-${version}`
|
|
3297
|
-
};
|
|
3298
|
-
if (this.adminAuth) {
|
|
3299
|
-
headers["Authorization"] = `Convex ${this.adminAuth}`;
|
|
3300
|
-
} else if (this.auth) {
|
|
3301
|
-
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
3059
|
+
};
|
|
3060
|
+
VLiteral = class VLiteral extends BaseValidator {
|
|
3061
|
+
constructor({ isOptional, value }) {
|
|
3062
|
+
super({ isOptional });
|
|
3063
|
+
__publicField(this, "value");
|
|
3064
|
+
__publicField(this, "kind", "literal");
|
|
3065
|
+
if (typeof value !== "string" && typeof value !== "boolean" && typeof value !== "number" && typeof value !== "bigint") {
|
|
3066
|
+
throw new Error("v.literal(value) must be a string, number, or boolean");
|
|
3067
|
+
}
|
|
3068
|
+
this.value = value;
|
|
3302
3069
|
}
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
headers
|
|
3309
|
-
});
|
|
3310
|
-
if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
|
|
3311
|
-
throw new Error(await response.text());
|
|
3070
|
+
get json() {
|
|
3071
|
+
return {
|
|
3072
|
+
type: this.kind,
|
|
3073
|
+
value: convexToJson(this.value)
|
|
3074
|
+
};
|
|
3312
3075
|
}
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
}
|
|
3076
|
+
asOptional() {
|
|
3077
|
+
return new VLiteral({
|
|
3078
|
+
isOptional: "optional",
|
|
3079
|
+
value: this.value
|
|
3080
|
+
});
|
|
3318
3081
|
}
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3082
|
+
};
|
|
3083
|
+
VArray = class VArray extends BaseValidator {
|
|
3084
|
+
constructor({
|
|
3085
|
+
isOptional,
|
|
3086
|
+
element
|
|
3087
|
+
}) {
|
|
3088
|
+
super({ isOptional });
|
|
3089
|
+
__publicField(this, "element");
|
|
3090
|
+
__publicField(this, "kind", "array");
|
|
3091
|
+
if (element === undefined) {
|
|
3092
|
+
throwUndefinedValidatorError("v.array()");
|
|
3093
|
+
}
|
|
3094
|
+
this.element = element;
|
|
3329
3095
|
}
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
componentPath,
|
|
3336
|
-
path: name,
|
|
3337
|
-
format: "convex_encoded_json",
|
|
3338
|
-
args: convexToJson(functionArgs)
|
|
3339
|
-
});
|
|
3340
|
-
const headers = {
|
|
3341
|
-
"Content-Type": "application/json",
|
|
3342
|
-
"Convex-Client": `npm-${version}`
|
|
3343
|
-
};
|
|
3344
|
-
if (this.adminAuth) {
|
|
3345
|
-
headers["Authorization"] = `Convex ${this.adminAuth}`;
|
|
3346
|
-
} else if (this.auth) {
|
|
3347
|
-
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
3096
|
+
get json() {
|
|
3097
|
+
return {
|
|
3098
|
+
type: this.kind,
|
|
3099
|
+
value: this.element.json
|
|
3100
|
+
};
|
|
3348
3101
|
}
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
headers
|
|
3355
|
-
});
|
|
3356
|
-
if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
|
|
3357
|
-
throw new Error(await response.text());
|
|
3102
|
+
asOptional() {
|
|
3103
|
+
return new VArray({
|
|
3104
|
+
isOptional: "optional",
|
|
3105
|
+
element: this.element
|
|
3106
|
+
});
|
|
3358
3107
|
}
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3108
|
+
};
|
|
3109
|
+
VRecord = class VRecord extends BaseValidator {
|
|
3110
|
+
constructor({
|
|
3111
|
+
isOptional,
|
|
3112
|
+
key,
|
|
3113
|
+
value
|
|
3114
|
+
}) {
|
|
3115
|
+
super({ isOptional });
|
|
3116
|
+
__publicField(this, "key");
|
|
3117
|
+
__publicField(this, "value");
|
|
3118
|
+
__publicField(this, "kind", "record");
|
|
3119
|
+
if (key === undefined) {
|
|
3120
|
+
throwUndefinedValidatorError("v.record()", "key");
|
|
3121
|
+
}
|
|
3122
|
+
if (value === undefined) {
|
|
3123
|
+
throwUndefinedValidatorError("v.record()", "value");
|
|
3124
|
+
}
|
|
3125
|
+
if (key.isOptional === "optional") {
|
|
3126
|
+
throw new Error("Record validator cannot have optional keys");
|
|
3127
|
+
}
|
|
3128
|
+
if (value.isOptional === "optional") {
|
|
3129
|
+
throw new Error("Record validator cannot have optional values");
|
|
3363
3130
|
}
|
|
3131
|
+
if (!key.isConvexValidator || !value.isConvexValidator) {
|
|
3132
|
+
throw new Error("Key and value of v.record() but be validators");
|
|
3133
|
+
}
|
|
3134
|
+
this.key = key;
|
|
3135
|
+
this.value = value;
|
|
3364
3136
|
}
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3137
|
+
get json() {
|
|
3138
|
+
return {
|
|
3139
|
+
type: this.kind,
|
|
3140
|
+
keys: this.key.json,
|
|
3141
|
+
values: {
|
|
3142
|
+
fieldType: this.value.json,
|
|
3143
|
+
optional: false
|
|
3371
3144
|
}
|
|
3372
|
-
|
|
3373
|
-
default:
|
|
3374
|
-
throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
|
|
3145
|
+
};
|
|
3375
3146
|
}
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
}
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3147
|
+
asOptional() {
|
|
3148
|
+
return new VRecord({
|
|
3149
|
+
isOptional: "optional",
|
|
3150
|
+
key: this.key,
|
|
3151
|
+
value: this.value
|
|
3152
|
+
});
|
|
3153
|
+
}
|
|
3154
|
+
};
|
|
3155
|
+
VUnion = class VUnion extends BaseValidator {
|
|
3156
|
+
constructor({ isOptional, members }) {
|
|
3157
|
+
super({ isOptional });
|
|
3158
|
+
__publicField(this, "members");
|
|
3159
|
+
__publicField(this, "kind", "union");
|
|
3160
|
+
members.forEach((member, index) => {
|
|
3161
|
+
if (member === undefined) {
|
|
3162
|
+
throwUndefinedValidatorError("v.union()", `member at index ${index}`);
|
|
3163
|
+
}
|
|
3164
|
+
if (!member.isConvexValidator) {
|
|
3165
|
+
throw new Error("All members of v.union() must be validators");
|
|
3166
|
+
}
|
|
3167
|
+
});
|
|
3168
|
+
this.members = members;
|
|
3169
|
+
}
|
|
3170
|
+
get json() {
|
|
3171
|
+
return {
|
|
3172
|
+
type: this.kind,
|
|
3173
|
+
value: this.members.map((v2) => v2.json)
|
|
3174
|
+
};
|
|
3175
|
+
}
|
|
3176
|
+
asOptional() {
|
|
3177
|
+
return new VUnion({
|
|
3178
|
+
isOptional: "optional",
|
|
3179
|
+
members: this.members
|
|
3180
|
+
});
|
|
3181
|
+
}
|
|
3182
|
+
};
|
|
3388
3183
|
});
|
|
3389
3184
|
|
|
3390
|
-
// ../../node_modules
|
|
3391
|
-
var
|
|
3392
|
-
|
|
3185
|
+
// ../../node_modules/convex/dist/esm/values/validator.js
|
|
3186
|
+
var v2;
|
|
3187
|
+
var init_validator = __esm(() => {
|
|
3188
|
+
init_validators();
|
|
3189
|
+
v2 = {
|
|
3190
|
+
id: (tableName) => {
|
|
3191
|
+
return new VId({
|
|
3192
|
+
isOptional: "required",
|
|
3193
|
+
tableName
|
|
3194
|
+
});
|
|
3195
|
+
},
|
|
3196
|
+
null: () => {
|
|
3197
|
+
return new VNull({ isOptional: "required" });
|
|
3198
|
+
},
|
|
3199
|
+
number: () => {
|
|
3200
|
+
return new VFloat64({ isOptional: "required" });
|
|
3201
|
+
},
|
|
3202
|
+
float64: () => {
|
|
3203
|
+
return new VFloat64({ isOptional: "required" });
|
|
3204
|
+
},
|
|
3205
|
+
bigint: () => {
|
|
3206
|
+
return new VInt64({ isOptional: "required" });
|
|
3207
|
+
},
|
|
3208
|
+
int64: () => {
|
|
3209
|
+
return new VInt64({ isOptional: "required" });
|
|
3210
|
+
},
|
|
3211
|
+
boolean: () => {
|
|
3212
|
+
return new VBoolean({ isOptional: "required" });
|
|
3213
|
+
},
|
|
3214
|
+
string: () => {
|
|
3215
|
+
return new VString({ isOptional: "required" });
|
|
3216
|
+
},
|
|
3217
|
+
bytes: () => {
|
|
3218
|
+
return new VBytes({ isOptional: "required" });
|
|
3219
|
+
},
|
|
3220
|
+
literal: (literal) => {
|
|
3221
|
+
return new VLiteral({ isOptional: "required", value: literal });
|
|
3222
|
+
},
|
|
3223
|
+
array: (element) => {
|
|
3224
|
+
return new VArray({ isOptional: "required", element });
|
|
3225
|
+
},
|
|
3226
|
+
object: (fields) => {
|
|
3227
|
+
return new VObject({ isOptional: "required", fields });
|
|
3228
|
+
},
|
|
3229
|
+
record: (keys, values) => {
|
|
3230
|
+
return new VRecord({
|
|
3231
|
+
isOptional: "required",
|
|
3232
|
+
key: keys,
|
|
3233
|
+
value: values
|
|
3234
|
+
});
|
|
3235
|
+
},
|
|
3236
|
+
union: (...members) => {
|
|
3237
|
+
return new VUnion({
|
|
3238
|
+
isOptional: "required",
|
|
3239
|
+
members
|
|
3240
|
+
});
|
|
3241
|
+
},
|
|
3242
|
+
any: () => {
|
|
3243
|
+
return new VAny({ isOptional: "required" });
|
|
3244
|
+
},
|
|
3245
|
+
optional: (value) => {
|
|
3246
|
+
return value.asOptional();
|
|
3247
|
+
},
|
|
3248
|
+
nullable: (value) => {
|
|
3249
|
+
return v2.union(value, v2.null());
|
|
3250
|
+
}
|
|
3251
|
+
};
|
|
3393
3252
|
});
|
|
3394
3253
|
|
|
3395
|
-
// ../../node_modules
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
}
|
|
3410
|
-
function toByteArray2(b64) {
|
|
3411
|
-
var tmp;
|
|
3412
|
-
var lens = getLens2(b64);
|
|
3413
|
-
var validLen = lens[0];
|
|
3414
|
-
var placeHoldersLen = lens[1];
|
|
3415
|
-
var arr = new Arr2(_byteLength2(b64, validLen, placeHoldersLen));
|
|
3416
|
-
var curByte = 0;
|
|
3417
|
-
var len3 = placeHoldersLen > 0 ? validLen - 4 : validLen;
|
|
3418
|
-
var i4;
|
|
3419
|
-
for (i4 = 0;i4 < len3; i4 += 4) {
|
|
3420
|
-
tmp = revLookup2[b64.charCodeAt(i4)] << 18 | revLookup2[b64.charCodeAt(i4 + 1)] << 12 | revLookup2[b64.charCodeAt(i4 + 2)] << 6 | revLookup2[b64.charCodeAt(i4 + 3)];
|
|
3421
|
-
arr[curByte++] = tmp >> 16 & 255;
|
|
3422
|
-
arr[curByte++] = tmp >> 8 & 255;
|
|
3423
|
-
arr[curByte++] = tmp & 255;
|
|
3424
|
-
}
|
|
3425
|
-
if (placeHoldersLen === 2) {
|
|
3426
|
-
tmp = revLookup2[b64.charCodeAt(i4)] << 2 | revLookup2[b64.charCodeAt(i4 + 1)] >> 4;
|
|
3427
|
-
arr[curByte++] = tmp & 255;
|
|
3428
|
-
}
|
|
3429
|
-
if (placeHoldersLen === 1) {
|
|
3430
|
-
tmp = revLookup2[b64.charCodeAt(i4)] << 10 | revLookup2[b64.charCodeAt(i4 + 1)] << 4 | revLookup2[b64.charCodeAt(i4 + 2)] >> 2;
|
|
3431
|
-
arr[curByte++] = tmp >> 8 & 255;
|
|
3432
|
-
arr[curByte++] = tmp & 255;
|
|
3433
|
-
}
|
|
3434
|
-
return arr;
|
|
3435
|
-
}
|
|
3436
|
-
function tripletToBase642(num) {
|
|
3437
|
-
return lookup2[num >> 18 & 63] + lookup2[num >> 12 & 63] + lookup2[num >> 6 & 63] + lookup2[num & 63];
|
|
3438
|
-
}
|
|
3439
|
-
function encodeChunk2(uint8, start, end) {
|
|
3440
|
-
var tmp;
|
|
3441
|
-
var output = [];
|
|
3442
|
-
for (var i4 = start;i4 < end; i4 += 3) {
|
|
3443
|
-
tmp = (uint8[i4] << 16 & 16711680) + (uint8[i4 + 1] << 8 & 65280) + (uint8[i4 + 2] & 255);
|
|
3444
|
-
output.push(tripletToBase642(tmp));
|
|
3445
|
-
}
|
|
3446
|
-
return output.join("");
|
|
3447
|
-
}
|
|
3448
|
-
function fromByteArray2(uint8) {
|
|
3449
|
-
var tmp;
|
|
3450
|
-
var len3 = uint8.length;
|
|
3451
|
-
var extraBytes = len3 % 3;
|
|
3452
|
-
var parts = [];
|
|
3453
|
-
var maxChunkLength = 16383;
|
|
3454
|
-
for (var i4 = 0, len22 = len3 - extraBytes;i4 < len22; i4 += maxChunkLength) {
|
|
3455
|
-
parts.push(encodeChunk2(uint8, i4, i4 + maxChunkLength > len22 ? len22 : i4 + maxChunkLength));
|
|
3456
|
-
}
|
|
3457
|
-
if (extraBytes === 1) {
|
|
3458
|
-
tmp = uint8[len3 - 1];
|
|
3459
|
-
parts.push(lookup2[tmp >> 2] + lookup2[tmp << 4 & 63] + "==");
|
|
3460
|
-
} else if (extraBytes === 2) {
|
|
3461
|
-
tmp = (uint8[len3 - 2] << 8) + uint8[len3 - 1];
|
|
3462
|
-
parts.push(lookup2[tmp >> 10] + lookup2[tmp >> 4 & 63] + lookup2[tmp << 2 & 63] + "=");
|
|
3463
|
-
}
|
|
3464
|
-
return parts.join("");
|
|
3465
|
-
}
|
|
3466
|
-
var lookup2, revLookup2, Arr2, code2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i3, len2;
|
|
3467
|
-
var init_base642 = __esm(() => {
|
|
3468
|
-
lookup2 = [];
|
|
3469
|
-
revLookup2 = [];
|
|
3470
|
-
Arr2 = Uint8Array;
|
|
3471
|
-
for (i3 = 0, len2 = code2.length;i3 < len2; ++i3) {
|
|
3472
|
-
lookup2[i3] = code2[i3];
|
|
3473
|
-
revLookup2[code2.charCodeAt(i3)] = i3;
|
|
3474
|
-
}
|
|
3475
|
-
revLookup2[45] = 62;
|
|
3476
|
-
revLookup2[95] = 63;
|
|
3254
|
+
// ../../node_modules/convex/dist/esm/values/errors.js
|
|
3255
|
+
var __defProp4, __defNormalProp2 = (obj, key, value) => (key in obj) ? __defProp4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value, __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value), _a2, _b, IDENTIFYING_FIELD, ConvexError;
|
|
3256
|
+
var init_errors = __esm(() => {
|
|
3257
|
+
init_value();
|
|
3258
|
+
__defProp4 = Object.defineProperty;
|
|
3259
|
+
IDENTIFYING_FIELD = Symbol.for("ConvexError");
|
|
3260
|
+
ConvexError = class ConvexError extends (_b = Error, _a2 = IDENTIFYING_FIELD, _b) {
|
|
3261
|
+
constructor(data) {
|
|
3262
|
+
super(typeof data === "string" ? data : stringifyValueForError(data));
|
|
3263
|
+
__publicField2(this, "name", "ConvexError");
|
|
3264
|
+
__publicField2(this, "data");
|
|
3265
|
+
__publicField2(this, _a2, true);
|
|
3266
|
+
this.data = data;
|
|
3267
|
+
}
|
|
3268
|
+
};
|
|
3477
3269
|
});
|
|
3478
3270
|
|
|
3479
|
-
// ../../node_modules
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
return isObject && isSimple;
|
|
3485
|
-
}
|
|
3271
|
+
// ../../node_modules/convex/dist/esm/values/index.js
|
|
3272
|
+
var init_values = __esm(() => {
|
|
3273
|
+
init_value();
|
|
3274
|
+
init_errors();
|
|
3275
|
+
});
|
|
3486
3276
|
|
|
3487
|
-
// ../../node_modules
|
|
3488
|
-
function
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
const bytes = new Uint8Array(new ArrayBuffer(8));
|
|
3499
|
-
let i4 = 0;
|
|
3500
|
-
for (const hexByte of hex.match(/.{2}/g).reverse()) {
|
|
3501
|
-
bytes.set([parseInt(hexByte, 16)], i4++);
|
|
3502
|
-
value >>= EIGHT2;
|
|
3503
|
-
}
|
|
3504
|
-
return fromByteArray2(bytes);
|
|
3505
|
-
}
|
|
3506
|
-
function slowBase64ToBigInt2(encoded) {
|
|
3507
|
-
const integerBytes = toByteArray2(encoded);
|
|
3508
|
-
if (integerBytes.byteLength !== 8) {
|
|
3509
|
-
throw new Error(`Received ${integerBytes.byteLength} bytes, expected 8 for $integer`);
|
|
3510
|
-
}
|
|
3511
|
-
let value = ZERO2;
|
|
3512
|
-
let power = ZERO2;
|
|
3513
|
-
for (const byte of integerBytes) {
|
|
3514
|
-
value += BigInt(byte) * TWOFIFTYSIX2 ** power;
|
|
3515
|
-
power++;
|
|
3516
|
-
}
|
|
3517
|
-
if (value > MAX_INT642) {
|
|
3518
|
-
value += MIN_INT642 + MIN_INT642;
|
|
3519
|
-
}
|
|
3520
|
-
return value;
|
|
3521
|
-
}
|
|
3522
|
-
function modernBigIntToBase642(value) {
|
|
3523
|
-
if (value < MIN_INT642 || MAX_INT642 < value) {
|
|
3524
|
-
throw new Error(`BigInt ${value} does not fit into a 64-bit signed integer.`);
|
|
3525
|
-
}
|
|
3526
|
-
const buffer = new ArrayBuffer(8);
|
|
3527
|
-
new DataView(buffer).setBigInt64(0, value, true);
|
|
3528
|
-
return fromByteArray2(new Uint8Array(buffer));
|
|
3529
|
-
}
|
|
3530
|
-
function modernBase64ToBigInt2(encoded) {
|
|
3531
|
-
const integerBytes = toByteArray2(encoded);
|
|
3532
|
-
if (integerBytes.byteLength !== 8) {
|
|
3533
|
-
throw new Error(`Received ${integerBytes.byteLength} bytes, expected 8 for $integer`);
|
|
3534
|
-
}
|
|
3535
|
-
const intBytesView = new DataView(integerBytes.buffer);
|
|
3536
|
-
return intBytesView.getBigInt64(0, true);
|
|
3537
|
-
}
|
|
3538
|
-
function validateObjectField2(k2) {
|
|
3539
|
-
if (k2.length > MAX_IDENTIFIER_LEN2) {
|
|
3540
|
-
throw new Error(`Field name ${k2} exceeds maximum field name length ${MAX_IDENTIFIER_LEN2}.`);
|
|
3541
|
-
}
|
|
3542
|
-
if (k2.startsWith("$")) {
|
|
3543
|
-
throw new Error(`Field name ${k2} starts with a '$', which is reserved.`);
|
|
3544
|
-
}
|
|
3545
|
-
for (let i4 = 0;i4 < k2.length; i4 += 1) {
|
|
3546
|
-
const charCode = k2.charCodeAt(i4);
|
|
3547
|
-
if (charCode < 32 || charCode >= 127) {
|
|
3548
|
-
throw new Error(`Field name ${k2} has invalid character '${k2[i4]}': Field names can only contain non-control ASCII characters`);
|
|
3549
|
-
}
|
|
3550
|
-
}
|
|
3551
|
-
}
|
|
3552
|
-
function stringifyValueForError2(value) {
|
|
3553
|
-
const str = JSON.stringify(value, (_key, value2) => {
|
|
3554
|
-
if (value2 === undefined) {
|
|
3555
|
-
return "undefined";
|
|
3556
|
-
}
|
|
3557
|
-
if (typeof value2 === "bigint") {
|
|
3558
|
-
return `${value2.toString()}n`;
|
|
3559
|
-
}
|
|
3560
|
-
return value2;
|
|
3561
|
-
});
|
|
3562
|
-
if (str.length > MAX_VALUE_FOR_ERROR_LEN2) {
|
|
3563
|
-
const rest = "[...truncated]";
|
|
3564
|
-
let truncateAt = MAX_VALUE_FOR_ERROR_LEN2 - rest.length;
|
|
3565
|
-
const codePoint = str.codePointAt(truncateAt - 1);
|
|
3566
|
-
if (codePoint !== undefined && codePoint > 65535) {
|
|
3567
|
-
truncateAt -= 1;
|
|
3568
|
-
}
|
|
3569
|
-
return str.substring(0, truncateAt) + rest;
|
|
3570
|
-
}
|
|
3571
|
-
return str;
|
|
3572
|
-
}
|
|
3573
|
-
function convexToJsonInternal2(value, originalValue, context, includeTopLevelUndefined) {
|
|
3574
|
-
if (value === undefined) {
|
|
3575
|
-
const contextText = context && ` (present at path ${context} in original object ${stringifyValueForError2(originalValue)})`;
|
|
3576
|
-
throw new Error(`undefined is not a valid Convex value${contextText}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`);
|
|
3577
|
-
}
|
|
3578
|
-
if (value === null) {
|
|
3579
|
-
return value;
|
|
3277
|
+
// ../../node_modules/convex/dist/esm/browser/logging.js
|
|
3278
|
+
function prefix_for_source(source) {
|
|
3279
|
+
switch (source) {
|
|
3280
|
+
case "query":
|
|
3281
|
+
return "Q";
|
|
3282
|
+
case "mutation":
|
|
3283
|
+
return "M";
|
|
3284
|
+
case "action":
|
|
3285
|
+
return "A";
|
|
3286
|
+
case "any":
|
|
3287
|
+
return "?";
|
|
3580
3288
|
}
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3289
|
+
}
|
|
3290
|
+
|
|
3291
|
+
class DefaultLogger {
|
|
3292
|
+
constructor(options) {
|
|
3293
|
+
__publicField3(this, "_onLogLineFuncs");
|
|
3294
|
+
__publicField3(this, "_verbose");
|
|
3295
|
+
this._onLogLineFuncs = {};
|
|
3296
|
+
this._verbose = options.verbose;
|
|
3586
3297
|
}
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3298
|
+
addLogLineListener(func) {
|
|
3299
|
+
let id = Math.random().toString(36).substring(2, 15);
|
|
3300
|
+
for (let i3 = 0;i3 < 10; i3++) {
|
|
3301
|
+
if (this._onLogLineFuncs[id] === undefined) {
|
|
3302
|
+
break;
|
|
3303
|
+
}
|
|
3304
|
+
id = Math.random().toString(36).substring(2, 15);
|
|
3594
3305
|
}
|
|
3306
|
+
this._onLogLineFuncs[id] = func;
|
|
3307
|
+
return () => {
|
|
3308
|
+
delete this._onLogLineFuncs[id];
|
|
3309
|
+
};
|
|
3595
3310
|
}
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
if (value instanceof ArrayBuffer) {
|
|
3603
|
-
return { $bytes: fromByteArray2(new Uint8Array(value)) };
|
|
3604
|
-
}
|
|
3605
|
-
if (Array.isArray(value)) {
|
|
3606
|
-
return value.map((value2, i4) => convexToJsonInternal2(value2, originalValue, context + `[${i4}]`, false));
|
|
3607
|
-
}
|
|
3608
|
-
if (value instanceof Set) {
|
|
3609
|
-
throw new Error(errorMessageForUnsupportedType2(context, "Set", [...value], originalValue));
|
|
3311
|
+
logVerbose(...args) {
|
|
3312
|
+
if (this._verbose) {
|
|
3313
|
+
for (const func of Object.values(this._onLogLineFuncs)) {
|
|
3314
|
+
func("debug", `${(/* @__PURE__ */ new Date()).toISOString()}`, ...args);
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3610
3317
|
}
|
|
3611
|
-
|
|
3612
|
-
|
|
3318
|
+
log(...args) {
|
|
3319
|
+
for (const func of Object.values(this._onLogLineFuncs)) {
|
|
3320
|
+
func("info", ...args);
|
|
3321
|
+
}
|
|
3613
3322
|
}
|
|
3614
|
-
|
|
3615
|
-
const
|
|
3616
|
-
|
|
3617
|
-
|
|
3323
|
+
warn(...args) {
|
|
3324
|
+
for (const func of Object.values(this._onLogLineFuncs)) {
|
|
3325
|
+
func("warn", ...args);
|
|
3326
|
+
}
|
|
3618
3327
|
}
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
for (const [k2, v2] of entries) {
|
|
3623
|
-
if (v2 !== undefined) {
|
|
3624
|
-
validateObjectField2(k2);
|
|
3625
|
-
out[k2] = convexToJsonInternal2(v2, originalValue, context + `.${k2}`, false);
|
|
3626
|
-
} else if (includeTopLevelUndefined) {
|
|
3627
|
-
validateObjectField2(k2);
|
|
3628
|
-
out[k2] = convexOrUndefinedToJsonInternal2(v2, originalValue, context + `.${k2}`);
|
|
3328
|
+
error(...args) {
|
|
3329
|
+
for (const func of Object.values(this._onLogLineFuncs)) {
|
|
3330
|
+
func("error", ...args);
|
|
3629
3331
|
}
|
|
3630
3332
|
}
|
|
3631
|
-
return out;
|
|
3632
3333
|
}
|
|
3633
|
-
function
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3334
|
+
function instantiateDefaultLogger(options) {
|
|
3335
|
+
const logger = new DefaultLogger(options);
|
|
3336
|
+
logger.addLogLineListener((level, ...args) => {
|
|
3337
|
+
switch (level) {
|
|
3338
|
+
case "debug":
|
|
3339
|
+
console.debug(...args);
|
|
3340
|
+
break;
|
|
3341
|
+
case "info":
|
|
3342
|
+
console.log(...args);
|
|
3343
|
+
break;
|
|
3344
|
+
case "warn":
|
|
3345
|
+
console.warn(...args);
|
|
3346
|
+
break;
|
|
3347
|
+
case "error":
|
|
3348
|
+
console.error(...args);
|
|
3349
|
+
break;
|
|
3350
|
+
default: {
|
|
3351
|
+
console.log(...args);
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
});
|
|
3355
|
+
return logger;
|
|
3639
3356
|
}
|
|
3640
|
-
function
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3357
|
+
function instantiateNoopLogger(options) {
|
|
3358
|
+
return new DefaultLogger(options);
|
|
3359
|
+
}
|
|
3360
|
+
function logForFunction(logger, type, source, udfPath, message) {
|
|
3361
|
+
const prefix = prefix_for_source(source);
|
|
3362
|
+
if (typeof message === "object") {
|
|
3363
|
+
message = `ConvexError ${JSON.stringify(message.errorData, null, 2)}`;
|
|
3364
|
+
}
|
|
3365
|
+
if (type === "info") {
|
|
3366
|
+
const match = message.match(/^\[.*?\] /);
|
|
3367
|
+
if (match === null) {
|
|
3368
|
+
logger.error(`[CONVEX ${prefix}(${udfPath})] Could not parse console.log`);
|
|
3369
|
+
return;
|
|
3646
3370
|
}
|
|
3647
|
-
|
|
3371
|
+
const level = message.slice(1, match[0].length - 2);
|
|
3372
|
+
const args = message.slice(match[0].length);
|
|
3373
|
+
logger.log(`%c[CONVEX ${prefix}(${udfPath})] [${level}]`, INFO_COLOR, args);
|
|
3374
|
+
} else {
|
|
3375
|
+
logger.error(`[CONVEX ${prefix}(${udfPath})] ${message}`);
|
|
3648
3376
|
}
|
|
3649
3377
|
}
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
var LITTLE_ENDIAN2 = true, MIN_INT642, MAX_INT642, ZERO2, EIGHT2, TWOFIFTYSIX2, bigIntToBase642, base64ToBigInt2, MAX_IDENTIFIER_LEN2 = 1024, MAX_VALUE_FOR_ERROR_LEN2 = 16384;
|
|
3654
|
-
var init_value2 = __esm(() => {
|
|
3655
|
-
init_base642();
|
|
3656
|
-
MIN_INT642 = BigInt("-9223372036854775808");
|
|
3657
|
-
MAX_INT642 = BigInt("9223372036854775807");
|
|
3658
|
-
ZERO2 = BigInt("0");
|
|
3659
|
-
EIGHT2 = BigInt("8");
|
|
3660
|
-
TWOFIFTYSIX2 = BigInt("256");
|
|
3661
|
-
bigIntToBase642 = DataView.prototype.setBigInt64 ? modernBigIntToBase642 : slowBigIntToBase642;
|
|
3662
|
-
base64ToBigInt2 = DataView.prototype.getBigInt64 ? modernBase64ToBigInt2 : slowBase64ToBigInt2;
|
|
3378
|
+
var __defProp5, __defNormalProp3 = (obj, key, value) => (key in obj) ? __defProp5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value, __publicField3 = (obj, key, value) => __defNormalProp3(obj, typeof key !== "symbol" ? key + "" : key, value), INFO_COLOR = "color:rgb(0, 145, 255)";
|
|
3379
|
+
var init_logging = __esm(() => {
|
|
3380
|
+
__defProp5 = Object.defineProperty;
|
|
3663
3381
|
});
|
|
3664
3382
|
|
|
3665
|
-
// ../../node_modules
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
}
|
|
3383
|
+
// ../../node_modules/convex/dist/esm/server/functionName.js
|
|
3384
|
+
var functionName;
|
|
3385
|
+
var init_functionName = __esm(() => {
|
|
3386
|
+
functionName = Symbol.for("functionName");
|
|
3387
|
+
});
|
|
3670
3388
|
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
__publicField4(this, "fieldPaths");
|
|
3675
|
-
__publicField4(this, "isOptional");
|
|
3676
|
-
__publicField4(this, "isConvexValidator");
|
|
3677
|
-
this.isOptional = isOptional;
|
|
3678
|
-
this.isConvexValidator = true;
|
|
3679
|
-
}
|
|
3389
|
+
// ../../node_modules/convex/dist/esm/server/components/paths.js
|
|
3390
|
+
function extractReferencePath(reference) {
|
|
3391
|
+
return reference[toReferencePath] ?? null;
|
|
3680
3392
|
}
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
}
|
|
3690
|
-
|
|
3691
|
-
__publicField4(this, "tableName");
|
|
3692
|
-
__publicField4(this, "kind", "id");
|
|
3693
|
-
if (typeof tableName !== "string") {
|
|
3694
|
-
throw new Error("v.id(tableName) requires a string");
|
|
3695
|
-
}
|
|
3696
|
-
this.tableName = tableName;
|
|
3697
|
-
}
|
|
3698
|
-
get json() {
|
|
3699
|
-
return { type: "id", tableName: this.tableName };
|
|
3700
|
-
}
|
|
3701
|
-
asOptional() {
|
|
3702
|
-
return new VId({
|
|
3703
|
-
isOptional: "optional",
|
|
3704
|
-
tableName: this.tableName
|
|
3705
|
-
});
|
|
3706
|
-
}
|
|
3707
|
-
};
|
|
3708
|
-
VFloat64 = class VFloat64 extends BaseValidator {
|
|
3709
|
-
constructor() {
|
|
3710
|
-
super(...arguments);
|
|
3711
|
-
__publicField4(this, "kind", "float64");
|
|
3712
|
-
}
|
|
3713
|
-
get json() {
|
|
3714
|
-
return { type: "number" };
|
|
3715
|
-
}
|
|
3716
|
-
asOptional() {
|
|
3717
|
-
return new VFloat64({
|
|
3718
|
-
isOptional: "optional"
|
|
3719
|
-
});
|
|
3720
|
-
}
|
|
3721
|
-
};
|
|
3722
|
-
VInt64 = class VInt64 extends BaseValidator {
|
|
3723
|
-
constructor() {
|
|
3724
|
-
super(...arguments);
|
|
3725
|
-
__publicField4(this, "kind", "int64");
|
|
3726
|
-
}
|
|
3727
|
-
get json() {
|
|
3728
|
-
return { type: "bigint" };
|
|
3729
|
-
}
|
|
3730
|
-
asOptional() {
|
|
3731
|
-
return new VInt64({ isOptional: "optional" });
|
|
3732
|
-
}
|
|
3733
|
-
};
|
|
3734
|
-
VBoolean = class VBoolean extends BaseValidator {
|
|
3735
|
-
constructor() {
|
|
3736
|
-
super(...arguments);
|
|
3737
|
-
__publicField4(this, "kind", "boolean");
|
|
3738
|
-
}
|
|
3739
|
-
get json() {
|
|
3740
|
-
return { type: this.kind };
|
|
3741
|
-
}
|
|
3742
|
-
asOptional() {
|
|
3743
|
-
return new VBoolean({
|
|
3744
|
-
isOptional: "optional"
|
|
3745
|
-
});
|
|
3746
|
-
}
|
|
3747
|
-
};
|
|
3748
|
-
VBytes = class VBytes extends BaseValidator {
|
|
3749
|
-
constructor() {
|
|
3750
|
-
super(...arguments);
|
|
3751
|
-
__publicField4(this, "kind", "bytes");
|
|
3752
|
-
}
|
|
3753
|
-
get json() {
|
|
3754
|
-
return { type: this.kind };
|
|
3755
|
-
}
|
|
3756
|
-
asOptional() {
|
|
3757
|
-
return new VBytes({ isOptional: "optional" });
|
|
3758
|
-
}
|
|
3759
|
-
};
|
|
3760
|
-
VString = class VString extends BaseValidator {
|
|
3761
|
-
constructor() {
|
|
3762
|
-
super(...arguments);
|
|
3763
|
-
__publicField4(this, "kind", "string");
|
|
3764
|
-
}
|
|
3765
|
-
get json() {
|
|
3766
|
-
return { type: this.kind };
|
|
3767
|
-
}
|
|
3768
|
-
asOptional() {
|
|
3769
|
-
return new VString({
|
|
3770
|
-
isOptional: "optional"
|
|
3771
|
-
});
|
|
3393
|
+
function isFunctionHandle(s2) {
|
|
3394
|
+
return s2.startsWith("function://");
|
|
3395
|
+
}
|
|
3396
|
+
function getFunctionAddress(functionReference) {
|
|
3397
|
+
let functionAddress;
|
|
3398
|
+
if (typeof functionReference === "string") {
|
|
3399
|
+
if (isFunctionHandle(functionReference)) {
|
|
3400
|
+
functionAddress = { functionHandle: functionReference };
|
|
3401
|
+
} else {
|
|
3402
|
+
functionAddress = { name: functionReference };
|
|
3772
3403
|
}
|
|
3773
|
-
}
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3404
|
+
} else if (functionReference[functionName]) {
|
|
3405
|
+
functionAddress = { name: functionReference[functionName] };
|
|
3406
|
+
} else {
|
|
3407
|
+
const referencePath = extractReferencePath(functionReference);
|
|
3408
|
+
if (!referencePath) {
|
|
3409
|
+
throw new Error(`${functionReference} is not a functionReference`);
|
|
3778
3410
|
}
|
|
3779
|
-
|
|
3780
|
-
|
|
3411
|
+
functionAddress = { reference: referencePath };
|
|
3412
|
+
}
|
|
3413
|
+
return functionAddress;
|
|
3414
|
+
}
|
|
3415
|
+
var toReferencePath;
|
|
3416
|
+
var init_paths = __esm(() => {
|
|
3417
|
+
init_functionName();
|
|
3418
|
+
toReferencePath = Symbol.for("toReferencePath");
|
|
3419
|
+
});
|
|
3420
|
+
|
|
3421
|
+
// ../../node_modules/convex/dist/esm/server/api.js
|
|
3422
|
+
function getFunctionName(functionReference) {
|
|
3423
|
+
const address = getFunctionAddress(functionReference);
|
|
3424
|
+
if (address.name === undefined) {
|
|
3425
|
+
if (address.functionHandle !== undefined) {
|
|
3426
|
+
throw new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${address.functionHandle}`);
|
|
3427
|
+
} else if (address.reference !== undefined) {
|
|
3428
|
+
throw new Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${address.reference}`);
|
|
3781
3429
|
}
|
|
3782
|
-
|
|
3783
|
-
|
|
3430
|
+
throw new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(address)}`);
|
|
3431
|
+
}
|
|
3432
|
+
if (typeof functionReference === "string")
|
|
3433
|
+
return functionReference;
|
|
3434
|
+
const name = functionReference[functionName];
|
|
3435
|
+
if (!name) {
|
|
3436
|
+
throw new Error(`${functionReference} is not a functionReference`);
|
|
3437
|
+
}
|
|
3438
|
+
return name;
|
|
3439
|
+
}
|
|
3440
|
+
function createApi(pathParts = []) {
|
|
3441
|
+
const handler = {
|
|
3442
|
+
get(_3, prop) {
|
|
3443
|
+
if (typeof prop === "string") {
|
|
3444
|
+
const newParts = [...pathParts, prop];
|
|
3445
|
+
return createApi(newParts);
|
|
3446
|
+
} else if (prop === functionName) {
|
|
3447
|
+
if (pathParts.length < 2) {
|
|
3448
|
+
const found = ["api", ...pathParts].join(".");
|
|
3449
|
+
throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${found}\``);
|
|
3450
|
+
}
|
|
3451
|
+
const path = pathParts.slice(0, -1).join("/");
|
|
3452
|
+
const exportName = pathParts[pathParts.length - 1];
|
|
3453
|
+
if (exportName === "default") {
|
|
3454
|
+
return path;
|
|
3455
|
+
} else {
|
|
3456
|
+
return path + ":" + exportName;
|
|
3457
|
+
}
|
|
3458
|
+
} else if (prop === Symbol.toStringTag) {
|
|
3459
|
+
return "FunctionReference";
|
|
3460
|
+
} else {
|
|
3461
|
+
return;
|
|
3462
|
+
}
|
|
3784
3463
|
}
|
|
3785
3464
|
};
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3465
|
+
return new Proxy({}, handler);
|
|
3466
|
+
}
|
|
3467
|
+
var anyApi;
|
|
3468
|
+
var init_api = __esm(() => {
|
|
3469
|
+
init_functionName();
|
|
3470
|
+
init_paths();
|
|
3471
|
+
anyApi = createApi();
|
|
3472
|
+
});
|
|
3473
|
+
|
|
3474
|
+
// ../../node_modules/convex/dist/esm/browser/http_client.js
|
|
3475
|
+
class ConvexHttpClient {
|
|
3476
|
+
constructor(address, options) {
|
|
3477
|
+
__publicField4(this, "address");
|
|
3478
|
+
__publicField4(this, "auth");
|
|
3479
|
+
__publicField4(this, "adminAuth");
|
|
3480
|
+
__publicField4(this, "encodedTsPromise");
|
|
3481
|
+
__publicField4(this, "debug");
|
|
3482
|
+
__publicField4(this, "fetchOptions");
|
|
3483
|
+
__publicField4(this, "fetch");
|
|
3484
|
+
__publicField4(this, "logger");
|
|
3485
|
+
__publicField4(this, "mutationQueue", []);
|
|
3486
|
+
__publicField4(this, "isProcessingQueue", false);
|
|
3487
|
+
if (typeof options === "boolean") {
|
|
3488
|
+
throw new Error("skipConvexDeploymentUrlCheck as the second argument is no longer supported. Please pass an options object, `{ skipConvexDeploymentUrlCheck: true }`.");
|
|
3790
3489
|
}
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
};
|
|
3490
|
+
const opts = options ?? {};
|
|
3491
|
+
if (opts.skipConvexDeploymentUrlCheck !== true) {
|
|
3492
|
+
validateDeploymentUrl(address);
|
|
3795
3493
|
}
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3494
|
+
this.logger = options?.logger === false ? instantiateNoopLogger({ verbose: false }) : options?.logger !== true && options?.logger ? options.logger : instantiateDefaultLogger({ verbose: false });
|
|
3495
|
+
this.address = address;
|
|
3496
|
+
this.debug = true;
|
|
3497
|
+
this.auth = undefined;
|
|
3498
|
+
this.adminAuth = undefined;
|
|
3499
|
+
this.fetch = options?.fetch;
|
|
3500
|
+
if (options?.auth) {
|
|
3501
|
+
this.setAuth(options.auth);
|
|
3800
3502
|
}
|
|
3801
|
-
}
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
}
|
|
3818
|
-
|
|
3503
|
+
}
|
|
3504
|
+
backendUrl() {
|
|
3505
|
+
return `${this.address}/api`;
|
|
3506
|
+
}
|
|
3507
|
+
get url() {
|
|
3508
|
+
return this.address;
|
|
3509
|
+
}
|
|
3510
|
+
setAuth(value) {
|
|
3511
|
+
this.clearAuth();
|
|
3512
|
+
this.auth = value;
|
|
3513
|
+
}
|
|
3514
|
+
setAdminAuth(token, actingAsIdentity) {
|
|
3515
|
+
this.clearAuth();
|
|
3516
|
+
if (actingAsIdentity !== undefined) {
|
|
3517
|
+
const bytes = new TextEncoder().encode(JSON.stringify(actingAsIdentity));
|
|
3518
|
+
const actingAsIdentityEncoded = btoa(String.fromCodePoint(...bytes));
|
|
3519
|
+
this.adminAuth = `${token}:${actingAsIdentityEncoded}`;
|
|
3520
|
+
} else {
|
|
3521
|
+
this.adminAuth = token;
|
|
3819
3522
|
}
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3523
|
+
}
|
|
3524
|
+
clearAuth() {
|
|
3525
|
+
this.auth = undefined;
|
|
3526
|
+
this.adminAuth = undefined;
|
|
3527
|
+
}
|
|
3528
|
+
setDebug(debug2) {
|
|
3529
|
+
this.debug = debug2;
|
|
3530
|
+
}
|
|
3531
|
+
setFetchOptions(fetchOptions) {
|
|
3532
|
+
this.fetchOptions = fetchOptions;
|
|
3533
|
+
}
|
|
3534
|
+
async consistentQuery(query, ...args) {
|
|
3535
|
+
const queryArgs = parseArgs2(args[0]);
|
|
3536
|
+
const timestampPromise = this.getTimestamp();
|
|
3537
|
+
return await this.queryInner(query, queryArgs, { timestampPromise });
|
|
3538
|
+
}
|
|
3539
|
+
async getTimestamp() {
|
|
3540
|
+
if (this.encodedTsPromise) {
|
|
3541
|
+
return this.encodedTsPromise;
|
|
3831
3542
|
}
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3543
|
+
return this.encodedTsPromise = this.getTimestampInner();
|
|
3544
|
+
}
|
|
3545
|
+
async getTimestampInner() {
|
|
3546
|
+
const localFetch = this.fetch || specifiedFetch || fetch;
|
|
3547
|
+
const headers = {
|
|
3548
|
+
"Content-Type": "application/json",
|
|
3549
|
+
"Convex-Client": `npm-${version}`
|
|
3550
|
+
};
|
|
3551
|
+
const response = await localFetch(`${this.address}/api/query_ts`, {
|
|
3552
|
+
...this.fetchOptions,
|
|
3553
|
+
method: "POST",
|
|
3554
|
+
headers
|
|
3555
|
+
});
|
|
3556
|
+
if (!response.ok) {
|
|
3557
|
+
throw new Error(await response.text());
|
|
3837
3558
|
}
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3559
|
+
const { ts } = await response.json();
|
|
3560
|
+
return ts;
|
|
3561
|
+
}
|
|
3562
|
+
async query(query, ...args) {
|
|
3563
|
+
const queryArgs = parseArgs2(args[0]);
|
|
3564
|
+
return await this.queryInner(query, queryArgs, {});
|
|
3565
|
+
}
|
|
3566
|
+
async queryInner(query, queryArgs, options) {
|
|
3567
|
+
const name = getFunctionName(query);
|
|
3568
|
+
const args = [convexToJson(queryArgs)];
|
|
3569
|
+
const headers = {
|
|
3570
|
+
"Content-Type": "application/json",
|
|
3571
|
+
"Convex-Client": `npm-${version}`
|
|
3572
|
+
};
|
|
3573
|
+
if (this.adminAuth) {
|
|
3574
|
+
headers["Authorization"] = `Convex ${this.adminAuth}`;
|
|
3575
|
+
} else if (this.auth) {
|
|
3576
|
+
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
3847
3577
|
}
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3578
|
+
const localFetch = this.fetch || specifiedFetch || fetch;
|
|
3579
|
+
const timestamp = options.timestampPromise ? await options.timestampPromise : undefined;
|
|
3580
|
+
const body = JSON.stringify({
|
|
3581
|
+
path: name,
|
|
3582
|
+
format: "convex_encoded_json",
|
|
3583
|
+
args,
|
|
3584
|
+
...timestamp ? { ts: timestamp } : {}
|
|
3585
|
+
});
|
|
3586
|
+
const endpoint = timestamp ? `${this.address}/api/query_at_ts` : `${this.address}/api/query`;
|
|
3587
|
+
const response = await localFetch(endpoint, {
|
|
3588
|
+
...this.fetchOptions,
|
|
3589
|
+
body,
|
|
3590
|
+
method: "POST",
|
|
3591
|
+
headers
|
|
3592
|
+
});
|
|
3593
|
+
if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
|
|
3594
|
+
throw new Error(await response.text());
|
|
3857
3595
|
}
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
for (const
|
|
3861
|
-
|
|
3596
|
+
const respJSON = await response.json();
|
|
3597
|
+
if (this.debug) {
|
|
3598
|
+
for (const line of respJSON.logLines ?? []) {
|
|
3599
|
+
logForFunction(this.logger, "info", "query", name, line);
|
|
3862
3600
|
}
|
|
3863
|
-
return new VObject({
|
|
3864
|
-
isOptional: this.isOptional,
|
|
3865
|
-
fields: newFields
|
|
3866
|
-
});
|
|
3867
|
-
}
|
|
3868
|
-
extend(fields) {
|
|
3869
|
-
return new VObject({
|
|
3870
|
-
isOptional: this.isOptional,
|
|
3871
|
-
fields: { ...this.fields, ...fields }
|
|
3872
|
-
});
|
|
3873
3601
|
}
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
throw new Error(
|
|
3882
|
-
|
|
3883
|
-
|
|
3602
|
+
switch (respJSON.status) {
|
|
3603
|
+
case "success":
|
|
3604
|
+
return jsonToConvex(respJSON.value);
|
|
3605
|
+
case "error":
|
|
3606
|
+
if (respJSON.errorData !== undefined) {
|
|
3607
|
+
throw forwardErrorData(respJSON.errorData, new ConvexError(respJSON.errorMessage));
|
|
3608
|
+
}
|
|
3609
|
+
throw new Error(respJSON.errorMessage);
|
|
3610
|
+
default:
|
|
3611
|
+
throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
|
|
3884
3612
|
}
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3613
|
+
}
|
|
3614
|
+
async mutationInner(mutation, mutationArgs) {
|
|
3615
|
+
const name = getFunctionName(mutation);
|
|
3616
|
+
const body = JSON.stringify({
|
|
3617
|
+
path: name,
|
|
3618
|
+
format: "convex_encoded_json",
|
|
3619
|
+
args: [convexToJson(mutationArgs)]
|
|
3620
|
+
});
|
|
3621
|
+
const headers = {
|
|
3622
|
+
"Content-Type": "application/json",
|
|
3623
|
+
"Convex-Client": `npm-${version}`
|
|
3624
|
+
};
|
|
3625
|
+
if (this.adminAuth) {
|
|
3626
|
+
headers["Authorization"] = `Convex ${this.adminAuth}`;
|
|
3627
|
+
} else if (this.auth) {
|
|
3628
|
+
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
3890
3629
|
}
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3630
|
+
const localFetch = this.fetch || specifiedFetch || fetch;
|
|
3631
|
+
const response = await localFetch(`${this.address}/api/mutation`, {
|
|
3632
|
+
...this.fetchOptions,
|
|
3633
|
+
body,
|
|
3634
|
+
method: "POST",
|
|
3635
|
+
headers
|
|
3636
|
+
});
|
|
3637
|
+
if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
|
|
3638
|
+
throw new Error(await response.text());
|
|
3896
3639
|
}
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
element
|
|
3902
|
-
}) {
|
|
3903
|
-
super({ isOptional });
|
|
3904
|
-
__publicField4(this, "element");
|
|
3905
|
-
__publicField4(this, "kind", "array");
|
|
3906
|
-
if (element === undefined) {
|
|
3907
|
-
throwUndefinedValidatorError("v.array()");
|
|
3640
|
+
const respJSON = await response.json();
|
|
3641
|
+
if (this.debug) {
|
|
3642
|
+
for (const line of respJSON.logLines ?? []) {
|
|
3643
|
+
logForFunction(this.logger, "info", "mutation", name, line);
|
|
3908
3644
|
}
|
|
3909
|
-
this.element = element;
|
|
3910
3645
|
}
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3646
|
+
switch (respJSON.status) {
|
|
3647
|
+
case "success":
|
|
3648
|
+
return jsonToConvex(respJSON.value);
|
|
3649
|
+
case "error":
|
|
3650
|
+
if (respJSON.errorData !== undefined) {
|
|
3651
|
+
throw forwardErrorData(respJSON.errorData, new ConvexError(respJSON.errorMessage));
|
|
3652
|
+
}
|
|
3653
|
+
throw new Error(respJSON.errorMessage);
|
|
3654
|
+
default:
|
|
3655
|
+
throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
|
|
3916
3656
|
}
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
});
|
|
3657
|
+
}
|
|
3658
|
+
async processMutationQueue() {
|
|
3659
|
+
if (this.isProcessingQueue) {
|
|
3660
|
+
return;
|
|
3922
3661
|
}
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
__publicField4(this, "key");
|
|
3932
|
-
__publicField4(this, "value");
|
|
3933
|
-
__publicField4(this, "kind", "record");
|
|
3934
|
-
if (key === undefined) {
|
|
3935
|
-
throwUndefinedValidatorError("v.record()", "key");
|
|
3936
|
-
}
|
|
3937
|
-
if (value === undefined) {
|
|
3938
|
-
throwUndefinedValidatorError("v.record()", "value");
|
|
3939
|
-
}
|
|
3940
|
-
if (key.isOptional === "optional") {
|
|
3941
|
-
throw new Error("Record validator cannot have optional keys");
|
|
3942
|
-
}
|
|
3943
|
-
if (value.isOptional === "optional") {
|
|
3944
|
-
throw new Error("Record validator cannot have optional values");
|
|
3945
|
-
}
|
|
3946
|
-
if (!key.isConvexValidator || !value.isConvexValidator) {
|
|
3947
|
-
throw new Error("Key and value of v.record() but be validators");
|
|
3662
|
+
this.isProcessingQueue = true;
|
|
3663
|
+
while (this.mutationQueue.length > 0) {
|
|
3664
|
+
const { mutation, args, resolve, reject } = this.mutationQueue.shift();
|
|
3665
|
+
try {
|
|
3666
|
+
const result = await this.mutationInner(mutation, args);
|
|
3667
|
+
resolve(result);
|
|
3668
|
+
} catch (error) {
|
|
3669
|
+
reject(error);
|
|
3948
3670
|
}
|
|
3949
|
-
this.key = key;
|
|
3950
|
-
this.value = value;
|
|
3951
3671
|
}
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3672
|
+
this.isProcessingQueue = false;
|
|
3673
|
+
}
|
|
3674
|
+
enqueueMutation(mutation, args) {
|
|
3675
|
+
return new Promise((resolve, reject) => {
|
|
3676
|
+
this.mutationQueue.push({ mutation, args, resolve, reject });
|
|
3677
|
+
this.processMutationQueue();
|
|
3678
|
+
});
|
|
3679
|
+
}
|
|
3680
|
+
async mutation(mutation, ...args) {
|
|
3681
|
+
const [fnArgs, options] = args;
|
|
3682
|
+
const mutationArgs = parseArgs2(fnArgs);
|
|
3683
|
+
const queued = !options?.skipQueue;
|
|
3684
|
+
if (queued) {
|
|
3685
|
+
return await this.enqueueMutation(mutation, mutationArgs);
|
|
3686
|
+
} else {
|
|
3687
|
+
return await this.mutationInner(mutation, mutationArgs);
|
|
3961
3688
|
}
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3689
|
+
}
|
|
3690
|
+
async action(action, ...args) {
|
|
3691
|
+
const actionArgs = parseArgs2(args[0]);
|
|
3692
|
+
const name = getFunctionName(action);
|
|
3693
|
+
const body = JSON.stringify({
|
|
3694
|
+
path: name,
|
|
3695
|
+
format: "convex_encoded_json",
|
|
3696
|
+
args: [convexToJson(actionArgs)]
|
|
3697
|
+
});
|
|
3698
|
+
const headers = {
|
|
3699
|
+
"Content-Type": "application/json",
|
|
3700
|
+
"Convex-Client": `npm-${version}`
|
|
3701
|
+
};
|
|
3702
|
+
if (this.adminAuth) {
|
|
3703
|
+
headers["Authorization"] = `Convex ${this.adminAuth}`;
|
|
3704
|
+
} else if (this.auth) {
|
|
3705
|
+
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
3968
3706
|
}
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
}
|
|
3979
|
-
if (!member.isConvexValidator) {
|
|
3980
|
-
throw new Error("All members of v.union() must be validators");
|
|
3981
|
-
}
|
|
3982
|
-
});
|
|
3983
|
-
this.members = members;
|
|
3707
|
+
const localFetch = this.fetch || specifiedFetch || fetch;
|
|
3708
|
+
const response = await localFetch(`${this.address}/api/action`, {
|
|
3709
|
+
...this.fetchOptions,
|
|
3710
|
+
body,
|
|
3711
|
+
method: "POST",
|
|
3712
|
+
headers
|
|
3713
|
+
});
|
|
3714
|
+
if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
|
|
3715
|
+
throw new Error(await response.text());
|
|
3984
3716
|
}
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
}
|
|
3717
|
+
const respJSON = await response.json();
|
|
3718
|
+
if (this.debug) {
|
|
3719
|
+
for (const line of respJSON.logLines ?? []) {
|
|
3720
|
+
logForFunction(this.logger, "info", "action", name, line);
|
|
3721
|
+
}
|
|
3990
3722
|
}
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3723
|
+
switch (respJSON.status) {
|
|
3724
|
+
case "success":
|
|
3725
|
+
return jsonToConvex(respJSON.value);
|
|
3726
|
+
case "error":
|
|
3727
|
+
if (respJSON.errorData !== undefined) {
|
|
3728
|
+
throw forwardErrorData(respJSON.errorData, new ConvexError(respJSON.errorMessage));
|
|
3729
|
+
}
|
|
3730
|
+
throw new Error(respJSON.errorMessage);
|
|
3731
|
+
default:
|
|
3732
|
+
throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
|
|
3996
3733
|
}
|
|
3997
|
-
}
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
}
|
|
4010
|
-
}
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
}
|
|
4014
|
-
|
|
4015
|
-
return new VFloat64({ isOptional: "required" });
|
|
4016
|
-
},
|
|
4017
|
-
float64: () => {
|
|
4018
|
-
return new VFloat64({ isOptional: "required" });
|
|
4019
|
-
},
|
|
4020
|
-
bigint: () => {
|
|
4021
|
-
return new VInt64({ isOptional: "required" });
|
|
4022
|
-
},
|
|
4023
|
-
int64: () => {
|
|
4024
|
-
return new VInt64({ isOptional: "required" });
|
|
4025
|
-
},
|
|
4026
|
-
boolean: () => {
|
|
4027
|
-
return new VBoolean({ isOptional: "required" });
|
|
4028
|
-
},
|
|
4029
|
-
string: () => {
|
|
4030
|
-
return new VString({ isOptional: "required" });
|
|
4031
|
-
},
|
|
4032
|
-
bytes: () => {
|
|
4033
|
-
return new VBytes({ isOptional: "required" });
|
|
4034
|
-
},
|
|
4035
|
-
literal: (literal) => {
|
|
4036
|
-
return new VLiteral({ isOptional: "required", value: literal });
|
|
4037
|
-
},
|
|
4038
|
-
array: (element) => {
|
|
4039
|
-
return new VArray({ isOptional: "required", element });
|
|
4040
|
-
},
|
|
4041
|
-
object: (fields) => {
|
|
4042
|
-
return new VObject({ isOptional: "required", fields });
|
|
4043
|
-
},
|
|
4044
|
-
record: (keys, values) => {
|
|
4045
|
-
return new VRecord({
|
|
4046
|
-
isOptional: "required",
|
|
4047
|
-
key: keys,
|
|
4048
|
-
value: values
|
|
4049
|
-
});
|
|
4050
|
-
},
|
|
4051
|
-
union: (...members) => {
|
|
4052
|
-
return new VUnion({
|
|
4053
|
-
isOptional: "required",
|
|
4054
|
-
members
|
|
4055
|
-
});
|
|
4056
|
-
},
|
|
4057
|
-
any: () => {
|
|
4058
|
-
return new VAny({ isOptional: "required" });
|
|
4059
|
-
},
|
|
4060
|
-
optional: (value) => {
|
|
4061
|
-
return value.asOptional();
|
|
4062
|
-
},
|
|
4063
|
-
nullable: (value) => {
|
|
4064
|
-
return v2.union(value, v2.null());
|
|
3734
|
+
}
|
|
3735
|
+
async function(anyFunction, componentPath, ...args) {
|
|
3736
|
+
const functionArgs = parseArgs2(args[0]);
|
|
3737
|
+
const name = typeof anyFunction === "string" ? anyFunction : getFunctionName(anyFunction);
|
|
3738
|
+
const body = JSON.stringify({
|
|
3739
|
+
componentPath,
|
|
3740
|
+
path: name,
|
|
3741
|
+
format: "convex_encoded_json",
|
|
3742
|
+
args: convexToJson(functionArgs)
|
|
3743
|
+
});
|
|
3744
|
+
const headers = {
|
|
3745
|
+
"Content-Type": "application/json",
|
|
3746
|
+
"Convex-Client": `npm-${version}`
|
|
3747
|
+
};
|
|
3748
|
+
if (this.adminAuth) {
|
|
3749
|
+
headers["Authorization"] = `Convex ${this.adminAuth}`;
|
|
3750
|
+
} else if (this.auth) {
|
|
3751
|
+
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
4065
3752
|
}
|
|
4066
|
-
|
|
4067
|
-
}
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
3753
|
+
const localFetch = this.fetch || specifiedFetch || fetch;
|
|
3754
|
+
const response = await localFetch(`${this.address}/api/function`, {
|
|
3755
|
+
...this.fetchOptions,
|
|
3756
|
+
body,
|
|
3757
|
+
method: "POST",
|
|
3758
|
+
headers
|
|
3759
|
+
});
|
|
3760
|
+
if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
|
|
3761
|
+
throw new Error(await response.text());
|
|
3762
|
+
}
|
|
3763
|
+
const respJSON = await response.json();
|
|
3764
|
+
if (this.debug) {
|
|
3765
|
+
for (const line of respJSON.logLines ?? []) {
|
|
3766
|
+
logForFunction(this.logger, "info", "any", name, line);
|
|
3767
|
+
}
|
|
3768
|
+
}
|
|
3769
|
+
switch (respJSON.status) {
|
|
3770
|
+
case "success":
|
|
3771
|
+
return jsonToConvex(respJSON.value);
|
|
3772
|
+
case "error":
|
|
3773
|
+
if (respJSON.errorData !== undefined) {
|
|
3774
|
+
throw forwardErrorData(respJSON.errorData, new ConvexError(respJSON.errorMessage));
|
|
3775
|
+
}
|
|
3776
|
+
throw new Error(respJSON.errorMessage);
|
|
3777
|
+
default:
|
|
3778
|
+
throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
|
|
3779
|
+
}
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
function forwardErrorData(errorData, error) {
|
|
3783
|
+
error.data = jsonToConvex(errorData);
|
|
3784
|
+
return error;
|
|
3785
|
+
}
|
|
3786
|
+
var __defProp6, __defNormalProp4 = (obj, key, value) => (key in obj) ? __defProp6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value, __publicField4 = (obj, key, value) => __defNormalProp4(obj, typeof key !== "symbol" ? key + "" : key, value), STATUS_CODE_UDF_FAILED = 560, specifiedFetch = undefined;
|
|
3787
|
+
var init_http_client = __esm(() => {
|
|
3788
|
+
init_api();
|
|
3789
|
+
init_values();
|
|
3790
|
+
init_logging();
|
|
3791
|
+
__defProp6 = Object.defineProperty;
|
|
4073
3792
|
});
|
|
4074
3793
|
|
|
4075
|
-
// ../../node_modules
|
|
4076
|
-
var
|
|
4077
|
-
|
|
4078
|
-
toReferencePath2 = Symbol.for("toReferencePath");
|
|
3794
|
+
// ../../node_modules/convex/dist/esm/browser/index-node.js
|
|
3795
|
+
var init_index_node = __esm(() => {
|
|
3796
|
+
init_http_client();
|
|
4079
3797
|
});
|
|
4080
3798
|
|
|
4081
|
-
// ../../node_modules
|
|
3799
|
+
// ../../node_modules/convex/dist/esm/server/search_filter_builder.js
|
|
4082
3800
|
var init_search_filter_builder = () => {};
|
|
4083
3801
|
|
|
4084
|
-
// ../../node_modules
|
|
3802
|
+
// ../../node_modules/convex/dist/esm/server/pagination.js
|
|
4085
3803
|
var paginationOptsValidator;
|
|
4086
3804
|
var init_pagination = __esm(() => {
|
|
4087
3805
|
init_validator();
|
|
@@ -4095,48 +3813,14 @@ var init_pagination = __esm(() => {
|
|
|
4095
3813
|
});
|
|
4096
3814
|
});
|
|
4097
3815
|
|
|
4098
|
-
// ../../node_modules
|
|
4099
|
-
function createApi2(pathParts = []) {
|
|
4100
|
-
const handler = {
|
|
4101
|
-
get(_3, prop) {
|
|
4102
|
-
if (typeof prop === "string") {
|
|
4103
|
-
const newParts = [...pathParts, prop];
|
|
4104
|
-
return createApi2(newParts);
|
|
4105
|
-
} else if (prop === functionName2) {
|
|
4106
|
-
if (pathParts.length < 2) {
|
|
4107
|
-
const found = ["api", ...pathParts].join(".");
|
|
4108
|
-
throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${found}\``);
|
|
4109
|
-
}
|
|
4110
|
-
const path = pathParts.slice(0, -1).join("/");
|
|
4111
|
-
const exportName = pathParts[pathParts.length - 1];
|
|
4112
|
-
if (exportName === "default") {
|
|
4113
|
-
return path;
|
|
4114
|
-
} else {
|
|
4115
|
-
return path + ":" + exportName;
|
|
4116
|
-
}
|
|
4117
|
-
} else if (prop === Symbol.toStringTag) {
|
|
4118
|
-
return "FunctionReference";
|
|
4119
|
-
} else {
|
|
4120
|
-
return;
|
|
4121
|
-
}
|
|
4122
|
-
}
|
|
4123
|
-
};
|
|
4124
|
-
return new Proxy({}, handler);
|
|
4125
|
-
}
|
|
4126
|
-
var anyApi2;
|
|
4127
|
-
var init_api2 = __esm(() => {
|
|
4128
|
-
init_functionName2();
|
|
4129
|
-
anyApi2 = createApi2();
|
|
4130
|
-
});
|
|
4131
|
-
|
|
4132
|
-
// ../../node_modules/.bun/convex@1.31.7/node_modules/convex/dist/esm/server/components/index.js
|
|
3816
|
+
// ../../node_modules/convex/dist/esm/server/components/index.js
|
|
4133
3817
|
function createChildComponents(root, pathParts) {
|
|
4134
3818
|
const handler = {
|
|
4135
3819
|
get(_3, prop) {
|
|
4136
3820
|
if (typeof prop === "string") {
|
|
4137
3821
|
const newParts = [...pathParts, prop];
|
|
4138
3822
|
return createChildComponents(root, newParts);
|
|
4139
|
-
} else if (prop ===
|
|
3823
|
+
} else if (prop === toReferencePath) {
|
|
4140
3824
|
if (pathParts.length < 1) {
|
|
4141
3825
|
const found = [root, ...pathParts].join(".");
|
|
4142
3826
|
throw new Error(`API path is expected to be of the form \`${root}.childComponent.functionName\`. Found: \`${found}\``);
|
|
@@ -4151,12 +3835,12 @@ function createChildComponents(root, pathParts) {
|
|
|
4151
3835
|
}
|
|
4152
3836
|
var componentsGeneric = () => createChildComponents("components", []);
|
|
4153
3837
|
var init_components = __esm(() => {
|
|
4154
|
-
|
|
3838
|
+
init_paths();
|
|
4155
3839
|
});
|
|
4156
3840
|
|
|
4157
|
-
// ../../node_modules
|
|
3841
|
+
// ../../node_modules/convex/dist/esm/server/index.js
|
|
4158
3842
|
var init_server = __esm(() => {
|
|
4159
|
-
|
|
3843
|
+
init_api();
|
|
4160
3844
|
init_components();
|
|
4161
3845
|
init_pagination();
|
|
4162
3846
|
init_search_filter_builder();
|
|
@@ -4164,9 +3848,9 @@ var init_server = __esm(() => {
|
|
|
4164
3848
|
|
|
4165
3849
|
// ../../convex/_generated/api.js
|
|
4166
3850
|
var api, components;
|
|
4167
|
-
var
|
|
3851
|
+
var init_api2 = __esm(() => {
|
|
4168
3852
|
init_server();
|
|
4169
|
-
api =
|
|
3853
|
+
api = anyApi;
|
|
4170
3854
|
components = componentsGeneric();
|
|
4171
3855
|
});
|
|
4172
3856
|
|
|
@@ -4243,7 +3927,7 @@ function requireGitHub() {
|
|
|
4243
3927
|
var PRODUCTION_CONVEX_URL = "https://steady-bass-841.convex.cloud", CONFIG_DIR, CONFIG_FILE, getClerkId, requireClerkId;
|
|
4244
3928
|
var init_client = __esm(() => {
|
|
4245
3929
|
init_index_node();
|
|
4246
|
-
|
|
3930
|
+
init_api2();
|
|
4247
3931
|
init_dist();
|
|
4248
3932
|
CONFIG_DIR = join4(homedir3(), ".nairon-bench");
|
|
4249
3933
|
CONFIG_FILE = join4(CONFIG_DIR, "config.json");
|
|
@@ -4251,7 +3935,7 @@ var init_client = __esm(() => {
|
|
|
4251
3935
|
requireClerkId = requireGitHub;
|
|
4252
3936
|
});
|
|
4253
3937
|
|
|
4254
|
-
// ../../node_modules
|
|
3938
|
+
// ../../node_modules/picocolors/picocolors.js
|
|
4255
3939
|
var require_picocolors = __commonJS((exports, module) => {
|
|
4256
3940
|
var p = process || {};
|
|
4257
3941
|
var argv2 = p.argv || [];
|
|
@@ -4321,14 +4005,14 @@ var require_picocolors = __commonJS((exports, module) => {
|
|
|
4321
4005
|
module.exports.createColors = createColors2;
|
|
4322
4006
|
});
|
|
4323
4007
|
|
|
4324
|
-
// ../../node_modules
|
|
4008
|
+
// ../../node_modules/citty/dist/index.mjs
|
|
4325
4009
|
init_dist();
|
|
4326
4010
|
|
|
4327
|
-
// ../../node_modules
|
|
4011
|
+
// ../../node_modules/consola/dist/utils.mjs
|
|
4328
4012
|
init_consola_DXBYu_KD();
|
|
4329
4013
|
init_consola_DXBYu_KD();
|
|
4330
4014
|
|
|
4331
|
-
// ../../node_modules
|
|
4015
|
+
// ../../node_modules/citty/dist/index.mjs
|
|
4332
4016
|
function toArray(val) {
|
|
4333
4017
|
if (Array.isArray(val)) {
|
|
4334
4018
|
return val;
|
|
@@ -4755,7 +4439,7 @@ async function runMain(cmd, opts = {}) {
|
|
|
4755
4439
|
}
|
|
4756
4440
|
}
|
|
4757
4441
|
|
|
4758
|
-
// ../../node_modules
|
|
4442
|
+
// ../../node_modules/citty/dist/index.mjs
|
|
4759
4443
|
init_dist();
|
|
4760
4444
|
function defineCommand2(def) {
|
|
4761
4445
|
return def;
|
|
@@ -4765,7 +4449,7 @@ function defineCommand2(def) {
|
|
|
4765
4449
|
import { existsSync as existsSync6, mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "node:fs";
|
|
4766
4450
|
import { join as join6 } from "node:path";
|
|
4767
4451
|
|
|
4768
|
-
// ../../node_modules
|
|
4452
|
+
// ../../node_modules/simple-git/dist/esm/index.js
|
|
4769
4453
|
var import_file_exists = __toESM(require_dist(), 1);
|
|
4770
4454
|
var import_debug = __toESM(require_src(), 1);
|
|
4771
4455
|
var import_promise_deferred = __toESM(require_dist2(), 1);
|
|
@@ -4781,7 +4465,7 @@ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
|
4781
4465
|
var __esm2 = (fn, res) => function __init() {
|
|
4782
4466
|
return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
|
|
4783
4467
|
};
|
|
4784
|
-
var __commonJS2 = (cb, mod) => function
|
|
4468
|
+
var __commonJS2 = (cb, mod) => function __require2() {
|
|
4785
4469
|
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
4786
4470
|
};
|
|
4787
4471
|
var __export2 = (target, all) => {
|
|
@@ -10923,12 +10607,12 @@ function analyzeParallelization(agents) {
|
|
|
10923
10607
|
if (agents && agents.sessions.length > 0) {
|
|
10924
10608
|
const sortedSessions = [...agents.sessions].sort((a2, b2) => new Date(a2.startedAt).getTime() - new Date(b2.startedAt).getTime());
|
|
10925
10609
|
let maxConcurrent = 1;
|
|
10926
|
-
for (let
|
|
10927
|
-
const session = sortedSessions[
|
|
10610
|
+
for (let i3 = 0;i3 < sortedSessions.length; i3++) {
|
|
10611
|
+
const session = sortedSessions[i3];
|
|
10928
10612
|
const sessionStart = new Date(session.startedAt).getTime();
|
|
10929
10613
|
const sessionEnd = session.endedAt ? new Date(session.endedAt).getTime() : sessionStart + session.durationMinutes * 60000;
|
|
10930
10614
|
let concurrent = 1;
|
|
10931
|
-
for (let j =
|
|
10615
|
+
for (let j = i3 + 1;j < sortedSessions.length; j++) {
|
|
10932
10616
|
const other = sortedSessions[j];
|
|
10933
10617
|
const otherStart = new Date(other.startedAt).getTime();
|
|
10934
10618
|
if (otherStart < sessionEnd) {
|
|
@@ -11029,14 +10713,14 @@ function calculateScanCost(agents, git) {
|
|
|
11029
10713
|
};
|
|
11030
10714
|
}
|
|
11031
10715
|
|
|
11032
|
-
// ../../node_modules
|
|
10716
|
+
// ../../node_modules/ora/index.js
|
|
11033
10717
|
import process8 from "node:process";
|
|
11034
10718
|
import { stripVTControlCharacters } from "node:util";
|
|
11035
10719
|
|
|
11036
|
-
// ../../node_modules
|
|
10720
|
+
// ../../node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
11037
10721
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
11038
|
-
var wrapAnsi16 = (offset = 0) => (
|
|
11039
|
-
var wrapAnsi256 = (offset = 0) => (
|
|
10722
|
+
var wrapAnsi16 = (offset = 0) => (code2) => `\x1B[${code2 + offset}m`;
|
|
10723
|
+
var wrapAnsi256 = (offset = 0) => (code2) => `\x1B[${38 + offset};5;${code2}m`;
|
|
11040
10724
|
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
11041
10725
|
var styles = {
|
|
11042
10726
|
modifier: {
|
|
@@ -11163,24 +10847,24 @@ function assembleStyles() {
|
|
|
11163
10847
|
enumerable: false
|
|
11164
10848
|
},
|
|
11165
10849
|
ansi256ToAnsi: {
|
|
11166
|
-
value(
|
|
11167
|
-
if (
|
|
11168
|
-
return 30 +
|
|
10850
|
+
value(code2) {
|
|
10851
|
+
if (code2 < 8) {
|
|
10852
|
+
return 30 + code2;
|
|
11169
10853
|
}
|
|
11170
|
-
if (
|
|
11171
|
-
return 90 + (
|
|
10854
|
+
if (code2 < 16) {
|
|
10855
|
+
return 90 + (code2 - 8);
|
|
11172
10856
|
}
|
|
11173
10857
|
let red;
|
|
11174
10858
|
let green;
|
|
11175
10859
|
let blue;
|
|
11176
|
-
if (
|
|
11177
|
-
red = ((
|
|
10860
|
+
if (code2 >= 232) {
|
|
10861
|
+
red = ((code2 - 232) * 10 + 8) / 255;
|
|
11178
10862
|
green = red;
|
|
11179
10863
|
blue = red;
|
|
11180
10864
|
} else {
|
|
11181
|
-
|
|
11182
|
-
const remainder =
|
|
11183
|
-
red = Math.floor(
|
|
10865
|
+
code2 -= 16;
|
|
10866
|
+
const remainder = code2 % 36;
|
|
10867
|
+
red = Math.floor(code2 / 36) / 5;
|
|
11184
10868
|
green = Math.floor(remainder / 6) / 5;
|
|
11185
10869
|
blue = remainder % 6 / 5;
|
|
11186
10870
|
}
|
|
@@ -11210,7 +10894,7 @@ function assembleStyles() {
|
|
|
11210
10894
|
var ansiStyles = assembleStyles();
|
|
11211
10895
|
var ansi_styles_default = ansiStyles;
|
|
11212
10896
|
|
|
11213
|
-
// ../../node_modules
|
|
10897
|
+
// ../../node_modules/chalk/source/vendor/supports-color/index.js
|
|
11214
10898
|
import process2 from "node:process";
|
|
11215
10899
|
import os from "node:os";
|
|
11216
10900
|
import tty2 from "node:tty";
|
|
@@ -11342,7 +11026,7 @@ var supportsColor = {
|
|
|
11342
11026
|
};
|
|
11343
11027
|
var supports_color_default = supportsColor;
|
|
11344
11028
|
|
|
11345
|
-
// ../../node_modules
|
|
11029
|
+
// ../../node_modules/chalk/source/utilities.js
|
|
11346
11030
|
function stringReplaceAll(string, substring, replacer) {
|
|
11347
11031
|
let index = string.indexOf(substring);
|
|
11348
11032
|
if (index === -1) {
|
|
@@ -11375,7 +11059,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
|
11375
11059
|
return returnValue;
|
|
11376
11060
|
}
|
|
11377
11061
|
|
|
11378
|
-
// ../../node_modules
|
|
11062
|
+
// ../../node_modules/chalk/source/index.js
|
|
11379
11063
|
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
11380
11064
|
var GENERATOR = Symbol("GENERATOR");
|
|
11381
11065
|
var STYLER = Symbol("STYLER");
|
|
@@ -11522,13 +11206,13 @@ var chalk = createChalk();
|
|
|
11522
11206
|
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
11523
11207
|
var source_default = chalk;
|
|
11524
11208
|
|
|
11525
|
-
// ../../node_modules
|
|
11209
|
+
// ../../node_modules/cli-cursor/index.js
|
|
11526
11210
|
import process5 from "node:process";
|
|
11527
11211
|
|
|
11528
|
-
// ../../node_modules
|
|
11212
|
+
// ../../node_modules/restore-cursor/index.js
|
|
11529
11213
|
import process4 from "node:process";
|
|
11530
11214
|
|
|
11531
|
-
// ../../node_modules
|
|
11215
|
+
// ../../node_modules/mimic-function/index.js
|
|
11532
11216
|
var copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
|
11533
11217
|
if (property === "length" || property === "prototype") {
|
|
11534
11218
|
return;
|
|
@@ -11574,7 +11258,7 @@ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
|
|
|
11574
11258
|
return to;
|
|
11575
11259
|
}
|
|
11576
11260
|
|
|
11577
|
-
// ../../node_modules
|
|
11261
|
+
// ../../node_modules/onetime/index.js
|
|
11578
11262
|
var calledFunctions = new WeakMap;
|
|
11579
11263
|
var onetime = (function_, options = {}) => {
|
|
11580
11264
|
if (typeof function_ !== "function") {
|
|
@@ -11582,14 +11266,14 @@ var onetime = (function_, options = {}) => {
|
|
|
11582
11266
|
}
|
|
11583
11267
|
let returnValue;
|
|
11584
11268
|
let callCount = 0;
|
|
11585
|
-
const
|
|
11269
|
+
const functionName2 = function_.displayName || function_.name || "<anonymous>";
|
|
11586
11270
|
const onetime2 = function(...arguments_) {
|
|
11587
11271
|
calledFunctions.set(onetime2, ++callCount);
|
|
11588
11272
|
if (callCount === 1) {
|
|
11589
11273
|
returnValue = function_.apply(this, arguments_);
|
|
11590
11274
|
function_ = undefined;
|
|
11591
11275
|
} else if (options.throw === true) {
|
|
11592
|
-
throw new Error(`Function \`${
|
|
11276
|
+
throw new Error(`Function \`${functionName2}\` can only be called once`);
|
|
11593
11277
|
}
|
|
11594
11278
|
return returnValue;
|
|
11595
11279
|
};
|
|
@@ -11605,7 +11289,7 @@ onetime.callCount = (function_) => {
|
|
|
11605
11289
|
};
|
|
11606
11290
|
var onetime_default = onetime;
|
|
11607
11291
|
|
|
11608
|
-
// ../../node_modules
|
|
11292
|
+
// ../../node_modules/signal-exit/dist/mjs/signals.js
|
|
11609
11293
|
var signals = [];
|
|
11610
11294
|
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
11611
11295
|
if (process.platform !== "win32") {
|
|
@@ -11615,7 +11299,7 @@ if (process.platform === "linux") {
|
|
|
11615
11299
|
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
11616
11300
|
}
|
|
11617
11301
|
|
|
11618
|
-
// ../../node_modules
|
|
11302
|
+
// ../../node_modules/signal-exit/dist/mjs/index.js
|
|
11619
11303
|
var processOk = (process3) => !!process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
|
|
11620
11304
|
var kExitEmitter = Symbol.for("signal-exit emitter");
|
|
11621
11305
|
var global = globalThis;
|
|
@@ -11648,27 +11332,27 @@ class Emitter {
|
|
|
11648
11332
|
}
|
|
11649
11333
|
removeListener(ev, fn) {
|
|
11650
11334
|
const list = this.listeners[ev];
|
|
11651
|
-
const
|
|
11652
|
-
if (
|
|
11335
|
+
const i3 = list.indexOf(fn);
|
|
11336
|
+
if (i3 === -1) {
|
|
11653
11337
|
return;
|
|
11654
11338
|
}
|
|
11655
|
-
if (
|
|
11339
|
+
if (i3 === 0 && list.length === 1) {
|
|
11656
11340
|
list.length = 0;
|
|
11657
11341
|
} else {
|
|
11658
|
-
list.splice(
|
|
11342
|
+
list.splice(i3, 1);
|
|
11659
11343
|
}
|
|
11660
11344
|
}
|
|
11661
|
-
emit(ev,
|
|
11345
|
+
emit(ev, code2, signal) {
|
|
11662
11346
|
if (this.emitted[ev]) {
|
|
11663
11347
|
return false;
|
|
11664
11348
|
}
|
|
11665
11349
|
this.emitted[ev] = true;
|
|
11666
11350
|
let ret = false;
|
|
11667
11351
|
for (const fn of this.listeners[ev]) {
|
|
11668
|
-
ret = fn(
|
|
11352
|
+
ret = fn(code2, signal) === true || ret;
|
|
11669
11353
|
}
|
|
11670
11354
|
if (ev === "exit") {
|
|
11671
|
-
ret = this.emit("afterExit",
|
|
11355
|
+
ret = this.emit("afterExit", code2, signal) || ret;
|
|
11672
11356
|
}
|
|
11673
11357
|
return ret;
|
|
11674
11358
|
}
|
|
@@ -11762,8 +11446,8 @@ class SignalExit extends SignalExitBase {
|
|
|
11762
11446
|
this.#process.emit = (ev, ...a2) => {
|
|
11763
11447
|
return this.#processEmit(ev, ...a2);
|
|
11764
11448
|
};
|
|
11765
|
-
this.#process.reallyExit = (
|
|
11766
|
-
return this.#processReallyExit(
|
|
11449
|
+
this.#process.reallyExit = (code2) => {
|
|
11450
|
+
return this.#processReallyExit(code2);
|
|
11767
11451
|
};
|
|
11768
11452
|
}
|
|
11769
11453
|
unload() {
|
|
@@ -11784,11 +11468,11 @@ class SignalExit extends SignalExitBase {
|
|
|
11784
11468
|
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
11785
11469
|
this.#emitter.count -= 1;
|
|
11786
11470
|
}
|
|
11787
|
-
#processReallyExit(
|
|
11471
|
+
#processReallyExit(code2) {
|
|
11788
11472
|
if (!processOk(this.#process)) {
|
|
11789
11473
|
return 0;
|
|
11790
11474
|
}
|
|
11791
|
-
this.#process.exitCode =
|
|
11475
|
+
this.#process.exitCode = code2 || 0;
|
|
11792
11476
|
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
11793
11477
|
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
11794
11478
|
}
|
|
@@ -11813,7 +11497,7 @@ var {
|
|
|
11813
11497
|
unload
|
|
11814
11498
|
} = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback);
|
|
11815
11499
|
|
|
11816
|
-
// ../../node_modules
|
|
11500
|
+
// ../../node_modules/restore-cursor/index.js
|
|
11817
11501
|
var terminal = process4.stderr.isTTY ? process4.stderr : process4.stdout.isTTY ? process4.stdout : undefined;
|
|
11818
11502
|
var restoreCursor = terminal ? onetime_default(() => {
|
|
11819
11503
|
onExit(() => {
|
|
@@ -11822,7 +11506,7 @@ var restoreCursor = terminal ? onetime_default(() => {
|
|
|
11822
11506
|
}) : () => {};
|
|
11823
11507
|
var restore_cursor_default = restoreCursor;
|
|
11824
11508
|
|
|
11825
|
-
// ../../node_modules
|
|
11509
|
+
// ../../node_modules/cli-cursor/index.js
|
|
11826
11510
|
var isHidden = false;
|
|
11827
11511
|
var cliCursor = {};
|
|
11828
11512
|
cliCursor.show = (writableStream = process5.stderr) => {
|
|
@@ -11851,7 +11535,7 @@ cliCursor.toggle = (force, writableStream) => {
|
|
|
11851
11535
|
}
|
|
11852
11536
|
};
|
|
11853
11537
|
var cli_cursor_default = cliCursor;
|
|
11854
|
-
// ../../node_modules
|
|
11538
|
+
// ../../node_modules/cli-spinners/spinners.json
|
|
11855
11539
|
var spinners_default = {
|
|
11856
11540
|
dots: {
|
|
11857
11541
|
interval: 80,
|
|
@@ -13550,11 +13234,11 @@ var spinners_default = {
|
|
|
13550
13234
|
}
|
|
13551
13235
|
};
|
|
13552
13236
|
|
|
13553
|
-
// ../../node_modules
|
|
13237
|
+
// ../../node_modules/cli-spinners/index.js
|
|
13554
13238
|
var cli_spinners_default = spinners_default;
|
|
13555
13239
|
var spinnersList = Object.keys(spinners_default);
|
|
13556
13240
|
|
|
13557
|
-
// ../../node_modules
|
|
13241
|
+
// ../../node_modules/log-symbols/symbols.js
|
|
13558
13242
|
var exports_symbols = {};
|
|
13559
13243
|
__export(exports_symbols, {
|
|
13560
13244
|
warning: () => warning,
|
|
@@ -13563,7 +13247,7 @@ __export(exports_symbols, {
|
|
|
13563
13247
|
error: () => error
|
|
13564
13248
|
});
|
|
13565
13249
|
|
|
13566
|
-
// ../../node_modules
|
|
13250
|
+
// ../../node_modules/yoctocolors/base.js
|
|
13567
13251
|
import tty3 from "node:tty";
|
|
13568
13252
|
var hasColors = tty3?.WriteStream?.prototype?.hasColors?.() ?? false;
|
|
13569
13253
|
var format = (open, close) => {
|
|
@@ -13633,7 +13317,7 @@ var bgMagentaBright = format(105, 49);
|
|
|
13633
13317
|
var bgCyanBright = format(106, 49);
|
|
13634
13318
|
var bgWhiteBright = format(107, 49);
|
|
13635
13319
|
|
|
13636
|
-
// ../../node_modules
|
|
13320
|
+
// ../../node_modules/is-unicode-supported/index.js
|
|
13637
13321
|
import process6 from "node:process";
|
|
13638
13322
|
function isUnicodeSupported2() {
|
|
13639
13323
|
const { env: env3 } = process6;
|
|
@@ -13644,13 +13328,13 @@ function isUnicodeSupported2() {
|
|
|
13644
13328
|
return Boolean(env3.WT_SESSION) || Boolean(env3.TERMINUS_SUBLIME) || env3.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env3.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
13645
13329
|
}
|
|
13646
13330
|
|
|
13647
|
-
// ../../node_modules
|
|
13331
|
+
// ../../node_modules/log-symbols/symbols.js
|
|
13648
13332
|
var _isUnicodeSupported = isUnicodeSupported2();
|
|
13649
13333
|
var info = blue(_isUnicodeSupported ? "ℹ" : "i");
|
|
13650
13334
|
var success = green(_isUnicodeSupported ? "✔" : "√");
|
|
13651
13335
|
var warning = yellow(_isUnicodeSupported ? "⚠" : "‼");
|
|
13652
13336
|
var error = red(_isUnicodeSupported ? "✖" : "×");
|
|
13653
|
-
// ../../node_modules
|
|
13337
|
+
// ../../node_modules/ansi-regex/index.js
|
|
13654
13338
|
function ansiRegex3({ onlyFirst = false } = {}) {
|
|
13655
13339
|
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
13656
13340
|
const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
|
|
@@ -13659,7 +13343,7 @@ function ansiRegex3({ onlyFirst = false } = {}) {
|
|
|
13659
13343
|
return new RegExp(pattern, onlyFirst ? undefined : "g");
|
|
13660
13344
|
}
|
|
13661
13345
|
|
|
13662
|
-
// ../../node_modules
|
|
13346
|
+
// ../../node_modules/strip-ansi/index.js
|
|
13663
13347
|
var regex2 = ansiRegex3();
|
|
13664
13348
|
function stripAnsi3(string) {
|
|
13665
13349
|
if (typeof string !== "string") {
|
|
@@ -13668,7 +13352,7 @@ function stripAnsi3(string) {
|
|
|
13668
13352
|
return string.replace(regex2, "");
|
|
13669
13353
|
}
|
|
13670
13354
|
|
|
13671
|
-
// ../../node_modules
|
|
13355
|
+
// ../../node_modules/get-east-asian-width/lookup.js
|
|
13672
13356
|
function isAmbiguous2(x2) {
|
|
13673
13357
|
return x2 === 161 || x2 === 164 || x2 === 167 || x2 === 168 || x2 === 170 || x2 === 173 || x2 === 174 || x2 >= 176 && x2 <= 180 || x2 >= 182 && x2 <= 186 || x2 >= 188 && x2 <= 191 || x2 === 198 || x2 === 208 || x2 === 215 || x2 === 216 || x2 >= 222 && x2 <= 225 || x2 === 230 || x2 >= 232 && x2 <= 234 || x2 === 236 || x2 === 237 || x2 === 240 || x2 === 242 || x2 === 243 || x2 >= 247 && x2 <= 250 || x2 === 252 || x2 === 254 || x2 === 257 || x2 === 273 || x2 === 275 || x2 === 283 || x2 === 294 || x2 === 295 || x2 === 299 || x2 >= 305 && x2 <= 307 || x2 === 312 || x2 >= 319 && x2 <= 322 || x2 === 324 || x2 >= 328 && x2 <= 331 || x2 === 333 || x2 === 338 || x2 === 339 || x2 === 358 || x2 === 359 || x2 === 363 || x2 === 462 || x2 === 464 || x2 === 466 || x2 === 468 || x2 === 470 || x2 === 472 || x2 === 474 || x2 === 476 || x2 === 593 || x2 === 609 || x2 === 708 || x2 === 711 || x2 >= 713 && x2 <= 715 || x2 === 717 || x2 === 720 || x2 >= 728 && x2 <= 731 || x2 === 733 || x2 === 735 || x2 >= 768 && x2 <= 879 || x2 >= 913 && x2 <= 929 || x2 >= 931 && x2 <= 937 || x2 >= 945 && x2 <= 961 || x2 >= 963 && x2 <= 969 || x2 === 1025 || x2 >= 1040 && x2 <= 1103 || x2 === 1105 || x2 === 8208 || x2 >= 8211 && x2 <= 8214 || x2 === 8216 || x2 === 8217 || x2 === 8220 || x2 === 8221 || x2 >= 8224 && x2 <= 8226 || x2 >= 8228 && x2 <= 8231 || x2 === 8240 || x2 === 8242 || x2 === 8243 || x2 === 8245 || x2 === 8251 || x2 === 8254 || x2 === 8308 || x2 === 8319 || x2 >= 8321 && x2 <= 8324 || x2 === 8364 || x2 === 8451 || x2 === 8453 || x2 === 8457 || x2 === 8467 || x2 === 8470 || x2 === 8481 || x2 === 8482 || x2 === 8486 || x2 === 8491 || x2 === 8531 || x2 === 8532 || x2 >= 8539 && x2 <= 8542 || x2 >= 8544 && x2 <= 8555 || x2 >= 8560 && x2 <= 8569 || x2 === 8585 || x2 >= 8592 && x2 <= 8601 || x2 === 8632 || x2 === 8633 || x2 === 8658 || x2 === 8660 || x2 === 8679 || x2 === 8704 || x2 === 8706 || x2 === 8707 || x2 === 8711 || x2 === 8712 || x2 === 8715 || x2 === 8719 || x2 === 8721 || x2 === 8725 || x2 === 8730 || x2 >= 8733 && x2 <= 8736 || x2 === 8739 || x2 === 8741 || x2 >= 8743 && x2 <= 8748 || x2 === 8750 || x2 >= 8756 && x2 <= 8759 || x2 === 8764 || x2 === 8765 || x2 === 8776 || x2 === 8780 || x2 === 8786 || x2 === 8800 || x2 === 8801 || x2 >= 8804 && x2 <= 8807 || x2 === 8810 || x2 === 8811 || x2 === 8814 || x2 === 8815 || x2 === 8834 || x2 === 8835 || x2 === 8838 || x2 === 8839 || x2 === 8853 || x2 === 8857 || x2 === 8869 || x2 === 8895 || x2 === 8978 || x2 >= 9312 && x2 <= 9449 || x2 >= 9451 && x2 <= 9547 || x2 >= 9552 && x2 <= 9587 || x2 >= 9600 && x2 <= 9615 || x2 >= 9618 && x2 <= 9621 || x2 === 9632 || x2 === 9633 || x2 >= 9635 && x2 <= 9641 || x2 === 9650 || x2 === 9651 || x2 === 9654 || x2 === 9655 || x2 === 9660 || x2 === 9661 || x2 === 9664 || x2 === 9665 || x2 >= 9670 && x2 <= 9672 || x2 === 9675 || x2 >= 9678 && x2 <= 9681 || x2 >= 9698 && x2 <= 9701 || x2 === 9711 || x2 === 9733 || x2 === 9734 || x2 === 9737 || x2 === 9742 || x2 === 9743 || x2 === 9756 || x2 === 9758 || x2 === 9792 || x2 === 9794 || x2 === 9824 || x2 === 9825 || x2 >= 9827 && x2 <= 9829 || x2 >= 9831 && x2 <= 9834 || x2 === 9836 || x2 === 9837 || x2 === 9839 || x2 === 9886 || x2 === 9887 || x2 === 9919 || x2 >= 9926 && x2 <= 9933 || x2 >= 9935 && x2 <= 9939 || x2 >= 9941 && x2 <= 9953 || x2 === 9955 || x2 === 9960 || x2 === 9961 || x2 >= 9963 && x2 <= 9969 || x2 === 9972 || x2 >= 9974 && x2 <= 9977 || x2 === 9979 || x2 === 9980 || x2 === 9982 || x2 === 9983 || x2 === 10045 || x2 >= 10102 && x2 <= 10111 || x2 >= 11094 && x2 <= 11097 || x2 >= 12872 && x2 <= 12879 || x2 >= 57344 && x2 <= 63743 || x2 >= 65024 && x2 <= 65039 || x2 === 65533 || x2 >= 127232 && x2 <= 127242 || x2 >= 127248 && x2 <= 127277 || x2 >= 127280 && x2 <= 127337 || x2 >= 127344 && x2 <= 127373 || x2 === 127375 || x2 === 127376 || x2 >= 127387 && x2 <= 127404 || x2 >= 917760 && x2 <= 917999 || x2 >= 983040 && x2 <= 1048573 || x2 >= 1048576 && x2 <= 1114109;
|
|
13674
13358
|
}
|
|
@@ -13679,7 +13363,7 @@ function isWide2(x2) {
|
|
|
13679
13363
|
return x2 >= 4352 && x2 <= 4447 || x2 === 8986 || x2 === 8987 || x2 === 9001 || x2 === 9002 || x2 >= 9193 && x2 <= 9196 || x2 === 9200 || x2 === 9203 || x2 === 9725 || x2 === 9726 || x2 === 9748 || x2 === 9749 || x2 >= 9776 && x2 <= 9783 || x2 >= 9800 && x2 <= 9811 || x2 === 9855 || x2 >= 9866 && x2 <= 9871 || x2 === 9875 || x2 === 9889 || x2 === 9898 || x2 === 9899 || x2 === 9917 || x2 === 9918 || x2 === 9924 || x2 === 9925 || x2 === 9934 || x2 === 9940 || x2 === 9962 || x2 === 9970 || x2 === 9971 || x2 === 9973 || x2 === 9978 || x2 === 9981 || x2 === 9989 || x2 === 9994 || x2 === 9995 || x2 === 10024 || x2 === 10060 || x2 === 10062 || x2 >= 10067 && x2 <= 10069 || x2 === 10071 || x2 >= 10133 && x2 <= 10135 || x2 === 10160 || x2 === 10175 || x2 === 11035 || x2 === 11036 || x2 === 11088 || x2 === 11093 || x2 >= 11904 && x2 <= 11929 || x2 >= 11931 && x2 <= 12019 || x2 >= 12032 && x2 <= 12245 || x2 >= 12272 && x2 <= 12287 || x2 >= 12289 && x2 <= 12350 || x2 >= 12353 && x2 <= 12438 || x2 >= 12441 && x2 <= 12543 || x2 >= 12549 && x2 <= 12591 || x2 >= 12593 && x2 <= 12686 || x2 >= 12688 && x2 <= 12773 || x2 >= 12783 && x2 <= 12830 || x2 >= 12832 && x2 <= 12871 || x2 >= 12880 && x2 <= 42124 || x2 >= 42128 && x2 <= 42182 || x2 >= 43360 && x2 <= 43388 || x2 >= 44032 && x2 <= 55203 || x2 >= 63744 && x2 <= 64255 || x2 >= 65040 && x2 <= 65049 || x2 >= 65072 && x2 <= 65106 || x2 >= 65108 && x2 <= 65126 || x2 >= 65128 && x2 <= 65131 || x2 >= 94176 && x2 <= 94180 || x2 >= 94192 && x2 <= 94198 || x2 >= 94208 && x2 <= 101589 || x2 >= 101631 && x2 <= 101662 || x2 >= 101760 && x2 <= 101874 || x2 >= 110576 && x2 <= 110579 || x2 >= 110581 && x2 <= 110587 || x2 === 110589 || x2 === 110590 || x2 >= 110592 && x2 <= 110882 || x2 === 110898 || x2 >= 110928 && x2 <= 110930 || x2 === 110933 || x2 >= 110948 && x2 <= 110951 || x2 >= 110960 && x2 <= 111355 || x2 >= 119552 && x2 <= 119638 || x2 >= 119648 && x2 <= 119670 || x2 === 126980 || x2 === 127183 || x2 === 127374 || x2 >= 127377 && x2 <= 127386 || x2 >= 127488 && x2 <= 127490 || x2 >= 127504 && x2 <= 127547 || x2 >= 127552 && x2 <= 127560 || x2 === 127568 || x2 === 127569 || x2 >= 127584 && x2 <= 127589 || x2 >= 127744 && x2 <= 127776 || x2 >= 127789 && x2 <= 127797 || x2 >= 127799 && x2 <= 127868 || x2 >= 127870 && x2 <= 127891 || x2 >= 127904 && x2 <= 127946 || x2 >= 127951 && x2 <= 127955 || x2 >= 127968 && x2 <= 127984 || x2 === 127988 || x2 >= 127992 && x2 <= 128062 || x2 === 128064 || x2 >= 128066 && x2 <= 128252 || x2 >= 128255 && x2 <= 128317 || x2 >= 128331 && x2 <= 128334 || x2 >= 128336 && x2 <= 128359 || x2 === 128378 || x2 === 128405 || x2 === 128406 || x2 === 128420 || x2 >= 128507 && x2 <= 128591 || x2 >= 128640 && x2 <= 128709 || x2 === 128716 || x2 >= 128720 && x2 <= 128722 || x2 >= 128725 && x2 <= 128728 || x2 >= 128732 && x2 <= 128735 || x2 === 128747 || x2 === 128748 || x2 >= 128756 && x2 <= 128764 || x2 >= 128992 && x2 <= 129003 || x2 === 129008 || x2 >= 129292 && x2 <= 129338 || x2 >= 129340 && x2 <= 129349 || x2 >= 129351 && x2 <= 129535 || x2 >= 129648 && x2 <= 129660 || x2 >= 129664 && x2 <= 129674 || x2 >= 129678 && x2 <= 129734 || x2 === 129736 || x2 >= 129741 && x2 <= 129756 || x2 >= 129759 && x2 <= 129770 || x2 >= 129775 && x2 <= 129784 || x2 >= 131072 && x2 <= 196605 || x2 >= 196608 && x2 <= 262141;
|
|
13680
13364
|
}
|
|
13681
13365
|
|
|
13682
|
-
// ../../node_modules
|
|
13366
|
+
// ../../node_modules/get-east-asian-width/index.js
|
|
13683
13367
|
function validate2(codePoint) {
|
|
13684
13368
|
if (!Number.isSafeInteger(codePoint)) {
|
|
13685
13369
|
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
@@ -13693,7 +13377,7 @@ function eastAsianWidth2(codePoint, { ambiguousAsWide = false } = {}) {
|
|
|
13693
13377
|
return 1;
|
|
13694
13378
|
}
|
|
13695
13379
|
|
|
13696
|
-
// ../../node_modules
|
|
13380
|
+
// ../../node_modules/string-width/index.js
|
|
13697
13381
|
var segmenter2 = new Intl.Segmenter;
|
|
13698
13382
|
var zeroWidthClusterRegex = /^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Mark}|\p{Surrogate})+$/v;
|
|
13699
13383
|
var leadingNonPrintingRegex = /^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v;
|
|
@@ -13747,12 +13431,12 @@ function stringWidth2(input, options = {}) {
|
|
|
13747
13431
|
return width;
|
|
13748
13432
|
}
|
|
13749
13433
|
|
|
13750
|
-
// ../../node_modules
|
|
13434
|
+
// ../../node_modules/is-interactive/index.js
|
|
13751
13435
|
function isInteractive({ stream = process.stdout } = {}) {
|
|
13752
13436
|
return Boolean(stream && stream.isTTY && process.env.TERM !== "dumb" && !("CI" in process.env));
|
|
13753
13437
|
}
|
|
13754
13438
|
|
|
13755
|
-
// ../../node_modules
|
|
13439
|
+
// ../../node_modules/stdin-discarder/index.js
|
|
13756
13440
|
import process7 from "node:process";
|
|
13757
13441
|
var ASCII_ETX_CODE = 3;
|
|
13758
13442
|
|
|
@@ -13765,8 +13449,8 @@ class StdinDiscarder {
|
|
|
13765
13449
|
if (!chunk?.length) {
|
|
13766
13450
|
return;
|
|
13767
13451
|
}
|
|
13768
|
-
const
|
|
13769
|
-
if (
|
|
13452
|
+
const code2 = typeof chunk === "string" ? chunk.codePointAt(0) : chunk[0];
|
|
13453
|
+
if (code2 === ASCII_ETX_CODE) {
|
|
13770
13454
|
if (process7.listenerCount("SIGINT") > 0) {
|
|
13771
13455
|
process7.emit("SIGINT");
|
|
13772
13456
|
} else {
|
|
@@ -13823,7 +13507,7 @@ class StdinDiscarder {
|
|
|
13823
13507
|
var stdinDiscarder = new StdinDiscarder;
|
|
13824
13508
|
var stdin_discarder_default = Object.freeze(stdinDiscarder);
|
|
13825
13509
|
|
|
13826
|
-
// ../../node_modules
|
|
13510
|
+
// ../../node_modules/ora/index.js
|
|
13827
13511
|
var RENDER_DEFERRAL_TIMEOUT = 200;
|
|
13828
13512
|
var SYNCHRONIZED_OUTPUT_ENABLE = "\x1B[?2026h";
|
|
13829
13513
|
var SYNCHRONIZED_OUTPUT_DISABLE = "\x1B[?2026l";
|
|
@@ -14368,8 +14052,8 @@ async function animateProgressBar(label, score, options = {}) {
|
|
|
14368
14052
|
const paddedLabel = label.padEnd(labelWidth);
|
|
14369
14053
|
const scoreStr = `${score}/100`.padStart(7);
|
|
14370
14054
|
write(` ${colors2.dim(paddedLabel)} ${colors2.dim(scoreStr)} `);
|
|
14371
|
-
for (let
|
|
14372
|
-
if (
|
|
14055
|
+
for (let i3 = 0;i3 < width; i3++) {
|
|
14056
|
+
if (i3 < filled) {
|
|
14373
14057
|
write(barColor("█"));
|
|
14374
14058
|
} else {
|
|
14375
14059
|
write(colors2.dim("░"));
|
|
@@ -14402,8 +14086,8 @@ async function animateScoreReveal(score, tier, options = {}) {
|
|
|
14402
14086
|
console.log();
|
|
14403
14087
|
const steps = 30;
|
|
14404
14088
|
const stepDuration = countDuration / steps;
|
|
14405
|
-
for (let
|
|
14406
|
-
const current = Math.round(
|
|
14089
|
+
for (let i3 = 1;i3 <= steps; i3++) {
|
|
14090
|
+
const current = Math.round(i3 / steps * score);
|
|
14407
14091
|
clearLine2();
|
|
14408
14092
|
write(` ${colors2.bold("Your Score:")} ${scoreColor(colors2.bold(current.toString()))}/100`);
|
|
14409
14093
|
await sleep(stepDuration);
|
|
@@ -14414,8 +14098,8 @@ async function animateScoreReveal(score, tier, options = {}) {
|
|
|
14414
14098
|
const barWidth = 30;
|
|
14415
14099
|
const filled = Math.round(score / 100 * barWidth);
|
|
14416
14100
|
write(" ");
|
|
14417
|
-
for (let
|
|
14418
|
-
if (
|
|
14101
|
+
for (let i3 = 0;i3 < barWidth; i3++) {
|
|
14102
|
+
if (i3 < filled) {
|
|
14419
14103
|
write(scoreColor("█"));
|
|
14420
14104
|
} else {
|
|
14421
14105
|
write(colors2.dim("░"));
|
|
@@ -14640,11 +14324,11 @@ var scanCommand = defineCommand2({
|
|
|
14640
14324
|
console.log(` ${colors2.bold("Recommendations")}`);
|
|
14641
14325
|
console.log(colors2.dim(" " + "─".repeat(40)));
|
|
14642
14326
|
const topRecs = analysis.recommendations.slice(0, 3);
|
|
14643
|
-
for (let
|
|
14644
|
-
const rec = topRecs[
|
|
14327
|
+
for (let i3 = 0;i3 < topRecs.length; i3++) {
|
|
14328
|
+
const rec = topRecs[i3];
|
|
14645
14329
|
await sleep(400);
|
|
14646
14330
|
console.log();
|
|
14647
|
-
console.log(` ${colors2.success(`${
|
|
14331
|
+
console.log(` ${colors2.success(`${i3 + 1}.`)} ${colors2.bold(rec.title)}`);
|
|
14648
14332
|
await sleep(150);
|
|
14649
14333
|
console.log(` ${colors2.dim(rec.description)}`);
|
|
14650
14334
|
}
|
|
@@ -14934,9 +14618,9 @@ function generateReport(reportDir, score, git, agents, tests, since, sdlcAnalysi
|
|
|
14934
14618
|
if (analysis && analysis.recommendations.length > 0) {
|
|
14935
14619
|
lines.push("## Recommendations");
|
|
14936
14620
|
lines.push("");
|
|
14937
|
-
for (let
|
|
14938
|
-
const rec = analysis.recommendations[
|
|
14939
|
-
lines.push(`### ${
|
|
14621
|
+
for (let i3 = 0;i3 < Math.min(5, analysis.recommendations.length); i3++) {
|
|
14622
|
+
const rec = analysis.recommendations[i3];
|
|
14623
|
+
lines.push(`### ${i3 + 1}. ${rec.title}`);
|
|
14940
14624
|
lines.push("");
|
|
14941
14625
|
lines.push(rec.description);
|
|
14942
14626
|
lines.push("");
|
|
@@ -15511,8 +15195,8 @@ function extractText2(entry) {
|
|
|
15511
15195
|
}
|
|
15512
15196
|
function hashPath(path) {
|
|
15513
15197
|
let hash = 0;
|
|
15514
|
-
for (let
|
|
15515
|
-
const char = path.charCodeAt(
|
|
15198
|
+
for (let i3 = 0;i3 < path.length; i3++) {
|
|
15199
|
+
const char = path.charCodeAt(i3);
|
|
15516
15200
|
hash = (hash << 5) - hash + char;
|
|
15517
15201
|
hash = hash & hash;
|
|
15518
15202
|
}
|
|
@@ -15770,9 +15454,9 @@ function identifyGaps(distribution) {
|
|
|
15770
15454
|
function analyzeTransitions(prompts, classifications) {
|
|
15771
15455
|
const transitionCounts = new Map;
|
|
15772
15456
|
const sorted2 = [...prompts].sort((a2, b2) => a2.timestamp.getTime() - b2.timestamp.getTime());
|
|
15773
|
-
for (let
|
|
15774
|
-
const prev = sorted2[
|
|
15775
|
-
const curr = sorted2[
|
|
15457
|
+
for (let i3 = 1;i3 < sorted2.length; i3++) {
|
|
15458
|
+
const prev = sorted2[i3 - 1];
|
|
15459
|
+
const curr = sorted2[i3];
|
|
15776
15460
|
const prevClass = classifications.get(prev.id);
|
|
15777
15461
|
const currClass = classifications.get(curr.id);
|
|
15778
15462
|
if (prevClass && currClass && prevClass.phase !== currClass.phase) {
|
|
@@ -16059,7 +15743,7 @@ function findExamples(prompts, promptScores) {
|
|
|
16059
15743
|
prompt: p,
|
|
16060
15744
|
score: promptScores.get(p.id)?.overall ?? 0
|
|
16061
15745
|
})).sort((a2, b2) => b2.score - a2.score);
|
|
16062
|
-
const truncate = (text,
|
|
15746
|
+
const truncate = (text, len2 = 100) => text.length > len2 ? text.slice(0, len2) + "..." : text;
|
|
16063
15747
|
const toExample = (item, reason) => ({
|
|
16064
15748
|
id: item.prompt.id,
|
|
16065
15749
|
text: item.prompt.text,
|
|
@@ -16343,7 +16027,7 @@ function analyzeTenacity(data) {
|
|
|
16343
16027
|
evidence.push(`Sustained focus with ${avgSessionLength} min average sessions`);
|
|
16344
16028
|
}
|
|
16345
16029
|
const frustrationPrompts = prompts.filter((p) => p.isFrustrated);
|
|
16346
|
-
const continuedAfterFrustration = frustrationPrompts.filter((p,
|
|
16030
|
+
const continuedAfterFrustration = frustrationPrompts.filter((p, i3) => {
|
|
16347
16031
|
const idx = prompts.indexOf(p);
|
|
16348
16032
|
return idx < prompts.length - 1;
|
|
16349
16033
|
}).length;
|
|
@@ -16371,7 +16055,7 @@ function analyzeTenacity(data) {
|
|
|
16371
16055
|
}
|
|
16372
16056
|
const compactions = sessions.filter((s2) => s2.hadCompaction).length;
|
|
16373
16057
|
if (compactions > 0) {
|
|
16374
|
-
const continueAfterCompaction = sessions.filter((s2,
|
|
16058
|
+
const continueAfterCompaction = sessions.filter((s2, i3) => s2.hadCompaction && i3 < sessions.length - 1).length;
|
|
16375
16059
|
if (continueAfterCompaction > 0) {
|
|
16376
16060
|
score += 10;
|
|
16377
16061
|
evidence.push("Resilient: continued working after context loss");
|
|
@@ -16564,10 +16248,10 @@ function detectSearchBeforeCodePattern(prompts) {
|
|
|
16564
16248
|
const codeKeywords = /\b(create|implement|add|write|fix|build)\b/i;
|
|
16565
16249
|
let searchBeforeCode = 0;
|
|
16566
16250
|
let totalCodingPrompts = 0;
|
|
16567
|
-
for (let
|
|
16568
|
-
if (codeKeywords.test(prompts[
|
|
16251
|
+
for (let i3 = 1;i3 < prompts.length; i3++) {
|
|
16252
|
+
if (codeKeywords.test(prompts[i3].text)) {
|
|
16569
16253
|
totalCodingPrompts++;
|
|
16570
|
-
if (searchKeywords.test(prompts[
|
|
16254
|
+
if (searchKeywords.test(prompts[i3 - 1].text)) {
|
|
16571
16255
|
searchBeforeCode++;
|
|
16572
16256
|
}
|
|
16573
16257
|
}
|
|
@@ -16579,10 +16263,10 @@ function analyzeErrorRecovery(prompts) {
|
|
|
16579
16263
|
const recoveryIndicators = /\b(try|let me|fix|update|change|instead)\b/i;
|
|
16580
16264
|
let errorCount = 0;
|
|
16581
16265
|
let recoveredCount = 0;
|
|
16582
|
-
for (let
|
|
16583
|
-
if (errorIndicators.test(prompts[
|
|
16266
|
+
for (let i3 = 0;i3 < prompts.length - 1; i3++) {
|
|
16267
|
+
if (errorIndicators.test(prompts[i3].text)) {
|
|
16584
16268
|
errorCount++;
|
|
16585
|
-
if (recoveryIndicators.test(prompts[
|
|
16269
|
+
if (recoveryIndicators.test(prompts[i3 + 1].text)) {
|
|
16586
16270
|
recoveredCount++;
|
|
16587
16271
|
}
|
|
16588
16272
|
}
|
|
@@ -16860,8 +16544,8 @@ function analyzeSessionTiming(sessions) {
|
|
|
16860
16544
|
};
|
|
16861
16545
|
const sortedSessions = [...sessions].sort((a2, b2) => a2.startTime.getTime() - b2.startTime.getTime());
|
|
16862
16546
|
let totalTimeBetween = 0;
|
|
16863
|
-
for (let
|
|
16864
|
-
const session = sortedSessions[
|
|
16547
|
+
for (let i3 = 0;i3 < sortedSessions.length; i3++) {
|
|
16548
|
+
const session = sortedSessions[i3];
|
|
16865
16549
|
const hour = session.startTime.getHours();
|
|
16866
16550
|
if (sessionsByHour[hour] !== undefined) {
|
|
16867
16551
|
sessionsByHour[hour]++;
|
|
@@ -16871,8 +16555,8 @@ function analyzeSessionTiming(sessions) {
|
|
|
16871
16555
|
if (day && sessionsByDay[day] !== undefined) {
|
|
16872
16556
|
sessionsByDay[day]++;
|
|
16873
16557
|
}
|
|
16874
|
-
if (
|
|
16875
|
-
const prevSession = sortedSessions[
|
|
16558
|
+
if (i3 > 0) {
|
|
16559
|
+
const prevSession = sortedSessions[i3 - 1];
|
|
16876
16560
|
const gap = session.startTime.getTime() - prevSession.endTime.getTime();
|
|
16877
16561
|
if (gap > 0 && gap < 24 * 60 * 60 * 1000) {
|
|
16878
16562
|
totalTimeBetween += gap;
|
|
@@ -17595,10 +17279,10 @@ function renderTimelineMarkdown(timeline) {
|
|
|
17595
17279
|
}
|
|
17596
17280
|
return lines;
|
|
17597
17281
|
}
|
|
17598
|
-
function truncate(str,
|
|
17599
|
-
if (str.length <=
|
|
17282
|
+
function truncate(str, len2) {
|
|
17283
|
+
if (str.length <= len2)
|
|
17600
17284
|
return str;
|
|
17601
|
-
return str.slice(0,
|
|
17285
|
+
return str.slice(0, len2 - 3) + "...";
|
|
17602
17286
|
}
|
|
17603
17287
|
function cleanCommitMessage(message) {
|
|
17604
17288
|
return message.replace(/^(feat|fix|refactor|docs|test|chore|style|perf|ci|build|revert)(\(.+?\))?:\s*/i, "").replace(/^(add|fix|update|remove|implement|refactor)\s+/i, "").trim();
|
|
@@ -18840,6 +18524,466 @@ function renderGitBlameMarkdown(analysis) {
|
|
|
18840
18524
|
return lines;
|
|
18841
18525
|
}
|
|
18842
18526
|
|
|
18527
|
+
// src/lib/llm-pattern-detector.ts
|
|
18528
|
+
var FRUSTRATION_PATTERNS = {
|
|
18529
|
+
allCaps: {
|
|
18530
|
+
pattern: /[A-Z]{4,}/,
|
|
18531
|
+
weight: 3,
|
|
18532
|
+
type: "CAPS_LOCK"
|
|
18533
|
+
},
|
|
18534
|
+
multipleExclamation: {
|
|
18535
|
+
pattern: /!{2,}/,
|
|
18536
|
+
weight: 2,
|
|
18537
|
+
type: "EXCLAMATION_SPAM"
|
|
18538
|
+
},
|
|
18539
|
+
multipleQuestion: {
|
|
18540
|
+
pattern: /\?{2,}/,
|
|
18541
|
+
weight: 2,
|
|
18542
|
+
type: "QUESTION_SPAM"
|
|
18543
|
+
},
|
|
18544
|
+
profanity: {
|
|
18545
|
+
pattern: /\b(wtf|wth|damn|shit|fuck|crap|hell|stupid|idiot)\b/i,
|
|
18546
|
+
weight: 4,
|
|
18547
|
+
type: "PROFANITY"
|
|
18548
|
+
},
|
|
18549
|
+
exasperation: {
|
|
18550
|
+
pattern: /\b(ugh|argh|gah|sigh|ffs|omg)\b/i,
|
|
18551
|
+
weight: 3,
|
|
18552
|
+
type: "EXASPERATION"
|
|
18553
|
+
},
|
|
18554
|
+
frustrationPhrases: {
|
|
18555
|
+
pattern: /\b(doesn't work|not working|still broken|wrong again|try again|for the \d+(st|nd|rd|th) time)\b/i,
|
|
18556
|
+
weight: 4,
|
|
18557
|
+
type: "FRUSTRATION_PHRASE"
|
|
18558
|
+
},
|
|
18559
|
+
confusion: {
|
|
18560
|
+
pattern: /\b(what\?|huh\?|why is|i don't understand|confused|makes no sense)\b/i,
|
|
18561
|
+
weight: 2,
|
|
18562
|
+
type: "CONFUSION"
|
|
18563
|
+
},
|
|
18564
|
+
impatience: {
|
|
18565
|
+
pattern: /\b(just|simply|already told you|i said|like i mentioned|as i said)\b/i,
|
|
18566
|
+
weight: 2,
|
|
18567
|
+
type: "IMPATIENCE"
|
|
18568
|
+
},
|
|
18569
|
+
negation: {
|
|
18570
|
+
pattern: /\b(no,|nope|wrong|incorrect|that's not|don't|stop)\b/i,
|
|
18571
|
+
weight: 2,
|
|
18572
|
+
type: "NEGATION"
|
|
18573
|
+
}
|
|
18574
|
+
};
|
|
18575
|
+
var INEFFICIENCY_PATTERNS = {
|
|
18576
|
+
repeatedQuestion: {
|
|
18577
|
+
description: "Asking the same question multiple times",
|
|
18578
|
+
tokenCost: 500,
|
|
18579
|
+
timeCost: 2
|
|
18580
|
+
},
|
|
18581
|
+
vagueClarification: {
|
|
18582
|
+
description: "Vague prompts requiring clarification",
|
|
18583
|
+
tokenCost: 300,
|
|
18584
|
+
timeCost: 1
|
|
18585
|
+
},
|
|
18586
|
+
undoRequest: {
|
|
18587
|
+
description: "Undo/revert requests",
|
|
18588
|
+
tokenCost: 400,
|
|
18589
|
+
timeCost: 2
|
|
18590
|
+
},
|
|
18591
|
+
startOver: {
|
|
18592
|
+
description: "Starting over or trying a different approach",
|
|
18593
|
+
tokenCost: 1000,
|
|
18594
|
+
timeCost: 5
|
|
18595
|
+
},
|
|
18596
|
+
missingContext: {
|
|
18597
|
+
description: "Re-explaining context that was already provided",
|
|
18598
|
+
tokenCost: 600,
|
|
18599
|
+
timeCost: 3
|
|
18600
|
+
}
|
|
18601
|
+
};
|
|
18602
|
+
var ANTI_PATTERNS = {
|
|
18603
|
+
noFileReferences: {
|
|
18604
|
+
name: "Missing File References",
|
|
18605
|
+
description: "Prompts that don't specify which files to work with",
|
|
18606
|
+
pattern: (prompts) => {
|
|
18607
|
+
const noRefs = prompts.filter((p) => !p.hasFileReferences);
|
|
18608
|
+
return noRefs.length / prompts.length > 0.5;
|
|
18609
|
+
},
|
|
18610
|
+
solution: "Always specify file paths when referring to code"
|
|
18611
|
+
},
|
|
18612
|
+
veryShortPrompts: {
|
|
18613
|
+
name: "Overly Brief Prompts",
|
|
18614
|
+
description: "Very short prompts that lack context",
|
|
18615
|
+
pattern: (prompts) => {
|
|
18616
|
+
const short = prompts.filter((p) => p.wordCount < 10);
|
|
18617
|
+
return short.length / prompts.length > 0.3;
|
|
18618
|
+
},
|
|
18619
|
+
solution: "Provide more context in prompts (what, where, why)"
|
|
18620
|
+
},
|
|
18621
|
+
noCodeExamples: {
|
|
18622
|
+
name: "Missing Code Examples",
|
|
18623
|
+
description: "Complex requests without code examples",
|
|
18624
|
+
pattern: (prompts) => {
|
|
18625
|
+
const complex = prompts.filter((p) => p.wordCount > 50 && !p.hasCodeBlocks);
|
|
18626
|
+
return complex.length / prompts.length > 0.4;
|
|
18627
|
+
},
|
|
18628
|
+
solution: "Include code snippets or examples when explaining requirements"
|
|
18629
|
+
},
|
|
18630
|
+
longSessions: {
|
|
18631
|
+
name: "Overlong Sessions",
|
|
18632
|
+
description: "Sessions that run too long without a fresh start",
|
|
18633
|
+
pattern: (_prompts, sessions) => {
|
|
18634
|
+
const long = sessions.filter((s2) => s2.durationMinutes > 120);
|
|
18635
|
+
return long.length / sessions.length > 0.2;
|
|
18636
|
+
},
|
|
18637
|
+
solution: "Start fresh sessions for new tasks to maintain context quality"
|
|
18638
|
+
},
|
|
18639
|
+
highCorrectionRate: {
|
|
18640
|
+
name: "High Correction Rate",
|
|
18641
|
+
description: "Frequently correcting the AI's output",
|
|
18642
|
+
pattern: (prompts) => {
|
|
18643
|
+
const corrections = prompts.filter((p) => p.isCorrection);
|
|
18644
|
+
return corrections.length / prompts.length > 0.2;
|
|
18645
|
+
},
|
|
18646
|
+
solution: "Improve initial prompt clarity to reduce corrections"
|
|
18647
|
+
}
|
|
18648
|
+
};
|
|
18649
|
+
function detectPatterns3(data) {
|
|
18650
|
+
const prompts = data.allPrompts;
|
|
18651
|
+
const sessions = data.sessions;
|
|
18652
|
+
const frustrationIndicators = analyzeFrustration(prompts);
|
|
18653
|
+
const frustrationPeaks = findFrustrationPeaks(prompts, sessions);
|
|
18654
|
+
const frustrationScore = calculateFrustrationScore(frustrationIndicators);
|
|
18655
|
+
const patterns = detectAllPatterns(prompts, sessions, frustrationIndicators);
|
|
18656
|
+
const inefficiencies = findInefficiencies(prompts, sessions);
|
|
18657
|
+
const efficiencyScore = 100 - Math.min(100, inefficiencies.reduce((a2, i3) => a2 + i3.occurrences * 5, 0));
|
|
18658
|
+
const missedOpportunities = findMissedOpportunities(data);
|
|
18659
|
+
const antiPatterns = detectAntiPatterns(prompts, sessions);
|
|
18660
|
+
const recommendations = generateRecommendations2(patterns, frustrationIndicators, inefficiencies, antiPatterns, missedOpportunities);
|
|
18661
|
+
const overallSentiment = frustrationScore > 50 ? "negative" : frustrationScore > 25 ? "neutral" : "positive";
|
|
18662
|
+
const summary = generateSummary(overallSentiment, frustrationScore, efficiencyScore, patterns, antiPatterns);
|
|
18663
|
+
return {
|
|
18664
|
+
overallSentiment,
|
|
18665
|
+
frustrationScore,
|
|
18666
|
+
efficiencyScore,
|
|
18667
|
+
patterns,
|
|
18668
|
+
frustrationIndicators,
|
|
18669
|
+
frustrationPeaks,
|
|
18670
|
+
inefficiencies,
|
|
18671
|
+
missedOpportunities,
|
|
18672
|
+
antiPatterns,
|
|
18673
|
+
recommendations,
|
|
18674
|
+
summary
|
|
18675
|
+
};
|
|
18676
|
+
}
|
|
18677
|
+
function analyzeFrustration(prompts) {
|
|
18678
|
+
const indicators = new Map;
|
|
18679
|
+
for (const prompt2 of prompts) {
|
|
18680
|
+
const text = prompt2.text;
|
|
18681
|
+
for (const [key, config] of Object.entries(FRUSTRATION_PATTERNS)) {
|
|
18682
|
+
if (config.pattern.test(text)) {
|
|
18683
|
+
const existing = indicators.get(config.type) || { count: 0, examples: [], weight: config.weight };
|
|
18684
|
+
existing.count++;
|
|
18685
|
+
if (existing.examples.length < 3) {
|
|
18686
|
+
existing.examples.push(text.slice(0, 100));
|
|
18687
|
+
}
|
|
18688
|
+
indicators.set(config.type, existing);
|
|
18689
|
+
}
|
|
18690
|
+
}
|
|
18691
|
+
}
|
|
18692
|
+
return Array.from(indicators.entries()).map(([type, data]) => ({
|
|
18693
|
+
type,
|
|
18694
|
+
count: data.count,
|
|
18695
|
+
examples: data.examples,
|
|
18696
|
+
severity: data.weight >= 4 ? "high" : data.weight >= 3 ? "medium" : "low"
|
|
18697
|
+
})).sort((a2, b2) => b2.count - a2.count);
|
|
18698
|
+
}
|
|
18699
|
+
function findFrustrationPeaks(prompts, sessions) {
|
|
18700
|
+
const peaks = [];
|
|
18701
|
+
for (const prompt2 of prompts) {
|
|
18702
|
+
if (!prompt2.isFrustrated)
|
|
18703
|
+
continue;
|
|
18704
|
+
const indicators = [];
|
|
18705
|
+
for (const [_3, config] of Object.entries(FRUSTRATION_PATTERNS)) {
|
|
18706
|
+
if (config.pattern.test(prompt2.text)) {
|
|
18707
|
+
indicators.push(config.type);
|
|
18708
|
+
}
|
|
18709
|
+
}
|
|
18710
|
+
if (indicators.length >= 2) {
|
|
18711
|
+
peaks.push({
|
|
18712
|
+
sessionId: prompt2.sessionId,
|
|
18713
|
+
timestamp: prompt2.timestamp,
|
|
18714
|
+
promptText: prompt2.text.slice(0, 200),
|
|
18715
|
+
indicators,
|
|
18716
|
+
suggestedCause: guessFrustrationCause(prompt2, indicators)
|
|
18717
|
+
});
|
|
18718
|
+
}
|
|
18719
|
+
}
|
|
18720
|
+
return peaks.sort((a2, b2) => b2.indicators.length - a2.indicators.length).slice(0, 10);
|
|
18721
|
+
}
|
|
18722
|
+
function guessFrustrationCause(prompt2, indicators) {
|
|
18723
|
+
if (prompt2.isCorrection) {
|
|
18724
|
+
return "AI did not follow instructions correctly";
|
|
18725
|
+
}
|
|
18726
|
+
if (indicators.includes("FRUSTRATION_PHRASE")) {
|
|
18727
|
+
return "Repeated failures or misunderstandings";
|
|
18728
|
+
}
|
|
18729
|
+
if (indicators.includes("CONFUSION")) {
|
|
18730
|
+
return "Unexpected or confusing AI behavior";
|
|
18731
|
+
}
|
|
18732
|
+
if (indicators.includes("IMPATIENCE")) {
|
|
18733
|
+
return "Need to repeat context or instructions";
|
|
18734
|
+
}
|
|
18735
|
+
return "General workflow friction";
|
|
18736
|
+
}
|
|
18737
|
+
function calculateFrustrationScore(indicators) {
|
|
18738
|
+
let score = 0;
|
|
18739
|
+
for (const indicator of indicators) {
|
|
18740
|
+
const weight = indicator.severity === "high" ? 3 : indicator.severity === "medium" ? 2 : 1;
|
|
18741
|
+
score += indicator.count * weight;
|
|
18742
|
+
}
|
|
18743
|
+
return Math.min(100, score * 2);
|
|
18744
|
+
}
|
|
18745
|
+
function detectAllPatterns(prompts, sessions, frustrationIndicators) {
|
|
18746
|
+
const patterns = [];
|
|
18747
|
+
for (const indicator of frustrationIndicators) {
|
|
18748
|
+
if (indicator.count >= 3) {
|
|
18749
|
+
patterns.push({
|
|
18750
|
+
id: `frustration-${indicator.type.toLowerCase()}`,
|
|
18751
|
+
name: formatPatternName(indicator.type),
|
|
18752
|
+
type: "frustration",
|
|
18753
|
+
severity: indicator.severity,
|
|
18754
|
+
frequency: indicator.count,
|
|
18755
|
+
description: `${indicator.count} occurrences of ${indicator.type.toLowerCase().replace(/_/g, " ")}`,
|
|
18756
|
+
examples: indicator.examples,
|
|
18757
|
+
sessionIds: []
|
|
18758
|
+
});
|
|
18759
|
+
}
|
|
18760
|
+
}
|
|
18761
|
+
const highCorrectionSessions = sessions.filter((s2) => s2.correctionCount >= 5);
|
|
18762
|
+
if (highCorrectionSessions.length > 0) {
|
|
18763
|
+
patterns.push({
|
|
18764
|
+
id: "correction-loop",
|
|
18765
|
+
name: "Correction Loops",
|
|
18766
|
+
type: "inefficiency",
|
|
18767
|
+
severity: highCorrectionSessions.length > 3 ? "high" : "medium",
|
|
18768
|
+
frequency: highCorrectionSessions.length,
|
|
18769
|
+
description: `${highCorrectionSessions.length} sessions with 5+ corrections`,
|
|
18770
|
+
examples: [],
|
|
18771
|
+
sessionIds: highCorrectionSessions.map((s2) => s2.id)
|
|
18772
|
+
});
|
|
18773
|
+
}
|
|
18774
|
+
const compactionSessions = sessions.filter((s2) => s2.hadCompaction);
|
|
18775
|
+
if (compactionSessions.length > 0) {
|
|
18776
|
+
patterns.push({
|
|
18777
|
+
id: "context-loss",
|
|
18778
|
+
name: "Context Loss",
|
|
18779
|
+
type: "inefficiency",
|
|
18780
|
+
severity: compactionSessions.length > 2 ? "high" : "medium",
|
|
18781
|
+
frequency: compactionSessions.length,
|
|
18782
|
+
description: `${compactionSessions.length} sessions experienced context compaction`,
|
|
18783
|
+
examples: [],
|
|
18784
|
+
sessionIds: compactionSessions.map((s2) => s2.id)
|
|
18785
|
+
});
|
|
18786
|
+
}
|
|
18787
|
+
const singleShotSessions = sessions.filter((s2) => s2.promptCount >= 3 && s2.correctionCount === 0 && s2.frustrationCount === 0);
|
|
18788
|
+
if (singleShotSessions.length > 0) {
|
|
18789
|
+
patterns.push({
|
|
18790
|
+
id: "single-shot-success",
|
|
18791
|
+
name: "Single-Shot Success",
|
|
18792
|
+
type: "positive",
|
|
18793
|
+
severity: "low",
|
|
18794
|
+
frequency: singleShotSessions.length,
|
|
18795
|
+
description: `${singleShotSessions.length} sessions completed without corrections`,
|
|
18796
|
+
examples: [],
|
|
18797
|
+
sessionIds: singleShotSessions.map((s2) => s2.id)
|
|
18798
|
+
});
|
|
18799
|
+
}
|
|
18800
|
+
return patterns.sort((a2, b2) => {
|
|
18801
|
+
const severityOrder = { high: 0, medium: 1, low: 2 };
|
|
18802
|
+
return severityOrder[a2.severity] - severityOrder[b2.severity];
|
|
18803
|
+
});
|
|
18804
|
+
}
|
|
18805
|
+
function findInefficiencies(prompts, sessions) {
|
|
18806
|
+
const inefficiencies = [];
|
|
18807
|
+
const corrections = prompts.filter((p) => p.isCorrection);
|
|
18808
|
+
if (corrections.length > 0) {
|
|
18809
|
+
inefficiencies.push({
|
|
18810
|
+
type: "corrections",
|
|
18811
|
+
description: "Prompts that correct AI mistakes",
|
|
18812
|
+
estimatedWastedTokens: corrections.length * INEFFICIENCY_PATTERNS.undoRequest.tokenCost,
|
|
18813
|
+
estimatedWastedMinutes: corrections.length * INEFFICIENCY_PATTERNS.undoRequest.timeCost,
|
|
18814
|
+
occurrences: corrections.length,
|
|
18815
|
+
fix: "Improve prompt specificity and provide examples"
|
|
18816
|
+
});
|
|
18817
|
+
}
|
|
18818
|
+
const reExplanations = findSimilarPrompts(prompts);
|
|
18819
|
+
if (reExplanations > 0) {
|
|
18820
|
+
inefficiencies.push({
|
|
18821
|
+
type: "repeated-context",
|
|
18822
|
+
description: "Re-explaining context already provided",
|
|
18823
|
+
estimatedWastedTokens: reExplanations * INEFFICIENCY_PATTERNS.missingContext.tokenCost,
|
|
18824
|
+
estimatedWastedMinutes: reExplanations * INEFFICIENCY_PATTERNS.missingContext.timeCost,
|
|
18825
|
+
occurrences: reExplanations,
|
|
18826
|
+
fix: "Use Supermemory or CLAUDE.md to persist context"
|
|
18827
|
+
});
|
|
18828
|
+
}
|
|
18829
|
+
const compactions = sessions.filter((s2) => s2.hadCompaction).length;
|
|
18830
|
+
if (compactions > 0) {
|
|
18831
|
+
inefficiencies.push({
|
|
18832
|
+
type: "context-compaction",
|
|
18833
|
+
description: "Sessions that lost context requiring re-explanation",
|
|
18834
|
+
estimatedWastedTokens: compactions * INEFFICIENCY_PATTERNS.startOver.tokenCost,
|
|
18835
|
+
estimatedWastedMinutes: compactions * INEFFICIENCY_PATTERNS.startOver.timeCost,
|
|
18836
|
+
occurrences: compactions,
|
|
18837
|
+
fix: "Start fresh sessions for new tasks"
|
|
18838
|
+
});
|
|
18839
|
+
}
|
|
18840
|
+
const vaguePrompts = prompts.filter((p) => p.wordCount < 10 && !p.hasFileReferences);
|
|
18841
|
+
if (vaguePrompts.length > 5) {
|
|
18842
|
+
inefficiencies.push({
|
|
18843
|
+
type: "vague-prompts",
|
|
18844
|
+
description: "Prompts too brief to be actionable",
|
|
18845
|
+
estimatedWastedTokens: vaguePrompts.length * INEFFICIENCY_PATTERNS.vagueClarification.tokenCost,
|
|
18846
|
+
estimatedWastedMinutes: vaguePrompts.length * INEFFICIENCY_PATTERNS.vagueClarification.timeCost,
|
|
18847
|
+
occurrences: vaguePrompts.length,
|
|
18848
|
+
fix: "Include file paths, line numbers, and expected behavior"
|
|
18849
|
+
});
|
|
18850
|
+
}
|
|
18851
|
+
return inefficiencies.sort((a2, b2) => b2.estimatedWastedTokens - a2.estimatedWastedTokens);
|
|
18852
|
+
}
|
|
18853
|
+
function findSimilarPrompts(prompts) {
|
|
18854
|
+
let similar = 0;
|
|
18855
|
+
const starts = new Map;
|
|
18856
|
+
for (const prompt2 of prompts) {
|
|
18857
|
+
const start = prompt2.text.toLowerCase().split(/\s+/).slice(0, 3).join(" ");
|
|
18858
|
+
if (start.length > 10) {
|
|
18859
|
+
const count = (starts.get(start) || 0) + 1;
|
|
18860
|
+
starts.set(start, count);
|
|
18861
|
+
if (count > 1)
|
|
18862
|
+
similar++;
|
|
18863
|
+
}
|
|
18864
|
+
}
|
|
18865
|
+
return similar;
|
|
18866
|
+
}
|
|
18867
|
+
function findMissedOpportunities(data) {
|
|
18868
|
+
const opportunities = [];
|
|
18869
|
+
const mcpNames = data.mcpConfigs.map((m2) => m2.name.toLowerCase());
|
|
18870
|
+
if (!mcpNames.some((n2) => n2.includes("context7"))) {
|
|
18871
|
+
opportunities.push({
|
|
18872
|
+
type: "missing-mcp",
|
|
18873
|
+
description: "Context7 not installed",
|
|
18874
|
+
potentialBenefit: "Up-to-date library documentation reduces API hallucinations",
|
|
18875
|
+
howToImplement: "claude mcp add context7"
|
|
18876
|
+
});
|
|
18877
|
+
}
|
|
18878
|
+
if (!mcpNames.some((n2) => n2.includes("supermemory") || n2.includes("memory"))) {
|
|
18879
|
+
opportunities.push({
|
|
18880
|
+
type: "missing-mcp",
|
|
18881
|
+
description: "Supermemory not installed",
|
|
18882
|
+
potentialBenefit: "Persistent memory reduces repeated explanations",
|
|
18883
|
+
howToImplement: "claude mcp add supermemory"
|
|
18884
|
+
});
|
|
18885
|
+
}
|
|
18886
|
+
if (data.stats.uniqueToolsUsed < 5) {
|
|
18887
|
+
opportunities.push({
|
|
18888
|
+
type: "low-tool-usage",
|
|
18889
|
+
description: "Using fewer than 5 tools",
|
|
18890
|
+
potentialBenefit: "More tools = more efficient workflows",
|
|
18891
|
+
howToImplement: "Explore grep, Task agents, web fetch capabilities"
|
|
18892
|
+
});
|
|
18893
|
+
}
|
|
18894
|
+
const hasTestReferences = data.allPrompts.some((p) => /\b(test|jest|vitest|pytest)\b/i.test(p.text));
|
|
18895
|
+
if (!hasTestReferences) {
|
|
18896
|
+
opportunities.push({
|
|
18897
|
+
type: "no-testing",
|
|
18898
|
+
description: "No test commands detected in prompts",
|
|
18899
|
+
potentialBenefit: "AI can write and run tests automatically",
|
|
18900
|
+
howToImplement: "Add test command to CLAUDE.md and ask AI to write tests"
|
|
18901
|
+
});
|
|
18902
|
+
}
|
|
18903
|
+
return opportunities;
|
|
18904
|
+
}
|
|
18905
|
+
function detectAntiPatterns(prompts, sessions) {
|
|
18906
|
+
const antiPatterns = [];
|
|
18907
|
+
for (const [key, config] of Object.entries(ANTI_PATTERNS)) {
|
|
18908
|
+
if (config.pattern(prompts, sessions)) {
|
|
18909
|
+
const examples = [];
|
|
18910
|
+
if (key === "noFileReferences") {
|
|
18911
|
+
examples.push(...prompts.filter((p) => !p.hasFileReferences).slice(0, 2).map((p) => p.text.slice(0, 100)));
|
|
18912
|
+
} else if (key === "veryShortPrompts") {
|
|
18913
|
+
examples.push(...prompts.filter((p) => p.wordCount < 10).slice(0, 2).map((p) => p.text));
|
|
18914
|
+
}
|
|
18915
|
+
antiPatterns.push({
|
|
18916
|
+
name: config.name,
|
|
18917
|
+
description: config.description,
|
|
18918
|
+
occurrences: 1,
|
|
18919
|
+
severity: "medium",
|
|
18920
|
+
examples,
|
|
18921
|
+
solution: config.solution
|
|
18922
|
+
});
|
|
18923
|
+
}
|
|
18924
|
+
}
|
|
18925
|
+
return antiPatterns;
|
|
18926
|
+
}
|
|
18927
|
+
function generateRecommendations2(patterns, frustrationIndicators, inefficiencies, antiPatterns, missedOpportunities) {
|
|
18928
|
+
const recommendations = [];
|
|
18929
|
+
for (const ineff of inefficiencies.slice(0, 3)) {
|
|
18930
|
+
recommendations.push({
|
|
18931
|
+
priority: ineff.estimatedWastedTokens > 5000 ? "high" : "medium",
|
|
18932
|
+
title: `Reduce ${ineff.type.replace(/-/g, " ")}`,
|
|
18933
|
+
description: ineff.description,
|
|
18934
|
+
impact: `Save ~${ineff.estimatedWastedTokens} tokens, ${ineff.estimatedWastedMinutes} min`,
|
|
18935
|
+
action: ineff.fix
|
|
18936
|
+
});
|
|
18937
|
+
}
|
|
18938
|
+
for (const ap of antiPatterns.slice(0, 2)) {
|
|
18939
|
+
recommendations.push({
|
|
18940
|
+
priority: "medium",
|
|
18941
|
+
title: `Fix: ${ap.name}`,
|
|
18942
|
+
description: ap.description,
|
|
18943
|
+
impact: "Improve prompt effectiveness",
|
|
18944
|
+
action: ap.solution
|
|
18945
|
+
});
|
|
18946
|
+
}
|
|
18947
|
+
for (const opp of missedOpportunities.slice(0, 2)) {
|
|
18948
|
+
recommendations.push({
|
|
18949
|
+
priority: opp.type === "missing-mcp" ? "high" : "medium",
|
|
18950
|
+
title: `Opportunity: ${opp.description}`,
|
|
18951
|
+
description: opp.potentialBenefit,
|
|
18952
|
+
impact: "Increase productivity",
|
|
18953
|
+
action: opp.howToImplement
|
|
18954
|
+
});
|
|
18955
|
+
}
|
|
18956
|
+
const priorityOrder = { high: 0, medium: 1, low: 2 };
|
|
18957
|
+
recommendations.sort((a2, b2) => priorityOrder[a2.priority] - priorityOrder[b2.priority]);
|
|
18958
|
+
return recommendations.slice(0, 5);
|
|
18959
|
+
}
|
|
18960
|
+
function generateSummary(sentiment, frustrationScore, efficiencyScore, patterns, antiPatterns) {
|
|
18961
|
+
const parts = [];
|
|
18962
|
+
if (sentiment === "positive") {
|
|
18963
|
+
parts.push("Overall positive workflow with low frustration.");
|
|
18964
|
+
} else if (sentiment === "neutral") {
|
|
18965
|
+
parts.push("Workflow has room for improvement.");
|
|
18966
|
+
} else {
|
|
18967
|
+
parts.push("High frustration detected in workflow.");
|
|
18968
|
+
}
|
|
18969
|
+
const negativePatterns = patterns.filter((p) => p.type !== "positive");
|
|
18970
|
+
if (negativePatterns.length > 0) {
|
|
18971
|
+
parts.push(`Key issues: ${negativePatterns.slice(0, 2).map((p) => p.name).join(", ")}.`);
|
|
18972
|
+
}
|
|
18973
|
+
if (antiPatterns.length > 0) {
|
|
18974
|
+
parts.push(`Anti-patterns found: ${antiPatterns.slice(0, 2).map((p) => p.name).join(", ")}.`);
|
|
18975
|
+
}
|
|
18976
|
+
if (efficiencyScore < 50) {
|
|
18977
|
+
parts.push("Significant token waste from inefficient patterns.");
|
|
18978
|
+
} else if (efficiencyScore >= 80) {
|
|
18979
|
+
parts.push("Good efficiency with minimal waste.");
|
|
18980
|
+
}
|
|
18981
|
+
return parts.join(" ");
|
|
18982
|
+
}
|
|
18983
|
+
function formatPatternName(type) {
|
|
18984
|
+
return type.split("_").map((w2) => w2.charAt(0) + w2.slice(1).toLowerCase()).join(" ");
|
|
18985
|
+
}
|
|
18986
|
+
|
|
18843
18987
|
// src/lib/hackathon-report.ts
|
|
18844
18988
|
async function generateHackathonReport(projectDir, since, until = new Date, harness) {
|
|
18845
18989
|
const data = await collectReportData(projectDir, since, until, harness);
|
|
@@ -18851,9 +18995,10 @@ async function generateHackathonReport(projectDir, since, until = new Date, harn
|
|
|
18851
18995
|
const toolUtilization = analyzeToolUtilization(data);
|
|
18852
18996
|
const coverage = parseCoverageReport(projectDir);
|
|
18853
18997
|
const gitBlame = await analyzeGitBlame(projectDir, data);
|
|
18998
|
+
const patternDetection = detectPatterns3(data);
|
|
18854
18999
|
const scores = calculateScores2(data, sdlcAnalysis, promptAnalysis, toolUtilization, coverage);
|
|
18855
19000
|
const overallScore = Math.round(scores.sdlcCoverage * 0.2 + scores.promptQuality * 0.25 + scores.toolUtilization * 0.2 + scores.efficiency * 0.2 + (coverage ? coverage.summary.overall * 0.15 : scores.efficiency * 0.15));
|
|
18856
|
-
const recommendations =
|
|
19001
|
+
const recommendations = generateRecommendations3(data, sdlcAnalysis, promptAnalysis, scores);
|
|
18857
19002
|
const { grade, gradeDescription } = calculateGrade(overallScore, sdlcAnalysis, promptAnalysis);
|
|
18858
19003
|
const summary = buildSummary(data, sdlcAnalysis, promptAnalysis, toolUtilization);
|
|
18859
19004
|
const agentLabels = {
|
|
@@ -18881,6 +19026,7 @@ async function generateHackathonReport(projectDir, since, until = new Date, harn
|
|
|
18881
19026
|
toolUtilization,
|
|
18882
19027
|
coverage,
|
|
18883
19028
|
gitBlame,
|
|
19029
|
+
patternDetection,
|
|
18884
19030
|
summary,
|
|
18885
19031
|
recommendations,
|
|
18886
19032
|
grade,
|
|
@@ -18947,7 +19093,7 @@ function calculateGrade(score, sdlc, prompts) {
|
|
|
18947
19093
|
}
|
|
18948
19094
|
return { grade, gradeDescription };
|
|
18949
19095
|
}
|
|
18950
|
-
function
|
|
19096
|
+
function generateRecommendations3(data, sdlc, prompts, scores) {
|
|
18951
19097
|
const recs = [];
|
|
18952
19098
|
for (const gap of sdlc.gaps) {
|
|
18953
19099
|
recs.push({
|
|
@@ -18957,7 +19103,7 @@ function generateRecommendations2(data, sdlc, prompts, scores) {
|
|
|
18957
19103
|
impact: gap.suggestion
|
|
18958
19104
|
});
|
|
18959
19105
|
}
|
|
18960
|
-
for (const insight of prompts.insights.filter((
|
|
19106
|
+
for (const insight of prompts.insights.filter((i3) => i3.type === "weakness")) {
|
|
18961
19107
|
recs.push({
|
|
18962
19108
|
priority: "medium",
|
|
18963
19109
|
title: insight.title,
|
|
@@ -19145,6 +19291,32 @@ function formatReportAsMarkdown(report) {
|
|
|
19145
19291
|
lines.push("");
|
|
19146
19292
|
}
|
|
19147
19293
|
}
|
|
19294
|
+
if (report.patternDetection.frustrationPeaks.length > 0) {
|
|
19295
|
+
lines.push("## Frustration Analysis");
|
|
19296
|
+
lines.push("");
|
|
19297
|
+
lines.push(`**Frustration Score:** ${report.patternDetection.frustrationScore}/100`);
|
|
19298
|
+
lines.push(`**Efficiency Score:** ${report.patternDetection.efficiencyScore}/100`);
|
|
19299
|
+
lines.push("");
|
|
19300
|
+
lines.push("### Frustration Moments");
|
|
19301
|
+
lines.push("");
|
|
19302
|
+
lines.push("These prompts showed signs of frustration:");
|
|
19303
|
+
lines.push("");
|
|
19304
|
+
for (const peak of report.patternDetection.frustrationPeaks.slice(0, 5)) {
|
|
19305
|
+
lines.push(`> "${peak.promptText}"`);
|
|
19306
|
+
lines.push(">");
|
|
19307
|
+
lines.push(`> **Cause:** ${peak.suggestedCause}`);
|
|
19308
|
+
lines.push(`> **Indicators:** ${peak.indicators.join(", ")}`);
|
|
19309
|
+
lines.push("");
|
|
19310
|
+
}
|
|
19311
|
+
if (report.patternDetection.recommendations.length > 0) {
|
|
19312
|
+
lines.push("### How to Reduce Frustration");
|
|
19313
|
+
lines.push("");
|
|
19314
|
+
for (const rec of report.patternDetection.recommendations.slice(0, 3)) {
|
|
19315
|
+
lines.push(`- **${rec.title}**: ${rec.action}`);
|
|
19316
|
+
}
|
|
19317
|
+
lines.push("");
|
|
19318
|
+
}
|
|
19319
|
+
}
|
|
19148
19320
|
const toolUtilLines = renderToolUtilizationMarkdown(report.toolUtilization);
|
|
19149
19321
|
lines.push(...toolUtilLines);
|
|
19150
19322
|
const sessionPatternLines = renderSessionPatternsMarkdown(report.sessionPatterns);
|
|
@@ -19240,6 +19412,25 @@ function formatReportAsTerminal(report) {
|
|
|
19240
19412
|
lines.push(` Improve: ${report.effectivenessProfile.weaknesses.slice(0, 2).map((w2) => w2.split(":")[0]).join(", ")}`);
|
|
19241
19413
|
}
|
|
19242
19414
|
lines.push("");
|
|
19415
|
+
if (report.patternDetection.frustrationPeaks.length > 0) {
|
|
19416
|
+
lines.push(" Frustration Moments:");
|
|
19417
|
+
lines.push("");
|
|
19418
|
+
for (const peak of report.patternDetection.frustrationPeaks.slice(0, 3)) {
|
|
19419
|
+
const promptSnippet = peak.promptText.length > 80 ? peak.promptText.slice(0, 77) + "..." : peak.promptText;
|
|
19420
|
+
lines.push(` "${promptSnippet}"`);
|
|
19421
|
+
lines.push(` Cause: ${peak.suggestedCause}`);
|
|
19422
|
+
lines.push(` Indicators: ${peak.indicators.slice(0, 3).join(", ")}`);
|
|
19423
|
+
lines.push("");
|
|
19424
|
+
}
|
|
19425
|
+
const frustrationRecs = report.patternDetection.recommendations.filter((r3) => r3.title.toLowerCase().includes("correction") || r3.title.toLowerCase().includes("frustration") || r3.title.toLowerCase().includes("reduce")).slice(0, 2);
|
|
19426
|
+
if (frustrationRecs.length > 0) {
|
|
19427
|
+
lines.push(" How to improve:");
|
|
19428
|
+
for (const rec of frustrationRecs) {
|
|
19429
|
+
lines.push(` - ${rec.action}`);
|
|
19430
|
+
}
|
|
19431
|
+
lines.push("");
|
|
19432
|
+
}
|
|
19433
|
+
}
|
|
19243
19434
|
const sessionLines = renderSessionPatternsSummary(report.sessionPatterns);
|
|
19244
19435
|
for (const line of sessionLines) {
|
|
19245
19436
|
lines.push(line);
|
|
@@ -19351,6 +19542,21 @@ function formatReportAsJSON(report) {
|
|
|
19351
19542
|
trend: report.gitBlame.trend,
|
|
19352
19543
|
patterns: report.gitBlame.patterns,
|
|
19353
19544
|
insights: report.gitBlame.insights
|
|
19545
|
+
},
|
|
19546
|
+
patternDetection: {
|
|
19547
|
+
frustrationScore: report.patternDetection.frustrationScore,
|
|
19548
|
+
efficiencyScore: report.patternDetection.efficiencyScore,
|
|
19549
|
+
overallSentiment: report.patternDetection.overallSentiment,
|
|
19550
|
+
frustrationPeaks: report.patternDetection.frustrationPeaks.map((peak) => ({
|
|
19551
|
+
promptText: peak.promptText,
|
|
19552
|
+
indicators: peak.indicators,
|
|
19553
|
+
suggestedCause: peak.suggestedCause
|
|
19554
|
+
})),
|
|
19555
|
+
recommendations: report.patternDetection.recommendations.map((rec) => ({
|
|
19556
|
+
priority: rec.priority,
|
|
19557
|
+
title: rec.title,
|
|
19558
|
+
action: rec.action
|
|
19559
|
+
}))
|
|
19354
19560
|
}
|
|
19355
19561
|
};
|
|
19356
19562
|
return JSON.stringify(serializable, null, 2);
|
|
@@ -19513,6 +19719,30 @@ async function runHackathonReport(args) {
|
|
|
19513
19719
|
consola.start(`Generating AI-nativeness report for ${harnessLabel} (last ${hoursAgo} hours)...`);
|
|
19514
19720
|
try {
|
|
19515
19721
|
const report = await generateHackathonReport(projectDir, since, until, harness);
|
|
19722
|
+
if (report.summary.totalSessions === 0 && harness && harness !== "all") {
|
|
19723
|
+
consola.warn(`No sessions found for harness "${harness}".`);
|
|
19724
|
+
consola.info(`Try running with --harness all to include sessions from all AI tools.`);
|
|
19725
|
+
consola.info(`Or check that your AI tool's session logs exist in the expected location.`);
|
|
19726
|
+
const allReport = await generateHackathonReport(projectDir, since, until, "all");
|
|
19727
|
+
if (allReport.summary.totalSessions > 0) {
|
|
19728
|
+
consola.info(`Found ${allReport.summary.totalSessions} sessions from other harnesses.`);
|
|
19729
|
+
const useAll = await consola.prompt("Use all sessions instead?", {
|
|
19730
|
+
type: "confirm",
|
|
19731
|
+
initial: true
|
|
19732
|
+
});
|
|
19733
|
+
if (useAll) {
|
|
19734
|
+
const newReport = allReport;
|
|
19735
|
+
if (args.publish) {
|
|
19736
|
+
await publishReport(newReport);
|
|
19737
|
+
return;
|
|
19738
|
+
}
|
|
19739
|
+
const format3 = args.format || "terminal";
|
|
19740
|
+
const output2 = format3 === "md" || format3 === "markdown" ? formatReportAsMarkdown(newReport) : format3 === "json" ? formatReportAsJSON(newReport) : formatReportAsTerminal(newReport);
|
|
19741
|
+
console.log(output2);
|
|
19742
|
+
return;
|
|
19743
|
+
}
|
|
19744
|
+
}
|
|
19745
|
+
}
|
|
19516
19746
|
if (args.publish) {
|
|
19517
19747
|
await publishReport(report);
|
|
19518
19748
|
return;
|
|
@@ -19558,6 +19788,21 @@ async function publishReport(report) {
|
|
|
19558
19788
|
consola.info("Alternatively, use `nb report --hackathon --format md` for local markdown.");
|
|
19559
19789
|
return;
|
|
19560
19790
|
}
|
|
19791
|
+
if (report.summary.totalSessions === 0) {
|
|
19792
|
+
consola.warn("Publishing report with 0 sessions detected.");
|
|
19793
|
+
consola.info("This may result in incomplete data. Common causes:");
|
|
19794
|
+
consola.info(" - Selected harness doesn't match your AI tool");
|
|
19795
|
+
consola.info(" - Session logs not found in expected location");
|
|
19796
|
+
consola.info(" - Time range doesn't include recent sessions");
|
|
19797
|
+
const proceed = await consola.prompt("Continue publishing anyway?", {
|
|
19798
|
+
type: "confirm",
|
|
19799
|
+
initial: false
|
|
19800
|
+
});
|
|
19801
|
+
if (!proceed) {
|
|
19802
|
+
consola.info("Aborted. Try running with --harness all");
|
|
19803
|
+
return;
|
|
19804
|
+
}
|
|
19805
|
+
}
|
|
19561
19806
|
consola.start("Publishing report...");
|
|
19562
19807
|
const markdownContent = formatReportAsMarkdown(report);
|
|
19563
19808
|
const basePayload = {
|
|
@@ -19627,6 +19872,20 @@ async function publishReport(report) {
|
|
|
19627
19872
|
description: r3.description,
|
|
19628
19873
|
impact: r3.impact
|
|
19629
19874
|
})),
|
|
19875
|
+
frustrationAnalysis: {
|
|
19876
|
+
frustrationScore: report.patternDetection.frustrationScore,
|
|
19877
|
+
efficiencyScore: report.patternDetection.efficiencyScore,
|
|
19878
|
+
overallSentiment: report.patternDetection.overallSentiment,
|
|
19879
|
+
frustrationPeaks: report.patternDetection.frustrationPeaks.slice(0, 5).map((peak) => ({
|
|
19880
|
+
promptText: peak.promptText.slice(0, 200),
|
|
19881
|
+
indicators: peak.indicators,
|
|
19882
|
+
suggestedCause: peak.suggestedCause
|
|
19883
|
+
})),
|
|
19884
|
+
improvements: report.patternDetection.recommendations.slice(0, 3).map((rec) => ({
|
|
19885
|
+
title: rec.title,
|
|
19886
|
+
action: rec.action
|
|
19887
|
+
}))
|
|
19888
|
+
},
|
|
19630
19889
|
markdownContent
|
|
19631
19890
|
};
|
|
19632
19891
|
const payload = clerkId ? { ...basePayload, clerkId } : basePayload;
|
|
@@ -20417,9 +20676,9 @@ async function renderLocalInsights(score, phaseFilter) {
|
|
|
20417
20676
|
console.log(` ${icons.success} ${colors2.success("No critical insights. Your workflow looks strong!")}`);
|
|
20418
20677
|
return;
|
|
20419
20678
|
}
|
|
20420
|
-
const critical = insights.filter((
|
|
20421
|
-
const warning2 = insights.filter((
|
|
20422
|
-
const info2 = insights.filter((
|
|
20679
|
+
const critical = insights.filter((i3) => i3.severity === "critical");
|
|
20680
|
+
const warning2 = insights.filter((i3) => i3.severity === "warning");
|
|
20681
|
+
const info2 = insights.filter((i3) => i3.severity === "info");
|
|
20423
20682
|
if (critical.length > 0) {
|
|
20424
20683
|
console.log(` ${colors2.error(colors2.bold("Critical Issues"))}`);
|
|
20425
20684
|
console.log(colors2.dim(" " + "─".repeat(40)));
|
|
@@ -21572,8 +21831,8 @@ function renderMiniChart(scores) {
|
|
|
21572
21831
|
const width = Math.min(scores.length, 30);
|
|
21573
21832
|
const step = Math.max(1, Math.floor(scores.length / width));
|
|
21574
21833
|
const sampled = [];
|
|
21575
|
-
for (let
|
|
21576
|
-
sampled.push(scores[
|
|
21834
|
+
for (let i3 = 0;i3 < scores.length; i3 += step) {
|
|
21835
|
+
sampled.push(scores[i3]);
|
|
21577
21836
|
}
|
|
21578
21837
|
const min = Math.min(...sampled);
|
|
21579
21838
|
const max = Math.max(...sampled);
|
|
@@ -22812,8 +23071,8 @@ function formatBytes(bytes) {
|
|
|
22812
23071
|
return "0 B";
|
|
22813
23072
|
const k2 = 1024;
|
|
22814
23073
|
const sizes = ["B", "KB", "MB", "GB"];
|
|
22815
|
-
const
|
|
22816
|
-
return `${parseFloat((bytes / Math.pow(k2,
|
|
23074
|
+
const i3 = Math.floor(Math.log(bytes) / Math.log(k2));
|
|
23075
|
+
return `${parseFloat((bytes / Math.pow(k2, i3)).toFixed(1))} ${sizes[i3]}`;
|
|
22817
23076
|
}
|
|
22818
23077
|
|
|
22819
23078
|
// src/commands/setup.ts
|
|
@@ -22950,10 +23209,10 @@ async function confirm(question, defaultYes = true) {
|
|
|
22950
23209
|
async function selectMultiple(question, options) {
|
|
22951
23210
|
console.log(question);
|
|
22952
23211
|
console.log();
|
|
22953
|
-
for (let
|
|
22954
|
-
const opt = options[
|
|
23212
|
+
for (let i3 = 0;i3 < options.length; i3++) {
|
|
23213
|
+
const opt = options[i3];
|
|
22955
23214
|
const marker = opt.selected ? colors2.success("[x]") : colors2.dim("[ ]");
|
|
22956
|
-
console.log(` ${marker} ${
|
|
23215
|
+
console.log(` ${marker} ${i3 + 1}. ${opt.label}`);
|
|
22957
23216
|
}
|
|
22958
23217
|
console.log();
|
|
22959
23218
|
const answer = await prompt2(`${colors2.dim("Enter numbers (comma-separated) or press Enter for selected:")} `);
|
|
@@ -22961,7 +23220,7 @@ async function selectMultiple(question, options) {
|
|
|
22961
23220
|
return options.filter((o3) => o3.selected).map((o3) => o3.id);
|
|
22962
23221
|
}
|
|
22963
23222
|
const indices = answer.split(",").map((s2) => parseInt(s2.trim(), 10) - 1);
|
|
22964
|
-
return indices.filter((
|
|
23223
|
+
return indices.filter((i3) => i3 >= 0 && i3 < options.length).map((i3) => options[i3].id);
|
|
22965
23224
|
}
|
|
22966
23225
|
function getInstalledMCPs(harnesses) {
|
|
22967
23226
|
const installed = new Set;
|
|
@@ -23210,9 +23469,9 @@ var setupCommand = defineCommand2({
|
|
|
23210
23469
|
console.log(`${colors2.dim("[3/4]")} ${colors2.primary("Recommended optimizations:")}`);
|
|
23211
23470
|
console.log();
|
|
23212
23471
|
const topRecs = analysis.recommendations.slice(0, 4);
|
|
23213
|
-
for (let
|
|
23214
|
-
const rec = topRecs[
|
|
23215
|
-
console.log(` ${colors2.success(`${
|
|
23472
|
+
for (let i3 = 0;i3 < topRecs.length; i3++) {
|
|
23473
|
+
const rec = topRecs[i3];
|
|
23474
|
+
console.log(` ${colors2.success(`${i3 + 1}.`)} ${colors2.bold(rec.title)}`);
|
|
23216
23475
|
console.log(` ${colors2.dim(rec.description)}`);
|
|
23217
23476
|
}
|
|
23218
23477
|
console.log();
|
|
@@ -23373,7 +23632,7 @@ var setupCommand = defineCommand2({
|
|
|
23373
23632
|
// package.json
|
|
23374
23633
|
var package_default = {
|
|
23375
23634
|
name: "nairon-bench",
|
|
23376
|
-
version: "0.0.
|
|
23635
|
+
version: "0.0.40",
|
|
23377
23636
|
description: "AI workflow benchmarking CLI",
|
|
23378
23637
|
type: "module",
|
|
23379
23638
|
bin: {
|
|
@@ -23410,19 +23669,6 @@ var package_default = {
|
|
|
23410
23669
|
clean: "rm -rf dist",
|
|
23411
23670
|
prepublishOnly: "bun run build"
|
|
23412
23671
|
},
|
|
23413
|
-
devDependencies: {
|
|
23414
|
-
"@nairon-bench/shared": "workspace:*",
|
|
23415
|
-
"@opentui/core": "^0.1.0",
|
|
23416
|
-
"@opentui/react": "^0.1.0",
|
|
23417
|
-
"@types/bun": "latest",
|
|
23418
|
-
citty: "^0.1.6",
|
|
23419
|
-
consola: "^3.4.0",
|
|
23420
|
-
convex: "^1.21.0",
|
|
23421
|
-
react: "^19.0.0",
|
|
23422
|
-
"simple-git": "^3.27.0",
|
|
23423
|
-
tuistory: "^1.0.0",
|
|
23424
|
-
typescript: "^5.8.0"
|
|
23425
|
-
},
|
|
23426
23672
|
dependencies: {
|
|
23427
23673
|
"cli-boxes": "^4.0.1",
|
|
23428
23674
|
ora: "^9.3.0",
|