agent-inspect 6.7.4 → 6.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/docs/CLI.md +4 -4
- package/docs/NESTJS.md +10 -0
- package/package.json +2 -2
- package/packages/cli/dist/{chunk-FVEQ7JFF.mjs → chunk-TO4VENHV.mjs} +3 -35
- package/packages/cli/dist/chunk-TO4VENHV.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +155 -846
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +114 -43
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/src-Z5W27YCW.mjs +419 -0
- package/packages/cli/dist/src-Z5W27YCW.mjs.map +1 -0
- package/packages/cli/dist/chunk-FVEQ7JFF.mjs.map +0 -1
- package/packages/cli/dist/src-I5NA7BLK.mjs +0 -1160
- package/packages/cli/dist/src-I5NA7BLK.mjs.map +0 -1
|
@@ -11,9 +11,9 @@ var tty = require('tty');
|
|
|
11
11
|
var fs = require('fs');
|
|
12
12
|
var readline = require('readline');
|
|
13
13
|
var url = require('url');
|
|
14
|
+
var module$1 = require('module');
|
|
14
15
|
var commander = require('commander');
|
|
15
16
|
var http = require('http');
|
|
16
|
-
var module$1 = require('module');
|
|
17
17
|
|
|
18
18
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
19
19
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -24,44 +24,15 @@ var path26__default = /*#__PURE__*/_interopDefault(path26);
|
|
|
24
24
|
var process3__default = /*#__PURE__*/_interopDefault(process3);
|
|
25
25
|
var tty__default = /*#__PURE__*/_interopDefault(tty);
|
|
26
26
|
|
|
27
|
-
var __create = Object.create;
|
|
28
27
|
var __defProp = Object.defineProperty;
|
|
29
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
30
28
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
31
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
32
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
33
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
34
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
35
|
-
}) : x)(function(x) {
|
|
36
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
37
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
38
|
-
});
|
|
39
29
|
var __esm = (fn, res) => function __init() {
|
|
40
30
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
41
31
|
};
|
|
42
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
43
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
44
|
-
};
|
|
45
32
|
var __export = (target, all) => {
|
|
46
33
|
for (var name in all)
|
|
47
34
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
48
35
|
};
|
|
49
|
-
var __copyProps = (to, from, except, desc) => {
|
|
50
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
51
|
-
for (let key of __getOwnPropNames(from))
|
|
52
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
53
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
54
|
-
}
|
|
55
|
-
return to;
|
|
56
|
-
};
|
|
57
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
58
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
59
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
60
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
61
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
62
|
-
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
63
|
-
mod
|
|
64
|
-
));
|
|
65
36
|
|
|
66
37
|
// packages/core/src/correlation-metadata.ts
|
|
67
38
|
function isNonEmptyString(value) {
|
|
@@ -2114,8 +2085,8 @@ function buildRunSummary(events) {
|
|
|
2114
2085
|
let hasCachedTokens = false;
|
|
2115
2086
|
const depthCache = /* @__PURE__ */ new Map();
|
|
2116
2087
|
const computeDepth = (stepId) => {
|
|
2117
|
-
const
|
|
2118
|
-
if (
|
|
2088
|
+
const cached2 = depthCache.get(stepId);
|
|
2089
|
+
if (cached2 !== void 0) return cached2;
|
|
2119
2090
|
const node = steps.get(stepId);
|
|
2120
2091
|
if (!node) return 0;
|
|
2121
2092
|
const parent = node.parentId;
|
|
@@ -2498,8 +2469,8 @@ function buildRunTimeline(events, options = {}) {
|
|
|
2498
2469
|
}
|
|
2499
2470
|
const depthCache = /* @__PURE__ */ new Map();
|
|
2500
2471
|
const computeDepth = (stepId) => {
|
|
2501
|
-
const
|
|
2502
|
-
if (
|
|
2472
|
+
const cached2 = depthCache.get(stepId);
|
|
2473
|
+
if (cached2 !== void 0) return cached2;
|
|
2503
2474
|
const node = steps.get(stepId);
|
|
2504
2475
|
if (!node) return 0;
|
|
2505
2476
|
const parent = node.parentId;
|
|
@@ -5958,17 +5929,17 @@ function normalizeTokenUsage(value) {
|
|
|
5958
5929
|
const input3 = nonNegativeFinite(value.input);
|
|
5959
5930
|
const output2 = nonNegativeFinite(value.output);
|
|
5960
5931
|
const suppliedTotal = nonNegativeFinite(value.total);
|
|
5961
|
-
const
|
|
5932
|
+
const cached2 = nonNegativeFinite(value.cached);
|
|
5962
5933
|
const derivedTotal = input3 !== void 0 && output2 !== void 0 && Number.isFinite(input3 + output2) ? input3 + output2 : void 0;
|
|
5963
5934
|
const total = suppliedTotal ?? derivedTotal;
|
|
5964
|
-
if (input3 === void 0 && output2 === void 0 && total === void 0 &&
|
|
5935
|
+
if (input3 === void 0 && output2 === void 0 && total === void 0 && cached2 === void 0) {
|
|
5965
5936
|
return void 0;
|
|
5966
5937
|
}
|
|
5967
5938
|
return {
|
|
5968
5939
|
...input3 !== void 0 ? { input: input3 } : {},
|
|
5969
5940
|
...output2 !== void 0 ? { output: output2 } : {},
|
|
5970
5941
|
...total !== void 0 ? { total } : {},
|
|
5971
|
-
...
|
|
5942
|
+
...cached2 !== void 0 ? { cached: cached2 } : {}
|
|
5972
5943
|
};
|
|
5973
5944
|
}
|
|
5974
5945
|
var init_token_usage = __esm({
|
|
@@ -6529,8 +6500,8 @@ async function jsonlFilesInDirectory(dirPath) {
|
|
|
6529
6500
|
return entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl")).map((entry) => path26__default.default.join(dirPath, entry.name)).sort((a, b) => a.localeCompare(b));
|
|
6530
6501
|
}
|
|
6531
6502
|
async function resolveInput(input3) {
|
|
6532
|
-
const
|
|
6533
|
-
if (
|
|
6503
|
+
const cached2 = resolvedInputCache.get(input3);
|
|
6504
|
+
if (cached2) return cached2;
|
|
6534
6505
|
const promise = resolveInputUncached(input3);
|
|
6535
6506
|
resolvedInputCache.set(input3, promise);
|
|
6536
6507
|
return promise;
|
|
@@ -6966,7 +6937,7 @@ function readOpenInferenceTokenUsage(attributes) {
|
|
|
6966
6937
|
const prompt = attributes["llm.token_count.prompt"];
|
|
6967
6938
|
const completion = attributes["llm.token_count.completion"];
|
|
6968
6939
|
const total = attributes["llm.token_count.total"];
|
|
6969
|
-
const
|
|
6940
|
+
const cached2 = attributes["llm.token_count.prompt_details.cache_read"];
|
|
6970
6941
|
const usage = {};
|
|
6971
6942
|
if (typeof prompt === "number" && Number.isFinite(prompt) && prompt >= 0) {
|
|
6972
6943
|
usage.input = prompt;
|
|
@@ -6977,8 +6948,8 @@ function readOpenInferenceTokenUsage(attributes) {
|
|
|
6977
6948
|
if (typeof total === "number" && Number.isFinite(total) && total >= 0) {
|
|
6978
6949
|
usage.total = total;
|
|
6979
6950
|
}
|
|
6980
|
-
if (typeof
|
|
6981
|
-
usage.cached =
|
|
6951
|
+
if (typeof cached2 === "number" && Number.isFinite(cached2) && cached2 >= 0) {
|
|
6952
|
+
usage.cached = cached2;
|
|
6982
6953
|
}
|
|
6983
6954
|
if (usage.total === void 0 && usage.input !== void 0 && usage.output !== void 0) {
|
|
6984
6955
|
usage.total = usage.input + usage.output;
|
|
@@ -9647,764 +9618,6 @@ var init_types6 = __esm({
|
|
|
9647
9618
|
}
|
|
9648
9619
|
});
|
|
9649
9620
|
|
|
9650
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/util.js
|
|
9651
|
-
var require_util = __commonJS({
|
|
9652
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/util.js"(exports$1) {
|
|
9653
|
-
exports$1.getBooleanOption = (options, key) => {
|
|
9654
|
-
let value = false;
|
|
9655
|
-
if (key in options && typeof (value = options[key]) !== "boolean") {
|
|
9656
|
-
throw new TypeError(`Expected the "${key}" option to be a boolean`);
|
|
9657
|
-
}
|
|
9658
|
-
return value;
|
|
9659
|
-
};
|
|
9660
|
-
exports$1.cppdb = /* @__PURE__ */ Symbol();
|
|
9661
|
-
exports$1.inspect = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
9662
|
-
}
|
|
9663
|
-
});
|
|
9664
|
-
|
|
9665
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/sqlite-error.js
|
|
9666
|
-
var require_sqlite_error = __commonJS({
|
|
9667
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/sqlite-error.js"(exports$1, module) {
|
|
9668
|
-
var descriptor = { value: "SqliteError", writable: true, enumerable: false, configurable: true };
|
|
9669
|
-
function SqliteError(message, code) {
|
|
9670
|
-
if (new.target !== SqliteError) {
|
|
9671
|
-
return new SqliteError(message, code);
|
|
9672
|
-
}
|
|
9673
|
-
if (typeof code !== "string") {
|
|
9674
|
-
throw new TypeError("Expected second argument to be a string");
|
|
9675
|
-
}
|
|
9676
|
-
Error.call(this, message);
|
|
9677
|
-
descriptor.value = "" + message;
|
|
9678
|
-
Object.defineProperty(this, "message", descriptor);
|
|
9679
|
-
Error.captureStackTrace(this, SqliteError);
|
|
9680
|
-
this.code = code;
|
|
9681
|
-
}
|
|
9682
|
-
Object.setPrototypeOf(SqliteError, Error);
|
|
9683
|
-
Object.setPrototypeOf(SqliteError.prototype, Error.prototype);
|
|
9684
|
-
Object.defineProperty(SqliteError.prototype, "name", descriptor);
|
|
9685
|
-
module.exports = SqliteError;
|
|
9686
|
-
}
|
|
9687
|
-
});
|
|
9688
|
-
|
|
9689
|
-
// node_modules/.pnpm/file-uri-to-path@1.0.0/node_modules/file-uri-to-path/index.js
|
|
9690
|
-
var require_file_uri_to_path = __commonJS({
|
|
9691
|
-
"node_modules/.pnpm/file-uri-to-path@1.0.0/node_modules/file-uri-to-path/index.js"(exports$1, module) {
|
|
9692
|
-
var sep = __require("path").sep || "/";
|
|
9693
|
-
module.exports = fileUriToPath;
|
|
9694
|
-
function fileUriToPath(uri) {
|
|
9695
|
-
if ("string" != typeof uri || uri.length <= 7 || "file://" != uri.substring(0, 7)) {
|
|
9696
|
-
throw new TypeError("must pass in a file:// URI to convert to a file path");
|
|
9697
|
-
}
|
|
9698
|
-
var rest = decodeURI(uri.substring(7));
|
|
9699
|
-
var firstSlash = rest.indexOf("/");
|
|
9700
|
-
var host = rest.substring(0, firstSlash);
|
|
9701
|
-
var path37 = rest.substring(firstSlash + 1);
|
|
9702
|
-
if ("localhost" == host) host = "";
|
|
9703
|
-
if (host) {
|
|
9704
|
-
host = sep + sep + host;
|
|
9705
|
-
}
|
|
9706
|
-
path37 = path37.replace(/^(.+)\|/, "$1:");
|
|
9707
|
-
if (sep == "\\") {
|
|
9708
|
-
path37 = path37.replace(/\//g, "\\");
|
|
9709
|
-
}
|
|
9710
|
-
if (/^.+\:/.test(path37)) ; else {
|
|
9711
|
-
path37 = sep + path37;
|
|
9712
|
-
}
|
|
9713
|
-
return host + path37;
|
|
9714
|
-
}
|
|
9715
|
-
}
|
|
9716
|
-
});
|
|
9717
|
-
|
|
9718
|
-
// node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/bindings.js
|
|
9719
|
-
var require_bindings = __commonJS({
|
|
9720
|
-
"node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/bindings.js"(exports$1, module) {
|
|
9721
|
-
var fs = __require("fs");
|
|
9722
|
-
var path37 = __require("path");
|
|
9723
|
-
var fileURLToPath3 = require_file_uri_to_path();
|
|
9724
|
-
var join = path37.join;
|
|
9725
|
-
var dirname = path37.dirname;
|
|
9726
|
-
var exists2 = fs.accessSync && function(path38) {
|
|
9727
|
-
try {
|
|
9728
|
-
fs.accessSync(path38);
|
|
9729
|
-
} catch (e) {
|
|
9730
|
-
return false;
|
|
9731
|
-
}
|
|
9732
|
-
return true;
|
|
9733
|
-
} || fs.existsSync || path37.existsSync;
|
|
9734
|
-
var defaults = {
|
|
9735
|
-
arrow: process.env.NODE_BINDINGS_ARROW || " \u2192 ",
|
|
9736
|
-
compiled: process.env.NODE_BINDINGS_COMPILED_DIR || "compiled",
|
|
9737
|
-
platform: process.platform,
|
|
9738
|
-
arch: process.arch,
|
|
9739
|
-
nodePreGyp: "node-v" + process.versions.modules + "-" + process.platform + "-" + process.arch,
|
|
9740
|
-
version: process.versions.node,
|
|
9741
|
-
bindings: "bindings.node",
|
|
9742
|
-
try: [
|
|
9743
|
-
// node-gyp's linked version in the "build" dir
|
|
9744
|
-
["module_root", "build", "bindings"],
|
|
9745
|
-
// node-waf and gyp_addon (a.k.a node-gyp)
|
|
9746
|
-
["module_root", "build", "Debug", "bindings"],
|
|
9747
|
-
["module_root", "build", "Release", "bindings"],
|
|
9748
|
-
// Debug files, for development (legacy behavior, remove for node v0.9)
|
|
9749
|
-
["module_root", "out", "Debug", "bindings"],
|
|
9750
|
-
["module_root", "Debug", "bindings"],
|
|
9751
|
-
// Release files, but manually compiled (legacy behavior, remove for node v0.9)
|
|
9752
|
-
["module_root", "out", "Release", "bindings"],
|
|
9753
|
-
["module_root", "Release", "bindings"],
|
|
9754
|
-
// Legacy from node-waf, node <= 0.4.x
|
|
9755
|
-
["module_root", "build", "default", "bindings"],
|
|
9756
|
-
// Production "Release" buildtype binary (meh...)
|
|
9757
|
-
["module_root", "compiled", "version", "platform", "arch", "bindings"],
|
|
9758
|
-
// node-qbs builds
|
|
9759
|
-
["module_root", "addon-build", "release", "install-root", "bindings"],
|
|
9760
|
-
["module_root", "addon-build", "debug", "install-root", "bindings"],
|
|
9761
|
-
["module_root", "addon-build", "default", "install-root", "bindings"],
|
|
9762
|
-
// node-pre-gyp path ./lib/binding/{node_abi}-{platform}-{arch}
|
|
9763
|
-
["module_root", "lib", "binding", "nodePreGyp", "bindings"]
|
|
9764
|
-
]
|
|
9765
|
-
};
|
|
9766
|
-
function bindings(opts) {
|
|
9767
|
-
if (typeof opts == "string") {
|
|
9768
|
-
opts = { bindings: opts };
|
|
9769
|
-
} else if (!opts) {
|
|
9770
|
-
opts = {};
|
|
9771
|
-
}
|
|
9772
|
-
Object.keys(defaults).map(function(i2) {
|
|
9773
|
-
if (!(i2 in opts)) opts[i2] = defaults[i2];
|
|
9774
|
-
});
|
|
9775
|
-
if (!opts.module_root) {
|
|
9776
|
-
opts.module_root = exports$1.getRoot(exports$1.getFileName());
|
|
9777
|
-
}
|
|
9778
|
-
if (path37.extname(opts.bindings) != ".node") {
|
|
9779
|
-
opts.bindings += ".node";
|
|
9780
|
-
}
|
|
9781
|
-
var requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
9782
|
-
var tries = [], i = 0, l = opts.try.length, n, b, err;
|
|
9783
|
-
for (; i < l; i++) {
|
|
9784
|
-
n = join.apply(
|
|
9785
|
-
null,
|
|
9786
|
-
opts.try[i].map(function(p) {
|
|
9787
|
-
return opts[p] || p;
|
|
9788
|
-
})
|
|
9789
|
-
);
|
|
9790
|
-
tries.push(n);
|
|
9791
|
-
try {
|
|
9792
|
-
b = opts.path ? requireFunc.resolve(n) : requireFunc(n);
|
|
9793
|
-
if (!opts.path) {
|
|
9794
|
-
b.path = n;
|
|
9795
|
-
}
|
|
9796
|
-
return b;
|
|
9797
|
-
} catch (e) {
|
|
9798
|
-
if (e.code !== "MODULE_NOT_FOUND" && e.code !== "QUALIFIED_PATH_RESOLUTION_FAILED" && !/not find/i.test(e.message)) {
|
|
9799
|
-
throw e;
|
|
9800
|
-
}
|
|
9801
|
-
}
|
|
9802
|
-
}
|
|
9803
|
-
err = new Error(
|
|
9804
|
-
"Could not locate the bindings file. Tried:\n" + tries.map(function(a) {
|
|
9805
|
-
return opts.arrow + a;
|
|
9806
|
-
}).join("\n")
|
|
9807
|
-
);
|
|
9808
|
-
err.tries = tries;
|
|
9809
|
-
throw err;
|
|
9810
|
-
}
|
|
9811
|
-
module.exports = exports$1 = bindings;
|
|
9812
|
-
exports$1.getFileName = function getFileName(calling_file) {
|
|
9813
|
-
var origPST = Error.prepareStackTrace, origSTL = Error.stackTraceLimit, dummy = {}, fileName;
|
|
9814
|
-
Error.stackTraceLimit = 10;
|
|
9815
|
-
Error.prepareStackTrace = function(e, st) {
|
|
9816
|
-
for (var i = 0, l = st.length; i < l; i++) {
|
|
9817
|
-
fileName = st[i].getFileName();
|
|
9818
|
-
if (fileName !== __filename) {
|
|
9819
|
-
if (calling_file) {
|
|
9820
|
-
if (fileName !== calling_file) {
|
|
9821
|
-
return;
|
|
9822
|
-
}
|
|
9823
|
-
} else {
|
|
9824
|
-
return;
|
|
9825
|
-
}
|
|
9826
|
-
}
|
|
9827
|
-
}
|
|
9828
|
-
};
|
|
9829
|
-
Error.captureStackTrace(dummy);
|
|
9830
|
-
dummy.stack;
|
|
9831
|
-
Error.prepareStackTrace = origPST;
|
|
9832
|
-
Error.stackTraceLimit = origSTL;
|
|
9833
|
-
var fileSchema = "file://";
|
|
9834
|
-
if (fileName.indexOf(fileSchema) === 0) {
|
|
9835
|
-
fileName = fileURLToPath3(fileName);
|
|
9836
|
-
}
|
|
9837
|
-
return fileName;
|
|
9838
|
-
};
|
|
9839
|
-
exports$1.getRoot = function getRoot(file) {
|
|
9840
|
-
var dir = dirname(file), prev;
|
|
9841
|
-
while (true) {
|
|
9842
|
-
if (dir === ".") {
|
|
9843
|
-
dir = process.cwd();
|
|
9844
|
-
}
|
|
9845
|
-
if (exists2(join(dir, "package.json")) || exists2(join(dir, "node_modules"))) {
|
|
9846
|
-
return dir;
|
|
9847
|
-
}
|
|
9848
|
-
if (prev === dir) {
|
|
9849
|
-
throw new Error(
|
|
9850
|
-
'Could not find module root given file: "' + file + '". Do you have a `package.json` file? '
|
|
9851
|
-
);
|
|
9852
|
-
}
|
|
9853
|
-
prev = dir;
|
|
9854
|
-
dir = join(dir, "..");
|
|
9855
|
-
}
|
|
9856
|
-
};
|
|
9857
|
-
}
|
|
9858
|
-
});
|
|
9859
|
-
|
|
9860
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/wrappers.js
|
|
9861
|
-
var require_wrappers = __commonJS({
|
|
9862
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/wrappers.js"(exports$1) {
|
|
9863
|
-
var { cppdb } = require_util();
|
|
9864
|
-
exports$1.prepare = function prepare(sql) {
|
|
9865
|
-
return this[cppdb].prepare(sql, this, false);
|
|
9866
|
-
};
|
|
9867
|
-
exports$1.exec = function exec(sql) {
|
|
9868
|
-
this[cppdb].exec(sql);
|
|
9869
|
-
return this;
|
|
9870
|
-
};
|
|
9871
|
-
exports$1.close = function close() {
|
|
9872
|
-
this[cppdb].close();
|
|
9873
|
-
return this;
|
|
9874
|
-
};
|
|
9875
|
-
exports$1.loadExtension = function loadExtension(...args) {
|
|
9876
|
-
this[cppdb].loadExtension(...args);
|
|
9877
|
-
return this;
|
|
9878
|
-
};
|
|
9879
|
-
exports$1.defaultSafeIntegers = function defaultSafeIntegers(...args) {
|
|
9880
|
-
this[cppdb].defaultSafeIntegers(...args);
|
|
9881
|
-
return this;
|
|
9882
|
-
};
|
|
9883
|
-
exports$1.unsafeMode = function unsafeMode(...args) {
|
|
9884
|
-
this[cppdb].unsafeMode(...args);
|
|
9885
|
-
return this;
|
|
9886
|
-
};
|
|
9887
|
-
exports$1.getters = {
|
|
9888
|
-
name: {
|
|
9889
|
-
get: function name() {
|
|
9890
|
-
return this[cppdb].name;
|
|
9891
|
-
},
|
|
9892
|
-
enumerable: true
|
|
9893
|
-
},
|
|
9894
|
-
open: {
|
|
9895
|
-
get: function open3() {
|
|
9896
|
-
return this[cppdb].open;
|
|
9897
|
-
},
|
|
9898
|
-
enumerable: true
|
|
9899
|
-
},
|
|
9900
|
-
inTransaction: {
|
|
9901
|
-
get: function inTransaction() {
|
|
9902
|
-
return this[cppdb].inTransaction;
|
|
9903
|
-
},
|
|
9904
|
-
enumerable: true
|
|
9905
|
-
},
|
|
9906
|
-
readonly: {
|
|
9907
|
-
get: function readonly() {
|
|
9908
|
-
return this[cppdb].readonly;
|
|
9909
|
-
},
|
|
9910
|
-
enumerable: true
|
|
9911
|
-
},
|
|
9912
|
-
memory: {
|
|
9913
|
-
get: function memory() {
|
|
9914
|
-
return this[cppdb].memory;
|
|
9915
|
-
},
|
|
9916
|
-
enumerable: true
|
|
9917
|
-
}
|
|
9918
|
-
};
|
|
9919
|
-
}
|
|
9920
|
-
});
|
|
9921
|
-
|
|
9922
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/transaction.js
|
|
9923
|
-
var require_transaction = __commonJS({
|
|
9924
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/transaction.js"(exports$1, module) {
|
|
9925
|
-
var { cppdb } = require_util();
|
|
9926
|
-
var controllers = /* @__PURE__ */ new WeakMap();
|
|
9927
|
-
module.exports = function transaction(fn) {
|
|
9928
|
-
if (typeof fn !== "function") throw new TypeError("Expected first argument to be a function");
|
|
9929
|
-
const db = this[cppdb];
|
|
9930
|
-
const controller = getController(db, this);
|
|
9931
|
-
const { apply } = Function.prototype;
|
|
9932
|
-
const properties = {
|
|
9933
|
-
default: { value: wrapTransaction(apply, fn, db, controller.default) },
|
|
9934
|
-
deferred: { value: wrapTransaction(apply, fn, db, controller.deferred) },
|
|
9935
|
-
immediate: { value: wrapTransaction(apply, fn, db, controller.immediate) },
|
|
9936
|
-
exclusive: { value: wrapTransaction(apply, fn, db, controller.exclusive) },
|
|
9937
|
-
database: { value: this, enumerable: true }
|
|
9938
|
-
};
|
|
9939
|
-
Object.defineProperties(properties.default.value, properties);
|
|
9940
|
-
Object.defineProperties(properties.deferred.value, properties);
|
|
9941
|
-
Object.defineProperties(properties.immediate.value, properties);
|
|
9942
|
-
Object.defineProperties(properties.exclusive.value, properties);
|
|
9943
|
-
return properties.default.value;
|
|
9944
|
-
};
|
|
9945
|
-
var getController = (db, self) => {
|
|
9946
|
-
let controller = controllers.get(db);
|
|
9947
|
-
if (!controller) {
|
|
9948
|
-
const shared = {
|
|
9949
|
-
commit: db.prepare("COMMIT", self, false),
|
|
9950
|
-
rollback: db.prepare("ROLLBACK", self, false),
|
|
9951
|
-
savepoint: db.prepare("SAVEPOINT ` _bs3. `", self, false),
|
|
9952
|
-
release: db.prepare("RELEASE ` _bs3. `", self, false),
|
|
9953
|
-
rollbackTo: db.prepare("ROLLBACK TO ` _bs3. `", self, false)
|
|
9954
|
-
};
|
|
9955
|
-
controllers.set(db, controller = {
|
|
9956
|
-
default: Object.assign({ begin: db.prepare("BEGIN", self, false) }, shared),
|
|
9957
|
-
deferred: Object.assign({ begin: db.prepare("BEGIN DEFERRED", self, false) }, shared),
|
|
9958
|
-
immediate: Object.assign({ begin: db.prepare("BEGIN IMMEDIATE", self, false) }, shared),
|
|
9959
|
-
exclusive: Object.assign({ begin: db.prepare("BEGIN EXCLUSIVE", self, false) }, shared)
|
|
9960
|
-
});
|
|
9961
|
-
}
|
|
9962
|
-
return controller;
|
|
9963
|
-
};
|
|
9964
|
-
var wrapTransaction = (apply, fn, db, { begin, commit, rollback, savepoint, release, rollbackTo }) => function sqliteTransaction() {
|
|
9965
|
-
let before, after, undo;
|
|
9966
|
-
if (db.inTransaction) {
|
|
9967
|
-
before = savepoint;
|
|
9968
|
-
after = release;
|
|
9969
|
-
undo = rollbackTo;
|
|
9970
|
-
} else {
|
|
9971
|
-
before = begin;
|
|
9972
|
-
after = commit;
|
|
9973
|
-
undo = rollback;
|
|
9974
|
-
}
|
|
9975
|
-
before.run();
|
|
9976
|
-
try {
|
|
9977
|
-
const result = apply.call(fn, this, arguments);
|
|
9978
|
-
if (result && typeof result.then === "function") {
|
|
9979
|
-
throw new TypeError("Transaction function cannot return a promise");
|
|
9980
|
-
}
|
|
9981
|
-
after.run();
|
|
9982
|
-
return result;
|
|
9983
|
-
} catch (ex) {
|
|
9984
|
-
if (db.inTransaction) {
|
|
9985
|
-
undo.run();
|
|
9986
|
-
if (undo !== rollback) after.run();
|
|
9987
|
-
}
|
|
9988
|
-
throw ex;
|
|
9989
|
-
}
|
|
9990
|
-
};
|
|
9991
|
-
}
|
|
9992
|
-
});
|
|
9993
|
-
|
|
9994
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/pragma.js
|
|
9995
|
-
var require_pragma = __commonJS({
|
|
9996
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/pragma.js"(exports$1, module) {
|
|
9997
|
-
var { getBooleanOption, cppdb } = require_util();
|
|
9998
|
-
module.exports = function pragma(source, options) {
|
|
9999
|
-
if (options == null) options = {};
|
|
10000
|
-
if (typeof source !== "string") throw new TypeError("Expected first argument to be a string");
|
|
10001
|
-
if (typeof options !== "object") throw new TypeError("Expected second argument to be an options object");
|
|
10002
|
-
const simple = getBooleanOption(options, "simple");
|
|
10003
|
-
const stmt = this[cppdb].prepare(`PRAGMA ${source}`, this, true);
|
|
10004
|
-
return simple ? stmt.pluck().get() : stmt.all();
|
|
10005
|
-
};
|
|
10006
|
-
}
|
|
10007
|
-
});
|
|
10008
|
-
|
|
10009
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/backup.js
|
|
10010
|
-
var require_backup = __commonJS({
|
|
10011
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/backup.js"(exports$1, module) {
|
|
10012
|
-
var fs = __require("fs");
|
|
10013
|
-
var path37 = __require("path");
|
|
10014
|
-
var { promisify } = __require("util");
|
|
10015
|
-
var { cppdb } = require_util();
|
|
10016
|
-
var fsAccess = promisify(fs.access);
|
|
10017
|
-
module.exports = async function backup(filename, options) {
|
|
10018
|
-
if (options == null) options = {};
|
|
10019
|
-
if (typeof filename !== "string") throw new TypeError("Expected first argument to be a string");
|
|
10020
|
-
if (typeof options !== "object") throw new TypeError("Expected second argument to be an options object");
|
|
10021
|
-
filename = filename.trim();
|
|
10022
|
-
const attachedName = "attached" in options ? options.attached : "main";
|
|
10023
|
-
const handler = "progress" in options ? options.progress : null;
|
|
10024
|
-
if (!filename) throw new TypeError("Backup filename cannot be an empty string");
|
|
10025
|
-
if (filename === ":memory:") throw new TypeError('Invalid backup filename ":memory:"');
|
|
10026
|
-
if (typeof attachedName !== "string") throw new TypeError('Expected the "attached" option to be a string');
|
|
10027
|
-
if (!attachedName) throw new TypeError('The "attached" option cannot be an empty string');
|
|
10028
|
-
if (handler != null && typeof handler !== "function") throw new TypeError('Expected the "progress" option to be a function');
|
|
10029
|
-
await fsAccess(path37.dirname(filename)).catch(() => {
|
|
10030
|
-
throw new TypeError("Cannot save backup because the directory does not exist");
|
|
10031
|
-
});
|
|
10032
|
-
const isNewFile = await fsAccess(filename).then(() => false, () => true);
|
|
10033
|
-
return runBackup(this[cppdb].backup(this, attachedName, filename, isNewFile), handler || null);
|
|
10034
|
-
};
|
|
10035
|
-
var runBackup = (backup, handler) => {
|
|
10036
|
-
let rate = 0;
|
|
10037
|
-
let useDefault = true;
|
|
10038
|
-
return new Promise((resolve, reject) => {
|
|
10039
|
-
setImmediate(function step() {
|
|
10040
|
-
try {
|
|
10041
|
-
const progress = backup.transfer(rate);
|
|
10042
|
-
if (!progress.remainingPages) {
|
|
10043
|
-
backup.close();
|
|
10044
|
-
resolve(progress);
|
|
10045
|
-
return;
|
|
10046
|
-
}
|
|
10047
|
-
if (useDefault) {
|
|
10048
|
-
useDefault = false;
|
|
10049
|
-
rate = 100;
|
|
10050
|
-
}
|
|
10051
|
-
if (handler) {
|
|
10052
|
-
const ret = handler(progress);
|
|
10053
|
-
if (ret !== void 0) {
|
|
10054
|
-
if (typeof ret === "number" && ret === ret) rate = Math.max(0, Math.min(2147483647, Math.round(ret)));
|
|
10055
|
-
else throw new TypeError("Expected progress callback to return a number or undefined");
|
|
10056
|
-
}
|
|
10057
|
-
}
|
|
10058
|
-
setImmediate(step);
|
|
10059
|
-
} catch (err) {
|
|
10060
|
-
backup.close();
|
|
10061
|
-
reject(err);
|
|
10062
|
-
}
|
|
10063
|
-
});
|
|
10064
|
-
});
|
|
10065
|
-
};
|
|
10066
|
-
}
|
|
10067
|
-
});
|
|
10068
|
-
|
|
10069
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/serialize.js
|
|
10070
|
-
var require_serialize = __commonJS({
|
|
10071
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/serialize.js"(exports$1, module) {
|
|
10072
|
-
var { cppdb } = require_util();
|
|
10073
|
-
module.exports = function serialize(options) {
|
|
10074
|
-
if (options == null) options = {};
|
|
10075
|
-
if (typeof options !== "object") throw new TypeError("Expected first argument to be an options object");
|
|
10076
|
-
const attachedName = "attached" in options ? options.attached : "main";
|
|
10077
|
-
if (typeof attachedName !== "string") throw new TypeError('Expected the "attached" option to be a string');
|
|
10078
|
-
if (!attachedName) throw new TypeError('The "attached" option cannot be an empty string');
|
|
10079
|
-
return this[cppdb].serialize(attachedName);
|
|
10080
|
-
};
|
|
10081
|
-
}
|
|
10082
|
-
});
|
|
10083
|
-
|
|
10084
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/function.js
|
|
10085
|
-
var require_function = __commonJS({
|
|
10086
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/function.js"(exports$1, module) {
|
|
10087
|
-
var { getBooleanOption, cppdb } = require_util();
|
|
10088
|
-
module.exports = function defineFunction(name, options, fn) {
|
|
10089
|
-
if (options == null) options = {};
|
|
10090
|
-
if (typeof options === "function") {
|
|
10091
|
-
fn = options;
|
|
10092
|
-
options = {};
|
|
10093
|
-
}
|
|
10094
|
-
if (typeof name !== "string") throw new TypeError("Expected first argument to be a string");
|
|
10095
|
-
if (typeof fn !== "function") throw new TypeError("Expected last argument to be a function");
|
|
10096
|
-
if (typeof options !== "object") throw new TypeError("Expected second argument to be an options object");
|
|
10097
|
-
if (!name) throw new TypeError("User-defined function name cannot be an empty string");
|
|
10098
|
-
const safeIntegers = "safeIntegers" in options ? +getBooleanOption(options, "safeIntegers") : 2;
|
|
10099
|
-
const deterministic = getBooleanOption(options, "deterministic");
|
|
10100
|
-
const directOnly = getBooleanOption(options, "directOnly");
|
|
10101
|
-
const varargs = getBooleanOption(options, "varargs");
|
|
10102
|
-
let argCount = -1;
|
|
10103
|
-
if (!varargs) {
|
|
10104
|
-
argCount = fn.length;
|
|
10105
|
-
if (!Number.isInteger(argCount) || argCount < 0) throw new TypeError("Expected function.length to be a positive integer");
|
|
10106
|
-
if (argCount > 100) throw new RangeError("User-defined functions cannot have more than 100 arguments");
|
|
10107
|
-
}
|
|
10108
|
-
this[cppdb].function(fn, name, argCount, safeIntegers, deterministic, directOnly);
|
|
10109
|
-
return this;
|
|
10110
|
-
};
|
|
10111
|
-
}
|
|
10112
|
-
});
|
|
10113
|
-
|
|
10114
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/aggregate.js
|
|
10115
|
-
var require_aggregate = __commonJS({
|
|
10116
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/aggregate.js"(exports$1, module) {
|
|
10117
|
-
var { getBooleanOption, cppdb } = require_util();
|
|
10118
|
-
module.exports = function defineAggregate(name, options) {
|
|
10119
|
-
if (typeof name !== "string") throw new TypeError("Expected first argument to be a string");
|
|
10120
|
-
if (typeof options !== "object" || options === null) throw new TypeError("Expected second argument to be an options object");
|
|
10121
|
-
if (!name) throw new TypeError("User-defined function name cannot be an empty string");
|
|
10122
|
-
const start = "start" in options ? options.start : null;
|
|
10123
|
-
const step = getFunctionOption(options, "step", true);
|
|
10124
|
-
const inverse = getFunctionOption(options, "inverse", false);
|
|
10125
|
-
const result = getFunctionOption(options, "result", false);
|
|
10126
|
-
const safeIntegers = "safeIntegers" in options ? +getBooleanOption(options, "safeIntegers") : 2;
|
|
10127
|
-
const deterministic = getBooleanOption(options, "deterministic");
|
|
10128
|
-
const directOnly = getBooleanOption(options, "directOnly");
|
|
10129
|
-
const varargs = getBooleanOption(options, "varargs");
|
|
10130
|
-
let argCount = -1;
|
|
10131
|
-
if (!varargs) {
|
|
10132
|
-
argCount = Math.max(getLength(step), inverse ? getLength(inverse) : 0);
|
|
10133
|
-
if (argCount > 0) argCount -= 1;
|
|
10134
|
-
if (argCount > 100) throw new RangeError("User-defined functions cannot have more than 100 arguments");
|
|
10135
|
-
}
|
|
10136
|
-
this[cppdb].aggregate(start, step, inverse, result, name, argCount, safeIntegers, deterministic, directOnly);
|
|
10137
|
-
return this;
|
|
10138
|
-
};
|
|
10139
|
-
var getFunctionOption = (options, key, required) => {
|
|
10140
|
-
const value = key in options ? options[key] : null;
|
|
10141
|
-
if (typeof value === "function") return value;
|
|
10142
|
-
if (value != null) throw new TypeError(`Expected the "${key}" option to be a function`);
|
|
10143
|
-
if (required) throw new TypeError(`Missing required option "${key}"`);
|
|
10144
|
-
return null;
|
|
10145
|
-
};
|
|
10146
|
-
var getLength = ({ length }) => {
|
|
10147
|
-
if (Number.isInteger(length) && length >= 0) return length;
|
|
10148
|
-
throw new TypeError("Expected function.length to be a positive integer");
|
|
10149
|
-
};
|
|
10150
|
-
}
|
|
10151
|
-
});
|
|
10152
|
-
|
|
10153
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/table.js
|
|
10154
|
-
var require_table = __commonJS({
|
|
10155
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/table.js"(exports$1, module) {
|
|
10156
|
-
var { cppdb } = require_util();
|
|
10157
|
-
module.exports = function defineTable(name, factory) {
|
|
10158
|
-
if (typeof name !== "string") throw new TypeError("Expected first argument to be a string");
|
|
10159
|
-
if (!name) throw new TypeError("Virtual table module name cannot be an empty string");
|
|
10160
|
-
let eponymous = false;
|
|
10161
|
-
if (typeof factory === "object" && factory !== null) {
|
|
10162
|
-
eponymous = true;
|
|
10163
|
-
factory = defer(parseTableDefinition(factory, "used", name));
|
|
10164
|
-
} else {
|
|
10165
|
-
if (typeof factory !== "function") throw new TypeError("Expected second argument to be a function or a table definition object");
|
|
10166
|
-
factory = wrapFactory(factory);
|
|
10167
|
-
}
|
|
10168
|
-
this[cppdb].table(factory, name, eponymous);
|
|
10169
|
-
return this;
|
|
10170
|
-
};
|
|
10171
|
-
function wrapFactory(factory) {
|
|
10172
|
-
return function virtualTableFactory(moduleName, databaseName, tableName, ...args) {
|
|
10173
|
-
const thisObject = {
|
|
10174
|
-
module: moduleName,
|
|
10175
|
-
database: databaseName,
|
|
10176
|
-
table: tableName
|
|
10177
|
-
};
|
|
10178
|
-
const def = apply.call(factory, thisObject, args);
|
|
10179
|
-
if (typeof def !== "object" || def === null) {
|
|
10180
|
-
throw new TypeError(`Virtual table module "${moduleName}" did not return a table definition object`);
|
|
10181
|
-
}
|
|
10182
|
-
return parseTableDefinition(def, "returned", moduleName);
|
|
10183
|
-
};
|
|
10184
|
-
}
|
|
10185
|
-
function parseTableDefinition(def, verb, moduleName) {
|
|
10186
|
-
if (!hasOwnProperty.call(def, "rows")) {
|
|
10187
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition without a "rows" property`);
|
|
10188
|
-
}
|
|
10189
|
-
if (!hasOwnProperty.call(def, "columns")) {
|
|
10190
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition without a "columns" property`);
|
|
10191
|
-
}
|
|
10192
|
-
const rows = def.rows;
|
|
10193
|
-
if (typeof rows !== "function" || Object.getPrototypeOf(rows) !== GeneratorFunctionPrototype) {
|
|
10194
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "rows" property (should be a generator function)`);
|
|
10195
|
-
}
|
|
10196
|
-
let columns = def.columns;
|
|
10197
|
-
if (!Array.isArray(columns) || !(columns = [...columns]).every((x) => typeof x === "string")) {
|
|
10198
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "columns" property (should be an array of strings)`);
|
|
10199
|
-
}
|
|
10200
|
-
if (columns.length !== new Set(columns).size) {
|
|
10201
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with duplicate column names`);
|
|
10202
|
-
}
|
|
10203
|
-
if (!columns.length) {
|
|
10204
|
-
throw new RangeError(`Virtual table module "${moduleName}" ${verb} a table definition with zero columns`);
|
|
10205
|
-
}
|
|
10206
|
-
let parameters;
|
|
10207
|
-
if (hasOwnProperty.call(def, "parameters")) {
|
|
10208
|
-
parameters = def.parameters;
|
|
10209
|
-
if (!Array.isArray(parameters) || !(parameters = [...parameters]).every((x) => typeof x === "string")) {
|
|
10210
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "parameters" property (should be an array of strings)`);
|
|
10211
|
-
}
|
|
10212
|
-
} else {
|
|
10213
|
-
parameters = inferParameters(rows);
|
|
10214
|
-
}
|
|
10215
|
-
if (parameters.length !== new Set(parameters).size) {
|
|
10216
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with duplicate parameter names`);
|
|
10217
|
-
}
|
|
10218
|
-
if (parameters.length > 32) {
|
|
10219
|
-
throw new RangeError(`Virtual table module "${moduleName}" ${verb} a table definition with more than the maximum number of 32 parameters`);
|
|
10220
|
-
}
|
|
10221
|
-
for (const parameter of parameters) {
|
|
10222
|
-
if (columns.includes(parameter)) {
|
|
10223
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with column "${parameter}" which was ambiguously defined as both a column and parameter`);
|
|
10224
|
-
}
|
|
10225
|
-
}
|
|
10226
|
-
let safeIntegers = 2;
|
|
10227
|
-
if (hasOwnProperty.call(def, "safeIntegers")) {
|
|
10228
|
-
const bool = def.safeIntegers;
|
|
10229
|
-
if (typeof bool !== "boolean") {
|
|
10230
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "safeIntegers" property (should be a boolean)`);
|
|
10231
|
-
}
|
|
10232
|
-
safeIntegers = +bool;
|
|
10233
|
-
}
|
|
10234
|
-
let directOnly = false;
|
|
10235
|
-
if (hasOwnProperty.call(def, "directOnly")) {
|
|
10236
|
-
directOnly = def.directOnly;
|
|
10237
|
-
if (typeof directOnly !== "boolean") {
|
|
10238
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "directOnly" property (should be a boolean)`);
|
|
10239
|
-
}
|
|
10240
|
-
}
|
|
10241
|
-
const columnDefinitions = [
|
|
10242
|
-
...parameters.map(identifier).map((str2) => `${str2} HIDDEN`),
|
|
10243
|
-
...columns.map(identifier)
|
|
10244
|
-
];
|
|
10245
|
-
return [
|
|
10246
|
-
`CREATE TABLE x(${columnDefinitions.join(", ")});`,
|
|
10247
|
-
wrapGenerator(rows, new Map(columns.map((x, i) => [x, parameters.length + i])), moduleName),
|
|
10248
|
-
parameters,
|
|
10249
|
-
safeIntegers,
|
|
10250
|
-
directOnly
|
|
10251
|
-
];
|
|
10252
|
-
}
|
|
10253
|
-
function wrapGenerator(generator, columnMap, moduleName) {
|
|
10254
|
-
return function* virtualTable(...args) {
|
|
10255
|
-
const output2 = args.map((x) => Buffer.isBuffer(x) ? Buffer.from(x) : x);
|
|
10256
|
-
for (let i = 0; i < columnMap.size; ++i) {
|
|
10257
|
-
output2.push(null);
|
|
10258
|
-
}
|
|
10259
|
-
for (const row of generator(...args)) {
|
|
10260
|
-
if (Array.isArray(row)) {
|
|
10261
|
-
extractRowArray(row, output2, columnMap.size, moduleName);
|
|
10262
|
-
yield output2;
|
|
10263
|
-
} else if (typeof row === "object" && row !== null) {
|
|
10264
|
-
extractRowObject(row, output2, columnMap, moduleName);
|
|
10265
|
-
yield output2;
|
|
10266
|
-
} else {
|
|
10267
|
-
throw new TypeError(`Virtual table module "${moduleName}" yielded something that isn't a valid row object`);
|
|
10268
|
-
}
|
|
10269
|
-
}
|
|
10270
|
-
};
|
|
10271
|
-
}
|
|
10272
|
-
function extractRowArray(row, output2, columnCount, moduleName) {
|
|
10273
|
-
if (row.length !== columnCount) {
|
|
10274
|
-
throw new TypeError(`Virtual table module "${moduleName}" yielded a row with an incorrect number of columns`);
|
|
10275
|
-
}
|
|
10276
|
-
const offset = output2.length - columnCount;
|
|
10277
|
-
for (let i = 0; i < columnCount; ++i) {
|
|
10278
|
-
output2[i + offset] = row[i];
|
|
10279
|
-
}
|
|
10280
|
-
}
|
|
10281
|
-
function extractRowObject(row, output2, columnMap, moduleName) {
|
|
10282
|
-
let count = 0;
|
|
10283
|
-
for (const key of Object.keys(row)) {
|
|
10284
|
-
const index = columnMap.get(key);
|
|
10285
|
-
if (index === void 0) {
|
|
10286
|
-
throw new TypeError(`Virtual table module "${moduleName}" yielded a row with an undeclared column "${key}"`);
|
|
10287
|
-
}
|
|
10288
|
-
output2[index] = row[key];
|
|
10289
|
-
count += 1;
|
|
10290
|
-
}
|
|
10291
|
-
if (count !== columnMap.size) {
|
|
10292
|
-
throw new TypeError(`Virtual table module "${moduleName}" yielded a row with missing columns`);
|
|
10293
|
-
}
|
|
10294
|
-
}
|
|
10295
|
-
function inferParameters({ length }) {
|
|
10296
|
-
if (!Number.isInteger(length) || length < 0) {
|
|
10297
|
-
throw new TypeError("Expected function.length to be a positive integer");
|
|
10298
|
-
}
|
|
10299
|
-
const params = [];
|
|
10300
|
-
for (let i = 0; i < length; ++i) {
|
|
10301
|
-
params.push(`$${i + 1}`);
|
|
10302
|
-
}
|
|
10303
|
-
return params;
|
|
10304
|
-
}
|
|
10305
|
-
var { hasOwnProperty } = Object.prototype;
|
|
10306
|
-
var { apply } = Function.prototype;
|
|
10307
|
-
var GeneratorFunctionPrototype = Object.getPrototypeOf(function* () {
|
|
10308
|
-
});
|
|
10309
|
-
var identifier = (str2) => `"${str2.replace(/"/g, '""')}"`;
|
|
10310
|
-
var defer = (x) => () => x;
|
|
10311
|
-
}
|
|
10312
|
-
});
|
|
10313
|
-
|
|
10314
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/inspect.js
|
|
10315
|
-
var require_inspect = __commonJS({
|
|
10316
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/inspect.js"(exports$1, module) {
|
|
10317
|
-
var DatabaseInspection = function Database3() {
|
|
10318
|
-
};
|
|
10319
|
-
module.exports = function inspect(depth, opts) {
|
|
10320
|
-
return Object.assign(new DatabaseInspection(), this);
|
|
10321
|
-
};
|
|
10322
|
-
}
|
|
10323
|
-
});
|
|
10324
|
-
|
|
10325
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/database.js
|
|
10326
|
-
var require_database = __commonJS({
|
|
10327
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/database.js"(exports$1, module) {
|
|
10328
|
-
var fs = __require("fs");
|
|
10329
|
-
var path37 = __require("path");
|
|
10330
|
-
var util = require_util();
|
|
10331
|
-
var SqliteError = require_sqlite_error();
|
|
10332
|
-
var DEFAULT_ADDON;
|
|
10333
|
-
function Database3(filenameGiven, options) {
|
|
10334
|
-
if (new.target == null) {
|
|
10335
|
-
return new Database3(filenameGiven, options);
|
|
10336
|
-
}
|
|
10337
|
-
let buffer;
|
|
10338
|
-
if (Buffer.isBuffer(filenameGiven)) {
|
|
10339
|
-
buffer = filenameGiven;
|
|
10340
|
-
filenameGiven = ":memory:";
|
|
10341
|
-
}
|
|
10342
|
-
if (filenameGiven == null) filenameGiven = "";
|
|
10343
|
-
if (options == null) options = {};
|
|
10344
|
-
if (typeof filenameGiven !== "string") throw new TypeError("Expected first argument to be a string");
|
|
10345
|
-
if (typeof options !== "object") throw new TypeError("Expected second argument to be an options object");
|
|
10346
|
-
if ("readOnly" in options) throw new TypeError('Misspelled option "readOnly" should be "readonly"');
|
|
10347
|
-
if ("memory" in options) throw new TypeError('Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)');
|
|
10348
|
-
const filename = filenameGiven.trim();
|
|
10349
|
-
const anonymous = filename === "" || filename === ":memory:";
|
|
10350
|
-
const readonly = util.getBooleanOption(options, "readonly");
|
|
10351
|
-
const fileMustExist = util.getBooleanOption(options, "fileMustExist");
|
|
10352
|
-
const timeout = "timeout" in options ? options.timeout : 5e3;
|
|
10353
|
-
const verbose = "verbose" in options ? options.verbose : null;
|
|
10354
|
-
const nativeBinding = "nativeBinding" in options ? options.nativeBinding : null;
|
|
10355
|
-
if (readonly && anonymous && !buffer) throw new TypeError("In-memory/temporary databases cannot be readonly");
|
|
10356
|
-
if (!Number.isInteger(timeout) || timeout < 0) throw new TypeError('Expected the "timeout" option to be a positive integer');
|
|
10357
|
-
if (timeout > 2147483647) throw new RangeError('Option "timeout" cannot be greater than 2147483647');
|
|
10358
|
-
if (verbose != null && typeof verbose !== "function") throw new TypeError('Expected the "verbose" option to be a function');
|
|
10359
|
-
if (nativeBinding != null && typeof nativeBinding !== "string" && typeof nativeBinding !== "object") throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');
|
|
10360
|
-
let addon;
|
|
10361
|
-
if (nativeBinding == null) {
|
|
10362
|
-
addon = DEFAULT_ADDON || (DEFAULT_ADDON = require_bindings()("better_sqlite3.node"));
|
|
10363
|
-
} else if (typeof nativeBinding === "string") {
|
|
10364
|
-
const requireFunc = typeof __non_webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
10365
|
-
addon = requireFunc(path37.resolve(nativeBinding).replace(/(\.node)?$/, ".node"));
|
|
10366
|
-
} else {
|
|
10367
|
-
addon = nativeBinding;
|
|
10368
|
-
}
|
|
10369
|
-
if (!addon.isInitialized) {
|
|
10370
|
-
addon.setErrorConstructor(SqliteError);
|
|
10371
|
-
addon.isInitialized = true;
|
|
10372
|
-
}
|
|
10373
|
-
if (!anonymous && !fs.existsSync(path37.dirname(filename))) {
|
|
10374
|
-
throw new TypeError("Cannot open database because the directory does not exist");
|
|
10375
|
-
}
|
|
10376
|
-
Object.defineProperties(this, {
|
|
10377
|
-
[util.cppdb]: { value: new addon.Database(filename, filenameGiven, anonymous, readonly, fileMustExist, timeout, verbose || null, buffer || null) },
|
|
10378
|
-
...wrappers.getters
|
|
10379
|
-
});
|
|
10380
|
-
}
|
|
10381
|
-
var wrappers = require_wrappers();
|
|
10382
|
-
Database3.prototype.prepare = wrappers.prepare;
|
|
10383
|
-
Database3.prototype.transaction = require_transaction();
|
|
10384
|
-
Database3.prototype.pragma = require_pragma();
|
|
10385
|
-
Database3.prototype.backup = require_backup();
|
|
10386
|
-
Database3.prototype.serialize = require_serialize();
|
|
10387
|
-
Database3.prototype.function = require_function();
|
|
10388
|
-
Database3.prototype.aggregate = require_aggregate();
|
|
10389
|
-
Database3.prototype.table = require_table();
|
|
10390
|
-
Database3.prototype.loadExtension = wrappers.loadExtension;
|
|
10391
|
-
Database3.prototype.exec = wrappers.exec;
|
|
10392
|
-
Database3.prototype.close = wrappers.close;
|
|
10393
|
-
Database3.prototype.defaultSafeIntegers = wrappers.defaultSafeIntegers;
|
|
10394
|
-
Database3.prototype.unsafeMode = wrappers.unsafeMode;
|
|
10395
|
-
Database3.prototype[util.inspect] = require_inspect();
|
|
10396
|
-
module.exports = Database3;
|
|
10397
|
-
}
|
|
10398
|
-
});
|
|
10399
|
-
|
|
10400
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/index.js
|
|
10401
|
-
var require_lib = __commonJS({
|
|
10402
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/index.js"(exports$1, module) {
|
|
10403
|
-
module.exports = require_database();
|
|
10404
|
-
module.exports.SqliteError = require_sqlite_error();
|
|
10405
|
-
}
|
|
10406
|
-
});
|
|
10407
|
-
|
|
10408
9621
|
// packages/index-sqlite/src/schema.ts
|
|
10409
9622
|
function metaDefaults(sourceDir, fileCount) {
|
|
10410
9623
|
return {
|
|
@@ -10496,6 +9709,24 @@ GROUP BY session_id;
|
|
|
10496
9709
|
};
|
|
10497
9710
|
}
|
|
10498
9711
|
});
|
|
9712
|
+
function loadBetterSqlite3() {
|
|
9713
|
+
if (cached !== void 0) return cached;
|
|
9714
|
+
try {
|
|
9715
|
+
const require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
9716
|
+
cached = require2("better-sqlite3");
|
|
9717
|
+
return cached;
|
|
9718
|
+
} catch (error) {
|
|
9719
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
9720
|
+
throw new Error(
|
|
9721
|
+
`better-sqlite3 native driver is unavailable (${detail}). Install a prebuild for your Node/OS (see better-sqlite3 docs) or fall back to JSONL directory scans without the SQLite index. Core agent-inspect remains usable without this optional package.`
|
|
9722
|
+
);
|
|
9723
|
+
}
|
|
9724
|
+
}
|
|
9725
|
+
var cached;
|
|
9726
|
+
var init_load_sqlite = __esm({
|
|
9727
|
+
"packages/index-sqlite/src/load-sqlite.ts"() {
|
|
9728
|
+
}
|
|
9729
|
+
});
|
|
10499
9730
|
function resolveIndexDbPath(traceDir, dbPath) {
|
|
10500
9731
|
if (dbPath && dbPath.trim() !== "") return path26__default.default.resolve(dbPath);
|
|
10501
9732
|
return path26__default.default.join(path26__default.default.resolve(traceDir), INDEX_DB_FILENAME);
|
|
@@ -10592,7 +9823,8 @@ async function buildIndex(options = {}) {
|
|
|
10592
9823
|
}
|
|
10593
9824
|
await promises.mkdir(path26__default.default.dirname(dbPath), { recursive: true });
|
|
10594
9825
|
await promises.rm(dbPath, { force: true });
|
|
10595
|
-
const
|
|
9826
|
+
const Sqlite = loadBetterSqlite3();
|
|
9827
|
+
const db = new Sqlite(dbPath);
|
|
10596
9828
|
let runCount = 0;
|
|
10597
9829
|
let stepCount = 0;
|
|
10598
9830
|
let errorCount = 0;
|
|
@@ -10649,7 +9881,8 @@ async function buildIndex(options = {}) {
|
|
|
10649
9881
|
}
|
|
10650
9882
|
function readMetaValue(dbPath, key) {
|
|
10651
9883
|
try {
|
|
10652
|
-
const
|
|
9884
|
+
const Sqlite = loadBetterSqlite3();
|
|
9885
|
+
const db = new Sqlite(dbPath, { readonly: true, fileMustExist: true });
|
|
10653
9886
|
try {
|
|
10654
9887
|
const row = db.prepare(`SELECT value FROM meta WHERE key = ?`).get(key);
|
|
10655
9888
|
return row?.value ?? null;
|
|
@@ -10665,12 +9898,12 @@ async function cleanIndex(dbPath) {
|
|
|
10665
9898
|
await promises.rm(`${dbPath}-wal`, { force: true });
|
|
10666
9899
|
await promises.rm(`${dbPath}-shm`, { force: true });
|
|
10667
9900
|
}
|
|
10668
|
-
var
|
|
9901
|
+
var DEFAULT_MAX_RUNS, rebuildIndex;
|
|
10669
9902
|
var init_builder = __esm({
|
|
10670
9903
|
"packages/index-sqlite/src/builder.ts"() {
|
|
10671
|
-
import_better_sqlite3 = __toESM(require_lib());
|
|
10672
9904
|
init_advanced();
|
|
10673
9905
|
init_schema();
|
|
9906
|
+
init_load_sqlite();
|
|
10674
9907
|
init_types6();
|
|
10675
9908
|
DEFAULT_MAX_RUNS = 1e4;
|
|
10676
9909
|
rebuildIndex = buildIndex;
|
|
@@ -10678,8 +9911,14 @@ var init_builder = __esm({
|
|
|
10678
9911
|
});
|
|
10679
9912
|
function openHealthy(dbPath) {
|
|
10680
9913
|
if (!fs.existsSync(dbPath)) return null;
|
|
9914
|
+
let Sqlite;
|
|
9915
|
+
try {
|
|
9916
|
+
Sqlite = loadBetterSqlite3();
|
|
9917
|
+
} catch {
|
|
9918
|
+
return null;
|
|
9919
|
+
}
|
|
10681
9920
|
try {
|
|
10682
|
-
const db = new
|
|
9921
|
+
const db = new Sqlite(dbPath, { readonly: true, fileMustExist: true });
|
|
10683
9922
|
try {
|
|
10684
9923
|
const result = db.pragma("integrity_check", { simple: true });
|
|
10685
9924
|
if (result !== "ok") {
|
|
@@ -10801,10 +10040,9 @@ function queryRuns(dbPath, query = {}) {
|
|
|
10801
10040
|
db.close();
|
|
10802
10041
|
}
|
|
10803
10042
|
}
|
|
10804
|
-
var import_better_sqlite32;
|
|
10805
10043
|
var init_query = __esm({
|
|
10806
10044
|
"packages/index-sqlite/src/query.ts"() {
|
|
10807
|
-
|
|
10045
|
+
init_load_sqlite();
|
|
10808
10046
|
init_schema();
|
|
10809
10047
|
}
|
|
10810
10048
|
});
|
|
@@ -10831,7 +10069,7 @@ var init_src = __esm({
|
|
|
10831
10069
|
});
|
|
10832
10070
|
|
|
10833
10071
|
// package.json
|
|
10834
|
-
var version = "6.
|
|
10072
|
+
var version = "6.8.0";
|
|
10835
10073
|
|
|
10836
10074
|
// packages/cli/src/list.ts
|
|
10837
10075
|
init_advanced();
|
|
@@ -13760,6 +12998,20 @@ ${attrsSection}
|
|
|
13760
12998
|
// packages/core/src/entries/exporters.ts
|
|
13761
12999
|
init_helpers();
|
|
13762
13000
|
|
|
13001
|
+
// packages/cli/src/cli-option-aliases.ts
|
|
13002
|
+
function resolveOutputOption(options) {
|
|
13003
|
+
const canonical = options.output?.trim();
|
|
13004
|
+
if (canonical) return canonical;
|
|
13005
|
+
const legacy = options.out?.trim();
|
|
13006
|
+
return legacy || void 0;
|
|
13007
|
+
}
|
|
13008
|
+
function resolveRedactionProfileOption(options) {
|
|
13009
|
+
const canonical = options.redactionProfile?.trim();
|
|
13010
|
+
if (canonical) return canonical;
|
|
13011
|
+
const legacy = options.profile?.trim();
|
|
13012
|
+
return legacy || void 0;
|
|
13013
|
+
}
|
|
13014
|
+
|
|
13763
13015
|
// packages/cli/src/export.ts
|
|
13764
13016
|
function parseRedactionProfile(s) {
|
|
13765
13017
|
const v = (s ?? "local").trim().toLowerCase();
|
|
@@ -13790,7 +13042,7 @@ async function exportCommand(runId, options = {}) {
|
|
|
13790
13042
|
let redactionProfile;
|
|
13791
13043
|
try {
|
|
13792
13044
|
format = parseExportFormat(options.format);
|
|
13793
|
-
redactionProfile = parseRedactionProfile(options
|
|
13045
|
+
redactionProfile = parseRedactionProfile(resolveRedactionProfileOption(options));
|
|
13794
13046
|
} catch (e) {
|
|
13795
13047
|
const msg = e instanceof Error ? e.message : String(e);
|
|
13796
13048
|
console.error(msg);
|
|
@@ -13838,7 +13090,8 @@ Trace directory: ${traceDir}`);
|
|
|
13838
13090
|
if (validation !== void 0 && !validation.ok) {
|
|
13839
13091
|
process.exitCode = 1;
|
|
13840
13092
|
}
|
|
13841
|
-
const
|
|
13093
|
+
const resolvedOutput = resolveOutputOption(options);
|
|
13094
|
+
const outPath = resolvedOutput !== void 0 ? path26__default.default.resolve(resolvedOutput) : void 0;
|
|
13842
13095
|
if (outPath !== void 0) {
|
|
13843
13096
|
await promises.mkdir(path26__default.default.dirname(outPath), { recursive: true });
|
|
13844
13097
|
await promises.writeFile(outPath, result.content, "utf-8");
|
|
@@ -15109,7 +14362,7 @@ async function reportCommand(runId, options = {}) {
|
|
|
15109
14362
|
let redactionProfile;
|
|
15110
14363
|
try {
|
|
15111
14364
|
format = parseReportFormat(options.format);
|
|
15112
|
-
redactionProfile = parseRedactionProfile2(options
|
|
14365
|
+
redactionProfile = parseRedactionProfile2(resolveRedactionProfileOption(options));
|
|
15113
14366
|
} catch (e) {
|
|
15114
14367
|
const msg = e instanceof Error ? e.message : String(e);
|
|
15115
14368
|
console.error(msg);
|
|
@@ -15141,7 +14394,8 @@ async function reportCommand(runId, options = {}) {
|
|
|
15141
14394
|
correlation: !options.noCorrelation,
|
|
15142
14395
|
...options.section ? { section: options.section } : {}
|
|
15143
14396
|
});
|
|
15144
|
-
const
|
|
14397
|
+
const resolvedOutput = resolveOutputOption(options);
|
|
14398
|
+
const outPath = resolvedOutput !== void 0 ? path26__default.default.resolve(resolvedOutput) : void 0;
|
|
15145
14399
|
if (outPath !== void 0) {
|
|
15146
14400
|
await promises.mkdir(path26__default.default.dirname(outPath), { recursive: true });
|
|
15147
14401
|
await promises.writeFile(outPath, result.content, "utf-8");
|
|
@@ -15660,11 +14914,12 @@ function redactTraceContent(content, profile) {
|
|
|
15660
14914
|
return redactDocument(content, profile);
|
|
15661
14915
|
}
|
|
15662
14916
|
async function redactCommand(target, options = {}, stdin = process.stdin) {
|
|
15663
|
-
const profile = parseRedactionProfile3(options
|
|
14917
|
+
const profile = parseRedactionProfile3(resolveRedactionProfileOption(options));
|
|
15664
14918
|
const source = await contentFromTarget(target, options, stdin);
|
|
15665
14919
|
const redacted = redactDocument(source.content, profile);
|
|
15666
|
-
|
|
15667
|
-
|
|
14920
|
+
const outputPath = resolveOutputOption(options);
|
|
14921
|
+
if (outputPath !== void 0) {
|
|
14922
|
+
await promises.writeFile(outputPath, redacted.content, "utf-8");
|
|
15668
14923
|
}
|
|
15669
14924
|
if (options.json) {
|
|
15670
14925
|
console.log(
|
|
@@ -15673,9 +14928,9 @@ async function redactCommand(target, options = {}, stdin = process.stdin) {
|
|
|
15673
14928
|
ok: true,
|
|
15674
14929
|
profile,
|
|
15675
14930
|
source: source.source,
|
|
15676
|
-
output:
|
|
14931
|
+
output: outputPath,
|
|
15677
14932
|
findings: redacted.findings,
|
|
15678
|
-
content:
|
|
14933
|
+
content: outputPath === void 0 ? redacted.content : void 0
|
|
15679
14934
|
}),
|
|
15680
14935
|
null,
|
|
15681
14936
|
2
|
|
@@ -15683,7 +14938,7 @@ async function redactCommand(target, options = {}, stdin = process.stdin) {
|
|
|
15683
14938
|
);
|
|
15684
14939
|
return;
|
|
15685
14940
|
}
|
|
15686
|
-
if (
|
|
14941
|
+
if (outputPath === void 0) {
|
|
15687
14942
|
process.stdout.write(redacted.content);
|
|
15688
14943
|
}
|
|
15689
14944
|
}
|
|
@@ -15761,7 +15016,7 @@ async function explainCommand(target, options = {}, stdin = process.stdin) {
|
|
|
15761
15016
|
}
|
|
15762
15017
|
let redactionProfile;
|
|
15763
15018
|
try {
|
|
15764
|
-
redactionProfile = parseRedactionProfile4(options
|
|
15019
|
+
redactionProfile = parseRedactionProfile4(resolveRedactionProfileOption(options));
|
|
15765
15020
|
} catch (error) {
|
|
15766
15021
|
process.exitCode = 1;
|
|
15767
15022
|
console.error(error instanceof Error ? error.message : String(error));
|
|
@@ -19723,8 +18978,9 @@ function safetyStatusFromAssess(status) {
|
|
|
19723
18978
|
return "UNKNOWN";
|
|
19724
18979
|
}
|
|
19725
18980
|
async function resolveOutputDir(options, runIds, cwd) {
|
|
19726
|
-
|
|
19727
|
-
|
|
18981
|
+
const out = resolveOutputOption(options);
|
|
18982
|
+
if (out !== void 0) {
|
|
18983
|
+
const normalized = normalizeBundleOutputPath(out);
|
|
19728
18984
|
try {
|
|
19729
18985
|
const location = resolveWorkspaceLocation(cwd);
|
|
19730
18986
|
const manifest = await readWorkspaceManifestFile(location);
|
|
@@ -19794,7 +19050,7 @@ function extractHtmlBody(content) {
|
|
|
19794
19050
|
return match?.[1]?.trim() ?? content;
|
|
19795
19051
|
}
|
|
19796
19052
|
async function bundleCommand(runIdArg, options = {}) {
|
|
19797
|
-
const profile = parseBundleProfile(options
|
|
19053
|
+
const profile = parseBundleProfile(resolveRedactionProfileOption(options));
|
|
19798
19054
|
const traceDir = resolveTraceDir({ dir: options.dir });
|
|
19799
19055
|
const cwd = process.cwd();
|
|
19800
19056
|
let resolveResult;
|
|
@@ -20679,42 +19935,67 @@ async function traceDirWritable(traceDir) {
|
|
|
20679
19935
|
};
|
|
20680
19936
|
}
|
|
20681
19937
|
}
|
|
20682
|
-
function
|
|
19938
|
+
function readPackageVersionNearEntry(entryPath, packageName) {
|
|
19939
|
+
let dir = path26__default.default.dirname(path26__default.default.resolve(entryPath));
|
|
19940
|
+
const { root } = path26__default.default.parse(dir);
|
|
19941
|
+
while (true) {
|
|
19942
|
+
const candidate = path26__default.default.join(dir, "package.json");
|
|
19943
|
+
if (fs.existsSync(candidate)) {
|
|
19944
|
+
try {
|
|
19945
|
+
const pkg = JSON.parse(fs.readFileSync(candidate, "utf8"));
|
|
19946
|
+
if (pkg.name === packageName && typeof pkg.version === "string") {
|
|
19947
|
+
return pkg.version;
|
|
19948
|
+
}
|
|
19949
|
+
} catch {
|
|
19950
|
+
}
|
|
19951
|
+
}
|
|
19952
|
+
if (dir === root) break;
|
|
19953
|
+
const parent = path26__default.default.dirname(dir);
|
|
19954
|
+
if (parent === dir) break;
|
|
19955
|
+
dir = parent;
|
|
19956
|
+
}
|
|
19957
|
+
return void 0;
|
|
19958
|
+
}
|
|
19959
|
+
function resolveInstalledPackage(cwd, name) {
|
|
20683
19960
|
const require2 = module$1.createRequire(path26__default.default.join(cwd, "package.json"));
|
|
20684
19961
|
try {
|
|
20685
|
-
const
|
|
20686
|
-
|
|
20687
|
-
|
|
19962
|
+
const entry = require2.resolve(name);
|
|
19963
|
+
let version2;
|
|
19964
|
+
try {
|
|
19965
|
+
const pkgPath = require2.resolve(`${name}/package.json`);
|
|
19966
|
+
const pkg = require2(pkgPath);
|
|
19967
|
+
if (typeof pkg.version === "string") version2 = pkg.version;
|
|
19968
|
+
} catch {
|
|
19969
|
+
version2 = readPackageVersionNearEntry(entry, name);
|
|
19970
|
+
}
|
|
19971
|
+
return { ok: true, version: version2, entry };
|
|
20688
19972
|
} catch {
|
|
20689
19973
|
return { ok: false };
|
|
20690
19974
|
}
|
|
20691
19975
|
}
|
|
20692
19976
|
function importSmoke(cwd) {
|
|
20693
19977
|
const results = [];
|
|
20694
|
-
const
|
|
20695
|
-
|
|
20696
|
-
require2.resolve("agent-inspect");
|
|
19978
|
+
const resolved = resolveInstalledPackage(cwd, "agent-inspect");
|
|
19979
|
+
if (resolved.ok) {
|
|
20697
19980
|
results.push({
|
|
20698
19981
|
id: "import-agent-inspect",
|
|
20699
19982
|
status: "pass",
|
|
20700
|
-
message: "agent-inspect resolves from the current project."
|
|
19983
|
+
message: "agent-inspect resolves from the current project.",
|
|
19984
|
+
evidence: resolved.entry
|
|
20701
19985
|
});
|
|
20702
|
-
|
|
19986
|
+
results.push({
|
|
19987
|
+
id: "import-agent-inspect-cjs",
|
|
19988
|
+
status: "pass",
|
|
19989
|
+
message: "CJS resolution for agent-inspect succeeded.",
|
|
19990
|
+
evidence: resolved.entry
|
|
19991
|
+
});
|
|
19992
|
+
} else {
|
|
20703
19993
|
results.push({
|
|
20704
19994
|
id: "import-agent-inspect",
|
|
20705
19995
|
status: "warn",
|
|
20706
19996
|
message: "agent-inspect is not installed in the current project.",
|
|
20707
19997
|
remediation: "Run npm install agent-inspect (or pnpm add agent-inspect)."
|
|
20708
19998
|
});
|
|
20709
|
-
}
|
|
20710
|
-
try {
|
|
20711
|
-
require2.resolve("agent-inspect/package.json");
|
|
20712
|
-
results.push({
|
|
20713
|
-
id: "import-agent-inspect-cjs",
|
|
20714
|
-
status: "pass",
|
|
20715
|
-
message: "CJS resolution for agent-inspect succeeded."
|
|
20716
|
-
});
|
|
20717
|
-
} catch {
|
|
20718
19999
|
results.push({
|
|
20719
20000
|
id: "import-agent-inspect-cjs",
|
|
20720
20001
|
status: "skipped",
|
|
@@ -20732,7 +20013,7 @@ function optionalPackageChecks(cwd, framework) {
|
|
|
20732
20013
|
"@agent-inspect/eval"
|
|
20733
20014
|
];
|
|
20734
20015
|
return packages.map((name) => {
|
|
20735
|
-
const resolved =
|
|
20016
|
+
const resolved = resolveInstalledPackage(cwd, name);
|
|
20736
20017
|
if (!resolved.ok) {
|
|
20737
20018
|
return {
|
|
20738
20019
|
id: `optional-package-${name}`,
|
|
@@ -20750,7 +20031,7 @@ function optionalPackageChecks(cwd, framework) {
|
|
|
20750
20031
|
});
|
|
20751
20032
|
}
|
|
20752
20033
|
function versionMismatchCheck(cwd) {
|
|
20753
|
-
const root =
|
|
20034
|
+
const root = resolveInstalledPackage(cwd, "agent-inspect");
|
|
20754
20035
|
if (!root.ok || root.version === void 0) {
|
|
20755
20036
|
return {
|
|
20756
20037
|
id: "version-alignment",
|
|
@@ -22112,11 +21393,17 @@ function createCliProgram() {
|
|
|
22112
21393
|
"openinference",
|
|
22113
21394
|
"otlp-json"
|
|
22114
21395
|
])
|
|
22115
|
-
).option("-o, --output <path>", "write export to file (creates parent dirs)").option("--json", "emit JSON wrapper about the export (includes content when writing to stdout)").option("--validate", "validate exported payload shape after generation").option("--include-attributes", "include bounded attributes (review before sharing)").option("--no-metadata", "omit summary / metadata sections").option("--no-errors", "omit error sections").addOption(
|
|
21396
|
+
).option("-o, --output <path>", "write export to file (creates parent dirs)").option("--out <path>", "alias for --output").option("--json", "emit JSON wrapper about the export (includes content when writing to stdout)").option("--validate", "validate exported payload shape after generation").option("--include-attributes", "include bounded attributes (review before sharing)").option("--no-metadata", "omit summary / metadata sections").option("--no-errors", "omit error sections").addOption(
|
|
22116
21397
|
new commander.Option(
|
|
22117
21398
|
"--redaction-profile <profile>",
|
|
22118
21399
|
"redaction profile for exported copies: local, share, strict (default: local)"
|
|
22119
21400
|
).choices(["local", "share", "strict"])
|
|
21401
|
+
).addOption(
|
|
21402
|
+
new commander.Option("--profile <profile>", "alias for --redaction-profile").choices([
|
|
21403
|
+
"local",
|
|
21404
|
+
"share",
|
|
21405
|
+
"strict"
|
|
21406
|
+
])
|
|
22120
21407
|
).action((runId, opts) => {
|
|
22121
21408
|
runCommand(() => exportCommand(runId, opts));
|
|
22122
21409
|
});
|
|
@@ -22252,7 +21539,12 @@ function createCliProgram() {
|
|
|
22252
21539
|
});
|
|
22253
21540
|
program.command("bundle").description("Create a share-safe offline trace bundle (local folder)").argument("[run-id]", "run id to bundle (optional with --session or --since)").option("--dir <path>", "trace directory for run/session lookup").option("--session <session-id>", "bundle all runs in a session").option("--since <duration>", "bundle runs with activity since a duration (e.g. 24h)").addOption(
|
|
22254
21541
|
new commander.Option("--profile <profile>", "redaction profile for exported copies").choices(["local", "share", "strict"]).default("share")
|
|
22255
|
-
).
|
|
21542
|
+
).addOption(
|
|
21543
|
+
new commander.Option(
|
|
21544
|
+
"--redaction-profile <profile>",
|
|
21545
|
+
"alias for --profile (canonical spelling)"
|
|
21546
|
+
).choices(["local", "share", "strict"])
|
|
21547
|
+
).option("--out <path>", "output directory (folder; .zip suffix is stripped)").option("--output <path>", "alias for --out (canonical spelling)").option("--allow-unsafe", "write bundle even when verify-safe reports UNSAFE").option("--json", "print deterministic JSON manifest").action((runId, opts) => {
|
|
22256
21548
|
runCommand(() => bundleCommand(runId, opts));
|
|
22257
21549
|
});
|
|
22258
21550
|
program.command("ci-summary").description("Summarize local reporter artifact manifests for CI").argument("<manifest...>", "reporter artifact manifest JSON files").option("-o, --output <path>", "write Markdown summary to a local file").option("--github-summary <path>", "append Markdown summary to this local file, e.g. GITHUB_STEP_SUMMARY").option("--json", "print deterministic JSON summary").action((manifest, opts) => {
|
|
@@ -22345,7 +21637,7 @@ function createCliProgram() {
|
|
|
22345
21637
|
"markdown",
|
|
22346
21638
|
"html"
|
|
22347
21639
|
])
|
|
22348
|
-
).option("-o, --output <path>", "write report to file (creates parent dirs)").option("--json", "emit JSON wrapper (includes content when writing to stdout)").option("--include-attributes", "include bounded step attributes in tree section").option("--no-errors", "omit error details from tree section").option("--no-correlation", "omit correlation metadata from what section").addOption(
|
|
21640
|
+
).option("-o, --output <path>", "write report to file (creates parent dirs)").option("--out <path>", "alias for --output").option("--json", "emit JSON wrapper (includes content when writing to stdout)").option("--include-attributes", "include bounded step attributes in tree section").option("--no-errors", "omit error details from tree section").option("--no-correlation", "omit correlation metadata from what section").addOption(
|
|
22349
21641
|
new commander.Option("--section <section>", "report section (default: all)").choices([
|
|
22350
21642
|
"all",
|
|
22351
21643
|
"observations",
|
|
@@ -22358,6 +21650,12 @@ function createCliProgram() {
|
|
|
22358
21650
|
"--redaction-profile <profile>",
|
|
22359
21651
|
"redaction profile for entire report: local, share, strict (default: local)"
|
|
22360
21652
|
).choices(["local", "share", "strict"])
|
|
21653
|
+
).addOption(
|
|
21654
|
+
new commander.Option("--profile <profile>", "alias for --redaction-profile").choices([
|
|
21655
|
+
"local",
|
|
21656
|
+
"share",
|
|
21657
|
+
"strict"
|
|
21658
|
+
])
|
|
22361
21659
|
).action((runId, opts) => {
|
|
22362
21660
|
runCommand(() => reportCommand(runId, opts));
|
|
22363
21661
|
});
|
|
@@ -22366,7 +21664,12 @@ function createCliProgram() {
|
|
|
22366
21664
|
"--profile <profile>",
|
|
22367
21665
|
"redaction profile: local, share, strict (default: share)"
|
|
22368
21666
|
).choices(["local", "share", "strict"])
|
|
22369
|
-
).
|
|
21667
|
+
).addOption(
|
|
21668
|
+
new commander.Option(
|
|
21669
|
+
"--redaction-profile <profile>",
|
|
21670
|
+
"alias for --profile (canonical spelling)"
|
|
21671
|
+
).choices(["local", "share", "strict"])
|
|
21672
|
+
).option("-o, --output <path>", "write redacted content to a file").option("--out <path>", "alias for --output").option("--json", "print deterministic JSON wrapper with findings").action((target, opts) => {
|
|
22370
21673
|
runCommand(() => redactCommand(target, opts));
|
|
22371
21674
|
});
|
|
22372
21675
|
program.command("explain").description("Explain a local trace with deterministic facts (no provider calls)").argument("<trace-path-or-run-id>", "trace file, directory, stdin -, or run id").option("--dir <path>", "trace directory for run-id lookup").addOption(
|
|
@@ -22383,6 +21686,12 @@ function createCliProgram() {
|
|
|
22383
21686
|
"--redaction-profile <profile>",
|
|
22384
21687
|
"redaction profile for explanation payload: local, share, strict (default: local)"
|
|
22385
21688
|
).choices(["local", "share", "strict"])
|
|
21689
|
+
).addOption(
|
|
21690
|
+
new commander.Option("--profile <profile>", "alias for --redaction-profile").choices([
|
|
21691
|
+
"local",
|
|
21692
|
+
"share",
|
|
21693
|
+
"strict"
|
|
21694
|
+
])
|
|
22386
21695
|
).action((target, opts) => {
|
|
22387
21696
|
runCommand(() => explainCommand(target, opts));
|
|
22388
21697
|
});
|