nairon-bench 0.0.33 → 0.0.35

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.
Files changed (2) hide show
  1. package/dist/index.js +1329 -997
  2. package/package.json +14 -1
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/consola/dist/core.mjs
33
+ // ../../node_modules/.bun/consola@3.4.2/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/consola/dist/shared/consola.DRwqZj3T.mjs
432
+ // ../../node_modules/.bun/consola@3.4.2/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/consola/dist/shared/consola.DXBYu-KD.mjs
510
+ // ../../node_modules/.bun/consola@3.4.2/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/consola/dist/chunks/prompt.mjs
726
+ // ../../node_modules/.bun/consola@3.4.2/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/consola/dist/index.mjs
1482
+ // ../../node_modules/.bun/consola@3.4.2/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/ms/index.js
1770
+ // ../../node_modules/.bun/ms@2.1.3/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/debug/src/common.js
1880
+ // ../../node_modules/.bun/debug@4.4.3/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/debug/src/browser.js
2055
+ // ../../node_modules/.bun/debug@4.4.3/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/debug/src/node.js
2215
+ // ../../node_modules/.bun/debug@4.4.3/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/debug/src/index.js
2386
+ // ../../node_modules/.bun/debug@4.4.3/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/@kwsites/file-exists/dist/src/index.js
2395
+ // ../../node_modules/.bun/@kwsites+file-exists@1.1.1/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/@kwsites/file-exists/dist/index.js
2436
+ // ../../node_modules/.bun/@kwsites+file-exists@1.1.1/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/@kwsites/promise-deferred/dist/index.js
2447
+ // ../../node_modules/.bun/@kwsites+promise-deferred@1.1.1/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/convex/dist/esm/index.js
2486
+ // ../../node_modules/.bun/convex@1.31.7+b1ab299f0a400331/node_modules/convex/dist/esm/index.js
2487
2487
  var version = "1.31.7";
2488
2488
 
2489
- // ../../node_modules/convex/dist/esm/values/base64.js
2489
+ // ../../node_modules/.bun/convex@1.31.7+b1ab299f0a400331/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/convex/dist/esm/common/index.js
2573
+ // ../../node_modules/.bun/convex@1.31.7+b1ab299f0a400331/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/convex/dist/esm/values/value.js
2609
+ // ../../node_modules/.bun/convex@1.31.7+b1ab299f0a400331/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,959 +2847,1241 @@ var init_value = __esm(() => {
2847
2847
  base64ToBigInt = DataView.prototype.getBigInt64 ? modernBase64ToBigInt : slowBase64ToBigInt;
2848
2848
  });
2849
2849
 
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.`);
2854
- }
2850
+ // ../../node_modules/.bun/convex@1.31.7+b1ab299f0a400331/node_modules/convex/dist/esm/values/errors.js
2851
+ 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), _a2, _b, IDENTIFYING_FIELD, ConvexError;
2852
+ var init_errors = __esm(() => {
2853
+ init_value();
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
+ });
2855
2866
 
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;
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 "?";
2864
2884
  }
2865
2885
  }
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");
2886
+
2887
+ class DefaultLogger {
2888
+ constructor(options) {
2889
+ __publicField2(this, "_onLogLineFuncs");
2890
+ __publicField2(this, "_verbose");
2891
+ this._onLogLineFuncs = {};
2892
+ this._verbose = options.verbose;
2893
+ }
2894
+ addLogLineListener(func) {
2895
+ let id = Math.random().toString(36).substring(2, 15);
2896
+ for (let i3 = 0;i3 < 10; i3++) {
2897
+ if (this._onLogLineFuncs[id] === undefined) {
2898
+ break;
2880
2899
  }
2881
- this.tableName = tableName;
2882
- }
2883
- get json() {
2884
- return { type: "id", tableName: this.tableName };
2900
+ id = Math.random().toString(36).substring(2, 15);
2885
2901
  }
2886
- asOptional() {
2887
- return new VId({
2888
- isOptional: "optional",
2889
- tableName: this.tableName
2890
- });
2902
+ this._onLogLineFuncs[id] = func;
2903
+ return () => {
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
+ }
2891
2912
  }
2892
- };
2893
- VFloat64 = class VFloat64 extends BaseValidator {
2894
- constructor() {
2895
- super(...arguments);
2896
- __publicField(this, "kind", "float64");
2913
+ }
2914
+ log(...args) {
2915
+ for (const func of Object.values(this._onLogLineFuncs)) {
2916
+ func("info", ...args);
2897
2917
  }
2898
- get json() {
2899
- return { type: "number" };
2918
+ }
2919
+ warn(...args) {
2920
+ for (const func of Object.values(this._onLogLineFuncs)) {
2921
+ func("warn", ...args);
2900
2922
  }
2901
- asOptional() {
2902
- return new VFloat64({
2903
- isOptional: "optional"
2904
- });
2923
+ }
2924
+ error(...args) {
2925
+ for (const func of Object.values(this._onLogLineFuncs)) {
2926
+ func("error", ...args);
2905
2927
  }
2906
- };
2907
- VInt64 = class VInt64 extends BaseValidator {
2908
- constructor() {
2909
- super(...arguments);
2910
- __publicField(this, "kind", "int64");
2928
+ }
2929
+ }
2930
+ function instantiateDefaultLogger(options) {
2931
+ const logger = new DefaultLogger(options);
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
+ }
2911
2949
  }
2912
- get json() {
2913
- return { type: "bigint" };
2950
+ });
2951
+ return logger;
2952
+ }
2953
+ function instantiateNoopLogger(options) {
2954
+ return new DefaultLogger(options);
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;
2914
2966
  }
2915
- asOptional() {
2916
- return new VInt64({ isOptional: "optional" });
2967
+ const level = message.slice(1, match[0].length - 2);
2968
+ const args = message.slice(match[0].length);
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 };
2917
2999
  }
2918
- };
2919
- VBoolean = class VBoolean extends BaseValidator {
2920
- constructor() {
2921
- super(...arguments);
2922
- __publicField(this, "kind", "boolean");
3000
+ } else if (functionReference[functionName]) {
3001
+ functionAddress = { name: functionReference[functionName] };
3002
+ } else {
3003
+ const referencePath = extractReferencePath(functionReference);
3004
+ if (!referencePath) {
3005
+ throw new Error(`${functionReference} is not a functionReference`);
2923
3006
  }
2924
- get json() {
2925
- return { type: this.kind };
3007
+ functionAddress = { reference: referencePath };
3008
+ }
3009
+ return functionAddress;
3010
+ }
3011
+ var toReferencePath;
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}`);
2926
3025
  }
2927
- asOptional() {
2928
- return new VBoolean({
2929
- isOptional: "optional"
2930
- });
3026
+ throw new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(address)}`);
3027
+ }
3028
+ if (typeof functionReference === "string")
3029
+ return functionReference;
3030
+ const name = functionReference[functionName];
3031
+ if (!name) {
3032
+ throw new Error(`${functionReference} is not a functionReference`);
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
+ }
2931
3059
  }
2932
3060
  };
2933
- VBytes = class VBytes extends BaseValidator {
2934
- constructor() {
2935
- super(...arguments);
2936
- __publicField(this, "kind", "bytes");
3061
+ return new Proxy({}, handler);
3062
+ }
3063
+ var anyApi;
3064
+ var init_api = __esm(() => {
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 }`.");
2937
3085
  }
2938
- get json() {
2939
- return { type: this.kind };
2940
- }
2941
- asOptional() {
2942
- return new VBytes({ isOptional: "optional" });
2943
- }
2944
- };
2945
- VString = class VString extends BaseValidator {
2946
- constructor() {
2947
- super(...arguments);
2948
- __publicField(this, "kind", "string");
2949
- }
2950
- get json() {
2951
- return { type: this.kind };
3086
+ const opts = options ?? {};
3087
+ if (opts.skipConvexDeploymentUrlCheck !== true) {
3088
+ validateDeploymentUrl(address);
2952
3089
  }
2953
- asOptional() {
2954
- return new VString({
2955
- isOptional: "optional"
2956
- });
3090
+ this.logger = options?.logger === false ? instantiateNoopLogger({ verbose: false }) : options?.logger !== true && options?.logger ? options.logger : instantiateDefaultLogger({ verbose: false });
3091
+ this.address = address;
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);
2957
3098
  }
2958
- };
2959
- VNull = class VNull extends BaseValidator {
2960
- constructor() {
2961
- super(...arguments);
2962
- __publicField(this, "kind", "null");
3099
+ }
3100
+ backendUrl() {
3101
+ return `${this.address}/api`;
3102
+ }
3103
+ get url() {
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;
2963
3118
  }
2964
- get json() {
2965
- return { type: this.kind };
3119
+ }
3120
+ clearAuth() {
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;
2966
3138
  }
2967
- asOptional() {
2968
- return new VNull({ isOptional: "optional" });
3139
+ return this.encodedTsPromise = this.getTimestampInner();
3140
+ }
3141
+ async getTimestampInner() {
3142
+ const localFetch = this.fetch || specifiedFetch || fetch;
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());
2969
3154
  }
2970
- };
2971
- VAny = class VAny extends BaseValidator {
2972
- constructor() {
2973
- super(...arguments);
2974
- __publicField(this, "kind", "any");
3155
+ const { ts } = await response.json();
3156
+ return ts;
3157
+ }
3158
+ async query(query, ...args) {
3159
+ const queryArgs = parseArgs2(args[0]);
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}`;
2975
3173
  }
2976
- get json() {
2977
- return {
2978
- type: this.kind
2979
- };
3174
+ const localFetch = this.fetch || specifiedFetch || fetch;
3175
+ const timestamp = options.timestampPromise ? await options.timestampPromise : undefined;
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());
2980
3191
  }
2981
- asOptional() {
2982
- return new VAny({
2983
- isOptional: "optional"
2984
- });
3192
+ const respJSON = await response.json();
3193
+ if (this.debug) {
3194
+ for (const line of respJSON.logLines ?? []) {
3195
+ logForFunction(this.logger, "info", "query", name, line);
3196
+ }
2985
3197
  }
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);
2998
- }
2999
- if (!validator.isConvexValidator) {
3000
- throw new Error("v.object() entries must be validators");
3198
+ switch (respJSON.status) {
3199
+ case "success":
3200
+ return jsonToConvex(respJSON.value);
3201
+ case "error":
3202
+ if (respJSON.errorData !== undefined) {
3203
+ throw forwardErrorData(respJSON.errorData, new ConvexError(respJSON.errorMessage));
3001
3204
  }
3002
- });
3003
- this.fields = fields;
3205
+ throw new Error(respJSON.errorMessage);
3206
+ default:
3207
+ throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
3004
3208
  }
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
- };
3209
+ }
3210
+ async mutationInner(mutation, mutationArgs) {
3211
+ const name = getFunctionName(mutation);
3212
+ const body = JSON.stringify({
3213
+ path: name,
3214
+ format: "convex_encoded_json",
3215
+ args: [convexToJson(mutationArgs)]
3216
+ });
3217
+ const headers = {
3218
+ "Content-Type": "application/json",
3219
+ "Convex-Client": `npm-${version}`
3220
+ };
3221
+ if (this.adminAuth) {
3222
+ headers["Authorization"] = `Convex ${this.adminAuth}`;
3223
+ } else if (this.auth) {
3224
+ headers["Authorization"] = `Bearer ${this.auth}`;
3016
3225
  }
3017
- asOptional() {
3018
- return new VObject({
3019
- isOptional: "optional",
3020
- fields: this.fields
3021
- });
3226
+ const localFetch = this.fetch || specifiedFetch || fetch;
3227
+ const response = await localFetch(`${this.address}/api/mutation`, {
3228
+ ...this.fetchOptions,
3229
+ body,
3230
+ method: "POST",
3231
+ headers
3232
+ });
3233
+ if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
3234
+ throw new Error(await response.text());
3022
3235
  }
3023
- omit(...fields) {
3024
- const newFields = { ...this.fields };
3025
- for (const field of fields) {
3026
- delete newFields[field];
3236
+ const respJSON = await response.json();
3237
+ if (this.debug) {
3238
+ for (const line of respJSON.logLines ?? []) {
3239
+ logForFunction(this.logger, "info", "mutation", name, line);
3027
3240
  }
3028
- return new VObject({
3029
- isOptional: this.isOptional,
3030
- fields: newFields
3031
- });
3032
3241
  }
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
- });
3242
+ switch (respJSON.status) {
3243
+ case "success":
3244
+ return jsonToConvex(respJSON.value);
3245
+ case "error":
3246
+ if (respJSON.errorData !== undefined) {
3247
+ throw forwardErrorData(respJSON.errorData, new ConvexError(respJSON.errorMessage));
3248
+ }
3249
+ throw new Error(respJSON.errorMessage);
3250
+ default:
3251
+ throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
3042
3252
  }
3043
- partial() {
3044
- const newFields = {};
3045
- for (const [key, validator] of globalThis.Object.entries(this.fields)) {
3046
- newFields[key] = validator.asOptional();
3253
+ }
3254
+ async processMutationQueue() {
3255
+ if (this.isProcessingQueue) {
3256
+ return;
3257
+ }
3258
+ this.isProcessingQueue = true;
3259
+ while (this.mutationQueue.length > 0) {
3260
+ const { mutation, args, resolve, reject } = this.mutationQueue.shift();
3261
+ try {
3262
+ const result = await this.mutationInner(mutation, args);
3263
+ resolve(result);
3264
+ } catch (error) {
3265
+ reject(error);
3047
3266
  }
3048
- return new VObject({
3049
- isOptional: this.isOptional,
3050
- fields: newFields
3051
- });
3052
3267
  }
3053
- extend(fields) {
3054
- return new VObject({
3055
- isOptional: this.isOptional,
3056
- fields: { ...this.fields, ...fields }
3057
- });
3058
- }
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;
3069
- }
3070
- get json() {
3071
- return {
3072
- type: this.kind,
3073
- value: convexToJson(this.value)
3074
- };
3075
- }
3076
- asOptional() {
3077
- return new VLiteral({
3078
- isOptional: "optional",
3079
- value: this.value
3080
- });
3081
- }
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;
3268
+ this.isProcessingQueue = false;
3269
+ }
3270
+ enqueueMutation(mutation, args) {
3271
+ return new Promise((resolve, reject) => {
3272
+ this.mutationQueue.push({ mutation, args, resolve, reject });
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);
3095
3284
  }
3096
- get json() {
3097
- return {
3098
- type: this.kind,
3099
- value: this.element.json
3100
- };
3285
+ }
3286
+ async action(action, ...args) {
3287
+ const actionArgs = parseArgs2(args[0]);
3288
+ const name = getFunctionName(action);
3289
+ const body = JSON.stringify({
3290
+ path: name,
3291
+ format: "convex_encoded_json",
3292
+ args: [convexToJson(actionArgs)]
3293
+ });
3294
+ const headers = {
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}`;
3101
3302
  }
3102
- asOptional() {
3103
- return new VArray({
3104
- isOptional: "optional",
3105
- element: this.element
3106
- });
3303
+ const localFetch = this.fetch || specifiedFetch || fetch;
3304
+ const response = await localFetch(`${this.address}/api/action`, {
3305
+ ...this.fetchOptions,
3306
+ body,
3307
+ method: "POST",
3308
+ headers
3309
+ });
3310
+ if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
3311
+ throw new Error(await response.text());
3107
3312
  }
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");
3130
- }
3131
- if (!key.isConvexValidator || !value.isConvexValidator) {
3132
- throw new Error("Key and value of v.record() but be validators");
3313
+ const respJSON = await response.json();
3314
+ if (this.debug) {
3315
+ for (const line of respJSON.logLines ?? []) {
3316
+ logForFunction(this.logger, "info", "action", name, line);
3133
3317
  }
3134
- this.key = key;
3135
- this.value = value;
3136
3318
  }
3137
- get json() {
3138
- return {
3139
- type: this.kind,
3140
- keys: this.key.json,
3141
- values: {
3142
- fieldType: this.value.json,
3143
- optional: false
3319
+ switch (respJSON.status) {
3320
+ case "success":
3321
+ return jsonToConvex(respJSON.value);
3322
+ case "error":
3323
+ if (respJSON.errorData !== undefined) {
3324
+ throw forwardErrorData(respJSON.errorData, new ConvexError(respJSON.errorMessage));
3144
3325
  }
3145
- };
3326
+ throw new Error(respJSON.errorMessage);
3327
+ default:
3328
+ throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
3146
3329
  }
3147
- asOptional() {
3148
- return new VRecord({
3149
- isOptional: "optional",
3150
- key: this.key,
3151
- value: this.value
3152
- });
3330
+ }
3331
+ async function(anyFunction, componentPath, ...args) {
3332
+ const functionArgs = parseArgs2(args[0]);
3333
+ const name = typeof anyFunction === "string" ? anyFunction : getFunctionName(anyFunction);
3334
+ const body = JSON.stringify({
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}`;
3153
3348
  }
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;
3349
+ const localFetch = this.fetch || specifiedFetch || fetch;
3350
+ const response = await localFetch(`${this.address}/api/function`, {
3351
+ ...this.fetchOptions,
3352
+ body,
3353
+ method: "POST",
3354
+ headers
3355
+ });
3356
+ if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
3357
+ throw new Error(await response.text());
3169
3358
  }
3170
- get json() {
3171
- return {
3172
- type: this.kind,
3173
- value: this.members.map((v2) => v2.json)
3174
- };
3359
+ const respJSON = await response.json();
3360
+ if (this.debug) {
3361
+ for (const line of respJSON.logLines ?? []) {
3362
+ logForFunction(this.logger, "info", "any", name, line);
3363
+ }
3175
3364
  }
3176
- asOptional() {
3177
- return new VUnion({
3178
- isOptional: "optional",
3179
- members: this.members
3180
- });
3365
+ switch (respJSON.status) {
3366
+ case "success":
3367
+ return jsonToConvex(respJSON.value);
3368
+ case "error":
3369
+ if (respJSON.errorData !== undefined) {
3370
+ throw forwardErrorData(respJSON.errorData, new ConvexError(respJSON.errorMessage));
3371
+ }
3372
+ throw new Error(respJSON.errorMessage);
3373
+ default:
3374
+ throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
3181
3375
  }
3182
- };
3376
+ }
3377
+ }
3378
+ function forwardErrorData(errorData, error) {
3379
+ error.data = jsonToConvex(errorData);
3380
+ return error;
3381
+ }
3382
+ 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), STATUS_CODE_UDF_FAILED = 560, specifiedFetch = undefined;
3383
+ var init_http_client = __esm(() => {
3384
+ init_api();
3385
+ init_values();
3386
+ init_logging();
3387
+ __defProp5 = Object.defineProperty;
3183
3388
  });
3184
3389
 
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
- };
3390
+ // ../../node_modules/.bun/convex@1.31.7+b1ab299f0a400331/node_modules/convex/dist/esm/browser/index-node.js
3391
+ var init_index_node = __esm(() => {
3392
+ init_http_client();
3252
3393
  });
3253
3394
 
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
- };
3395
+ // ../../node_modules/.bun/convex@1.31.7/node_modules/convex/dist/esm/values/base64.js
3396
+ function getLens2(b64) {
3397
+ var len3 = b64.length;
3398
+ if (len3 % 4 > 0) {
3399
+ throw new Error("Invalid string. Length must be a multiple of 4");
3400
+ }
3401
+ var validLen = b64.indexOf("=");
3402
+ if (validLen === -1)
3403
+ validLen = len3;
3404
+ var placeHoldersLen = validLen === len3 ? 0 : 4 - validLen % 4;
3405
+ return [validLen, placeHoldersLen];
3406
+ }
3407
+ function _byteLength2(_b64, validLen, placeHoldersLen) {
3408
+ return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
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;
3269
3477
  });
3270
3478
 
3271
- // ../../node_modules/convex/dist/esm/values/index.js
3272
- var init_values = __esm(() => {
3273
- init_value();
3274
- init_errors();
3275
- });
3479
+ // ../../node_modules/.bun/convex@1.31.7/node_modules/convex/dist/esm/common/index.js
3480
+ function isSimpleObject2(value) {
3481
+ const isObject = typeof value === "object";
3482
+ const prototype = Object.getPrototypeOf(value);
3483
+ const isSimple = prototype === null || prototype === Object.prototype || prototype?.constructor?.name === "Object";
3484
+ return isObject && isSimple;
3485
+ }
3276
3486
 
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 "?";
3487
+ // ../../node_modules/.bun/convex@1.31.7/node_modules/convex/dist/esm/values/value.js
3488
+ function isSpecial2(n2) {
3489
+ return Number.isNaN(n2) || !Number.isFinite(n2) || Object.is(n2, -0);
3490
+ }
3491
+ function slowBigIntToBase642(value) {
3492
+ if (value < ZERO2) {
3493
+ value -= MIN_INT642 + MIN_INT642;
3288
3494
  }
3495
+ let hex = value.toString(16);
3496
+ if (hex.length % 2 === 1)
3497
+ hex = "0" + hex;
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);
3289
3505
  }
3290
-
3291
- class DefaultLogger {
3292
- constructor(options) {
3293
- __publicField3(this, "_onLogLineFuncs");
3294
- __publicField3(this, "_verbose");
3295
- this._onLogLineFuncs = {};
3296
- this._verbose = options.verbose;
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`);
3297
3510
  }
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);
3305
- }
3306
- this._onLogLineFuncs[id] = func;
3307
- return () => {
3308
- delete this._onLogLineFuncs[id];
3309
- };
3511
+ let value = ZERO2;
3512
+ let power = ZERO2;
3513
+ for (const byte of integerBytes) {
3514
+ value += BigInt(byte) * TWOFIFTYSIX2 ** power;
3515
+ power++;
3310
3516
  }
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
- }
3517
+ if (value > MAX_INT642) {
3518
+ value += MIN_INT642 + MIN_INT642;
3317
3519
  }
3318
- log(...args) {
3319
- for (const func of Object.values(this._onLogLineFuncs)) {
3320
- func("info", ...args);
3321
- }
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.`);
3322
3525
  }
3323
- warn(...args) {
3324
- for (const func of Object.values(this._onLogLineFuncs)) {
3325
- func("warn", ...args);
3326
- }
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`);
3327
3534
  }
3328
- error(...args) {
3329
- for (const func of Object.values(this._onLogLineFuncs)) {
3330
- func("error", ...args);
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`);
3331
3549
  }
3332
3550
  }
3333
3551
  }
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
- }
3552
+ function stringifyValueForError2(value) {
3553
+ const str = JSON.stringify(value, (_key, value2) => {
3554
+ if (value2 === undefined) {
3555
+ return "undefined";
3353
3556
  }
3557
+ if (typeof value2 === "bigint") {
3558
+ return `${value2.toString()}n`;
3559
+ }
3560
+ return value2;
3354
3561
  });
3355
- return logger;
3356
- }
3357
- function instantiateNoopLogger(options) {
3358
- return new DefaultLogger(options);
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;
3359
3572
  }
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)}`;
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;
3580
+ }
3581
+ if (typeof value === "bigint") {
3582
+ if (value < MIN_INT642 || MAX_INT642 < value) {
3583
+ throw new Error(`BigInt ${value} does not fit into a 64-bit signed integer.`);
3584
+ }
3585
+ return { $integer: bigIntToBase642(value) };
3586
+ }
3587
+ if (typeof value === "number") {
3588
+ if (isSpecial2(value)) {
3589
+ const buffer = new ArrayBuffer(8);
3590
+ new DataView(buffer).setFloat64(0, value, LITTLE_ENDIAN2);
3591
+ return { $float: fromByteArray2(new Uint8Array(buffer)) };
3592
+ } else {
3593
+ return value;
3594
+ }
3595
+ }
3596
+ if (typeof value === "boolean") {
3597
+ return value;
3598
+ }
3599
+ if (typeof value === "string") {
3600
+ return value;
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));
3364
3607
  }
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;
3608
+ if (value instanceof Set) {
3609
+ throw new Error(errorMessageForUnsupportedType2(context, "Set", [...value], originalValue));
3610
+ }
3611
+ if (value instanceof Map) {
3612
+ throw new Error(errorMessageForUnsupportedType2(context, "Map", [...value], originalValue));
3613
+ }
3614
+ if (!isSimpleObject2(value)) {
3615
+ const theType = value?.constructor?.name;
3616
+ const typeName = theType ? `${theType} ` : "";
3617
+ throw new Error(errorMessageForUnsupportedType2(context, typeName, value, originalValue));
3618
+ }
3619
+ const out = {};
3620
+ const entries = Object.entries(value);
3621
+ entries.sort(([k1, _v1], [k2, _v2]) => k1 === k2 ? 0 : k1 < k2 ? -1 : 1);
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}`);
3370
3629
  }
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}`);
3376
3630
  }
3631
+ return out;
3377
3632
  }
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;
3381
- });
3382
-
3383
- // ../../node_modules/convex/dist/esm/server/functionName.js
3384
- var functionName;
3385
- var init_functionName = __esm(() => {
3386
- functionName = Symbol.for("functionName");
3387
- });
3388
-
3389
- // ../../node_modules/convex/dist/esm/server/components/paths.js
3390
- function extractReferencePath(reference) {
3391
- return reference[toReferencePath] ?? null;
3392
- }
3393
- function isFunctionHandle(s2) {
3394
- return s2.startsWith("function://");
3633
+ function errorMessageForUnsupportedType2(context, typeName, value, originalValue) {
3634
+ if (context) {
3635
+ return `${typeName}${stringifyValueForError2(value)} is not a supported Convex type (present at path ${context} in original object ${stringifyValueForError2(originalValue)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`;
3636
+ } else {
3637
+ return `${typeName}${stringifyValueForError2(value)} is not a supported Convex type.`;
3638
+ }
3395
3639
  }
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 };
3403
- }
3404
- } else if (functionReference[functionName]) {
3405
- functionAddress = { name: functionReference[functionName] };
3640
+ function convexOrUndefinedToJsonInternal2(value, originalValue, context) {
3641
+ if (value === undefined) {
3642
+ return { $undefined: null };
3406
3643
  } else {
3407
- const referencePath = extractReferencePath(functionReference);
3408
- if (!referencePath) {
3409
- throw new Error(`${functionReference} is not a functionReference`);
3644
+ if (originalValue === undefined) {
3645
+ throw new Error(`Programming error. Current value is ${stringifyValueForError2(value)} but original value is undefined`);
3410
3646
  }
3411
- functionAddress = { reference: referencePath };
3647
+ return convexToJsonInternal2(value, originalValue, context, false);
3412
3648
  }
3413
- return functionAddress;
3414
3649
  }
3415
- var toReferencePath;
3416
- var init_paths = __esm(() => {
3417
- init_functionName();
3418
- toReferencePath = Symbol.for("toReferencePath");
3650
+ function convexToJson2(value) {
3651
+ return convexToJsonInternal2(value, value, "", false);
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;
3419
3663
  });
3420
3664
 
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}`);
3429
- }
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`);
3665
+ // ../../node_modules/.bun/convex@1.31.7/node_modules/convex/dist/esm/values/validators.js
3666
+ function throwUndefinedValidatorError(context, fieldName) {
3667
+ const fieldInfo = fieldName !== undefined ? ` for field "${fieldName}"` : "";
3668
+ throw new Error(`A validator is undefined${fieldInfo} in ${context}. This is often caused by circular imports. See ${UNDEFINED_VALIDATOR_ERROR_URL} for details.`);
3669
+ }
3670
+
3671
+ class BaseValidator {
3672
+ constructor({ isOptional }) {
3673
+ __publicField4(this, "type");
3674
+ __publicField4(this, "fieldPaths");
3675
+ __publicField4(this, "isOptional");
3676
+ __publicField4(this, "isConvexValidator");
3677
+ this.isOptional = isOptional;
3678
+ this.isConvexValidator = true;
3437
3679
  }
3438
- return name;
3439
3680
  }
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;
3681
+ 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), UNDEFINED_VALIDATOR_ERROR_URL = "https://docs.convex.dev/error#undefined-validator", VId, VFloat64, VInt64, VBoolean, VBytes, VString, VNull, VAny, VObject, VLiteral, VArray, VRecord, VUnion;
3682
+ var init_validators = __esm(() => {
3683
+ init_value2();
3684
+ __defProp6 = Object.defineProperty;
3685
+ VId = class VId extends BaseValidator {
3686
+ constructor({
3687
+ isOptional,
3688
+ tableName
3689
+ }) {
3690
+ super({ isOptional });
3691
+ __publicField4(this, "tableName");
3692
+ __publicField4(this, "kind", "id");
3693
+ if (typeof tableName !== "string") {
3694
+ throw new Error("v.id(tableName) requires a string");
3462
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
+ });
3463
3706
  }
3464
3707
  };
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 }`.");
3708
+ VFloat64 = class VFloat64 extends BaseValidator {
3709
+ constructor() {
3710
+ super(...arguments);
3711
+ __publicField4(this, "kind", "float64");
3489
3712
  }
3490
- const opts = options ?? {};
3491
- if (opts.skipConvexDeploymentUrlCheck !== true) {
3492
- validateDeploymentUrl(address);
3713
+ get json() {
3714
+ return { type: "number" };
3493
3715
  }
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);
3716
+ asOptional() {
3717
+ return new VFloat64({
3718
+ isOptional: "optional"
3719
+ });
3502
3720
  }
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;
3721
+ };
3722
+ VInt64 = class VInt64 extends BaseValidator {
3723
+ constructor() {
3724
+ super(...arguments);
3725
+ __publicField4(this, "kind", "int64");
3522
3726
  }
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;
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
+ });
3772
+ }
3773
+ };
3774
+ VNull = class VNull extends BaseValidator {
3775
+ constructor() {
3776
+ super(...arguments);
3777
+ __publicField4(this, "kind", "null");
3778
+ }
3779
+ get json() {
3780
+ return { type: this.kind };
3542
3781
  }
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());
3782
+ asOptional() {
3783
+ return new VNull({ isOptional: "optional" });
3558
3784
  }
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}`;
3785
+ };
3786
+ VAny = class VAny extends BaseValidator {
3787
+ constructor() {
3788
+ super(...arguments);
3789
+ __publicField4(this, "kind", "any");
3577
3790
  }
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());
3791
+ get json() {
3792
+ return {
3793
+ type: this.kind
3794
+ };
3595
3795
  }
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);
3600
- }
3796
+ asOptional() {
3797
+ return new VAny({
3798
+ isOptional: "optional"
3799
+ });
3601
3800
  }
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));
3801
+ };
3802
+ VObject = class VObject extends BaseValidator {
3803
+ constructor({
3804
+ isOptional,
3805
+ fields
3806
+ }) {
3807
+ super({ isOptional });
3808
+ __publicField4(this, "fields");
3809
+ __publicField4(this, "kind", "object");
3810
+ globalThis.Object.entries(fields).forEach(([fieldName, validator]) => {
3811
+ if (validator === undefined) {
3812
+ throwUndefinedValidatorError("v.object()", fieldName);
3608
3813
  }
3609
- throw new Error(respJSON.errorMessage);
3610
- default:
3611
- throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
3814
+ if (!validator.isConvexValidator) {
3815
+ throw new Error("v.object() entries must be validators");
3816
+ }
3817
+ });
3818
+ this.fields = fields;
3612
3819
  }
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}`;
3820
+ get json() {
3821
+ return {
3822
+ type: this.kind,
3823
+ value: globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([k2, v2]) => [
3824
+ k2,
3825
+ {
3826
+ fieldType: v2.json,
3827
+ optional: v2.isOptional === "optional" ? true : false
3828
+ }
3829
+ ]))
3830
+ };
3629
3831
  }
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());
3832
+ asOptional() {
3833
+ return new VObject({
3834
+ isOptional: "optional",
3835
+ fields: this.fields
3836
+ });
3639
3837
  }
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);
3838
+ omit(...fields) {
3839
+ const newFields = { ...this.fields };
3840
+ for (const field of fields) {
3841
+ delete newFields[field];
3644
3842
  }
3843
+ return new VObject({
3844
+ isOptional: this.isOptional,
3845
+ fields: newFields
3846
+ });
3645
3847
  }
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)}`);
3848
+ pick(...fields) {
3849
+ const newFields = {};
3850
+ for (const field of fields) {
3851
+ newFields[field] = this.fields[field];
3852
+ }
3853
+ return new VObject({
3854
+ isOptional: this.isOptional,
3855
+ fields: newFields
3856
+ });
3656
3857
  }
3657
- }
3658
- async processMutationQueue() {
3659
- if (this.isProcessingQueue) {
3660
- return;
3858
+ partial() {
3859
+ const newFields = {};
3860
+ for (const [key, validator] of globalThis.Object.entries(this.fields)) {
3861
+ newFields[key] = validator.asOptional();
3862
+ }
3863
+ return new VObject({
3864
+ isOptional: this.isOptional,
3865
+ fields: newFields
3866
+ });
3661
3867
  }
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);
3868
+ extend(fields) {
3869
+ return new VObject({
3870
+ isOptional: this.isOptional,
3871
+ fields: { ...this.fields, ...fields }
3872
+ });
3873
+ }
3874
+ };
3875
+ VLiteral = class VLiteral extends BaseValidator {
3876
+ constructor({ isOptional, value }) {
3877
+ super({ isOptional });
3878
+ __publicField4(this, "value");
3879
+ __publicField4(this, "kind", "literal");
3880
+ if (typeof value !== "string" && typeof value !== "boolean" && typeof value !== "number" && typeof value !== "bigint") {
3881
+ throw new Error("v.literal(value) must be a string, number, or boolean");
3670
3882
  }
3883
+ this.value = value;
3671
3884
  }
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);
3885
+ get json() {
3886
+ return {
3887
+ type: this.kind,
3888
+ value: convexToJson2(this.value)
3889
+ };
3688
3890
  }
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}`;
3891
+ asOptional() {
3892
+ return new VLiteral({
3893
+ isOptional: "optional",
3894
+ value: this.value
3895
+ });
3896
+ }
3897
+ };
3898
+ VArray = class VArray extends BaseValidator {
3899
+ constructor({
3900
+ isOptional,
3901
+ element
3902
+ }) {
3903
+ super({ isOptional });
3904
+ __publicField4(this, "element");
3905
+ __publicField4(this, "kind", "array");
3906
+ if (element === undefined) {
3907
+ throwUndefinedValidatorError("v.array()");
3908
+ }
3909
+ this.element = element;
3910
+ }
3911
+ get json() {
3912
+ return {
3913
+ type: this.kind,
3914
+ value: this.element.json
3915
+ };
3706
3916
  }
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());
3917
+ asOptional() {
3918
+ return new VArray({
3919
+ isOptional: "optional",
3920
+ element: this.element
3921
+ });
3716
3922
  }
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);
3923
+ };
3924
+ VRecord = class VRecord extends BaseValidator {
3925
+ constructor({
3926
+ isOptional,
3927
+ key,
3928
+ value
3929
+ }) {
3930
+ super({ isOptional });
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");
3721
3945
  }
3946
+ if (!key.isConvexValidator || !value.isConvexValidator) {
3947
+ throw new Error("Key and value of v.record() but be validators");
3948
+ }
3949
+ this.key = key;
3950
+ this.value = value;
3722
3951
  }
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));
3952
+ get json() {
3953
+ return {
3954
+ type: this.kind,
3955
+ keys: this.key.json,
3956
+ values: {
3957
+ fieldType: this.value.json,
3958
+ optional: false
3729
3959
  }
3730
- throw new Error(respJSON.errorMessage);
3731
- default:
3732
- throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
3960
+ };
3733
3961
  }
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}`;
3962
+ asOptional() {
3963
+ return new VRecord({
3964
+ isOptional: "optional",
3965
+ key: this.key,
3966
+ value: this.value
3967
+ });
3752
3968
  }
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());
3969
+ };
3970
+ VUnion = class VUnion extends BaseValidator {
3971
+ constructor({ isOptional, members }) {
3972
+ super({ isOptional });
3973
+ __publicField4(this, "members");
3974
+ __publicField4(this, "kind", "union");
3975
+ members.forEach((member, index) => {
3976
+ if (member === undefined) {
3977
+ throwUndefinedValidatorError("v.union()", `member at index ${index}`);
3978
+ }
3979
+ if (!member.isConvexValidator) {
3980
+ throw new Error("All members of v.union() must be validators");
3981
+ }
3982
+ });
3983
+ this.members = members;
3762
3984
  }
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
- }
3985
+ get json() {
3986
+ return {
3987
+ type: this.kind,
3988
+ value: this.members.map((v2) => v2.json)
3989
+ };
3768
3990
  }
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)}`);
3991
+ asOptional() {
3992
+ return new VUnion({
3993
+ isOptional: "optional",
3994
+ members: this.members
3995
+ });
3779
3996
  }
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;
3997
+ };
3792
3998
  });
3793
3999
 
3794
- // ../../node_modules/convex/dist/esm/browser/index-node.js
3795
- var init_index_node = __esm(() => {
3796
- init_http_client();
4000
+ // ../../node_modules/.bun/convex@1.31.7/node_modules/convex/dist/esm/values/validator.js
4001
+ var v2;
4002
+ var init_validator = __esm(() => {
4003
+ init_validators();
4004
+ v2 = {
4005
+ id: (tableName) => {
4006
+ return new VId({
4007
+ isOptional: "required",
4008
+ tableName
4009
+ });
4010
+ },
4011
+ null: () => {
4012
+ return new VNull({ isOptional: "required" });
4013
+ },
4014
+ number: () => {
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());
4065
+ }
4066
+ };
4067
+ });
4068
+
4069
+ // ../../node_modules/.bun/convex@1.31.7/node_modules/convex/dist/esm/server/functionName.js
4070
+ var functionName2;
4071
+ var init_functionName2 = __esm(() => {
4072
+ functionName2 = Symbol.for("functionName");
4073
+ });
4074
+
4075
+ // ../../node_modules/.bun/convex@1.31.7/node_modules/convex/dist/esm/server/components/paths.js
4076
+ var toReferencePath2;
4077
+ var init_paths2 = __esm(() => {
4078
+ toReferencePath2 = Symbol.for("toReferencePath");
3797
4079
  });
3798
4080
 
3799
- // ../../node_modules/convex/dist/esm/server/search_filter_builder.js
4081
+ // ../../node_modules/.bun/convex@1.31.7/node_modules/convex/dist/esm/server/search_filter_builder.js
3800
4082
  var init_search_filter_builder = () => {};
3801
4083
 
3802
- // ../../node_modules/convex/dist/esm/server/pagination.js
4084
+ // ../../node_modules/.bun/convex@1.31.7/node_modules/convex/dist/esm/server/pagination.js
3803
4085
  var paginationOptsValidator;
3804
4086
  var init_pagination = __esm(() => {
3805
4087
  init_validator();
@@ -3813,14 +4095,48 @@ var init_pagination = __esm(() => {
3813
4095
  });
3814
4096
  });
3815
4097
 
3816
- // ../../node_modules/convex/dist/esm/server/components/index.js
4098
+ // ../../node_modules/.bun/convex@1.31.7/node_modules/convex/dist/esm/server/api.js
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
3817
4133
  function createChildComponents(root, pathParts) {
3818
4134
  const handler = {
3819
4135
  get(_3, prop) {
3820
4136
  if (typeof prop === "string") {
3821
4137
  const newParts = [...pathParts, prop];
3822
4138
  return createChildComponents(root, newParts);
3823
- } else if (prop === toReferencePath) {
4139
+ } else if (prop === toReferencePath2) {
3824
4140
  if (pathParts.length < 1) {
3825
4141
  const found = [root, ...pathParts].join(".");
3826
4142
  throw new Error(`API path is expected to be of the form \`${root}.childComponent.functionName\`. Found: \`${found}\``);
@@ -3835,12 +4151,12 @@ function createChildComponents(root, pathParts) {
3835
4151
  }
3836
4152
  var componentsGeneric = () => createChildComponents("components", []);
3837
4153
  var init_components = __esm(() => {
3838
- init_paths();
4154
+ init_paths2();
3839
4155
  });
3840
4156
 
3841
- // ../../node_modules/convex/dist/esm/server/index.js
4157
+ // ../../node_modules/.bun/convex@1.31.7/node_modules/convex/dist/esm/server/index.js
3842
4158
  var init_server = __esm(() => {
3843
- init_api();
4159
+ init_api2();
3844
4160
  init_components();
3845
4161
  init_pagination();
3846
4162
  init_search_filter_builder();
@@ -3848,9 +4164,9 @@ var init_server = __esm(() => {
3848
4164
 
3849
4165
  // ../../convex/_generated/api.js
3850
4166
  var api, components;
3851
- var init_api2 = __esm(() => {
4167
+ var init_api3 = __esm(() => {
3852
4168
  init_server();
3853
- api = anyApi;
4169
+ api = anyApi2;
3854
4170
  components = componentsGeneric();
3855
4171
  });
3856
4172
 
@@ -3927,7 +4243,7 @@ function requireGitHub() {
3927
4243
  var PRODUCTION_CONVEX_URL = "https://steady-bass-841.convex.cloud", CONFIG_DIR, CONFIG_FILE, getClerkId, requireClerkId;
3928
4244
  var init_client = __esm(() => {
3929
4245
  init_index_node();
3930
- init_api2();
4246
+ init_api3();
3931
4247
  init_dist();
3932
4248
  CONFIG_DIR = join4(homedir3(), ".nairon-bench");
3933
4249
  CONFIG_FILE = join4(CONFIG_DIR, "config.json");
@@ -3935,7 +4251,7 @@ var init_client = __esm(() => {
3935
4251
  requireClerkId = requireGitHub;
3936
4252
  });
3937
4253
 
3938
- // ../../node_modules/picocolors/picocolors.js
4254
+ // ../../node_modules/.bun/picocolors@1.1.1/node_modules/picocolors/picocolors.js
3939
4255
  var require_picocolors = __commonJS((exports, module) => {
3940
4256
  var p = process || {};
3941
4257
  var argv2 = p.argv || [];
@@ -4005,14 +4321,14 @@ var require_picocolors = __commonJS((exports, module) => {
4005
4321
  module.exports.createColors = createColors2;
4006
4322
  });
4007
4323
 
4008
- // ../../node_modules/citty/dist/index.mjs
4324
+ // ../../node_modules/.bun/citty@0.1.6/node_modules/citty/dist/index.mjs
4009
4325
  init_dist();
4010
4326
 
4011
- // ../../node_modules/consola/dist/utils.mjs
4327
+ // ../../node_modules/.bun/consola@3.4.2/node_modules/consola/dist/utils.mjs
4012
4328
  init_consola_DXBYu_KD();
4013
4329
  init_consola_DXBYu_KD();
4014
4330
 
4015
- // ../../node_modules/citty/dist/index.mjs
4331
+ // ../../node_modules/.bun/citty@0.1.6/node_modules/citty/dist/index.mjs
4016
4332
  function toArray(val) {
4017
4333
  if (Array.isArray(val)) {
4018
4334
  return val;
@@ -4439,7 +4755,7 @@ async function runMain(cmd, opts = {}) {
4439
4755
  }
4440
4756
  }
4441
4757
 
4442
- // ../../node_modules/citty/dist/index.mjs
4758
+ // ../../node_modules/.bun/citty@0.1.6/node_modules/citty/dist/index.mjs
4443
4759
  init_dist();
4444
4760
  function defineCommand2(def) {
4445
4761
  return def;
@@ -4449,7 +4765,7 @@ function defineCommand2(def) {
4449
4765
  import { existsSync as existsSync6, mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "node:fs";
4450
4766
  import { join as join6 } from "node:path";
4451
4767
 
4452
- // ../../node_modules/simple-git/dist/esm/index.js
4768
+ // ../../node_modules/.bun/simple-git@3.30.0/node_modules/simple-git/dist/esm/index.js
4453
4769
  var import_file_exists = __toESM(require_dist(), 1);
4454
4770
  var import_debug = __toESM(require_src(), 1);
4455
4771
  var import_promise_deferred = __toESM(require_dist2(), 1);
@@ -4465,7 +4781,7 @@ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
4465
4781
  var __esm2 = (fn, res) => function __init() {
4466
4782
  return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
4467
4783
  };
4468
- var __commonJS2 = (cb, mod) => function __require2() {
4784
+ var __commonJS2 = (cb, mod) => function __require() {
4469
4785
  return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4470
4786
  };
4471
4787
  var __export2 = (target, all) => {
@@ -10607,12 +10923,12 @@ function analyzeParallelization(agents) {
10607
10923
  if (agents && agents.sessions.length > 0) {
10608
10924
  const sortedSessions = [...agents.sessions].sort((a2, b2) => new Date(a2.startedAt).getTime() - new Date(b2.startedAt).getTime());
10609
10925
  let maxConcurrent = 1;
10610
- for (let i3 = 0;i3 < sortedSessions.length; i3++) {
10611
- const session = sortedSessions[i3];
10926
+ for (let i4 = 0;i4 < sortedSessions.length; i4++) {
10927
+ const session = sortedSessions[i4];
10612
10928
  const sessionStart = new Date(session.startedAt).getTime();
10613
10929
  const sessionEnd = session.endedAt ? new Date(session.endedAt).getTime() : sessionStart + session.durationMinutes * 60000;
10614
10930
  let concurrent = 1;
10615
- for (let j = i3 + 1;j < sortedSessions.length; j++) {
10931
+ for (let j = i4 + 1;j < sortedSessions.length; j++) {
10616
10932
  const other = sortedSessions[j];
10617
10933
  const otherStart = new Date(other.startedAt).getTime();
10618
10934
  if (otherStart < sessionEnd) {
@@ -10713,14 +11029,14 @@ function calculateScanCost(agents, git) {
10713
11029
  };
10714
11030
  }
10715
11031
 
10716
- // ../../node_modules/ora/index.js
11032
+ // ../../node_modules/.bun/ora@9.3.0/node_modules/ora/index.js
10717
11033
  import process8 from "node:process";
10718
11034
  import { stripVTControlCharacters } from "node:util";
10719
11035
 
10720
- // ../../node_modules/chalk/source/vendor/ansi-styles/index.js
11036
+ // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
10721
11037
  var ANSI_BACKGROUND_OFFSET = 10;
10722
- var wrapAnsi16 = (offset = 0) => (code2) => `\x1B[${code2 + offset}m`;
10723
- var wrapAnsi256 = (offset = 0) => (code2) => `\x1B[${38 + offset};5;${code2}m`;
11038
+ var wrapAnsi16 = (offset = 0) => (code3) => `\x1B[${code3 + offset}m`;
11039
+ var wrapAnsi256 = (offset = 0) => (code3) => `\x1B[${38 + offset};5;${code3}m`;
10724
11040
  var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
10725
11041
  var styles = {
10726
11042
  modifier: {
@@ -10847,24 +11163,24 @@ function assembleStyles() {
10847
11163
  enumerable: false
10848
11164
  },
10849
11165
  ansi256ToAnsi: {
10850
- value(code2) {
10851
- if (code2 < 8) {
10852
- return 30 + code2;
11166
+ value(code3) {
11167
+ if (code3 < 8) {
11168
+ return 30 + code3;
10853
11169
  }
10854
- if (code2 < 16) {
10855
- return 90 + (code2 - 8);
11170
+ if (code3 < 16) {
11171
+ return 90 + (code3 - 8);
10856
11172
  }
10857
11173
  let red;
10858
11174
  let green;
10859
11175
  let blue;
10860
- if (code2 >= 232) {
10861
- red = ((code2 - 232) * 10 + 8) / 255;
11176
+ if (code3 >= 232) {
11177
+ red = ((code3 - 232) * 10 + 8) / 255;
10862
11178
  green = red;
10863
11179
  blue = red;
10864
11180
  } else {
10865
- code2 -= 16;
10866
- const remainder = code2 % 36;
10867
- red = Math.floor(code2 / 36) / 5;
11181
+ code3 -= 16;
11182
+ const remainder = code3 % 36;
11183
+ red = Math.floor(code3 / 36) / 5;
10868
11184
  green = Math.floor(remainder / 6) / 5;
10869
11185
  blue = remainder % 6 / 5;
10870
11186
  }
@@ -10894,7 +11210,7 @@ function assembleStyles() {
10894
11210
  var ansiStyles = assembleStyles();
10895
11211
  var ansi_styles_default = ansiStyles;
10896
11212
 
10897
- // ../../node_modules/chalk/source/vendor/supports-color/index.js
11213
+ // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
10898
11214
  import process2 from "node:process";
10899
11215
  import os from "node:os";
10900
11216
  import tty2 from "node:tty";
@@ -11026,7 +11342,7 @@ var supportsColor = {
11026
11342
  };
11027
11343
  var supports_color_default = supportsColor;
11028
11344
 
11029
- // ../../node_modules/chalk/source/utilities.js
11345
+ // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/utilities.js
11030
11346
  function stringReplaceAll(string, substring, replacer) {
11031
11347
  let index = string.indexOf(substring);
11032
11348
  if (index === -1) {
@@ -11059,7 +11375,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
11059
11375
  return returnValue;
11060
11376
  }
11061
11377
 
11062
- // ../../node_modules/chalk/source/index.js
11378
+ // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/index.js
11063
11379
  var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
11064
11380
  var GENERATOR = Symbol("GENERATOR");
11065
11381
  var STYLER = Symbol("STYLER");
@@ -11206,13 +11522,13 @@ var chalk = createChalk();
11206
11522
  var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
11207
11523
  var source_default = chalk;
11208
11524
 
11209
- // ../../node_modules/cli-cursor/index.js
11525
+ // ../../node_modules/.bun/cli-cursor@5.0.0/node_modules/cli-cursor/index.js
11210
11526
  import process5 from "node:process";
11211
11527
 
11212
- // ../../node_modules/restore-cursor/index.js
11528
+ // ../../node_modules/.bun/restore-cursor@5.1.0/node_modules/restore-cursor/index.js
11213
11529
  import process4 from "node:process";
11214
11530
 
11215
- // ../../node_modules/mimic-function/index.js
11531
+ // ../../node_modules/.bun/mimic-function@5.0.1/node_modules/mimic-function/index.js
11216
11532
  var copyProperty = (to, from, property, ignoreNonConfigurable) => {
11217
11533
  if (property === "length" || property === "prototype") {
11218
11534
  return;
@@ -11258,7 +11574,7 @@ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
11258
11574
  return to;
11259
11575
  }
11260
11576
 
11261
- // ../../node_modules/onetime/index.js
11577
+ // ../../node_modules/.bun/onetime@7.0.0/node_modules/onetime/index.js
11262
11578
  var calledFunctions = new WeakMap;
11263
11579
  var onetime = (function_, options = {}) => {
11264
11580
  if (typeof function_ !== "function") {
@@ -11266,14 +11582,14 @@ var onetime = (function_, options = {}) => {
11266
11582
  }
11267
11583
  let returnValue;
11268
11584
  let callCount = 0;
11269
- const functionName2 = function_.displayName || function_.name || "<anonymous>";
11585
+ const functionName3 = function_.displayName || function_.name || "<anonymous>";
11270
11586
  const onetime2 = function(...arguments_) {
11271
11587
  calledFunctions.set(onetime2, ++callCount);
11272
11588
  if (callCount === 1) {
11273
11589
  returnValue = function_.apply(this, arguments_);
11274
11590
  function_ = undefined;
11275
11591
  } else if (options.throw === true) {
11276
- throw new Error(`Function \`${functionName2}\` can only be called once`);
11592
+ throw new Error(`Function \`${functionName3}\` can only be called once`);
11277
11593
  }
11278
11594
  return returnValue;
11279
11595
  };
@@ -11289,7 +11605,7 @@ onetime.callCount = (function_) => {
11289
11605
  };
11290
11606
  var onetime_default = onetime;
11291
11607
 
11292
- // ../../node_modules/signal-exit/dist/mjs/signals.js
11608
+ // ../../node_modules/.bun/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
11293
11609
  var signals = [];
11294
11610
  signals.push("SIGHUP", "SIGINT", "SIGTERM");
11295
11611
  if (process.platform !== "win32") {
@@ -11299,7 +11615,7 @@ if (process.platform === "linux") {
11299
11615
  signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
11300
11616
  }
11301
11617
 
11302
- // ../../node_modules/signal-exit/dist/mjs/index.js
11618
+ // ../../node_modules/.bun/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
11303
11619
  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";
11304
11620
  var kExitEmitter = Symbol.for("signal-exit emitter");
11305
11621
  var global = globalThis;
@@ -11332,27 +11648,27 @@ class Emitter {
11332
11648
  }
11333
11649
  removeListener(ev, fn) {
11334
11650
  const list = this.listeners[ev];
11335
- const i3 = list.indexOf(fn);
11336
- if (i3 === -1) {
11651
+ const i4 = list.indexOf(fn);
11652
+ if (i4 === -1) {
11337
11653
  return;
11338
11654
  }
11339
- if (i3 === 0 && list.length === 1) {
11655
+ if (i4 === 0 && list.length === 1) {
11340
11656
  list.length = 0;
11341
11657
  } else {
11342
- list.splice(i3, 1);
11658
+ list.splice(i4, 1);
11343
11659
  }
11344
11660
  }
11345
- emit(ev, code2, signal) {
11661
+ emit(ev, code3, signal) {
11346
11662
  if (this.emitted[ev]) {
11347
11663
  return false;
11348
11664
  }
11349
11665
  this.emitted[ev] = true;
11350
11666
  let ret = false;
11351
11667
  for (const fn of this.listeners[ev]) {
11352
- ret = fn(code2, signal) === true || ret;
11668
+ ret = fn(code3, signal) === true || ret;
11353
11669
  }
11354
11670
  if (ev === "exit") {
11355
- ret = this.emit("afterExit", code2, signal) || ret;
11671
+ ret = this.emit("afterExit", code3, signal) || ret;
11356
11672
  }
11357
11673
  return ret;
11358
11674
  }
@@ -11446,8 +11762,8 @@ class SignalExit extends SignalExitBase {
11446
11762
  this.#process.emit = (ev, ...a2) => {
11447
11763
  return this.#processEmit(ev, ...a2);
11448
11764
  };
11449
- this.#process.reallyExit = (code2) => {
11450
- return this.#processReallyExit(code2);
11765
+ this.#process.reallyExit = (code3) => {
11766
+ return this.#processReallyExit(code3);
11451
11767
  };
11452
11768
  }
11453
11769
  unload() {
@@ -11468,11 +11784,11 @@ class SignalExit extends SignalExitBase {
11468
11784
  this.#process.reallyExit = this.#originalProcessReallyExit;
11469
11785
  this.#emitter.count -= 1;
11470
11786
  }
11471
- #processReallyExit(code2) {
11787
+ #processReallyExit(code3) {
11472
11788
  if (!processOk(this.#process)) {
11473
11789
  return 0;
11474
11790
  }
11475
- this.#process.exitCode = code2 || 0;
11791
+ this.#process.exitCode = code3 || 0;
11476
11792
  this.#emitter.emit("exit", this.#process.exitCode, null);
11477
11793
  return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
11478
11794
  }
@@ -11497,7 +11813,7 @@ var {
11497
11813
  unload
11498
11814
  } = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback);
11499
11815
 
11500
- // ../../node_modules/restore-cursor/index.js
11816
+ // ../../node_modules/.bun/restore-cursor@5.1.0/node_modules/restore-cursor/index.js
11501
11817
  var terminal = process4.stderr.isTTY ? process4.stderr : process4.stdout.isTTY ? process4.stdout : undefined;
11502
11818
  var restoreCursor = terminal ? onetime_default(() => {
11503
11819
  onExit(() => {
@@ -11506,7 +11822,7 @@ var restoreCursor = terminal ? onetime_default(() => {
11506
11822
  }) : () => {};
11507
11823
  var restore_cursor_default = restoreCursor;
11508
11824
 
11509
- // ../../node_modules/cli-cursor/index.js
11825
+ // ../../node_modules/.bun/cli-cursor@5.0.0/node_modules/cli-cursor/index.js
11510
11826
  var isHidden = false;
11511
11827
  var cliCursor = {};
11512
11828
  cliCursor.show = (writableStream = process5.stderr) => {
@@ -11535,7 +11851,7 @@ cliCursor.toggle = (force, writableStream) => {
11535
11851
  }
11536
11852
  };
11537
11853
  var cli_cursor_default = cliCursor;
11538
- // ../../node_modules/cli-spinners/spinners.json
11854
+ // ../../node_modules/.bun/cli-spinners@3.4.0/node_modules/cli-spinners/spinners.json
11539
11855
  var spinners_default = {
11540
11856
  dots: {
11541
11857
  interval: 80,
@@ -13234,11 +13550,11 @@ var spinners_default = {
13234
13550
  }
13235
13551
  };
13236
13552
 
13237
- // ../../node_modules/cli-spinners/index.js
13553
+ // ../../node_modules/.bun/cli-spinners@3.4.0/node_modules/cli-spinners/index.js
13238
13554
  var cli_spinners_default = spinners_default;
13239
13555
  var spinnersList = Object.keys(spinners_default);
13240
13556
 
13241
- // ../../node_modules/log-symbols/symbols.js
13557
+ // ../../node_modules/.bun/log-symbols@7.0.1/node_modules/log-symbols/symbols.js
13242
13558
  var exports_symbols = {};
13243
13559
  __export(exports_symbols, {
13244
13560
  warning: () => warning,
@@ -13247,7 +13563,7 @@ __export(exports_symbols, {
13247
13563
  error: () => error
13248
13564
  });
13249
13565
 
13250
- // ../../node_modules/yoctocolors/base.js
13566
+ // ../../node_modules/.bun/yoctocolors@2.1.2/node_modules/yoctocolors/base.js
13251
13567
  import tty3 from "node:tty";
13252
13568
  var hasColors = tty3?.WriteStream?.prototype?.hasColors?.() ?? false;
13253
13569
  var format = (open, close) => {
@@ -13317,7 +13633,7 @@ var bgMagentaBright = format(105, 49);
13317
13633
  var bgCyanBright = format(106, 49);
13318
13634
  var bgWhiteBright = format(107, 49);
13319
13635
 
13320
- // ../../node_modules/is-unicode-supported/index.js
13636
+ // ../../node_modules/.bun/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
13321
13637
  import process6 from "node:process";
13322
13638
  function isUnicodeSupported2() {
13323
13639
  const { env: env3 } = process6;
@@ -13328,13 +13644,13 @@ function isUnicodeSupported2() {
13328
13644
  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";
13329
13645
  }
13330
13646
 
13331
- // ../../node_modules/log-symbols/symbols.js
13647
+ // ../../node_modules/.bun/log-symbols@7.0.1/node_modules/log-symbols/symbols.js
13332
13648
  var _isUnicodeSupported = isUnicodeSupported2();
13333
13649
  var info = blue(_isUnicodeSupported ? "ℹ" : "i");
13334
13650
  var success = green(_isUnicodeSupported ? "✔" : "√");
13335
13651
  var warning = yellow(_isUnicodeSupported ? "⚠" : "‼");
13336
13652
  var error = red(_isUnicodeSupported ? "✖" : "×");
13337
- // ../../node_modules/ansi-regex/index.js
13653
+ // ../../node_modules/.bun/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
13338
13654
  function ansiRegex3({ onlyFirst = false } = {}) {
13339
13655
  const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
13340
13656
  const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
@@ -13343,7 +13659,7 @@ function ansiRegex3({ onlyFirst = false } = {}) {
13343
13659
  return new RegExp(pattern, onlyFirst ? undefined : "g");
13344
13660
  }
13345
13661
 
13346
- // ../../node_modules/strip-ansi/index.js
13662
+ // ../../node_modules/.bun/strip-ansi@7.1.2/node_modules/strip-ansi/index.js
13347
13663
  var regex2 = ansiRegex3();
13348
13664
  function stripAnsi3(string) {
13349
13665
  if (typeof string !== "string") {
@@ -13352,7 +13668,7 @@ function stripAnsi3(string) {
13352
13668
  return string.replace(regex2, "");
13353
13669
  }
13354
13670
 
13355
- // ../../node_modules/get-east-asian-width/lookup.js
13671
+ // ../../node_modules/.bun/get-east-asian-width@1.4.0/node_modules/get-east-asian-width/lookup.js
13356
13672
  function isAmbiguous2(x2) {
13357
13673
  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;
13358
13674
  }
@@ -13363,7 +13679,7 @@ function isWide2(x2) {
13363
13679
  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;
13364
13680
  }
13365
13681
 
13366
- // ../../node_modules/get-east-asian-width/index.js
13682
+ // ../../node_modules/.bun/get-east-asian-width@1.4.0/node_modules/get-east-asian-width/index.js
13367
13683
  function validate2(codePoint) {
13368
13684
  if (!Number.isSafeInteger(codePoint)) {
13369
13685
  throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
@@ -13377,7 +13693,7 @@ function eastAsianWidth2(codePoint, { ambiguousAsWide = false } = {}) {
13377
13693
  return 1;
13378
13694
  }
13379
13695
 
13380
- // ../../node_modules/string-width/index.js
13696
+ // ../../node_modules/.bun/string-width@8.1.1/node_modules/string-width/index.js
13381
13697
  var segmenter2 = new Intl.Segmenter;
13382
13698
  var zeroWidthClusterRegex = /^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Mark}|\p{Surrogate})+$/v;
13383
13699
  var leadingNonPrintingRegex = /^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v;
@@ -13431,12 +13747,12 @@ function stringWidth2(input, options = {}) {
13431
13747
  return width;
13432
13748
  }
13433
13749
 
13434
- // ../../node_modules/is-interactive/index.js
13750
+ // ../../node_modules/.bun/is-interactive@2.0.0/node_modules/is-interactive/index.js
13435
13751
  function isInteractive({ stream = process.stdout } = {}) {
13436
13752
  return Boolean(stream && stream.isTTY && process.env.TERM !== "dumb" && !("CI" in process.env));
13437
13753
  }
13438
13754
 
13439
- // ../../node_modules/stdin-discarder/index.js
13755
+ // ../../node_modules/.bun/stdin-discarder@0.3.1/node_modules/stdin-discarder/index.js
13440
13756
  import process7 from "node:process";
13441
13757
  var ASCII_ETX_CODE = 3;
13442
13758
 
@@ -13449,8 +13765,8 @@ class StdinDiscarder {
13449
13765
  if (!chunk?.length) {
13450
13766
  return;
13451
13767
  }
13452
- const code2 = typeof chunk === "string" ? chunk.codePointAt(0) : chunk[0];
13453
- if (code2 === ASCII_ETX_CODE) {
13768
+ const code3 = typeof chunk === "string" ? chunk.codePointAt(0) : chunk[0];
13769
+ if (code3 === ASCII_ETX_CODE) {
13454
13770
  if (process7.listenerCount("SIGINT") > 0) {
13455
13771
  process7.emit("SIGINT");
13456
13772
  } else {
@@ -13507,7 +13823,7 @@ class StdinDiscarder {
13507
13823
  var stdinDiscarder = new StdinDiscarder;
13508
13824
  var stdin_discarder_default = Object.freeze(stdinDiscarder);
13509
13825
 
13510
- // ../../node_modules/ora/index.js
13826
+ // ../../node_modules/.bun/ora@9.3.0/node_modules/ora/index.js
13511
13827
  var RENDER_DEFERRAL_TIMEOUT = 200;
13512
13828
  var SYNCHRONIZED_OUTPUT_ENABLE = "\x1B[?2026h";
13513
13829
  var SYNCHRONIZED_OUTPUT_DISABLE = "\x1B[?2026l";
@@ -14052,8 +14368,8 @@ async function animateProgressBar(label, score, options = {}) {
14052
14368
  const paddedLabel = label.padEnd(labelWidth);
14053
14369
  const scoreStr = `${score}/100`.padStart(7);
14054
14370
  write(` ${colors2.dim(paddedLabel)} ${colors2.dim(scoreStr)} `);
14055
- for (let i3 = 0;i3 < width; i3++) {
14056
- if (i3 < filled) {
14371
+ for (let i4 = 0;i4 < width; i4++) {
14372
+ if (i4 < filled) {
14057
14373
  write(barColor("█"));
14058
14374
  } else {
14059
14375
  write(colors2.dim("░"));
@@ -14086,8 +14402,8 @@ async function animateScoreReveal(score, tier, options = {}) {
14086
14402
  console.log();
14087
14403
  const steps = 30;
14088
14404
  const stepDuration = countDuration / steps;
14089
- for (let i3 = 1;i3 <= steps; i3++) {
14090
- const current = Math.round(i3 / steps * score);
14405
+ for (let i4 = 1;i4 <= steps; i4++) {
14406
+ const current = Math.round(i4 / steps * score);
14091
14407
  clearLine2();
14092
14408
  write(` ${colors2.bold("Your Score:")} ${scoreColor(colors2.bold(current.toString()))}/100`);
14093
14409
  await sleep(stepDuration);
@@ -14098,8 +14414,8 @@ async function animateScoreReveal(score, tier, options = {}) {
14098
14414
  const barWidth = 30;
14099
14415
  const filled = Math.round(score / 100 * barWidth);
14100
14416
  write(" ");
14101
- for (let i3 = 0;i3 < barWidth; i3++) {
14102
- if (i3 < filled) {
14417
+ for (let i4 = 0;i4 < barWidth; i4++) {
14418
+ if (i4 < filled) {
14103
14419
  write(scoreColor("█"));
14104
14420
  } else {
14105
14421
  write(colors2.dim("░"));
@@ -14324,11 +14640,11 @@ var scanCommand = defineCommand2({
14324
14640
  console.log(` ${colors2.bold("Recommendations")}`);
14325
14641
  console.log(colors2.dim(" " + "─".repeat(40)));
14326
14642
  const topRecs = analysis.recommendations.slice(0, 3);
14327
- for (let i3 = 0;i3 < topRecs.length; i3++) {
14328
- const rec = topRecs[i3];
14643
+ for (let i4 = 0;i4 < topRecs.length; i4++) {
14644
+ const rec = topRecs[i4];
14329
14645
  await sleep(400);
14330
14646
  console.log();
14331
- console.log(` ${colors2.success(`${i3 + 1}.`)} ${colors2.bold(rec.title)}`);
14647
+ console.log(` ${colors2.success(`${i4 + 1}.`)} ${colors2.bold(rec.title)}`);
14332
14648
  await sleep(150);
14333
14649
  console.log(` ${colors2.dim(rec.description)}`);
14334
14650
  }
@@ -14618,9 +14934,9 @@ function generateReport(reportDir, score, git, agents, tests, since, sdlcAnalysi
14618
14934
  if (analysis && analysis.recommendations.length > 0) {
14619
14935
  lines.push("## Recommendations");
14620
14936
  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}`);
14937
+ for (let i4 = 0;i4 < Math.min(5, analysis.recommendations.length); i4++) {
14938
+ const rec = analysis.recommendations[i4];
14939
+ lines.push(`### ${i4 + 1}. ${rec.title}`);
14624
14940
  lines.push("");
14625
14941
  lines.push(rec.description);
14626
14942
  lines.push("");
@@ -14707,15 +15023,13 @@ async function collectGitCommits(projectDir, since, until) {
14707
15023
  if (!await git.checkIsRepo()) {
14708
15024
  return [];
14709
15025
  }
14710
- const log = await git.log({
14711
- "--since": since.toISOString(),
14712
- "--until": until.toISOString(),
14713
- "--stat": null,
14714
- "--name-only": null
14715
- });
15026
+ const log = await git.log([
15027
+ `--since=${since.toISOString()}`,
15028
+ `--until=${until.toISOString()}`,
15029
+ "--stat"
15030
+ ]);
14716
15031
  return log.all.map((entry) => {
14717
15032
  const diff = entry.diff;
14718
- const message = entry.message.toLowerCase();
14719
15033
  const isAIAssisted = detectAIAssistedCommit(entry.message);
14720
15034
  return {
14721
15035
  hash: entry.hash,
@@ -14959,18 +15273,25 @@ function collectOpenCodeSessions2(openCodeDir, since, until) {
14959
15273
  } catch {}
14960
15274
  }
14961
15275
  }
14962
- const estimatedMsgTokens = Math.ceil(messageText.length / 4);
15276
+ const msgTokens = msgData.tokens || {};
15277
+ const msgInputTokens = msgTokens.input || 0;
15278
+ const msgOutputTokens = (msgTokens.output || 0) + (msgTokens.reasoning || 0);
15279
+ const msgTotalTokens = msgInputTokens + msgOutputTokens;
14963
15280
  if (msgData.role === "user" && messageText.trim()) {
14964
15281
  const prompt2 = analyzePrompt(messageText, sessionId, prompts.length, msgTime);
14965
15282
  prompts.push(prompt2);
14966
- inputTokens += estimatedMsgTokens;
14967
- totalTokens += estimatedMsgTokens;
15283
+ const userTokens = msgInputTokens || Math.ceil(messageText.length / 4);
15284
+ inputTokens += userTokens;
15285
+ totalTokens += userTokens;
14968
15286
  }
14969
- if (msgData.role === "assistant" && messageText.trim()) {
14970
- const response = analyzeResponse(messageText, sessionId, responses.length, prompts[prompts.length - 1]?.id ?? "", msgTime);
14971
- responses.push(response);
14972
- outputTokens += estimatedMsgTokens;
14973
- totalTokens += estimatedMsgTokens;
15287
+ if (msgData.role === "assistant") {
15288
+ if (messageText.trim()) {
15289
+ const response = analyzeResponse(messageText, sessionId, responses.length, prompts[prompts.length - 1]?.id ?? "", msgTime);
15290
+ responses.push(response);
15291
+ }
15292
+ inputTokens += msgInputTokens;
15293
+ outputTokens += msgOutputTokens;
15294
+ totalTokens += msgTotalTokens;
14974
15295
  if (messageText.includes("Write ") || messageText.includes("Created ")) {
14975
15296
  const fileMatches = messageText.match(/(?:Write|Created|Updated)\s+(\S+\.\w+)/g);
14976
15297
  if (fileMatches) {
@@ -14982,11 +15303,6 @@ function collectOpenCodeSessions2(openCodeDir, since, until) {
14982
15303
  }
14983
15304
  }
14984
15305
  }
14985
- if (msgData.usage) {
14986
- totalTokens += msgData.usage.totalTokens || 0;
14987
- inputTokens += msgData.usage.inputTokens || 0;
14988
- outputTokens += msgData.usage.outputTokens || 0;
14989
- }
14990
15306
  } catch {}
14991
15307
  }
14992
15308
  }
@@ -15195,8 +15511,8 @@ function extractText2(entry) {
15195
15511
  }
15196
15512
  function hashPath(path) {
15197
15513
  let hash = 0;
15198
- for (let i3 = 0;i3 < path.length; i3++) {
15199
- const char = path.charCodeAt(i3);
15514
+ for (let i4 = 0;i4 < path.length; i4++) {
15515
+ const char = path.charCodeAt(i4);
15200
15516
  hash = (hash << 5) - hash + char;
15201
15517
  hash = hash & hash;
15202
15518
  }
@@ -15454,9 +15770,9 @@ function identifyGaps(distribution) {
15454
15770
  function analyzeTransitions(prompts, classifications) {
15455
15771
  const transitionCounts = new Map;
15456
15772
  const sorted2 = [...prompts].sort((a2, b2) => a2.timestamp.getTime() - b2.timestamp.getTime());
15457
- for (let i3 = 1;i3 < sorted2.length; i3++) {
15458
- const prev = sorted2[i3 - 1];
15459
- const curr = sorted2[i3];
15773
+ for (let i4 = 1;i4 < sorted2.length; i4++) {
15774
+ const prev = sorted2[i4 - 1];
15775
+ const curr = sorted2[i4];
15460
15776
  const prevClass = classifications.get(prev.id);
15461
15777
  const currClass = classifications.get(curr.id);
15462
15778
  if (prevClass && currClass && prevClass.phase !== currClass.phase) {
@@ -15743,7 +16059,7 @@ function findExamples(prompts, promptScores) {
15743
16059
  prompt: p,
15744
16060
  score: promptScores.get(p.id)?.overall ?? 0
15745
16061
  })).sort((a2, b2) => b2.score - a2.score);
15746
- const truncate = (text, len2 = 100) => text.length > len2 ? text.slice(0, len2) + "..." : text;
16062
+ const truncate = (text, len3 = 100) => text.length > len3 ? text.slice(0, len3) + "..." : text;
15747
16063
  const toExample = (item, reason) => ({
15748
16064
  id: item.prompt.id,
15749
16065
  text: item.prompt.text,
@@ -16027,7 +16343,7 @@ function analyzeTenacity(data) {
16027
16343
  evidence.push(`Sustained focus with ${avgSessionLength} min average sessions`);
16028
16344
  }
16029
16345
  const frustrationPrompts = prompts.filter((p) => p.isFrustrated);
16030
- const continuedAfterFrustration = frustrationPrompts.filter((p, i3) => {
16346
+ const continuedAfterFrustration = frustrationPrompts.filter((p, i4) => {
16031
16347
  const idx = prompts.indexOf(p);
16032
16348
  return idx < prompts.length - 1;
16033
16349
  }).length;
@@ -16055,7 +16371,7 @@ function analyzeTenacity(data) {
16055
16371
  }
16056
16372
  const compactions = sessions.filter((s2) => s2.hadCompaction).length;
16057
16373
  if (compactions > 0) {
16058
- const continueAfterCompaction = sessions.filter((s2, i3) => s2.hadCompaction && i3 < sessions.length - 1).length;
16374
+ const continueAfterCompaction = sessions.filter((s2, i4) => s2.hadCompaction && i4 < sessions.length - 1).length;
16059
16375
  if (continueAfterCompaction > 0) {
16060
16376
  score += 10;
16061
16377
  evidence.push("Resilient: continued working after context loss");
@@ -16248,10 +16564,10 @@ function detectSearchBeforeCodePattern(prompts) {
16248
16564
  const codeKeywords = /\b(create|implement|add|write|fix|build)\b/i;
16249
16565
  let searchBeforeCode = 0;
16250
16566
  let totalCodingPrompts = 0;
16251
- for (let i3 = 1;i3 < prompts.length; i3++) {
16252
- if (codeKeywords.test(prompts[i3].text)) {
16567
+ for (let i4 = 1;i4 < prompts.length; i4++) {
16568
+ if (codeKeywords.test(prompts[i4].text)) {
16253
16569
  totalCodingPrompts++;
16254
- if (searchKeywords.test(prompts[i3 - 1].text)) {
16570
+ if (searchKeywords.test(prompts[i4 - 1].text)) {
16255
16571
  searchBeforeCode++;
16256
16572
  }
16257
16573
  }
@@ -16263,10 +16579,10 @@ function analyzeErrorRecovery(prompts) {
16263
16579
  const recoveryIndicators = /\b(try|let me|fix|update|change|instead)\b/i;
16264
16580
  let errorCount = 0;
16265
16581
  let recoveredCount = 0;
16266
- for (let i3 = 0;i3 < prompts.length - 1; i3++) {
16267
- if (errorIndicators.test(prompts[i3].text)) {
16582
+ for (let i4 = 0;i4 < prompts.length - 1; i4++) {
16583
+ if (errorIndicators.test(prompts[i4].text)) {
16268
16584
  errorCount++;
16269
- if (recoveryIndicators.test(prompts[i3 + 1].text)) {
16585
+ if (recoveryIndicators.test(prompts[i4 + 1].text)) {
16270
16586
  recoveredCount++;
16271
16587
  }
16272
16588
  }
@@ -16544,8 +16860,8 @@ function analyzeSessionTiming(sessions) {
16544
16860
  };
16545
16861
  const sortedSessions = [...sessions].sort((a2, b2) => a2.startTime.getTime() - b2.startTime.getTime());
16546
16862
  let totalTimeBetween = 0;
16547
- for (let i3 = 0;i3 < sortedSessions.length; i3++) {
16548
- const session = sortedSessions[i3];
16863
+ for (let i4 = 0;i4 < sortedSessions.length; i4++) {
16864
+ const session = sortedSessions[i4];
16549
16865
  const hour = session.startTime.getHours();
16550
16866
  if (sessionsByHour[hour] !== undefined) {
16551
16867
  sessionsByHour[hour]++;
@@ -16555,8 +16871,8 @@ function analyzeSessionTiming(sessions) {
16555
16871
  if (day && sessionsByDay[day] !== undefined) {
16556
16872
  sessionsByDay[day]++;
16557
16873
  }
16558
- if (i3 > 0) {
16559
- const prevSession = sortedSessions[i3 - 1];
16874
+ if (i4 > 0) {
16875
+ const prevSession = sortedSessions[i4 - 1];
16560
16876
  const gap = session.startTime.getTime() - prevSession.endTime.getTime();
16561
16877
  if (gap > 0 && gap < 24 * 60 * 60 * 1000) {
16562
16878
  totalTimeBetween += gap;
@@ -17279,10 +17595,10 @@ function renderTimelineMarkdown(timeline) {
17279
17595
  }
17280
17596
  return lines;
17281
17597
  }
17282
- function truncate(str, len2) {
17283
- if (str.length <= len2)
17598
+ function truncate(str, len3) {
17599
+ if (str.length <= len3)
17284
17600
  return str;
17285
- return str.slice(0, len2 - 3) + "...";
17601
+ return str.slice(0, len3 - 3) + "...";
17286
17602
  }
17287
17603
  function cleanCommitMessage(message) {
17288
17604
  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();
@@ -18539,7 +18855,7 @@ async function generateHackathonReport(projectDir, since, until = new Date, harn
18539
18855
  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));
18540
18856
  const recommendations = generateRecommendations2(data, sdlcAnalysis, promptAnalysis, scores);
18541
18857
  const { grade, gradeDescription } = calculateGrade(overallScore, sdlcAnalysis, promptAnalysis);
18542
- const summary = buildSummary(data, sdlcAnalysis, promptAnalysis);
18858
+ const summary = buildSummary(data, sdlcAnalysis, promptAnalysis, toolUtilization);
18543
18859
  const agentLabels = {
18544
18860
  "claude-code": "Claude Code",
18545
18861
  opencode: "OpenCode",
@@ -18641,7 +18957,7 @@ function generateRecommendations2(data, sdlc, prompts, scores) {
18641
18957
  impact: gap.suggestion
18642
18958
  });
18643
18959
  }
18644
- for (const insight of prompts.insights.filter((i3) => i3.type === "weakness")) {
18960
+ for (const insight of prompts.insights.filter((i4) => i4.type === "weakness")) {
18645
18961
  recs.push({
18646
18962
  priority: "medium",
18647
18963
  title: insight.title,
@@ -18686,7 +19002,7 @@ function generateRecommendations2(data, sdlc, prompts, scores) {
18686
19002
  recs.sort((a2, b2) => priorityOrder[a2.priority] - priorityOrder[b2.priority]);
18687
19003
  return recs.slice(0, 8);
18688
19004
  }
18689
- function buildSummary(data, sdlc, prompts) {
19005
+ function buildSummary(data, sdlc, prompts, toolAnalysis) {
18690
19006
  return {
18691
19007
  totalSessions: data.totalSessions,
18692
19008
  totalPrompts: data.totalPrompts,
@@ -18697,7 +19013,8 @@ function buildSummary(data, sdlc, prompts) {
18697
19013
  correctionRate: prompts.patterns.correctionRate,
18698
19014
  frustrationRate: prompts.patterns.frustrationRate,
18699
19015
  toolsUsed: Array.from(data.toolUsage.keys()),
18700
- mcpsInstalled: data.mcpConfigs.map((m2) => m2.name)
19016
+ mcpsInstalled: data.mcpConfigs.map((m2) => m2.name),
19017
+ skillsInstalled: toolAnalysis.skills.map((s2) => s2.name)
18701
19018
  };
18702
19019
  }
18703
19020
  function formatReportAsMarkdown(report) {
@@ -19015,6 +19332,8 @@ function formatReportAsJSON(report) {
19015
19332
  },
19016
19333
  toolUtilization: {
19017
19334
  mcpSummary: report.toolUtilization.mcpSummary,
19335
+ skills: report.toolUtilization.skills.map((s2) => ({ name: s2.name, used: s2.used })),
19336
+ skillsCount: report.toolUtilization.skillsCount,
19018
19337
  scores: report.toolUtilization.scores,
19019
19338
  recommendations: report.toolUtilization.recommendations
19020
19339
  },
@@ -20098,9 +20417,9 @@ async function renderLocalInsights(score, phaseFilter) {
20098
20417
  console.log(` ${icons.success} ${colors2.success("No critical insights. Your workflow looks strong!")}`);
20099
20418
  return;
20100
20419
  }
20101
- const critical = insights.filter((i3) => i3.severity === "critical");
20102
- const warning2 = insights.filter((i3) => i3.severity === "warning");
20103
- const info2 = insights.filter((i3) => i3.severity === "info");
20420
+ const critical = insights.filter((i4) => i4.severity === "critical");
20421
+ const warning2 = insights.filter((i4) => i4.severity === "warning");
20422
+ const info2 = insights.filter((i4) => i4.severity === "info");
20104
20423
  if (critical.length > 0) {
20105
20424
  console.log(` ${colors2.error(colors2.bold("Critical Issues"))}`);
20106
20425
  console.log(colors2.dim(" " + "─".repeat(40)));
@@ -21253,8 +21572,8 @@ function renderMiniChart(scores) {
21253
21572
  const width = Math.min(scores.length, 30);
21254
21573
  const step = Math.max(1, Math.floor(scores.length / width));
21255
21574
  const sampled = [];
21256
- for (let i3 = 0;i3 < scores.length; i3 += step) {
21257
- sampled.push(scores[i3]);
21575
+ for (let i4 = 0;i4 < scores.length; i4 += step) {
21576
+ sampled.push(scores[i4]);
21258
21577
  }
21259
21578
  const min = Math.min(...sampled);
21260
21579
  const max = Math.max(...sampled);
@@ -22493,8 +22812,8 @@ function formatBytes(bytes) {
22493
22812
  return "0 B";
22494
22813
  const k2 = 1024;
22495
22814
  const sizes = ["B", "KB", "MB", "GB"];
22496
- const i3 = Math.floor(Math.log(bytes) / Math.log(k2));
22497
- return `${parseFloat((bytes / Math.pow(k2, i3)).toFixed(1))} ${sizes[i3]}`;
22815
+ const i4 = Math.floor(Math.log(bytes) / Math.log(k2));
22816
+ return `${parseFloat((bytes / Math.pow(k2, i4)).toFixed(1))} ${sizes[i4]}`;
22498
22817
  }
22499
22818
 
22500
22819
  // src/commands/setup.ts
@@ -22631,10 +22950,10 @@ async function confirm(question, defaultYes = true) {
22631
22950
  async function selectMultiple(question, options) {
22632
22951
  console.log(question);
22633
22952
  console.log();
22634
- for (let i3 = 0;i3 < options.length; i3++) {
22635
- const opt = options[i3];
22953
+ for (let i4 = 0;i4 < options.length; i4++) {
22954
+ const opt = options[i4];
22636
22955
  const marker = opt.selected ? colors2.success("[x]") : colors2.dim("[ ]");
22637
- console.log(` ${marker} ${i3 + 1}. ${opt.label}`);
22956
+ console.log(` ${marker} ${i4 + 1}. ${opt.label}`);
22638
22957
  }
22639
22958
  console.log();
22640
22959
  const answer = await prompt2(`${colors2.dim("Enter numbers (comma-separated) or press Enter for selected:")} `);
@@ -22642,7 +22961,7 @@ async function selectMultiple(question, options) {
22642
22961
  return options.filter((o3) => o3.selected).map((o3) => o3.id);
22643
22962
  }
22644
22963
  const indices = answer.split(",").map((s2) => parseInt(s2.trim(), 10) - 1);
22645
- return indices.filter((i3) => i3 >= 0 && i3 < options.length).map((i3) => options[i3].id);
22964
+ return indices.filter((i4) => i4 >= 0 && i4 < options.length).map((i4) => options[i4].id);
22646
22965
  }
22647
22966
  function getInstalledMCPs(harnesses) {
22648
22967
  const installed = new Set;
@@ -22891,9 +23210,9 @@ var setupCommand = defineCommand2({
22891
23210
  console.log(`${colors2.dim("[3/4]")} ${colors2.primary("Recommended optimizations:")}`);
22892
23211
  console.log();
22893
23212
  const topRecs = analysis.recommendations.slice(0, 4);
22894
- for (let i3 = 0;i3 < topRecs.length; i3++) {
22895
- const rec = topRecs[i3];
22896
- console.log(` ${colors2.success(`${i3 + 1}.`)} ${colors2.bold(rec.title)}`);
23213
+ for (let i4 = 0;i4 < topRecs.length; i4++) {
23214
+ const rec = topRecs[i4];
23215
+ console.log(` ${colors2.success(`${i4 + 1}.`)} ${colors2.bold(rec.title)}`);
22897
23216
  console.log(` ${colors2.dim(rec.description)}`);
22898
23217
  }
22899
23218
  console.log();
@@ -23054,7 +23373,7 @@ var setupCommand = defineCommand2({
23054
23373
  // package.json
23055
23374
  var package_default = {
23056
23375
  name: "nairon-bench",
23057
- version: "0.0.33",
23376
+ version: "0.0.35",
23058
23377
  description: "AI workflow benchmarking CLI",
23059
23378
  type: "module",
23060
23379
  bin: {
@@ -23091,6 +23410,19 @@ var package_default = {
23091
23410
  clean: "rm -rf dist",
23092
23411
  prepublishOnly: "bun run build"
23093
23412
  },
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
+ },
23094
23426
  dependencies: {
23095
23427
  "cli-boxes": "^4.0.1",
23096
23428
  ora: "^9.3.0",