aiden-runtime 3.19.4 → 3.19.5
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/config/devos.config.backup.json +224 -224
- package/config/devos.config.json +1 -1
- package/dist/api/server.js +7 -1
- package/dist/core/agentLoop.js +8 -3
- package/dist/core/slashAsTool.js +2 -0
- package/dist/core/toolRegistry.js +16 -0
- package/dist/core/version.js +1 -1
- package/dist/providers/router.js +46 -6
- package/dist-bundle/cli.js +909 -557
- package/dist-bundle/index.js +756 -658
- package/package.json +267 -266
package/dist-bundle/cli.js
CHANGED
|
@@ -5,10 +5,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __glob = (map2) => (
|
|
9
|
-
var fn = map2[
|
|
8
|
+
var __glob = (map2) => (path54) => {
|
|
9
|
+
var fn = map2[path54];
|
|
10
10
|
if (fn) return fn();
|
|
11
|
-
throw new Error("Module not found in bundle: " +
|
|
11
|
+
throw new Error("Module not found in bundle: " + path54);
|
|
12
12
|
};
|
|
13
13
|
var __esm = (fn, res) => function __init() {
|
|
14
14
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
@@ -208,7 +208,7 @@ var init_updateCheck = __esm({
|
|
|
208
208
|
var VERSION;
|
|
209
209
|
var init_version = __esm({
|
|
210
210
|
"core/version.ts"() {
|
|
211
|
-
VERSION = "3.19.
|
|
211
|
+
VERSION = "3.19.5";
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
214
|
|
|
@@ -1830,7 +1830,7 @@ var require_minimatch = __commonJS({
|
|
|
1830
1830
|
"node_modules/minimatch/minimatch.js"(exports2, module2) {
|
|
1831
1831
|
module2.exports = minimatch3;
|
|
1832
1832
|
minimatch3.Minimatch = Minimatch;
|
|
1833
|
-
var
|
|
1833
|
+
var path54 = (function() {
|
|
1834
1834
|
try {
|
|
1835
1835
|
return require("path");
|
|
1836
1836
|
} catch (e) {
|
|
@@ -1838,7 +1838,7 @@ var require_minimatch = __commonJS({
|
|
|
1838
1838
|
})() || {
|
|
1839
1839
|
sep: "/"
|
|
1840
1840
|
};
|
|
1841
|
-
minimatch3.sep =
|
|
1841
|
+
minimatch3.sep = path54.sep;
|
|
1842
1842
|
var GLOBSTAR = minimatch3.GLOBSTAR = Minimatch.GLOBSTAR = {};
|
|
1843
1843
|
var expand2 = require_brace_expansion();
|
|
1844
1844
|
var plTypes = {
|
|
@@ -1927,8 +1927,8 @@ var require_minimatch = __commonJS({
|
|
|
1927
1927
|
assertValidPattern(pattern);
|
|
1928
1928
|
if (!options) options = {};
|
|
1929
1929
|
pattern = pattern.trim();
|
|
1930
|
-
if (!options.allowWindowsEscape &&
|
|
1931
|
-
pattern = pattern.split(
|
|
1930
|
+
if (!options.allowWindowsEscape && path54.sep !== "/") {
|
|
1931
|
+
pattern = pattern.split(path54.sep).join("/");
|
|
1932
1932
|
}
|
|
1933
1933
|
this.options = options;
|
|
1934
1934
|
this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
|
|
@@ -2299,8 +2299,8 @@ var require_minimatch = __commonJS({
|
|
|
2299
2299
|
if (this.empty) return f === "";
|
|
2300
2300
|
if (f === "/" && partial2) return true;
|
|
2301
2301
|
var options = this.options;
|
|
2302
|
-
if (
|
|
2303
|
-
f = f.split(
|
|
2302
|
+
if (path54.sep !== "/") {
|
|
2303
|
+
f = f.split(path54.sep).join("/");
|
|
2304
2304
|
}
|
|
2305
2305
|
f = f.split(slashSplit);
|
|
2306
2306
|
this.debug(this.pattern, "split", f);
|
|
@@ -3299,14 +3299,14 @@ var require_util = __commonJS({
|
|
|
3299
3299
|
}
|
|
3300
3300
|
const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
|
|
3301
3301
|
let origin2 = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
|
|
3302
|
-
let
|
|
3302
|
+
let path54 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
|
|
3303
3303
|
if (origin2[origin2.length - 1] === "/") {
|
|
3304
3304
|
origin2 = origin2.slice(0, origin2.length - 1);
|
|
3305
3305
|
}
|
|
3306
|
-
if (
|
|
3307
|
-
|
|
3306
|
+
if (path54 && path54[0] !== "/") {
|
|
3307
|
+
path54 = `/${path54}`;
|
|
3308
3308
|
}
|
|
3309
|
-
return new URL(`${origin2}${
|
|
3309
|
+
return new URL(`${origin2}${path54}`);
|
|
3310
3310
|
}
|
|
3311
3311
|
if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
|
|
3312
3312
|
throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -3757,39 +3757,39 @@ var require_diagnostics = __commonJS({
|
|
|
3757
3757
|
});
|
|
3758
3758
|
diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
|
|
3759
3759
|
const {
|
|
3760
|
-
request: { method, path:
|
|
3760
|
+
request: { method, path: path54, origin: origin2 }
|
|
3761
3761
|
} = evt;
|
|
3762
|
-
debuglog("sending request to %s %s/%s", method, origin2,
|
|
3762
|
+
debuglog("sending request to %s %s/%s", method, origin2, path54);
|
|
3763
3763
|
});
|
|
3764
3764
|
diagnosticsChannel.channel("undici:request:headers").subscribe((evt) => {
|
|
3765
3765
|
const {
|
|
3766
|
-
request: { method, path:
|
|
3766
|
+
request: { method, path: path54, origin: origin2 },
|
|
3767
3767
|
response: { statusCode }
|
|
3768
3768
|
} = evt;
|
|
3769
3769
|
debuglog(
|
|
3770
3770
|
"received response to %s %s/%s - HTTP %d",
|
|
3771
3771
|
method,
|
|
3772
3772
|
origin2,
|
|
3773
|
-
|
|
3773
|
+
path54,
|
|
3774
3774
|
statusCode
|
|
3775
3775
|
);
|
|
3776
3776
|
});
|
|
3777
3777
|
diagnosticsChannel.channel("undici:request:trailers").subscribe((evt) => {
|
|
3778
3778
|
const {
|
|
3779
|
-
request: { method, path:
|
|
3779
|
+
request: { method, path: path54, origin: origin2 }
|
|
3780
3780
|
} = evt;
|
|
3781
|
-
debuglog("trailers received from %s %s/%s", method, origin2,
|
|
3781
|
+
debuglog("trailers received from %s %s/%s", method, origin2, path54);
|
|
3782
3782
|
});
|
|
3783
3783
|
diagnosticsChannel.channel("undici:request:error").subscribe((evt) => {
|
|
3784
3784
|
const {
|
|
3785
|
-
request: { method, path:
|
|
3785
|
+
request: { method, path: path54, origin: origin2 },
|
|
3786
3786
|
error: error2
|
|
3787
3787
|
} = evt;
|
|
3788
3788
|
debuglog(
|
|
3789
3789
|
"request to %s %s/%s errored - %s",
|
|
3790
3790
|
method,
|
|
3791
3791
|
origin2,
|
|
3792
|
-
|
|
3792
|
+
path54,
|
|
3793
3793
|
error2.message
|
|
3794
3794
|
);
|
|
3795
3795
|
});
|
|
@@ -3838,9 +3838,9 @@ var require_diagnostics = __commonJS({
|
|
|
3838
3838
|
});
|
|
3839
3839
|
diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
|
|
3840
3840
|
const {
|
|
3841
|
-
request: { method, path:
|
|
3841
|
+
request: { method, path: path54, origin: origin2 }
|
|
3842
3842
|
} = evt;
|
|
3843
|
-
debuglog("sending request to %s %s/%s", method, origin2,
|
|
3843
|
+
debuglog("sending request to %s %s/%s", method, origin2, path54);
|
|
3844
3844
|
});
|
|
3845
3845
|
}
|
|
3846
3846
|
diagnosticsChannel.channel("undici:websocket:open").subscribe((evt) => {
|
|
@@ -3903,7 +3903,7 @@ var require_request = __commonJS({
|
|
|
3903
3903
|
var kHandler = /* @__PURE__ */ Symbol("handler");
|
|
3904
3904
|
var Request = class {
|
|
3905
3905
|
constructor(origin2, {
|
|
3906
|
-
path:
|
|
3906
|
+
path: path54,
|
|
3907
3907
|
method,
|
|
3908
3908
|
body,
|
|
3909
3909
|
headers,
|
|
@@ -3918,11 +3918,11 @@ var require_request = __commonJS({
|
|
|
3918
3918
|
expectContinue,
|
|
3919
3919
|
servername
|
|
3920
3920
|
}, handler) {
|
|
3921
|
-
if (typeof
|
|
3921
|
+
if (typeof path54 !== "string") {
|
|
3922
3922
|
throw new InvalidArgumentError("path must be a string");
|
|
3923
|
-
} else if (
|
|
3923
|
+
} else if (path54[0] !== "/" && !(path54.startsWith("http://") || path54.startsWith("https://")) && method !== "CONNECT") {
|
|
3924
3924
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
|
3925
|
-
} else if (invalidPathRegex.test(
|
|
3925
|
+
} else if (invalidPathRegex.test(path54)) {
|
|
3926
3926
|
throw new InvalidArgumentError("invalid request path");
|
|
3927
3927
|
}
|
|
3928
3928
|
if (typeof method !== "string") {
|
|
@@ -3988,7 +3988,7 @@ var require_request = __commonJS({
|
|
|
3988
3988
|
this.completed = false;
|
|
3989
3989
|
this.aborted = false;
|
|
3990
3990
|
this.upgrade = upgrade || null;
|
|
3991
|
-
this.path = query ? buildURL2(
|
|
3991
|
+
this.path = query ? buildURL2(path54, query) : path54;
|
|
3992
3992
|
this.origin = origin2;
|
|
3993
3993
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
3994
3994
|
this.blocking = blocking == null ? false : blocking;
|
|
@@ -8507,7 +8507,7 @@ var require_client_h1 = __commonJS({
|
|
|
8507
8507
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
8508
8508
|
}
|
|
8509
8509
|
function writeH1(client, request) {
|
|
8510
|
-
const { method, path:
|
|
8510
|
+
const { method, path: path54, host, upgrade, blocking, reset } = request;
|
|
8511
8511
|
let { body, headers, contentLength } = request;
|
|
8512
8512
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
8513
8513
|
if (util3.isFormDataLike(body)) {
|
|
@@ -8573,7 +8573,7 @@ var require_client_h1 = __commonJS({
|
|
|
8573
8573
|
if (blocking) {
|
|
8574
8574
|
socket[kBlocking] = true;
|
|
8575
8575
|
}
|
|
8576
|
-
let header = `${method} ${
|
|
8576
|
+
let header = `${method} ${path54} HTTP/1.1\r
|
|
8577
8577
|
`;
|
|
8578
8578
|
if (typeof host === "string") {
|
|
8579
8579
|
header += `host: ${host}\r
|
|
@@ -9099,7 +9099,7 @@ var require_client_h2 = __commonJS({
|
|
|
9099
9099
|
}
|
|
9100
9100
|
function writeH2(client, request) {
|
|
9101
9101
|
const session = client[kHTTP2Session];
|
|
9102
|
-
const { method, path:
|
|
9102
|
+
const { method, path: path54, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
|
|
9103
9103
|
let { body } = request;
|
|
9104
9104
|
if (upgrade) {
|
|
9105
9105
|
util3.errorRequest(client, request, new Error("Upgrade not supported for H2"));
|
|
@@ -9166,7 +9166,7 @@ var require_client_h2 = __commonJS({
|
|
|
9166
9166
|
});
|
|
9167
9167
|
return true;
|
|
9168
9168
|
}
|
|
9169
|
-
headers[HTTP2_HEADER_PATH] =
|
|
9169
|
+
headers[HTTP2_HEADER_PATH] = path54;
|
|
9170
9170
|
headers[HTTP2_HEADER_SCHEME] = "https";
|
|
9171
9171
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
9172
9172
|
if (body && typeof body.read === "function") {
|
|
@@ -9519,9 +9519,9 @@ var require_redirect_handler = __commonJS({
|
|
|
9519
9519
|
return this.handler.onHeaders(statusCode, headers, resume, statusText);
|
|
9520
9520
|
}
|
|
9521
9521
|
const { origin: origin2, pathname, search } = util3.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
9522
|
-
const
|
|
9522
|
+
const path54 = search ? `${pathname}${search}` : pathname;
|
|
9523
9523
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin2);
|
|
9524
|
-
this.opts.path =
|
|
9524
|
+
this.opts.path = path54;
|
|
9525
9525
|
this.opts.origin = origin2;
|
|
9526
9526
|
this.opts.maxRedirections = 0;
|
|
9527
9527
|
this.opts.query = null;
|
|
@@ -10755,10 +10755,10 @@ var require_proxy_agent = __commonJS({
|
|
|
10755
10755
|
};
|
|
10756
10756
|
const {
|
|
10757
10757
|
origin: origin2,
|
|
10758
|
-
path:
|
|
10758
|
+
path: path54 = "/",
|
|
10759
10759
|
headers = {}
|
|
10760
10760
|
} = opts;
|
|
10761
|
-
opts.path = origin2 +
|
|
10761
|
+
opts.path = origin2 + path54;
|
|
10762
10762
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
10763
10763
|
const { host } = new URL2(origin2);
|
|
10764
10764
|
headers.host = host;
|
|
@@ -12679,20 +12679,20 @@ var require_mock_utils = __commonJS({
|
|
|
12679
12679
|
}
|
|
12680
12680
|
return true;
|
|
12681
12681
|
}
|
|
12682
|
-
function safeUrl(
|
|
12683
|
-
if (typeof
|
|
12684
|
-
return
|
|
12682
|
+
function safeUrl(path54) {
|
|
12683
|
+
if (typeof path54 !== "string") {
|
|
12684
|
+
return path54;
|
|
12685
12685
|
}
|
|
12686
|
-
const pathSegments =
|
|
12686
|
+
const pathSegments = path54.split("?");
|
|
12687
12687
|
if (pathSegments.length !== 2) {
|
|
12688
|
-
return
|
|
12688
|
+
return path54;
|
|
12689
12689
|
}
|
|
12690
12690
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
12691
12691
|
qp.sort();
|
|
12692
12692
|
return [...pathSegments, qp.toString()].join("?");
|
|
12693
12693
|
}
|
|
12694
|
-
function matchKey(mockDispatch2, { path:
|
|
12695
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
12694
|
+
function matchKey(mockDispatch2, { path: path54, method, body, headers }) {
|
|
12695
|
+
const pathMatch = matchValue(mockDispatch2.path, path54);
|
|
12696
12696
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
12697
12697
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
12698
12698
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -12714,7 +12714,7 @@ var require_mock_utils = __commonJS({
|
|
|
12714
12714
|
function getMockDispatch(mockDispatches, key) {
|
|
12715
12715
|
const basePath = key.query ? buildURL2(key.path, key.query) : key.path;
|
|
12716
12716
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
12717
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
12717
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path54 }) => matchValue(safeUrl(path54), resolvedPath));
|
|
12718
12718
|
if (matchedMockDispatches.length === 0) {
|
|
12719
12719
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
12720
12720
|
}
|
|
@@ -12752,9 +12752,9 @@ var require_mock_utils = __commonJS({
|
|
|
12752
12752
|
}
|
|
12753
12753
|
}
|
|
12754
12754
|
function buildKey(opts) {
|
|
12755
|
-
const { path:
|
|
12755
|
+
const { path: path54, method, body, headers, query } = opts;
|
|
12756
12756
|
return {
|
|
12757
|
-
path:
|
|
12757
|
+
path: path54,
|
|
12758
12758
|
method,
|
|
12759
12759
|
body,
|
|
12760
12760
|
headers,
|
|
@@ -13217,10 +13217,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
13217
13217
|
}
|
|
13218
13218
|
format(pendingInterceptors) {
|
|
13219
13219
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
13220
|
-
({ method, path:
|
|
13220
|
+
({ method, path: path54, data: { statusCode }, persist, times, timesInvoked, origin: origin2 }) => ({
|
|
13221
13221
|
Method: method,
|
|
13222
13222
|
Origin: origin2,
|
|
13223
|
-
Path:
|
|
13223
|
+
Path: path54,
|
|
13224
13224
|
"Status code": statusCode,
|
|
13225
13225
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
13226
13226
|
Invocations: timesInvoked,
|
|
@@ -18101,9 +18101,9 @@ var require_util6 = __commonJS({
|
|
|
18101
18101
|
}
|
|
18102
18102
|
}
|
|
18103
18103
|
}
|
|
18104
|
-
function validateCookiePath(
|
|
18105
|
-
for (let i = 0; i <
|
|
18106
|
-
const code =
|
|
18104
|
+
function validateCookiePath(path54) {
|
|
18105
|
+
for (let i = 0; i < path54.length; ++i) {
|
|
18106
|
+
const code = path54.charCodeAt(i);
|
|
18107
18107
|
if (code < 32 || // exclude CTLs (0-31)
|
|
18108
18108
|
code === 127 || // DEL
|
|
18109
18109
|
code === 59) {
|
|
@@ -20743,11 +20743,11 @@ var require_undici = __commonJS({
|
|
|
20743
20743
|
if (typeof opts.path !== "string") {
|
|
20744
20744
|
throw new InvalidArgumentError("invalid opts.path");
|
|
20745
20745
|
}
|
|
20746
|
-
let
|
|
20746
|
+
let path54 = opts.path;
|
|
20747
20747
|
if (!opts.path.startsWith("/")) {
|
|
20748
|
-
|
|
20748
|
+
path54 = `/${path54}`;
|
|
20749
20749
|
}
|
|
20750
|
-
url2 = new URL(util3.parseOrigin(url2).origin +
|
|
20750
|
+
url2 = new URL(util3.parseOrigin(url2).origin + path54);
|
|
20751
20751
|
} else {
|
|
20752
20752
|
if (!opts) {
|
|
20753
20753
|
opts = typeof url2 === "object" ? url2 : {};
|
|
@@ -26379,6 +26379,7 @@ var init_modelRegistry = __esm({
|
|
|
26379
26379
|
var router_exports = {};
|
|
26380
26380
|
__export(router_exports, {
|
|
26381
26381
|
assessComplexity: () => assessComplexity,
|
|
26382
|
+
diagnoseProviderPool: () => diagnoseProviderPool,
|
|
26382
26383
|
enterDegradedMode: () => enterDegradedMode,
|
|
26383
26384
|
exitDegradedMode: () => exitDegradedMode,
|
|
26384
26385
|
getLocalModels: () => getLocalModels,
|
|
@@ -26493,6 +26494,51 @@ function autoResetExpiredLimits() {
|
|
|
26493
26494
|
if (changed) saveConfig(config2);
|
|
26494
26495
|
return changed;
|
|
26495
26496
|
}
|
|
26497
|
+
function diagnoseProviderPool() {
|
|
26498
|
+
const config2 = loadConfig();
|
|
26499
|
+
const allApis = mergeCustomProviders(config2.providers.apis);
|
|
26500
|
+
const enabled = allApis.filter((a) => a.enabled);
|
|
26501
|
+
const disabledCount = allApis.length - enabled.length;
|
|
26502
|
+
let noKey = 0, rateLimited = 0;
|
|
26503
|
+
for (const a of enabled) {
|
|
26504
|
+
if (a.rateLimited) {
|
|
26505
|
+
rateLimited++;
|
|
26506
|
+
continue;
|
|
26507
|
+
}
|
|
26508
|
+
if (a.provider === "custom") continue;
|
|
26509
|
+
const k = a.key.startsWith("env:") ? process.env[a.key.replace("env:", "")] || "" : a.key;
|
|
26510
|
+
if (k.length === 0) noKey++;
|
|
26511
|
+
}
|
|
26512
|
+
const active = enabled.length - noKey - rateLimited;
|
|
26513
|
+
if (active > 0)
|
|
26514
|
+
return { state: "ok", noKeyCount: noKey, rateLimitedCount: rateLimited, disabledCount, enabledCount: enabled.length, message: "" };
|
|
26515
|
+
if (noKey > 0 && rateLimited === 0)
|
|
26516
|
+
return {
|
|
26517
|
+
state: "unconfigured",
|
|
26518
|
+
noKeyCount: noKey,
|
|
26519
|
+
rateLimitedCount: 0,
|
|
26520
|
+
disabledCount,
|
|
26521
|
+
enabledCount: enabled.length,
|
|
26522
|
+
message: "No API keys configured - add keys in Settings > API Keys or set env vars"
|
|
26523
|
+
};
|
|
26524
|
+
if (rateLimited > 0 && noKey === 0)
|
|
26525
|
+
return {
|
|
26526
|
+
state: "rate-limited",
|
|
26527
|
+
noKeyCount: 0,
|
|
26528
|
+
rateLimitedCount: rateLimited,
|
|
26529
|
+
disabledCount,
|
|
26530
|
+
enabledCount: enabled.length,
|
|
26531
|
+
message: `All ${rateLimited} cloud provider(s) rate-limited - retrying automatically`
|
|
26532
|
+
};
|
|
26533
|
+
return {
|
|
26534
|
+
state: "mixed",
|
|
26535
|
+
noKeyCount: noKey,
|
|
26536
|
+
rateLimitedCount: rateLimited,
|
|
26537
|
+
disabledCount,
|
|
26538
|
+
enabledCount: enabled.length,
|
|
26539
|
+
message: `${noKey} provider(s) have no key, ${rateLimited} rate-limited`
|
|
26540
|
+
};
|
|
26541
|
+
}
|
|
26496
26542
|
function getNextAvailableAPI() {
|
|
26497
26543
|
autoResetExpiredLimits();
|
|
26498
26544
|
const config2 = loadConfig();
|
|
@@ -26503,7 +26549,11 @@ function getNextAvailableAPI() {
|
|
|
26503
26549
|
const resolvedKey = api.key.startsWith("env:") ? process.env[api.key.replace("env:", "")] || "" : api.key;
|
|
26504
26550
|
return resolvedKey.length > 0;
|
|
26505
26551
|
});
|
|
26506
|
-
if (!available.length)
|
|
26552
|
+
if (!available.length) {
|
|
26553
|
+
const diag = diagnoseProviderPool();
|
|
26554
|
+
if (diag.message) console.log(`[Router] ${diag.message}`);
|
|
26555
|
+
return null;
|
|
26556
|
+
}
|
|
26507
26557
|
const primary = config2.primaryProvider;
|
|
26508
26558
|
const scored = available.map((api) => {
|
|
26509
26559
|
const avgMs = responseTimesMs.get(api.name) ?? 2e3;
|
|
@@ -26656,7 +26706,8 @@ function getModelForTask(task, message) {
|
|
|
26656
26706
|
return resolveKey(chosen);
|
|
26657
26707
|
}
|
|
26658
26708
|
const model = getOllamaModelForTask(task === "planner" ? "planner" : "responder");
|
|
26659
|
-
|
|
26709
|
+
const diag = diagnoseProviderPool();
|
|
26710
|
+
console.log(`[Router] ${task}: ${diag.message || "all cloud providers unavailable"} - using Ollama ${model}`);
|
|
26660
26711
|
return { apiKey: "", model, providerName: "ollama", apiName: "ollama" };
|
|
26661
26712
|
}
|
|
26662
26713
|
if (task === "executor") {
|
|
@@ -26665,7 +26716,8 @@ function getModelForTask(task, message) {
|
|
|
26665
26716
|
if (api) return resolveKey(api);
|
|
26666
26717
|
}
|
|
26667
26718
|
const model = getOllamaModelForTask("executor");
|
|
26668
|
-
|
|
26719
|
+
const diag = diagnoseProviderPool();
|
|
26720
|
+
console.log(`[Router] Executor: ${diag.message || "all cloud providers unavailable"} - falling back to Ollama ${model}`);
|
|
26669
26721
|
return { apiKey: "", model, providerName: "ollama", apiName: "ollama" };
|
|
26670
26722
|
}
|
|
26671
26723
|
if (available.length > 0) return resolveKey(available[0]);
|
|
@@ -26689,7 +26741,8 @@ function getSmartProvider() {
|
|
|
26689
26741
|
}
|
|
26690
26742
|
if (config2.routing?.fallbackToOllama !== false) {
|
|
26691
26743
|
const model2 = getOllamaModelForTask("responder");
|
|
26692
|
-
|
|
26744
|
+
const diag = diagnoseProviderPool();
|
|
26745
|
+
console.log(`[Router] ${diag.message || "All APIs unavailable"} - falling back to Ollama ${model2}`);
|
|
26693
26746
|
return { provider: ollamaProvider, model: model2, userName, apiName: "ollama" };
|
|
26694
26747
|
}
|
|
26695
26748
|
const model = getOllamaModelForTask("responder");
|
|
@@ -26731,7 +26784,7 @@ function enterDegradedMode(reason) {
|
|
|
26731
26784
|
}
|
|
26732
26785
|
return {
|
|
26733
26786
|
mode: "degraded",
|
|
26734
|
-
message: `I'm temporarily running in limited mode \u2014 my AI providers are at capacity. I can still:
|
|
26787
|
+
message: `I'm temporarily running in limited mode \u2014 ${diagnoseProviderPool().state === "unconfigured" ? "no API keys are configured" : "my AI providers are at capacity"}. I can still:
|
|
26735
26788
|
\u2022 Search your files and memory
|
|
26736
26789
|
\u2022 Run scheduled tasks
|
|
26737
26790
|
\u2022 Execute shell commands and scripts
|
|
@@ -38083,11 +38136,11 @@ var require_pdf_worker = __commonJS({
|
|
|
38083
38136
|
var nameTree = new NameTree(nameTreeRef, xref);
|
|
38084
38137
|
var names = nameTree.getAll();
|
|
38085
38138
|
for (var name in names) {
|
|
38086
|
-
var
|
|
38139
|
+
var fs50 = new FileSpec(names[name], xref);
|
|
38087
38140
|
if (!attachments) {
|
|
38088
38141
|
attachments = /* @__PURE__ */ Object.create(null);
|
|
38089
38142
|
}
|
|
38090
|
-
attachments[(0, _util.stringToPDFString)(name)] =
|
|
38143
|
+
attachments[(0, _util.stringToPDFString)(name)] = fs50.serializable;
|
|
38091
38144
|
}
|
|
38092
38145
|
}
|
|
38093
38146
|
return (0, _util.shadow)(this, "attachments", attachments);
|
|
@@ -43387,8 +43440,8 @@ var require_pdf_worker = __commonJS({
|
|
|
43387
43440
|
if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
|
|
43388
43441
|
var buildPath = function buildPath2(fontChar) {
|
|
43389
43442
|
if (!font.renderer.hasBuiltPath(fontChar)) {
|
|
43390
|
-
var
|
|
43391
|
-
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath",
|
|
43443
|
+
var path54 = font.renderer.getPathJs(fontChar);
|
|
43444
|
+
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath", path54]);
|
|
43392
43445
|
}
|
|
43393
43446
|
};
|
|
43394
43447
|
for (var i = 0, ii = glyphs.length; i < ii; i++) {
|
|
@@ -53110,7 +53163,7 @@ var require_pdf_worker = __commonJS({
|
|
|
53110
53163
|
includes: function includes(searchElement) {
|
|
53111
53164
|
return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : void 0);
|
|
53112
53165
|
},
|
|
53113
|
-
join: function
|
|
53166
|
+
join: function join9(separator) {
|
|
53114
53167
|
return arrayJoin.apply(validate(this), arguments);
|
|
53115
53168
|
},
|
|
53116
53169
|
lastIndexOf: function lastIndexOf(searchElement) {
|
|
@@ -80153,7 +80206,7 @@ var require_pdf = __commonJS({
|
|
|
80153
80206
|
includes: function includes(searchElement) {
|
|
80154
80207
|
return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : void 0);
|
|
80155
80208
|
},
|
|
80156
|
-
join: function
|
|
80209
|
+
join: function join9(separator) {
|
|
80157
80210
|
return arrayJoin.apply(validate(this), arguments);
|
|
80158
80211
|
},
|
|
80159
80212
|
lastIndexOf: function lastIndexOf(searchElement) {
|
|
@@ -86076,10 +86129,10 @@ var require_pdf = __commonJS({
|
|
|
86076
86129
|
ctx.save();
|
|
86077
86130
|
ctx.beginPath();
|
|
86078
86131
|
for (var i = 0; i < paths.length; i++) {
|
|
86079
|
-
var
|
|
86080
|
-
ctx.setTransform.apply(ctx,
|
|
86081
|
-
ctx.translate(
|
|
86082
|
-
|
|
86132
|
+
var path54 = paths[i];
|
|
86133
|
+
ctx.setTransform.apply(ctx, path54.transform);
|
|
86134
|
+
ctx.translate(path54.x, path54.y);
|
|
86135
|
+
path54.addToPath(ctx, path54.fontSize);
|
|
86083
86136
|
}
|
|
86084
86137
|
ctx.restore();
|
|
86085
86138
|
ctx.clip();
|
|
@@ -87939,7 +87992,7 @@ var require_pdf = __commonJS({
|
|
|
87939
87992
|
throw new TypeError("Cannot call a class as a function");
|
|
87940
87993
|
}
|
|
87941
87994
|
}
|
|
87942
|
-
var
|
|
87995
|
+
var fs50 = require("fs");
|
|
87943
87996
|
var http3 = require("http");
|
|
87944
87997
|
var https4 = require("https");
|
|
87945
87998
|
var url2 = require("url");
|
|
@@ -88272,8 +88325,8 @@ var require_pdf = __commonJS({
|
|
|
88272
88325
|
function PDFNodeStreamFsFullReader2(stream4) {
|
|
88273
88326
|
_classCallCheck(this, PDFNodeStreamFsFullReader2);
|
|
88274
88327
|
var _this7 = _possibleConstructorReturn(this, (PDFNodeStreamFsFullReader2.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsFullReader2)).call(this, stream4));
|
|
88275
|
-
var
|
|
88276
|
-
|
|
88328
|
+
var path54 = decodeURI(_this7._url.path);
|
|
88329
|
+
fs50.lstat(path54, function(error2, stat) {
|
|
88277
88330
|
if (error2) {
|
|
88278
88331
|
_this7._errored = true;
|
|
88279
88332
|
_this7._reason = error2;
|
|
@@ -88281,7 +88334,7 @@ var require_pdf = __commonJS({
|
|
|
88281
88334
|
return;
|
|
88282
88335
|
}
|
|
88283
88336
|
_this7._contentLength = stat.size;
|
|
88284
|
-
_this7._setReadableStream(
|
|
88337
|
+
_this7._setReadableStream(fs50.createReadStream(path54));
|
|
88285
88338
|
_this7._headersCapability.resolve();
|
|
88286
88339
|
});
|
|
88287
88340
|
return _this7;
|
|
@@ -88293,7 +88346,7 @@ var require_pdf = __commonJS({
|
|
|
88293
88346
|
function PDFNodeStreamFsRangeReader2(stream4, start, end) {
|
|
88294
88347
|
_classCallCheck(this, PDFNodeStreamFsRangeReader2);
|
|
88295
88348
|
var _this8 = _possibleConstructorReturn(this, (PDFNodeStreamFsRangeReader2.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsRangeReader2)).call(this, stream4));
|
|
88296
|
-
_this8._setReadableStream(
|
|
88349
|
+
_this8._setReadableStream(fs50.createReadStream(decodeURI(_this8._url.path), {
|
|
88297
88350
|
start,
|
|
88298
88351
|
end: end - 1
|
|
88299
88352
|
}));
|
|
@@ -100287,11 +100340,11 @@ var require_pdf_worker2 = __commonJS({
|
|
|
100287
100340
|
var nameTree = new NameTree(nameTreeRef, xref);
|
|
100288
100341
|
var names = nameTree.getAll();
|
|
100289
100342
|
for (var name in names) {
|
|
100290
|
-
var
|
|
100343
|
+
var fs50 = new FileSpec(names[name], xref);
|
|
100291
100344
|
if (!attachments) {
|
|
100292
100345
|
attachments = /* @__PURE__ */ Object.create(null);
|
|
100293
100346
|
}
|
|
100294
|
-
attachments[(0, _util.stringToPDFString)(name)] =
|
|
100347
|
+
attachments[(0, _util.stringToPDFString)(name)] = fs50.serializable;
|
|
100295
100348
|
}
|
|
100296
100349
|
}
|
|
100297
100350
|
return (0, _util.shadow)(this, "attachments", attachments);
|
|
@@ -105591,8 +105644,8 @@ var require_pdf_worker2 = __commonJS({
|
|
|
105591
105644
|
if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
|
|
105592
105645
|
var buildPath = function buildPath2(fontChar) {
|
|
105593
105646
|
if (!font.renderer.hasBuiltPath(fontChar)) {
|
|
105594
|
-
var
|
|
105595
|
-
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath",
|
|
105647
|
+
var path54 = font.renderer.getPathJs(fontChar);
|
|
105648
|
+
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath", path54]);
|
|
105596
105649
|
}
|
|
105597
105650
|
};
|
|
105598
105651
|
for (var i = 0, ii = glyphs.length; i < ii; i++) {
|
|
@@ -115325,7 +115378,7 @@ var require_pdf_worker2 = __commonJS({
|
|
|
115325
115378
|
includes: function includes(searchElement) {
|
|
115326
115379
|
return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : void 0);
|
|
115327
115380
|
},
|
|
115328
|
-
join: function
|
|
115381
|
+
join: function join9(separator) {
|
|
115329
115382
|
return arrayJoin.apply(validate(this), arguments);
|
|
115330
115383
|
},
|
|
115331
115384
|
lastIndexOf: function lastIndexOf(searchElement) {
|
|
@@ -142472,7 +142525,7 @@ var require_pdf2 = __commonJS({
|
|
|
142472
142525
|
includes: function includes(searchElement) {
|
|
142473
142526
|
return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : void 0);
|
|
142474
142527
|
},
|
|
142475
|
-
join: function
|
|
142528
|
+
join: function join9(separator) {
|
|
142476
142529
|
return arrayJoin.apply(validate(this), arguments);
|
|
142477
142530
|
},
|
|
142478
142531
|
lastIndexOf: function lastIndexOf(searchElement) {
|
|
@@ -148388,10 +148441,10 @@ var require_pdf2 = __commonJS({
|
|
|
148388
148441
|
ctx.save();
|
|
148389
148442
|
ctx.beginPath();
|
|
148390
148443
|
for (var i = 0; i < paths.length; i++) {
|
|
148391
|
-
var
|
|
148392
|
-
ctx.setTransform.apply(ctx,
|
|
148393
|
-
ctx.translate(
|
|
148394
|
-
|
|
148444
|
+
var path54 = paths[i];
|
|
148445
|
+
ctx.setTransform.apply(ctx, path54.transform);
|
|
148446
|
+
ctx.translate(path54.x, path54.y);
|
|
148447
|
+
path54.addToPath(ctx, path54.fontSize);
|
|
148395
148448
|
}
|
|
148396
148449
|
ctx.restore();
|
|
148397
148450
|
ctx.clip();
|
|
@@ -149775,7 +149828,7 @@ var require_pdf2 = __commonJS({
|
|
|
149775
149828
|
throw new TypeError("Cannot call a class as a function");
|
|
149776
149829
|
}
|
|
149777
149830
|
}
|
|
149778
|
-
var
|
|
149831
|
+
var fs50 = require("fs");
|
|
149779
149832
|
var http3 = require("http");
|
|
149780
149833
|
var https4 = require("https");
|
|
149781
149834
|
var url2 = require("url");
|
|
@@ -150108,8 +150161,8 @@ var require_pdf2 = __commonJS({
|
|
|
150108
150161
|
function PDFNodeStreamFsFullReader2(stream4) {
|
|
150109
150162
|
_classCallCheck(this, PDFNodeStreamFsFullReader2);
|
|
150110
150163
|
var _this7 = _possibleConstructorReturn(this, (PDFNodeStreamFsFullReader2.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsFullReader2)).call(this, stream4));
|
|
150111
|
-
var
|
|
150112
|
-
|
|
150164
|
+
var path54 = decodeURI(_this7._url.path);
|
|
150165
|
+
fs50.lstat(path54, function(error2, stat) {
|
|
150113
150166
|
if (error2) {
|
|
150114
150167
|
_this7._errored = true;
|
|
150115
150168
|
_this7._reason = error2;
|
|
@@ -150117,7 +150170,7 @@ var require_pdf2 = __commonJS({
|
|
|
150117
150170
|
return;
|
|
150118
150171
|
}
|
|
150119
150172
|
_this7._contentLength = stat.size;
|
|
150120
|
-
_this7._setReadableStream(
|
|
150173
|
+
_this7._setReadableStream(fs50.createReadStream(path54));
|
|
150121
150174
|
_this7._headersCapability.resolve();
|
|
150122
150175
|
});
|
|
150123
150176
|
return _this7;
|
|
@@ -150129,7 +150182,7 @@ var require_pdf2 = __commonJS({
|
|
|
150129
150182
|
function PDFNodeStreamFsRangeReader2(stream4, start, end) {
|
|
150130
150183
|
_classCallCheck(this, PDFNodeStreamFsRangeReader2);
|
|
150131
150184
|
var _this8 = _possibleConstructorReturn(this, (PDFNodeStreamFsRangeReader2.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsRangeReader2)).call(this, stream4));
|
|
150132
|
-
_this8._setReadableStream(
|
|
150185
|
+
_this8._setReadableStream(fs50.createReadStream(decodeURI(_this8._url.path), {
|
|
150133
150186
|
start,
|
|
150134
150187
|
end: end - 1
|
|
150135
150188
|
}));
|
|
@@ -167694,8 +167747,8 @@ var require_pdf_worker3 = __commonJS({
|
|
|
167694
167747
|
if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
|
|
167695
167748
|
var buildPath = function buildPath2(fontChar) {
|
|
167696
167749
|
if (!font.renderer.hasBuiltPath(fontChar)) {
|
|
167697
|
-
var
|
|
167698
|
-
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath",
|
|
167750
|
+
var path54 = font.renderer.getPathJs(fontChar);
|
|
167751
|
+
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath", path54]);
|
|
167699
167752
|
}
|
|
167700
167753
|
};
|
|
167701
167754
|
for (var i = 0, ii = glyphs.length; i < ii; i++) {
|
|
@@ -172513,11 +172566,11 @@ var require_pdf_worker3 = __commonJS({
|
|
|
172513
172566
|
var nameTree = new NameTree(nameTreeRef, xref);
|
|
172514
172567
|
var names = nameTree.getAll();
|
|
172515
172568
|
for (var name in names) {
|
|
172516
|
-
var
|
|
172569
|
+
var fs50 = new FileSpec(names[name], xref);
|
|
172517
172570
|
if (!attachments) {
|
|
172518
172571
|
attachments = /* @__PURE__ */ Object.create(null);
|
|
172519
172572
|
}
|
|
172520
|
-
attachments[(0, _util.stringToPDFString)(name)] =
|
|
172573
|
+
attachments[(0, _util.stringToPDFString)(name)] = fs50.serializable;
|
|
172521
172574
|
}
|
|
172522
172575
|
}
|
|
172523
172576
|
return (0, _util.shadow)(this, "attachments", attachments);
|
|
@@ -202150,10 +202203,10 @@ var require_pdf3 = __commonJS({
|
|
|
202150
202203
|
ctx.save();
|
|
202151
202204
|
ctx.beginPath();
|
|
202152
202205
|
for (var i = 0; i < paths.length; i++) {
|
|
202153
|
-
var
|
|
202154
|
-
ctx.setTransform.apply(ctx,
|
|
202155
|
-
ctx.translate(
|
|
202156
|
-
|
|
202206
|
+
var path54 = paths[i];
|
|
202207
|
+
ctx.setTransform.apply(ctx, path54.transform);
|
|
202208
|
+
ctx.translate(path54.x, path54.y);
|
|
202209
|
+
path54.addToPath(ctx, path54.fontSize);
|
|
202157
202210
|
}
|
|
202158
202211
|
ctx.restore();
|
|
202159
202212
|
ctx.clip();
|
|
@@ -214398,11 +214451,11 @@ var require_pdf_worker4 = __commonJS({
|
|
|
214398
214451
|
var nameTree = new NameTree(nameTreeRef, xref);
|
|
214399
214452
|
var names = nameTree.getAll();
|
|
214400
214453
|
for (var name in names) {
|
|
214401
|
-
var
|
|
214454
|
+
var fs50 = new FileSpec(names[name], xref);
|
|
214402
214455
|
if (!attachments) {
|
|
214403
214456
|
attachments = /* @__PURE__ */ Object.create(null);
|
|
214404
214457
|
}
|
|
214405
|
-
attachments[(0, _util.stringToPDFString)(name)] =
|
|
214458
|
+
attachments[(0, _util.stringToPDFString)(name)] = fs50.serializable;
|
|
214406
214459
|
}
|
|
214407
214460
|
}
|
|
214408
214461
|
return (0, _util.shadow)(this, "attachments", attachments);
|
|
@@ -227548,8 +227601,8 @@ var require_pdf_worker4 = __commonJS({
|
|
|
227548
227601
|
if (font.data && (isAddToPathSet || this.options.disableFontFace || state2.fillColorSpace.name === "Pattern")) {
|
|
227549
227602
|
var buildPath = function buildPath2(fontChar) {
|
|
227550
227603
|
if (!font.renderer.hasBuiltPath(fontChar)) {
|
|
227551
|
-
var
|
|
227552
|
-
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath",
|
|
227604
|
+
var path54 = font.renderer.getPathJs(fontChar);
|
|
227605
|
+
_this5.handler.send("commonobj", [font.loadedName + "_path_" + fontChar, "FontPath", path54]);
|
|
227553
227606
|
}
|
|
227554
227607
|
};
|
|
227555
227608
|
for (var i = 0, ii = glyphs.length; i < ii; i++) {
|
|
@@ -259513,10 +259566,10 @@ var require_pdf4 = __commonJS({
|
|
|
259513
259566
|
ctx.save();
|
|
259514
259567
|
ctx.beginPath();
|
|
259515
259568
|
for (var i = 0; i < paths.length; i++) {
|
|
259516
|
-
var
|
|
259517
|
-
ctx.setTransform.apply(ctx,
|
|
259518
|
-
ctx.translate(
|
|
259519
|
-
|
|
259569
|
+
var path54 = paths[i];
|
|
259570
|
+
ctx.setTransform.apply(ctx, path54.transform);
|
|
259571
|
+
ctx.translate(path54.x, path54.y);
|
|
259572
|
+
path54.addToPath(ctx, path54.fontSize);
|
|
259520
259573
|
}
|
|
259521
259574
|
ctx.restore();
|
|
259522
259575
|
ctx.clip();
|
|
@@ -264785,7 +264838,7 @@ var require_pdf4 = __commonJS({
|
|
|
264785
264838
|
throw new TypeError("Cannot call a class as a function");
|
|
264786
264839
|
}
|
|
264787
264840
|
}
|
|
264788
|
-
var
|
|
264841
|
+
var fs50 = require("fs");
|
|
264789
264842
|
var http3 = require("http");
|
|
264790
264843
|
var https4 = require("https");
|
|
264791
264844
|
var url2 = require("url");
|
|
@@ -265139,11 +265192,11 @@ var require_pdf4 = __commonJS({
|
|
|
265139
265192
|
function PDFNodeStreamFsFullReader2(stream4) {
|
|
265140
265193
|
_classCallCheck(this, PDFNodeStreamFsFullReader2);
|
|
265141
265194
|
var _this7 = _possibleConstructorReturn(this, (PDFNodeStreamFsFullReader2.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsFullReader2)).call(this, stream4));
|
|
265142
|
-
var
|
|
265195
|
+
var path54 = decodeURIComponent(_this7._url.path);
|
|
265143
265196
|
if (fileUriRegex.test(_this7._url.href)) {
|
|
265144
|
-
|
|
265197
|
+
path54 = path54.replace(/^\//, "");
|
|
265145
265198
|
}
|
|
265146
|
-
|
|
265199
|
+
fs50.lstat(path54, function(error2, stat) {
|
|
265147
265200
|
if (error2) {
|
|
265148
265201
|
_this7._errored = true;
|
|
265149
265202
|
_this7._reason = error2;
|
|
@@ -265151,7 +265204,7 @@ var require_pdf4 = __commonJS({
|
|
|
265151
265204
|
return;
|
|
265152
265205
|
}
|
|
265153
265206
|
_this7._contentLength = stat.size;
|
|
265154
|
-
_this7._setReadableStream(
|
|
265207
|
+
_this7._setReadableStream(fs50.createReadStream(path54));
|
|
265155
265208
|
_this7._headersCapability.resolve();
|
|
265156
265209
|
});
|
|
265157
265210
|
return _this7;
|
|
@@ -265163,11 +265216,11 @@ var require_pdf4 = __commonJS({
|
|
|
265163
265216
|
function PDFNodeStreamFsRangeReader2(stream4, start, end) {
|
|
265164
265217
|
_classCallCheck(this, PDFNodeStreamFsRangeReader2);
|
|
265165
265218
|
var _this8 = _possibleConstructorReturn(this, (PDFNodeStreamFsRangeReader2.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsRangeReader2)).call(this, stream4));
|
|
265166
|
-
var
|
|
265219
|
+
var path54 = decodeURIComponent(_this8._url.path);
|
|
265167
265220
|
if (fileUriRegex.test(_this8._url.href)) {
|
|
265168
|
-
|
|
265221
|
+
path54 = path54.replace(/^\//, "");
|
|
265169
265222
|
}
|
|
265170
|
-
_this8._setReadableStream(
|
|
265223
|
+
_this8._setReadableStream(fs50.createReadStream(path54, {
|
|
265171
265224
|
start,
|
|
265172
265225
|
end: end - 1
|
|
265173
265226
|
}));
|
|
@@ -266701,13 +266754,13 @@ function __disposeResources(env2) {
|
|
|
266701
266754
|
}
|
|
266702
266755
|
return next();
|
|
266703
266756
|
}
|
|
266704
|
-
function __rewriteRelativeImportExtension(
|
|
266705
|
-
if (typeof
|
|
266706
|
-
return
|
|
266757
|
+
function __rewriteRelativeImportExtension(path54, preserveJsx) {
|
|
266758
|
+
if (typeof path54 === "string" && /^\.\.?\//.test(path54)) {
|
|
266759
|
+
return path54.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
|
|
266707
266760
|
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js";
|
|
266708
266761
|
});
|
|
266709
266762
|
}
|
|
266710
|
-
return
|
|
266763
|
+
return path54;
|
|
266711
266764
|
}
|
|
266712
266765
|
var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
|
|
266713
266766
|
var init_tslib_es6 = __esm({
|
|
@@ -272392,7 +272445,7 @@ var require_utils2 = __commonJS({
|
|
|
272392
272445
|
module2.exports = Utils;
|
|
272393
272446
|
Utils.prototype.makeDir = function(folder) {
|
|
272394
272447
|
const self2 = this;
|
|
272395
|
-
function
|
|
272448
|
+
function mkdirSync8(fpath) {
|
|
272396
272449
|
let resolvedPath = fpath.split(self2.sep)[0];
|
|
272397
272450
|
fpath.split(self2.sep).forEach(function(name) {
|
|
272398
272451
|
if (!name || name.substr(-1, 1) === ":") return;
|
|
@@ -272410,27 +272463,27 @@ var require_utils2 = __commonJS({
|
|
|
272410
272463
|
if (stat && stat.isFile()) throw Errors.FILE_IN_THE_WAY(`"${resolvedPath}"`);
|
|
272411
272464
|
});
|
|
272412
272465
|
}
|
|
272413
|
-
|
|
272466
|
+
mkdirSync8(folder);
|
|
272414
272467
|
};
|
|
272415
|
-
Utils.prototype.writeFileTo = function(
|
|
272468
|
+
Utils.prototype.writeFileTo = function(path54, content, overwrite, attr) {
|
|
272416
272469
|
const self2 = this;
|
|
272417
|
-
if (self2.fs.existsSync(
|
|
272470
|
+
if (self2.fs.existsSync(path54)) {
|
|
272418
272471
|
if (!overwrite) return false;
|
|
272419
|
-
var stat = self2.fs.statSync(
|
|
272472
|
+
var stat = self2.fs.statSync(path54);
|
|
272420
272473
|
if (stat.isDirectory()) {
|
|
272421
272474
|
return false;
|
|
272422
272475
|
}
|
|
272423
272476
|
}
|
|
272424
|
-
var folder = pth.dirname(
|
|
272477
|
+
var folder = pth.dirname(path54);
|
|
272425
272478
|
if (!self2.fs.existsSync(folder)) {
|
|
272426
272479
|
self2.makeDir(folder);
|
|
272427
272480
|
}
|
|
272428
272481
|
var fd;
|
|
272429
272482
|
try {
|
|
272430
|
-
fd = self2.fs.openSync(
|
|
272483
|
+
fd = self2.fs.openSync(path54, "w", 438);
|
|
272431
272484
|
} catch (e) {
|
|
272432
|
-
self2.fs.chmodSync(
|
|
272433
|
-
fd = self2.fs.openSync(
|
|
272485
|
+
self2.fs.chmodSync(path54, 438);
|
|
272486
|
+
fd = self2.fs.openSync(path54, "w", 438);
|
|
272434
272487
|
}
|
|
272435
272488
|
if (fd) {
|
|
272436
272489
|
try {
|
|
@@ -272439,31 +272492,31 @@ var require_utils2 = __commonJS({
|
|
|
272439
272492
|
self2.fs.closeSync(fd);
|
|
272440
272493
|
}
|
|
272441
272494
|
}
|
|
272442
|
-
self2.fs.chmodSync(
|
|
272495
|
+
self2.fs.chmodSync(path54, attr || 438);
|
|
272443
272496
|
return true;
|
|
272444
272497
|
};
|
|
272445
|
-
Utils.prototype.writeFileToAsync = function(
|
|
272498
|
+
Utils.prototype.writeFileToAsync = function(path54, content, overwrite, attr, callback) {
|
|
272446
272499
|
if (typeof attr === "function") {
|
|
272447
272500
|
callback = attr;
|
|
272448
272501
|
attr = void 0;
|
|
272449
272502
|
}
|
|
272450
272503
|
const self2 = this;
|
|
272451
|
-
self2.fs.exists(
|
|
272504
|
+
self2.fs.exists(path54, function(exist) {
|
|
272452
272505
|
if (exist && !overwrite) return callback(false);
|
|
272453
|
-
self2.fs.stat(
|
|
272506
|
+
self2.fs.stat(path54, function(err, stat) {
|
|
272454
272507
|
if (exist && stat.isDirectory()) {
|
|
272455
272508
|
return callback(false);
|
|
272456
272509
|
}
|
|
272457
|
-
var folder = pth.dirname(
|
|
272510
|
+
var folder = pth.dirname(path54);
|
|
272458
272511
|
self2.fs.exists(folder, function(exists) {
|
|
272459
272512
|
if (!exists) self2.makeDir(folder);
|
|
272460
|
-
self2.fs.open(
|
|
272513
|
+
self2.fs.open(path54, "w", 438, function(err2, fd) {
|
|
272461
272514
|
if (err2) {
|
|
272462
|
-
self2.fs.chmod(
|
|
272463
|
-
self2.fs.open(
|
|
272515
|
+
self2.fs.chmod(path54, 438, function() {
|
|
272516
|
+
self2.fs.open(path54, "w", 438, function(err3, fd2) {
|
|
272464
272517
|
self2.fs.write(fd2, content, 0, content.length, 0, function() {
|
|
272465
272518
|
self2.fs.close(fd2, function() {
|
|
272466
|
-
self2.fs.chmod(
|
|
272519
|
+
self2.fs.chmod(path54, attr || 438, function() {
|
|
272467
272520
|
callback(true);
|
|
272468
272521
|
});
|
|
272469
272522
|
});
|
|
@@ -272473,13 +272526,13 @@ var require_utils2 = __commonJS({
|
|
|
272473
272526
|
} else if (fd) {
|
|
272474
272527
|
self2.fs.write(fd, content, 0, content.length, 0, function() {
|
|
272475
272528
|
self2.fs.close(fd, function() {
|
|
272476
|
-
self2.fs.chmod(
|
|
272529
|
+
self2.fs.chmod(path54, attr || 438, function() {
|
|
272477
272530
|
callback(true);
|
|
272478
272531
|
});
|
|
272479
272532
|
});
|
|
272480
272533
|
});
|
|
272481
272534
|
} else {
|
|
272482
|
-
self2.fs.chmod(
|
|
272535
|
+
self2.fs.chmod(path54, attr || 438, function() {
|
|
272483
272536
|
callback(true);
|
|
272484
272537
|
});
|
|
272485
272538
|
}
|
|
@@ -272488,7 +272541,7 @@ var require_utils2 = __commonJS({
|
|
|
272488
272541
|
});
|
|
272489
272542
|
});
|
|
272490
272543
|
};
|
|
272491
|
-
Utils.prototype.findFiles = function(
|
|
272544
|
+
Utils.prototype.findFiles = function(path54) {
|
|
272492
272545
|
const self2 = this;
|
|
272493
272546
|
function findSync(dir, pattern, recursive) {
|
|
272494
272547
|
if (typeof pattern === "boolean") {
|
|
@@ -272497,16 +272550,16 @@ var require_utils2 = __commonJS({
|
|
|
272497
272550
|
}
|
|
272498
272551
|
let files = [];
|
|
272499
272552
|
self2.fs.readdirSync(dir).forEach(function(file) {
|
|
272500
|
-
const
|
|
272501
|
-
const stat = self2.fs.statSync(
|
|
272502
|
-
if (!pattern || pattern.test(
|
|
272503
|
-
files.push(pth.normalize(
|
|
272553
|
+
const path55 = pth.join(dir, file);
|
|
272554
|
+
const stat = self2.fs.statSync(path55);
|
|
272555
|
+
if (!pattern || pattern.test(path55)) {
|
|
272556
|
+
files.push(pth.normalize(path55) + (stat.isDirectory() ? self2.sep : ""));
|
|
272504
272557
|
}
|
|
272505
|
-
if (stat.isDirectory() && recursive) files = files.concat(findSync(
|
|
272558
|
+
if (stat.isDirectory() && recursive) files = files.concat(findSync(path55, pattern, recursive));
|
|
272506
272559
|
});
|
|
272507
272560
|
return files;
|
|
272508
272561
|
}
|
|
272509
|
-
return findSync(
|
|
272562
|
+
return findSync(path54, void 0, true);
|
|
272510
272563
|
};
|
|
272511
272564
|
Utils.prototype.findFilesAsync = function(dir, cb) {
|
|
272512
272565
|
const self2 = this;
|
|
@@ -272561,14 +272614,14 @@ var require_utils2 = __commonJS({
|
|
|
272561
272614
|
return "UNSUPPORTED (" + method + ")";
|
|
272562
272615
|
}
|
|
272563
272616
|
};
|
|
272564
|
-
Utils.canonical = function(
|
|
272565
|
-
if (!
|
|
272566
|
-
const safeSuffix = pth.posix.normalize("/" +
|
|
272617
|
+
Utils.canonical = function(path54) {
|
|
272618
|
+
if (!path54) return "";
|
|
272619
|
+
const safeSuffix = pth.posix.normalize("/" + path54.split("\\").join("/"));
|
|
272567
272620
|
return pth.join(".", safeSuffix);
|
|
272568
272621
|
};
|
|
272569
|
-
Utils.zipnamefix = function(
|
|
272570
|
-
if (!
|
|
272571
|
-
const safeSuffix = pth.posix.normalize("/" +
|
|
272622
|
+
Utils.zipnamefix = function(path54) {
|
|
272623
|
+
if (!path54) return "";
|
|
272624
|
+
const safeSuffix = pth.posix.normalize("/" + path54.split("\\").join("/"));
|
|
272572
272625
|
return pth.posix.join(".", safeSuffix);
|
|
272573
272626
|
};
|
|
272574
272627
|
Utils.findLast = function(arr, callback) {
|
|
@@ -272585,9 +272638,9 @@ var require_utils2 = __commonJS({
|
|
|
272585
272638
|
prefix = pth.resolve(pth.normalize(prefix));
|
|
272586
272639
|
var parts = name.split("/");
|
|
272587
272640
|
for (var i = 0, l = parts.length; i < l; i++) {
|
|
272588
|
-
var
|
|
272589
|
-
if (
|
|
272590
|
-
return
|
|
272641
|
+
var path54 = pth.normalize(pth.join(prefix, parts.slice(i, l).join(pth.sep)));
|
|
272642
|
+
if (path54.indexOf(prefix) === 0) {
|
|
272643
|
+
return path54;
|
|
272591
272644
|
}
|
|
272592
272645
|
}
|
|
272593
272646
|
return pth.normalize(pth.join(prefix, pth.basename(name)));
|
|
@@ -272627,8 +272680,8 @@ var require_utils2 = __commonJS({
|
|
|
272627
272680
|
var require_fattr = __commonJS({
|
|
272628
272681
|
"node_modules/adm-zip/util/fattr.js"(exports2, module2) {
|
|
272629
272682
|
var pth = require("path");
|
|
272630
|
-
module2.exports = function(
|
|
272631
|
-
var _path =
|
|
272683
|
+
module2.exports = function(path54, { fs: fs50 }) {
|
|
272684
|
+
var _path = path54 || "", _obj = newAttr(), _stat = null;
|
|
272632
272685
|
function newAttr() {
|
|
272633
272686
|
return {
|
|
272634
272687
|
directory: false,
|
|
@@ -272639,8 +272692,8 @@ var require_fattr = __commonJS({
|
|
|
272639
272692
|
atime: 0
|
|
272640
272693
|
};
|
|
272641
272694
|
}
|
|
272642
|
-
if (_path &&
|
|
272643
|
-
_stat =
|
|
272695
|
+
if (_path && fs50.existsSync(_path)) {
|
|
272696
|
+
_stat = fs50.statSync(_path);
|
|
272644
272697
|
_obj.directory = _stat.isDirectory();
|
|
272645
272698
|
_obj.mtime = _stat.mtime;
|
|
272646
272699
|
_obj.atime = _stat.atime;
|
|
@@ -274017,8 +274070,8 @@ var require_adm_zip = __commonJS({
|
|
|
274017
274070
|
return null;
|
|
274018
274071
|
}
|
|
274019
274072
|
function fixPath(zipPath) {
|
|
274020
|
-
const { join:
|
|
274021
|
-
return
|
|
274073
|
+
const { join: join9, normalize: normalize2, sep } = pth.posix;
|
|
274074
|
+
return join9(pth.isAbsolute(zipPath) ? "/" : ".", normalize2(sep + zipPath.split("\\").join(sep) + sep));
|
|
274022
274075
|
}
|
|
274023
274076
|
function filenameFilter(filterfn) {
|
|
274024
274077
|
if (filterfn instanceof RegExp) {
|
|
@@ -282534,11 +282587,11 @@ var require_lodash = __commonJS({
|
|
|
282534
282587
|
return isFunction3(object3[key]);
|
|
282535
282588
|
});
|
|
282536
282589
|
}
|
|
282537
|
-
function baseGet(object3,
|
|
282538
|
-
|
|
282539
|
-
var index = 0, length =
|
|
282590
|
+
function baseGet(object3, path54) {
|
|
282591
|
+
path54 = castPath(path54, object3);
|
|
282592
|
+
var index = 0, length = path54.length;
|
|
282540
282593
|
while (object3 != null && index < length) {
|
|
282541
|
-
object3 = object3[toKey(
|
|
282594
|
+
object3 = object3[toKey(path54[index++])];
|
|
282542
282595
|
}
|
|
282543
282596
|
return index && index == length ? object3 : undefined2;
|
|
282544
282597
|
}
|
|
@@ -282602,10 +282655,10 @@ var require_lodash = __commonJS({
|
|
|
282602
282655
|
});
|
|
282603
282656
|
return accumulator;
|
|
282604
282657
|
}
|
|
282605
|
-
function baseInvoke(object3,
|
|
282606
|
-
|
|
282607
|
-
object3 = parent(object3,
|
|
282608
|
-
var func = object3 == null ? object3 : object3[toKey(last(
|
|
282658
|
+
function baseInvoke(object3, path54, args) {
|
|
282659
|
+
path54 = castPath(path54, object3);
|
|
282660
|
+
object3 = parent(object3, path54);
|
|
282661
|
+
var func = object3 == null ? object3 : object3[toKey(last(path54))];
|
|
282609
282662
|
return func == null ? undefined2 : apply(func, object3, args);
|
|
282610
282663
|
}
|
|
282611
282664
|
function baseIsArguments(value) {
|
|
@@ -282761,13 +282814,13 @@ var require_lodash = __commonJS({
|
|
|
282761
282814
|
return object3 === source || baseIsMatch(object3, source, matchData);
|
|
282762
282815
|
};
|
|
282763
282816
|
}
|
|
282764
|
-
function baseMatchesProperty(
|
|
282765
|
-
if (isKey(
|
|
282766
|
-
return matchesStrictComparable(toKey(
|
|
282817
|
+
function baseMatchesProperty(path54, srcValue) {
|
|
282818
|
+
if (isKey(path54) && isStrictComparable(srcValue)) {
|
|
282819
|
+
return matchesStrictComparable(toKey(path54), srcValue);
|
|
282767
282820
|
}
|
|
282768
282821
|
return function(object3) {
|
|
282769
|
-
var objValue = get2(object3,
|
|
282770
|
-
return objValue === undefined2 && objValue === srcValue ? hasIn(object3,
|
|
282822
|
+
var objValue = get2(object3, path54);
|
|
282823
|
+
return objValue === undefined2 && objValue === srcValue ? hasIn(object3, path54) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
282771
282824
|
};
|
|
282772
282825
|
}
|
|
282773
282826
|
function baseMerge(object3, source, srcIndex, customizer, stack) {
|
|
@@ -282864,23 +282917,23 @@ var require_lodash = __commonJS({
|
|
|
282864
282917
|
});
|
|
282865
282918
|
}
|
|
282866
282919
|
function basePick(object3, paths) {
|
|
282867
|
-
return basePickBy(object3, paths, function(value,
|
|
282868
|
-
return hasIn(object3,
|
|
282920
|
+
return basePickBy(object3, paths, function(value, path54) {
|
|
282921
|
+
return hasIn(object3, path54);
|
|
282869
282922
|
});
|
|
282870
282923
|
}
|
|
282871
282924
|
function basePickBy(object3, paths, predicate) {
|
|
282872
282925
|
var index = -1, length = paths.length, result2 = {};
|
|
282873
282926
|
while (++index < length) {
|
|
282874
|
-
var
|
|
282875
|
-
if (predicate(value,
|
|
282876
|
-
baseSet(result2, castPath(
|
|
282927
|
+
var path54 = paths[index], value = baseGet(object3, path54);
|
|
282928
|
+
if (predicate(value, path54)) {
|
|
282929
|
+
baseSet(result2, castPath(path54, object3), value);
|
|
282877
282930
|
}
|
|
282878
282931
|
}
|
|
282879
282932
|
return result2;
|
|
282880
282933
|
}
|
|
282881
|
-
function basePropertyDeep(
|
|
282934
|
+
function basePropertyDeep(path54) {
|
|
282882
282935
|
return function(object3) {
|
|
282883
|
-
return baseGet(object3,
|
|
282936
|
+
return baseGet(object3, path54);
|
|
282884
282937
|
};
|
|
282885
282938
|
}
|
|
282886
282939
|
function basePullAll(array2, values2, iteratee2, comparator) {
|
|
@@ -282954,14 +283007,14 @@ var require_lodash = __commonJS({
|
|
|
282954
283007
|
var array2 = values(collection);
|
|
282955
283008
|
return shuffleSelf(array2, baseClamp(n, 0, array2.length));
|
|
282956
283009
|
}
|
|
282957
|
-
function baseSet(object3,
|
|
283010
|
+
function baseSet(object3, path54, value, customizer) {
|
|
282958
283011
|
if (!isObject5(object3)) {
|
|
282959
283012
|
return object3;
|
|
282960
283013
|
}
|
|
282961
|
-
|
|
282962
|
-
var index = -1, length =
|
|
283014
|
+
path54 = castPath(path54, object3);
|
|
283015
|
+
var index = -1, length = path54.length, lastIndex = length - 1, nested = object3;
|
|
282963
283016
|
while (nested != null && ++index < length) {
|
|
282964
|
-
var key = toKey(
|
|
283017
|
+
var key = toKey(path54[index]), newValue = value;
|
|
282965
283018
|
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
282966
283019
|
return object3;
|
|
282967
283020
|
}
|
|
@@ -282969,7 +283022,7 @@ var require_lodash = __commonJS({
|
|
|
282969
283022
|
var objValue = nested[key];
|
|
282970
283023
|
newValue = customizer ? customizer(objValue, key, nested) : undefined2;
|
|
282971
283024
|
if (newValue === undefined2) {
|
|
282972
|
-
newValue = isObject5(objValue) ? objValue : isIndex(
|
|
283025
|
+
newValue = isObject5(objValue) ? objValue : isIndex(path54[index + 1]) ? [] : {};
|
|
282973
283026
|
}
|
|
282974
283027
|
}
|
|
282975
283028
|
assignValue(nested, key, newValue);
|
|
@@ -283135,14 +283188,14 @@ var require_lodash = __commonJS({
|
|
|
283135
283188
|
}
|
|
283136
283189
|
return result2;
|
|
283137
283190
|
}
|
|
283138
|
-
function baseUnset(object3,
|
|
283139
|
-
|
|
283140
|
-
var index = -1, length =
|
|
283191
|
+
function baseUnset(object3, path54) {
|
|
283192
|
+
path54 = castPath(path54, object3);
|
|
283193
|
+
var index = -1, length = path54.length;
|
|
283141
283194
|
if (!length) {
|
|
283142
283195
|
return true;
|
|
283143
283196
|
}
|
|
283144
283197
|
while (++index < length) {
|
|
283145
|
-
var key = toKey(
|
|
283198
|
+
var key = toKey(path54[index]);
|
|
283146
283199
|
if (key === "__proto__" && !hasOwnProperty2.call(object3, "__proto__")) {
|
|
283147
283200
|
return false;
|
|
283148
283201
|
}
|
|
@@ -283150,11 +283203,11 @@ var require_lodash = __commonJS({
|
|
|
283150
283203
|
return false;
|
|
283151
283204
|
}
|
|
283152
283205
|
}
|
|
283153
|
-
var obj2 = parent(object3,
|
|
283154
|
-
return obj2 == null || delete obj2[toKey(last(
|
|
283206
|
+
var obj2 = parent(object3, path54);
|
|
283207
|
+
return obj2 == null || delete obj2[toKey(last(path54))];
|
|
283155
283208
|
}
|
|
283156
|
-
function baseUpdate(object3,
|
|
283157
|
-
return baseSet(object3,
|
|
283209
|
+
function baseUpdate(object3, path54, updater, customizer) {
|
|
283210
|
+
return baseSet(object3, path54, updater(baseGet(object3, path54)), customizer);
|
|
283158
283211
|
}
|
|
283159
283212
|
function baseWhile(array2, predicate, isDrop, fromRight) {
|
|
283160
283213
|
var length = array2.length, index = fromRight ? length : -1;
|
|
@@ -284037,11 +284090,11 @@ var require_lodash = __commonJS({
|
|
|
284037
284090
|
var match = source.match(reWrapDetails);
|
|
284038
284091
|
return match ? match[1].split(reSplitDetails) : [];
|
|
284039
284092
|
}
|
|
284040
|
-
function hasPath(object3,
|
|
284041
|
-
|
|
284042
|
-
var index = -1, length =
|
|
284093
|
+
function hasPath(object3, path54, hasFunc) {
|
|
284094
|
+
path54 = castPath(path54, object3);
|
|
284095
|
+
var index = -1, length = path54.length, result2 = false;
|
|
284043
284096
|
while (++index < length) {
|
|
284044
|
-
var key = toKey(
|
|
284097
|
+
var key = toKey(path54[index]);
|
|
284045
284098
|
if (!(result2 = object3 != null && hasFunc(object3, key))) {
|
|
284046
284099
|
break;
|
|
284047
284100
|
}
|
|
@@ -284243,8 +284296,8 @@ var require_lodash = __commonJS({
|
|
|
284243
284296
|
return apply(func, this, otherArgs);
|
|
284244
284297
|
};
|
|
284245
284298
|
}
|
|
284246
|
-
function parent(object3,
|
|
284247
|
-
return
|
|
284299
|
+
function parent(object3, path54) {
|
|
284300
|
+
return path54.length < 2 ? object3 : baseGet(object3, baseSlice(path54, 0, -1));
|
|
284248
284301
|
}
|
|
284249
284302
|
function reorder(array2, indexes) {
|
|
284250
284303
|
var arrLength = array2.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array2);
|
|
@@ -284521,7 +284574,7 @@ var require_lodash = __commonJS({
|
|
|
284521
284574
|
}
|
|
284522
284575
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
284523
284576
|
});
|
|
284524
|
-
function
|
|
284577
|
+
function join9(array2, separator) {
|
|
284525
284578
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
284526
284579
|
}
|
|
284527
284580
|
function last(array2) {
|
|
@@ -284879,10 +284932,10 @@ var require_lodash = __commonJS({
|
|
|
284879
284932
|
}
|
|
284880
284933
|
return isString2(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
|
|
284881
284934
|
}
|
|
284882
|
-
var invokeMap = baseRest(function(collection,
|
|
284883
|
-
var index = -1, isFunc = typeof
|
|
284935
|
+
var invokeMap = baseRest(function(collection, path54, args) {
|
|
284936
|
+
var index = -1, isFunc = typeof path54 == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : [];
|
|
284884
284937
|
baseEach(collection, function(value) {
|
|
284885
|
-
result2[++index] = isFunc ? apply(
|
|
284938
|
+
result2[++index] = isFunc ? apply(path54, value, args) : baseInvoke(value, path54, args);
|
|
284886
284939
|
});
|
|
284887
284940
|
return result2;
|
|
284888
284941
|
});
|
|
@@ -285534,15 +285587,15 @@ var require_lodash = __commonJS({
|
|
|
285534
285587
|
function functionsIn(object3) {
|
|
285535
285588
|
return object3 == null ? [] : baseFunctions(object3, keysIn(object3));
|
|
285536
285589
|
}
|
|
285537
|
-
function get2(object3,
|
|
285538
|
-
var result2 = object3 == null ? undefined2 : baseGet(object3,
|
|
285590
|
+
function get2(object3, path54, defaultValue) {
|
|
285591
|
+
var result2 = object3 == null ? undefined2 : baseGet(object3, path54);
|
|
285539
285592
|
return result2 === undefined2 ? defaultValue : result2;
|
|
285540
285593
|
}
|
|
285541
|
-
function has(object3,
|
|
285542
|
-
return object3 != null && hasPath(object3,
|
|
285594
|
+
function has(object3, path54) {
|
|
285595
|
+
return object3 != null && hasPath(object3, path54, baseHas);
|
|
285543
285596
|
}
|
|
285544
|
-
function hasIn(object3,
|
|
285545
|
-
return object3 != null && hasPath(object3,
|
|
285597
|
+
function hasIn(object3, path54) {
|
|
285598
|
+
return object3 != null && hasPath(object3, path54, baseHasIn);
|
|
285546
285599
|
}
|
|
285547
285600
|
var invert = createInverter(function(result2, value, key) {
|
|
285548
285601
|
if (value != null && typeof value.toString != "function") {
|
|
@@ -285595,10 +285648,10 @@ var require_lodash = __commonJS({
|
|
|
285595
285648
|
return result2;
|
|
285596
285649
|
}
|
|
285597
285650
|
var isDeep = false;
|
|
285598
|
-
paths = arrayMap(paths, function(
|
|
285599
|
-
|
|
285600
|
-
isDeep || (isDeep =
|
|
285601
|
-
return
|
|
285651
|
+
paths = arrayMap(paths, function(path54) {
|
|
285652
|
+
path54 = castPath(path54, object3);
|
|
285653
|
+
isDeep || (isDeep = path54.length > 1);
|
|
285654
|
+
return path54;
|
|
285602
285655
|
});
|
|
285603
285656
|
copyObject(object3, getAllKeysIn(object3), result2);
|
|
285604
285657
|
if (isDeep) {
|
|
@@ -285624,19 +285677,19 @@ var require_lodash = __commonJS({
|
|
|
285624
285677
|
return [prop];
|
|
285625
285678
|
});
|
|
285626
285679
|
predicate = getIteratee(predicate);
|
|
285627
|
-
return basePickBy(object3, props, function(value,
|
|
285628
|
-
return predicate(value,
|
|
285680
|
+
return basePickBy(object3, props, function(value, path54) {
|
|
285681
|
+
return predicate(value, path54[0]);
|
|
285629
285682
|
});
|
|
285630
285683
|
}
|
|
285631
|
-
function result(object3,
|
|
285632
|
-
|
|
285633
|
-
var index = -1, length =
|
|
285684
|
+
function result(object3, path54, defaultValue) {
|
|
285685
|
+
path54 = castPath(path54, object3);
|
|
285686
|
+
var index = -1, length = path54.length;
|
|
285634
285687
|
if (!length) {
|
|
285635
285688
|
length = 1;
|
|
285636
285689
|
object3 = undefined2;
|
|
285637
285690
|
}
|
|
285638
285691
|
while (++index < length) {
|
|
285639
|
-
var value = object3 == null ? undefined2 : object3[toKey(
|
|
285692
|
+
var value = object3 == null ? undefined2 : object3[toKey(path54[index])];
|
|
285640
285693
|
if (value === undefined2) {
|
|
285641
285694
|
index = length;
|
|
285642
285695
|
value = defaultValue;
|
|
@@ -285645,12 +285698,12 @@ var require_lodash = __commonJS({
|
|
|
285645
285698
|
}
|
|
285646
285699
|
return object3;
|
|
285647
285700
|
}
|
|
285648
|
-
function set2(object3,
|
|
285649
|
-
return object3 == null ? object3 : baseSet(object3,
|
|
285701
|
+
function set2(object3, path54, value) {
|
|
285702
|
+
return object3 == null ? object3 : baseSet(object3, path54, value);
|
|
285650
285703
|
}
|
|
285651
|
-
function setWith(object3,
|
|
285704
|
+
function setWith(object3, path54, value, customizer) {
|
|
285652
285705
|
customizer = typeof customizer == "function" ? customizer : undefined2;
|
|
285653
|
-
return object3 == null ? object3 : baseSet(object3,
|
|
285706
|
+
return object3 == null ? object3 : baseSet(object3, path54, value, customizer);
|
|
285654
285707
|
}
|
|
285655
285708
|
var toPairs = createToPairs(keys);
|
|
285656
285709
|
var toPairsIn = createToPairs(keysIn);
|
|
@@ -285672,15 +285725,15 @@ var require_lodash = __commonJS({
|
|
|
285672
285725
|
});
|
|
285673
285726
|
return accumulator;
|
|
285674
285727
|
}
|
|
285675
|
-
function unset(object3,
|
|
285676
|
-
return object3 == null ? true : baseUnset(object3,
|
|
285728
|
+
function unset(object3, path54) {
|
|
285729
|
+
return object3 == null ? true : baseUnset(object3, path54);
|
|
285677
285730
|
}
|
|
285678
|
-
function update(object3,
|
|
285679
|
-
return object3 == null ? object3 : baseUpdate(object3,
|
|
285731
|
+
function update(object3, path54, updater) {
|
|
285732
|
+
return object3 == null ? object3 : baseUpdate(object3, path54, castFunction(updater));
|
|
285680
285733
|
}
|
|
285681
|
-
function updateWith(object3,
|
|
285734
|
+
function updateWith(object3, path54, updater, customizer) {
|
|
285682
285735
|
customizer = typeof customizer == "function" ? customizer : undefined2;
|
|
285683
|
-
return object3 == null ? object3 : baseUpdate(object3,
|
|
285736
|
+
return object3 == null ? object3 : baseUpdate(object3, path54, castFunction(updater), customizer);
|
|
285684
285737
|
}
|
|
285685
285738
|
function values(object3) {
|
|
285686
285739
|
return object3 == null ? [] : baseValues(object3, keys(object3));
|
|
@@ -286066,17 +286119,17 @@ var require_lodash = __commonJS({
|
|
|
286066
286119
|
function matches(source) {
|
|
286067
286120
|
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
|
|
286068
286121
|
}
|
|
286069
|
-
function matchesProperty(
|
|
286070
|
-
return baseMatchesProperty(
|
|
286122
|
+
function matchesProperty(path54, srcValue) {
|
|
286123
|
+
return baseMatchesProperty(path54, baseClone(srcValue, CLONE_DEEP_FLAG));
|
|
286071
286124
|
}
|
|
286072
|
-
var method = baseRest(function(
|
|
286125
|
+
var method = baseRest(function(path54, args) {
|
|
286073
286126
|
return function(object3) {
|
|
286074
|
-
return baseInvoke(object3,
|
|
286127
|
+
return baseInvoke(object3, path54, args);
|
|
286075
286128
|
};
|
|
286076
286129
|
});
|
|
286077
286130
|
var methodOf = baseRest(function(object3, args) {
|
|
286078
|
-
return function(
|
|
286079
|
-
return baseInvoke(object3,
|
|
286131
|
+
return function(path54) {
|
|
286132
|
+
return baseInvoke(object3, path54, args);
|
|
286080
286133
|
};
|
|
286081
286134
|
});
|
|
286082
286135
|
function mixin(object3, source, options) {
|
|
@@ -286123,12 +286176,12 @@ var require_lodash = __commonJS({
|
|
|
286123
286176
|
var over = createOver(arrayMap);
|
|
286124
286177
|
var overEvery = createOver(arrayEvery);
|
|
286125
286178
|
var overSome = createOver(arraySome);
|
|
286126
|
-
function property(
|
|
286127
|
-
return isKey(
|
|
286179
|
+
function property(path54) {
|
|
286180
|
+
return isKey(path54) ? baseProperty(toKey(path54)) : basePropertyDeep(path54);
|
|
286128
286181
|
}
|
|
286129
286182
|
function propertyOf(object3) {
|
|
286130
|
-
return function(
|
|
286131
|
-
return object3 == null ? undefined2 : baseGet(object3,
|
|
286183
|
+
return function(path54) {
|
|
286184
|
+
return object3 == null ? undefined2 : baseGet(object3, path54);
|
|
286132
286185
|
};
|
|
286133
286186
|
}
|
|
286134
286187
|
var range = createRange();
|
|
@@ -286445,7 +286498,7 @@ var require_lodash = __commonJS({
|
|
|
286445
286498
|
lodash.isUndefined = isUndefined2;
|
|
286446
286499
|
lodash.isWeakMap = isWeakMap;
|
|
286447
286500
|
lodash.isWeakSet = isWeakSet;
|
|
286448
|
-
lodash.join =
|
|
286501
|
+
lodash.join = join9;
|
|
286449
286502
|
lodash.kebabCase = kebabCase;
|
|
286450
286503
|
lodash.last = last;
|
|
286451
286504
|
lodash.lastIndexOf = lastIndexOf;
|
|
@@ -286581,12 +286634,12 @@ var require_lodash = __commonJS({
|
|
|
286581
286634
|
LazyWrapper.prototype.findLast = function(predicate) {
|
|
286582
286635
|
return this.reverse().find(predicate);
|
|
286583
286636
|
};
|
|
286584
|
-
LazyWrapper.prototype.invokeMap = baseRest(function(
|
|
286585
|
-
if (typeof
|
|
286637
|
+
LazyWrapper.prototype.invokeMap = baseRest(function(path54, args) {
|
|
286638
|
+
if (typeof path54 == "function") {
|
|
286586
286639
|
return new LazyWrapper(this);
|
|
286587
286640
|
}
|
|
286588
286641
|
return this.map(function(value) {
|
|
286589
|
-
return baseInvoke(value,
|
|
286642
|
+
return baseInvoke(value, path54, args);
|
|
286590
286643
|
});
|
|
286591
286644
|
});
|
|
286592
286645
|
LazyWrapper.prototype.reject = function(predicate) {
|
|
@@ -287599,16 +287652,16 @@ var require_epub = __commonJS({
|
|
|
287599
287652
|
* Parses "manifest" block (all items included, html files, images, styles)
|
|
287600
287653
|
**/
|
|
287601
287654
|
parseManifest(manifest) {
|
|
287602
|
-
var i, len,
|
|
287603
|
-
|
|
287604
|
-
path_str =
|
|
287655
|
+
var i, len, path54 = this.rootFile.split("/"), element, path_str;
|
|
287656
|
+
path54.pop();
|
|
287657
|
+
path_str = path54.join("/");
|
|
287605
287658
|
if (manifest.item) {
|
|
287606
287659
|
for (i = 0, len = manifest.item.length; i < len; i++) {
|
|
287607
287660
|
if (manifest.item[i]["@"]) {
|
|
287608
287661
|
element = manifest.item[i]["@"];
|
|
287609
287662
|
element = this._Elem(element);
|
|
287610
287663
|
if (element.href && element.href.substr(0, path_str.length) != path_str) {
|
|
287611
|
-
element.href =
|
|
287664
|
+
element.href = path54.concat([element.href]).join("/");
|
|
287612
287665
|
}
|
|
287613
287666
|
this.manifest[manifest.item[i]["@"].id] = element;
|
|
287614
287667
|
}
|
|
@@ -287621,8 +287674,8 @@ var require_epub = __commonJS({
|
|
|
287621
287674
|
* Parses "spine" block (all html elements that are shown to the reader)
|
|
287622
287675
|
**/
|
|
287623
287676
|
parseSpine(spine) {
|
|
287624
|
-
var i, len,
|
|
287625
|
-
|
|
287677
|
+
var i, len, path54 = this.rootFile.split("/"), element;
|
|
287678
|
+
path54.pop();
|
|
287626
287679
|
if (spine["@"] && spine["@"].toc) {
|
|
287627
287680
|
this.spine.toc = this.manifest[spine["@"].toc] || null;
|
|
287628
287681
|
}
|
|
@@ -287646,8 +287699,8 @@ var require_epub = __commonJS({
|
|
|
287646
287699
|
* Parses ncx file for table of contents (title, html file)
|
|
287647
287700
|
**/
|
|
287648
287701
|
parseTOC() {
|
|
287649
|
-
var i, len,
|
|
287650
|
-
|
|
287702
|
+
var i, len, path54 = this.spine.toc.href.split("/"), id_list = {}, keys;
|
|
287703
|
+
path54.pop();
|
|
287651
287704
|
keys = Object.keys(this.manifest);
|
|
287652
287705
|
for (i = 0, len = keys.length; i < len; i++) {
|
|
287653
287706
|
id_list[this.manifest[keys[i]].href] = keys[i];
|
|
@@ -287661,7 +287714,7 @@ var require_epub = __commonJS({
|
|
|
287661
287714
|
var xml = data.toString("utf-8"), xmlparser = new xml2js_1.default.Parser(xml2jsOptions);
|
|
287662
287715
|
xmlparser.on("end", (result) => {
|
|
287663
287716
|
if (result.navMap && result.navMap.navPoint) {
|
|
287664
|
-
this.toc = this.walkNavMap(result.navMap.navPoint,
|
|
287717
|
+
this.toc = this.walkNavMap(result.navMap.navPoint, path54, id_list);
|
|
287665
287718
|
}
|
|
287666
287719
|
this.emit("end");
|
|
287667
287720
|
});
|
|
@@ -287682,7 +287735,7 @@ var require_epub = __commonJS({
|
|
|
287682
287735
|
* Walks the NavMap object through all levels and finds elements
|
|
287683
287736
|
* for TOC
|
|
287684
287737
|
**/
|
|
287685
|
-
walkNavMap(branch,
|
|
287738
|
+
walkNavMap(branch, path54, id_list, level, pe, parentNcx, ncx_idx) {
|
|
287686
287739
|
ncx_idx = ncx_idx || {
|
|
287687
287740
|
index: 0
|
|
287688
287741
|
};
|
|
@@ -287718,7 +287771,7 @@ var require_epub = __commonJS({
|
|
|
287718
287771
|
title
|
|
287719
287772
|
};
|
|
287720
287773
|
if (href) {
|
|
287721
|
-
href =
|
|
287774
|
+
href = path54.concat([href]).join("/");
|
|
287722
287775
|
element.href = href;
|
|
287723
287776
|
if (id_list[element.href]) {
|
|
287724
287777
|
element = this.manifest[id_list[element.href]];
|
|
@@ -287752,7 +287805,7 @@ var require_epub = __commonJS({
|
|
|
287752
287805
|
}
|
|
287753
287806
|
}
|
|
287754
287807
|
if (branch[i].navPoint) {
|
|
287755
|
-
output = output.concat(this.walkNavMap(branch[i].navPoint,
|
|
287808
|
+
output = output.concat(this.walkNavMap(branch[i].navPoint, path54, id_list, level + 1, element, currentNcx, ncx_idx));
|
|
287756
287809
|
}
|
|
287757
287810
|
}
|
|
287758
287811
|
return output;
|
|
@@ -287773,8 +287826,8 @@ var require_epub = __commonJS({
|
|
|
287773
287826
|
return;
|
|
287774
287827
|
}
|
|
287775
287828
|
let meta = self2.manifest[chapterId];
|
|
287776
|
-
var i, len,
|
|
287777
|
-
|
|
287829
|
+
var i, len, path54 = this.rootFile.split("/"), keys = Object.keys(this.manifest);
|
|
287830
|
+
path54.pop();
|
|
287778
287831
|
let basePath = (0, path_1.dirname)(meta.href);
|
|
287779
287832
|
let baseHref = meta.href;
|
|
287780
287833
|
str2 = str2.replace(/\r?\n/g, "\0");
|
|
@@ -287811,7 +287864,7 @@ var require_epub = __commonJS({
|
|
|
287811
287864
|
return o;
|
|
287812
287865
|
});
|
|
287813
287866
|
str2 = str2.replace(/(\shref\s*=\s*["']?)([^"'\s>]*?)(["'\s>])/g, (o, a, b, c) => {
|
|
287814
|
-
var linkparts = b && b.split("#"), link =
|
|
287867
|
+
var linkparts = b && b.split("#"), link = path54.concat([linkparts.shift() || ""]).join("/").trim(), element;
|
|
287815
287868
|
for (i = 0, len = keys.length; i < len; i++) {
|
|
287816
287869
|
if (this.manifest[keys[i]].href.split("#")[0] == link) {
|
|
287817
287870
|
element = this.manifest[keys[i]];
|
|
@@ -291855,7 +291908,7 @@ ${summaryInput}`,
|
|
|
291855
291908
|
if (!parsed) {
|
|
291856
291909
|
console.warn("[Planner] All LLM attempts failed \u2014 respond fallback (going through guard)");
|
|
291857
291910
|
parsed = {
|
|
291858
|
-
plan: [{ step: 1, tool: "respond", input: { message: buildDiagnostic({ tool: "planner", error: "All LLM attempts failed", retries: 3, suggestion: "Provider chain
|
|
291911
|
+
plan: [{ step: 1, tool: "respond", input: { message: buildDiagnostic({ tool: "planner", error: "All LLM attempts failed", retries: 3, suggestion: diagnoseProviderPool().state === "unconfigured" ? "No API keys configured. Add keys in Settings > API Keys, or start Ollama for local inference." : "Provider chain is rate-limited. Try again in 1-2 minutes or rephrase your request." }) }, description: "Fallback response" }],
|
|
291859
291912
|
requires_execution: true,
|
|
291860
291913
|
goal: message
|
|
291861
291914
|
};
|
|
@@ -291987,7 +292040,7 @@ Fix these issues and output a corrected JSON plan.`
|
|
|
291987
292040
|
tool: "planner",
|
|
291988
292041
|
error: "Could not generate tool plan for action intent",
|
|
291989
292042
|
retries: 1,
|
|
291990
|
-
suggestion: "Provider chain
|
|
292043
|
+
suggestion: diagnoseProviderPool().state === "unconfigured" ? "No API keys configured. Add keys in Settings > API Keys, or start Ollama for local inference." : "Provider chain is rate-limited. Try again in 1-2 minutes or use a more specific instruction."
|
|
291991
292044
|
});
|
|
291992
292045
|
}
|
|
291993
292046
|
if (guardMatch) {
|
|
@@ -293095,7 +293148,8 @@ Respond naturally based on these real results only. Show the actual output, not
|
|
|
293095
293148
|
parts.push(
|
|
293096
293149
|
`Failed: ${failures.map((r) => `${r.tool} \u2014 ${r.error || "unknown error"}`).join("; ")}.`
|
|
293097
293150
|
);
|
|
293098
|
-
|
|
293151
|
+
const poolDiag = diagnoseProviderPool();
|
|
293152
|
+
parts.push(`(${poolDiag.state === "unconfigured" ? "No API keys configured - add keys in Settings > API Keys" : "All language providers are currently unavailable"} - full response cannot be generated.)`);
|
|
293099
293153
|
onToken(parts.join(" "));
|
|
293100
293154
|
return;
|
|
293101
293155
|
}
|
|
@@ -294528,11 +294582,11 @@ async function _doBuild() {
|
|
|
294528
294582
|
}
|
|
294529
294583
|
} catch {
|
|
294530
294584
|
}
|
|
294531
|
-
const { mkdtempSync, writeFileSync:
|
|
294532
|
-
const
|
|
294533
|
-
const tmpDir = mkdtempSync(import_path30.default.join(
|
|
294585
|
+
const { mkdtempSync, writeFileSync: writeFileSync8, rmSync } = await import("fs");
|
|
294586
|
+
const os8 = await import("os");
|
|
294587
|
+
const tmpDir = mkdtempSync(import_path30.default.join(os8.tmpdir(), "aiden-sandbox-"));
|
|
294534
294588
|
try {
|
|
294535
|
-
|
|
294589
|
+
writeFileSync8(import_path30.default.join(tmpDir, "Dockerfile"), DOCKERFILE_CONTENT);
|
|
294536
294590
|
console.log("[Sandbox] Building image", SANDBOX_IMAGE, "...");
|
|
294537
294591
|
const { stdout, stderr } = await execAsync2(
|
|
294538
294592
|
`docker build -t ${SANDBOX_IMAGE} "${tmpDir}"`,
|
|
@@ -295023,13 +295077,13 @@ async function fetchViaYtDlp(videoId) {
|
|
|
295023
295077
|
console.log("[YouTube] yt-dlp failed:", e.message?.slice(0, 80));
|
|
295024
295078
|
return null;
|
|
295025
295079
|
}
|
|
295026
|
-
const { readFileSync:
|
|
295080
|
+
const { readFileSync: readFileSync11, existsSync: existsSync8 } = await import("fs");
|
|
295027
295081
|
const vttPath = `/tmp/yt_${videoId}.en.vtt`;
|
|
295028
|
-
if (!
|
|
295082
|
+
if (!existsSync8(vttPath)) {
|
|
295029
295083
|
console.log("[YouTube] yt-dlp did not produce a VTT file");
|
|
295030
295084
|
return null;
|
|
295031
295085
|
}
|
|
295032
|
-
const vtt =
|
|
295086
|
+
const vtt = readFileSync11(vttPath, "utf8");
|
|
295033
295087
|
const lines = vtt.split("\n");
|
|
295034
295088
|
const texts = [];
|
|
295035
295089
|
const timeRe = /^\d{2}:\d{2}:\d{2}\.\d{3} --> /;
|
|
@@ -301337,15 +301391,15 @@ var require_Connection = __commonJS({
|
|
|
301337
301391
|
box.special_use_attrib = SPECIAL_USE_ATTRIBUTES[i];
|
|
301338
301392
|
var name = info.text.name, curChildren = this._curReq.cbargs[0];
|
|
301339
301393
|
if (box.delimiter) {
|
|
301340
|
-
var
|
|
301341
|
-
name =
|
|
301342
|
-
for (i = 0, len =
|
|
301343
|
-
if (!curChildren[
|
|
301344
|
-
curChildren[
|
|
301345
|
-
if (!curChildren[
|
|
301346
|
-
curChildren[
|
|
301347
|
-
parent = curChildren[
|
|
301348
|
-
curChildren = curChildren[
|
|
301394
|
+
var path54 = name.split(box.delimiter), parent = null;
|
|
301395
|
+
name = path54.pop();
|
|
301396
|
+
for (i = 0, len = path54.length; i < len; ++i) {
|
|
301397
|
+
if (!curChildren[path54[i]])
|
|
301398
|
+
curChildren[path54[i]] = {};
|
|
301399
|
+
if (!curChildren[path54[i]].children)
|
|
301400
|
+
curChildren[path54[i]].children = {};
|
|
301401
|
+
parent = curChildren[path54[i]];
|
|
301402
|
+
curChildren = curChildren[path54[i]].children;
|
|
301349
301403
|
}
|
|
301350
301404
|
box.parent = parent;
|
|
301351
301405
|
}
|
|
@@ -306576,8 +306630,8 @@ var require_cookies2 = __commonJS({
|
|
|
306576
306630
|
if (urlparts.hostname !== cookie.domain && (cookie.domain.charAt(0) !== "." || ("." + urlparts.hostname).substr(-cookie.domain.length) !== cookie.domain)) {
|
|
306577
306631
|
return false;
|
|
306578
306632
|
}
|
|
306579
|
-
const
|
|
306580
|
-
if (
|
|
306633
|
+
const path54 = this.getPath(urlparts.pathname);
|
|
306634
|
+
if (path54.substr(0, cookie.path.length) !== cookie.path) {
|
|
306581
306635
|
return false;
|
|
306582
306636
|
}
|
|
306583
306637
|
if (cookie.secure && urlparts.protocol !== "https:") {
|
|
@@ -306635,16 +306689,16 @@ var require_cookies2 = __commonJS({
|
|
|
306635
306689
|
* @returns {String} Normalized path
|
|
306636
306690
|
*/
|
|
306637
306691
|
getPath(pathname) {
|
|
306638
|
-
let
|
|
306639
|
-
|
|
306640
|
-
|
|
306641
|
-
if (
|
|
306642
|
-
|
|
306692
|
+
let path54 = (pathname || "/").split("/");
|
|
306693
|
+
path54.pop();
|
|
306694
|
+
path54 = path54.join("/").trim();
|
|
306695
|
+
if (path54.charAt(0) !== "/") {
|
|
306696
|
+
path54 = "/" + path54;
|
|
306643
306697
|
}
|
|
306644
|
-
if (
|
|
306645
|
-
|
|
306698
|
+
if (path54.substr(-1) !== "/") {
|
|
306699
|
+
path54 += "/";
|
|
306646
306700
|
}
|
|
306647
|
-
return
|
|
306701
|
+
return path54;
|
|
306648
306702
|
}
|
|
306649
306703
|
};
|
|
306650
306704
|
module2.exports = Cookies;
|
|
@@ -306989,11 +307043,11 @@ var require_shared = __commonJS({
|
|
|
306989
307043
|
"use strict";
|
|
306990
307044
|
var urllib = require("url");
|
|
306991
307045
|
var util3 = require("util");
|
|
306992
|
-
var
|
|
307046
|
+
var fs50 = require("fs");
|
|
306993
307047
|
var nmfetch = require_fetch2();
|
|
306994
307048
|
var dns = require("dns");
|
|
306995
307049
|
var net = require("net");
|
|
306996
|
-
var
|
|
307050
|
+
var os8 = require("os");
|
|
306997
307051
|
var DNS_TTL = 5 * 60 * 1e3;
|
|
306998
307052
|
var CACHE_CLEANUP_INTERVAL = 30 * 1e3;
|
|
306999
307053
|
var MAX_CACHE_SIZE = 1e3;
|
|
@@ -307004,7 +307058,7 @@ var require_shared = __commonJS({
|
|
|
307004
307058
|
};
|
|
307005
307059
|
var networkInterfaces;
|
|
307006
307060
|
try {
|
|
307007
|
-
networkInterfaces =
|
|
307061
|
+
networkInterfaces = os8.networkInterfaces();
|
|
307008
307062
|
} catch (_err) {
|
|
307009
307063
|
}
|
|
307010
307064
|
module2.exports.networkInterfaces = networkInterfaces;
|
|
@@ -307390,7 +307444,7 @@ var require_shared = __commonJS({
|
|
|
307390
307444
|
}
|
|
307391
307445
|
return callback(null, parsedDataUri.data);
|
|
307392
307446
|
} else if (content.path) {
|
|
307393
|
-
return resolveStream(
|
|
307447
|
+
return resolveStream(fs50.createReadStream(content.path), callback);
|
|
307394
307448
|
}
|
|
307395
307449
|
}
|
|
307396
307450
|
if (typeof data[key].content === "string" && !["utf8", "usascii", "ascii"].includes(encoding)) {
|
|
@@ -307504,7 +307558,7 @@ var require_shared = __commonJS({
|
|
|
307504
307558
|
var require_mime_types = __commonJS({
|
|
307505
307559
|
"node_modules/nodemailer/lib/mime-funcs/mime-types.js"(exports2, module2) {
|
|
307506
307560
|
"use strict";
|
|
307507
|
-
var
|
|
307561
|
+
var path54 = require("path");
|
|
307508
307562
|
var defaultMimeType = "application/octet-stream";
|
|
307509
307563
|
var defaultExtension = "bin";
|
|
307510
307564
|
var mimeTypes = /* @__PURE__ */ new Map([
|
|
@@ -309571,7 +309625,7 @@ var require_mime_types = __commonJS({
|
|
|
309571
309625
|
if (!filename) {
|
|
309572
309626
|
return defaultMimeType;
|
|
309573
309627
|
}
|
|
309574
|
-
const parsed =
|
|
309628
|
+
const parsed = path54.parse(filename);
|
|
309575
309629
|
const extension = (parsed.ext.substr(1) || parsed.name || "").split("?").shift().trim().toLowerCase();
|
|
309576
309630
|
const value = extensions.has(extension) ? extensions.get(extension) : defaultMimeType;
|
|
309577
309631
|
if (Array.isArray(value)) {
|
|
@@ -311001,7 +311055,7 @@ var require_mime_node = __commonJS({
|
|
|
311001
311055
|
"node_modules/nodemailer/lib/mime-node/index.js"(exports2, module2) {
|
|
311002
311056
|
"use strict";
|
|
311003
311057
|
var crypto4 = require("crypto");
|
|
311004
|
-
var
|
|
311058
|
+
var fs50 = require("fs");
|
|
311005
311059
|
var punycode = require_punycode();
|
|
311006
311060
|
var { PassThrough } = require("stream");
|
|
311007
311061
|
var shared = require_shared();
|
|
@@ -311723,7 +311777,7 @@ var require_mime_node = __commonJS({
|
|
|
311723
311777
|
});
|
|
311724
311778
|
return contentStream;
|
|
311725
311779
|
}
|
|
311726
|
-
return
|
|
311780
|
+
return fs50.createReadStream(content.path);
|
|
311727
311781
|
}
|
|
311728
311782
|
if (content && typeof content.href === "string") {
|
|
311729
311783
|
if (this.disableUrlAccess) {
|
|
@@ -312755,8 +312809,8 @@ var require_dkim = __commonJS({
|
|
|
312755
312809
|
var RelaxedBody = require_relaxed_body();
|
|
312756
312810
|
var sign = require_sign();
|
|
312757
312811
|
var { PassThrough } = require("stream");
|
|
312758
|
-
var
|
|
312759
|
-
var
|
|
312812
|
+
var fs50 = require("fs");
|
|
312813
|
+
var path54 = require("path");
|
|
312760
312814
|
var crypto4 = require("crypto");
|
|
312761
312815
|
var DKIM_ALGO = "sha256";
|
|
312762
312816
|
var MAX_MESSAGE_SIZE = 2 * 1024 * 1024;
|
|
@@ -312770,7 +312824,7 @@ var require_dkim = __commonJS({
|
|
|
312770
312824
|
this.chunks = [];
|
|
312771
312825
|
this.chunklen = 0;
|
|
312772
312826
|
this.readPos = 0;
|
|
312773
|
-
this.cachePath = this.cacheDir ?
|
|
312827
|
+
this.cachePath = this.cacheDir ? path54.join(this.cacheDir, "message." + Date.now() + "-" + crypto4.randomBytes(14).toString("hex")) : false;
|
|
312774
312828
|
this.cache = false;
|
|
312775
312829
|
this.headers = false;
|
|
312776
312830
|
this.bodyHash = false;
|
|
@@ -312790,10 +312844,10 @@ var require_dkim = __commonJS({
|
|
|
312790
312844
|
if (!this.cache || !this.cachePath) {
|
|
312791
312845
|
return;
|
|
312792
312846
|
}
|
|
312793
|
-
|
|
312847
|
+
fs50.unlink(this.cachePath, () => false);
|
|
312794
312848
|
}
|
|
312795
312849
|
createReadCache() {
|
|
312796
|
-
this.cache =
|
|
312850
|
+
this.cache = fs50.createReadStream(this.cachePath);
|
|
312797
312851
|
this.cache.once("error", (err) => {
|
|
312798
312852
|
this.cleanup();
|
|
312799
312853
|
this.output.emit("error", err);
|
|
@@ -312849,7 +312903,7 @@ var require_dkim = __commonJS({
|
|
|
312849
312903
|
}
|
|
312850
312904
|
createWriteCache() {
|
|
312851
312905
|
this.output.usingCache = true;
|
|
312852
|
-
this.cache =
|
|
312906
|
+
this.cache = fs50.createWriteStream(this.cachePath);
|
|
312853
312907
|
this.cache.once("error", (err) => {
|
|
312854
312908
|
this.cleanup();
|
|
312855
312909
|
this.relaxedBody.unpipe(this.cache);
|
|
@@ -313778,7 +313832,7 @@ var require_smtp_connection = __commonJS({
|
|
|
313778
313832
|
var { EventEmitter: EventEmitter5 } = require("events");
|
|
313779
313833
|
var net = require("net");
|
|
313780
313834
|
var tls = require("tls");
|
|
313781
|
-
var
|
|
313835
|
+
var os8 = require("os");
|
|
313782
313836
|
var crypto4 = require("crypto");
|
|
313783
313837
|
var DataStream = require_data_stream();
|
|
313784
313838
|
var { PassThrough } = require("stream");
|
|
@@ -315213,7 +315267,7 @@ var require_smtp_connection = __commonJS({
|
|
|
315213
315267
|
_getHostname() {
|
|
315214
315268
|
let defaultHostname;
|
|
315215
315269
|
try {
|
|
315216
|
-
defaultHostname =
|
|
315270
|
+
defaultHostname = os8.hostname() || "";
|
|
315217
315271
|
} catch (_err) {
|
|
315218
315272
|
defaultHostname = "localhost";
|
|
315219
315273
|
}
|
|
@@ -328111,11 +328165,11 @@ var require_mime_types2 = __commonJS({
|
|
|
328111
328165
|
}
|
|
328112
328166
|
return exts[0];
|
|
328113
328167
|
}
|
|
328114
|
-
function lookup(
|
|
328115
|
-
if (!
|
|
328168
|
+
function lookup(path54) {
|
|
328169
|
+
if (!path54 || typeof path54 !== "string") {
|
|
328116
328170
|
return false;
|
|
328117
328171
|
}
|
|
328118
|
-
var extension2 = extname2("x." +
|
|
328172
|
+
var extension2 = extname2("x." + path54).toLowerCase().substr(1);
|
|
328119
328173
|
if (!extension2) {
|
|
328120
328174
|
return false;
|
|
328121
328175
|
}
|
|
@@ -329220,11 +329274,11 @@ var require_form_data = __commonJS({
|
|
|
329220
329274
|
"use strict";
|
|
329221
329275
|
var CombinedStream = require_combined_stream();
|
|
329222
329276
|
var util3 = require("util");
|
|
329223
|
-
var
|
|
329277
|
+
var path54 = require("path");
|
|
329224
329278
|
var http3 = require("http");
|
|
329225
329279
|
var https4 = require("https");
|
|
329226
329280
|
var parseUrl2 = require("url").parse;
|
|
329227
|
-
var
|
|
329281
|
+
var fs50 = require("fs");
|
|
329228
329282
|
var Stream = require("stream").Stream;
|
|
329229
329283
|
var crypto4 = require("crypto");
|
|
329230
329284
|
var mime = require_mime_types2();
|
|
@@ -329291,7 +329345,7 @@ var require_form_data = __commonJS({
|
|
|
329291
329345
|
if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
|
|
329292
329346
|
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
329293
329347
|
} else {
|
|
329294
|
-
|
|
329348
|
+
fs50.stat(value.path, function(err, stat) {
|
|
329295
329349
|
if (err) {
|
|
329296
329350
|
callback(err);
|
|
329297
329351
|
return;
|
|
@@ -329348,11 +329402,11 @@ var require_form_data = __commonJS({
|
|
|
329348
329402
|
FormData3.prototype._getContentDisposition = function(value, options) {
|
|
329349
329403
|
var filename;
|
|
329350
329404
|
if (typeof options.filepath === "string") {
|
|
329351
|
-
filename =
|
|
329405
|
+
filename = path54.normalize(options.filepath).replace(/\\/g, "/");
|
|
329352
329406
|
} else if (options.filename || value && (value.name || value.path)) {
|
|
329353
|
-
filename =
|
|
329407
|
+
filename = path54.basename(options.filename || value && (value.name || value.path));
|
|
329354
329408
|
} else if (value && value.readable && hasOwn(value, "httpVersion")) {
|
|
329355
|
-
filename =
|
|
329409
|
+
filename = path54.basename(value.client._httpMessage.path || "");
|
|
329356
329410
|
}
|
|
329357
329411
|
if (filename) {
|
|
329358
329412
|
return 'filename="' + filename + '"';
|
|
@@ -329549,9 +329603,9 @@ function isVisitable(thing) {
|
|
|
329549
329603
|
function removeBrackets(key) {
|
|
329550
329604
|
return utils_default.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
329551
329605
|
}
|
|
329552
|
-
function renderKey(
|
|
329553
|
-
if (!
|
|
329554
|
-
return
|
|
329606
|
+
function renderKey(path54, key, dots) {
|
|
329607
|
+
if (!path54) return key;
|
|
329608
|
+
return path54.concat(key).map(function each(token, i) {
|
|
329555
329609
|
token = removeBrackets(token);
|
|
329556
329610
|
return !dots && i ? "[" + token + "]" : token;
|
|
329557
329611
|
}).join(dots ? "." : "");
|
|
@@ -329602,13 +329656,13 @@ function toFormData(obj2, formData, options) {
|
|
|
329602
329656
|
}
|
|
329603
329657
|
return value;
|
|
329604
329658
|
}
|
|
329605
|
-
function defaultVisitor(value, key,
|
|
329659
|
+
function defaultVisitor(value, key, path54) {
|
|
329606
329660
|
let arr = value;
|
|
329607
329661
|
if (utils_default.isReactNative(formData) && utils_default.isReactNativeBlob(value)) {
|
|
329608
|
-
formData.append(renderKey(
|
|
329662
|
+
formData.append(renderKey(path54, key, dots), convertValue(value));
|
|
329609
329663
|
return false;
|
|
329610
329664
|
}
|
|
329611
|
-
if (value && !
|
|
329665
|
+
if (value && !path54 && typeof value === "object") {
|
|
329612
329666
|
if (utils_default.endsWith(key, "{}")) {
|
|
329613
329667
|
key = metaTokens ? key : key.slice(0, -2);
|
|
329614
329668
|
value = JSON.stringify(value);
|
|
@@ -329627,7 +329681,7 @@ function toFormData(obj2, formData, options) {
|
|
|
329627
329681
|
if (isVisitable(value)) {
|
|
329628
329682
|
return true;
|
|
329629
329683
|
}
|
|
329630
|
-
formData.append(renderKey(
|
|
329684
|
+
formData.append(renderKey(path54, key, dots), convertValue(value));
|
|
329631
329685
|
return false;
|
|
329632
329686
|
}
|
|
329633
329687
|
const stack = [];
|
|
@@ -329636,7 +329690,7 @@ function toFormData(obj2, formData, options) {
|
|
|
329636
329690
|
convertValue,
|
|
329637
329691
|
isVisitable
|
|
329638
329692
|
});
|
|
329639
|
-
function build(value,
|
|
329693
|
+
function build(value, path54, depth = 0) {
|
|
329640
329694
|
if (utils_default.isUndefined(value)) return;
|
|
329641
329695
|
if (depth > maxDepth) {
|
|
329642
329696
|
throw new AxiosError_default(
|
|
@@ -329645,13 +329699,13 @@ function toFormData(obj2, formData, options) {
|
|
|
329645
329699
|
);
|
|
329646
329700
|
}
|
|
329647
329701
|
if (stack.indexOf(value) !== -1) {
|
|
329648
|
-
throw Error("Circular reference detected in " +
|
|
329702
|
+
throw Error("Circular reference detected in " + path54.join("."));
|
|
329649
329703
|
}
|
|
329650
329704
|
stack.push(value);
|
|
329651
329705
|
utils_default.forEach(value, function each(el, key) {
|
|
329652
|
-
const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(formData, el, utils_default.isString(key) ? key.trim() : key,
|
|
329706
|
+
const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(formData, el, utils_default.isString(key) ? key.trim() : key, path54, exposedHelpers);
|
|
329653
329707
|
if (result === true) {
|
|
329654
|
-
build(el,
|
|
329708
|
+
build(el, path54 ? path54.concat(key) : [key], depth + 1);
|
|
329655
329709
|
}
|
|
329656
329710
|
});
|
|
329657
329711
|
stack.pop();
|
|
@@ -329924,7 +329978,7 @@ var init_platform = __esm({
|
|
|
329924
329978
|
// node_modules/axios/lib/helpers/toURLEncodedForm.js
|
|
329925
329979
|
function toURLEncodedForm(data, options) {
|
|
329926
329980
|
return toFormData_default(data, new platform_default.classes.URLSearchParams(), {
|
|
329927
|
-
visitor: function(value, key,
|
|
329981
|
+
visitor: function(value, key, path54, helpers) {
|
|
329928
329982
|
if (platform_default.isNode && utils_default.isBuffer(value)) {
|
|
329929
329983
|
this.append(key, value.toString("base64"));
|
|
329930
329984
|
return false;
|
|
@@ -329962,11 +330016,11 @@ function arrayToObject(arr) {
|
|
|
329962
330016
|
return obj2;
|
|
329963
330017
|
}
|
|
329964
330018
|
function formDataToJSON(formData) {
|
|
329965
|
-
function buildPath(
|
|
329966
|
-
let name =
|
|
330019
|
+
function buildPath(path54, value, target, index) {
|
|
330020
|
+
let name = path54[index++];
|
|
329967
330021
|
if (name === "__proto__") return true;
|
|
329968
330022
|
const isNumericKey = Number.isFinite(+name);
|
|
329969
|
-
const isLast = index >=
|
|
330023
|
+
const isLast = index >= path54.length;
|
|
329970
330024
|
name = !name && utils_default.isArray(target) ? target.length : name;
|
|
329971
330025
|
if (isLast) {
|
|
329972
330026
|
if (utils_default.hasOwnProp(target, name)) {
|
|
@@ -329979,7 +330033,7 @@ function formDataToJSON(formData) {
|
|
|
329979
330033
|
if (!target[name] || !utils_default.isObject(target[name])) {
|
|
329980
330034
|
target[name] = [];
|
|
329981
330035
|
}
|
|
329982
|
-
const result = buildPath(
|
|
330036
|
+
const result = buildPath(path54, value, target[name], index);
|
|
329983
330037
|
if (result && utils_default.isArray(target[name])) {
|
|
329984
330038
|
target[name] = arrayToObject(target[name]);
|
|
329985
330039
|
}
|
|
@@ -331021,8 +331075,8 @@ var require_node = __commonJS({
|
|
|
331021
331075
|
}
|
|
331022
331076
|
break;
|
|
331023
331077
|
case "FILE":
|
|
331024
|
-
var
|
|
331025
|
-
stream5 = new
|
|
331078
|
+
var fs50 = require("fs");
|
|
331079
|
+
stream5 = new fs50.SyncWriteStream(fd2, { autoClose: false });
|
|
331026
331080
|
stream5._type = "fs";
|
|
331027
331081
|
break;
|
|
331028
331082
|
case "PIPE":
|
|
@@ -332707,9 +332761,9 @@ var init_http = __esm({
|
|
|
332707
332761
|
auth = urlUsername + ":" + urlPassword;
|
|
332708
332762
|
}
|
|
332709
332763
|
auth && headers.delete("authorization");
|
|
332710
|
-
let
|
|
332764
|
+
let path54;
|
|
332711
332765
|
try {
|
|
332712
|
-
|
|
332766
|
+
path54 = buildURL(
|
|
332713
332767
|
parsed.pathname + parsed.search,
|
|
332714
332768
|
config2.params,
|
|
332715
332769
|
config2.paramsSerializer
|
|
@@ -332727,7 +332781,7 @@ var init_http = __esm({
|
|
|
332727
332781
|
false
|
|
332728
332782
|
);
|
|
332729
332783
|
const options = {
|
|
332730
|
-
path:
|
|
332784
|
+
path: path54,
|
|
332731
332785
|
method,
|
|
332732
332786
|
headers: headers.toJSON(),
|
|
332733
332787
|
agents: { http: config2.httpAgent, https: config2.httpsAgent },
|
|
@@ -333053,14 +333107,14 @@ var init_cookies = __esm({
|
|
|
333053
333107
|
cookies_default = platform_default.hasStandardBrowserEnv ? (
|
|
333054
333108
|
// Standard browser envs support document.cookie
|
|
333055
333109
|
{
|
|
333056
|
-
write(name, value, expires,
|
|
333110
|
+
write(name, value, expires, path54, domain, secure, sameSite) {
|
|
333057
333111
|
if (typeof document === "undefined") return;
|
|
333058
333112
|
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
333059
333113
|
if (utils_default.isNumber(expires)) {
|
|
333060
333114
|
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
333061
333115
|
}
|
|
333062
|
-
if (utils_default.isString(
|
|
333063
|
-
cookie.push(`path=${
|
|
333116
|
+
if (utils_default.isString(path54)) {
|
|
333117
|
+
cookie.push(`path=${path54}`);
|
|
333064
333118
|
}
|
|
333065
333119
|
if (utils_default.isString(domain)) {
|
|
333066
333120
|
cookie.push(`domain=${domain}`);
|
|
@@ -335992,6 +336046,290 @@ var init_hybridSearch = __esm({
|
|
|
335992
336046
|
}
|
|
335993
336047
|
});
|
|
335994
336048
|
|
|
336049
|
+
// core/memoryIds.ts
|
|
336050
|
+
function _ensureDir() {
|
|
336051
|
+
fs39.mkdirSync(MEM_DIR, { recursive: true });
|
|
336052
|
+
}
|
|
336053
|
+
function _readSeq() {
|
|
336054
|
+
try {
|
|
336055
|
+
if (!fs39.existsSync(SEQUENCE_FILE)) return 0;
|
|
336056
|
+
const d = JSON.parse(fs39.readFileSync(SEQUENCE_FILE, "utf-8"));
|
|
336057
|
+
return typeof d.next === "number" ? d.next : 0;
|
|
336058
|
+
} catch {
|
|
336059
|
+
return 0;
|
|
336060
|
+
}
|
|
336061
|
+
}
|
|
336062
|
+
function _writeSeq(n) {
|
|
336063
|
+
_ensureDir();
|
|
336064
|
+
fs39.writeFileSync(SEQUENCE_FILE, JSON.stringify({ next: n }), "utf-8");
|
|
336065
|
+
}
|
|
336066
|
+
function nextId() {
|
|
336067
|
+
const n = _readSeq();
|
|
336068
|
+
_writeSeq(n + 1);
|
|
336069
|
+
return `mem_${String(n + 1).padStart(6, "0")}`;
|
|
336070
|
+
}
|
|
336071
|
+
function appendRecord(record2) {
|
|
336072
|
+
_ensureDir();
|
|
336073
|
+
fs39.appendFileSync(RECORDS_FILE, JSON.stringify(record2) + "\n", "utf-8");
|
|
336074
|
+
}
|
|
336075
|
+
function loadAllRecords() {
|
|
336076
|
+
try {
|
|
336077
|
+
if (!fs39.existsSync(RECORDS_FILE)) return [];
|
|
336078
|
+
return fs39.readFileSync(RECORDS_FILE, "utf-8").split("\n").filter((l) => l.trim()).map((l) => {
|
|
336079
|
+
try {
|
|
336080
|
+
return JSON.parse(l);
|
|
336081
|
+
} catch {
|
|
336082
|
+
return null;
|
|
336083
|
+
}
|
|
336084
|
+
}).filter((r) => r !== null);
|
|
336085
|
+
} catch {
|
|
336086
|
+
return [];
|
|
336087
|
+
}
|
|
336088
|
+
}
|
|
336089
|
+
function removeRecords(predicate) {
|
|
336090
|
+
const all3 = loadAllRecords();
|
|
336091
|
+
const kept = all3.filter((r) => !predicate(r));
|
|
336092
|
+
const removed = all3.length - kept.length;
|
|
336093
|
+
if (removed > 0) {
|
|
336094
|
+
_ensureDir();
|
|
336095
|
+
fs39.writeFileSync(
|
|
336096
|
+
RECORDS_FILE,
|
|
336097
|
+
kept.map((r) => JSON.stringify(r)).join("\n") + (kept.length ? "\n" : ""),
|
|
336098
|
+
"utf-8"
|
|
336099
|
+
);
|
|
336100
|
+
}
|
|
336101
|
+
return removed;
|
|
336102
|
+
}
|
|
336103
|
+
function assignId(partial2) {
|
|
336104
|
+
const record2 = {
|
|
336105
|
+
id: partial2.id ?? nextId(),
|
|
336106
|
+
timestamp: partial2.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
336107
|
+
type: partial2.type ?? "observation",
|
|
336108
|
+
content: partial2.content ?? "",
|
|
336109
|
+
summary: partial2.summary ?? _autoSummary(partial2.content ?? ""),
|
|
336110
|
+
sessionId: partial2.sessionId,
|
|
336111
|
+
tags: partial2.tags,
|
|
336112
|
+
entityRefs: partial2.entityRefs
|
|
336113
|
+
};
|
|
336114
|
+
appendRecord(record2);
|
|
336115
|
+
return record2;
|
|
336116
|
+
}
|
|
336117
|
+
function _autoSummary(content) {
|
|
336118
|
+
const first = content.split("\n").find((l) => l.trim()) ?? content;
|
|
336119
|
+
return first.slice(0, 100).trim();
|
|
336120
|
+
}
|
|
336121
|
+
var fs39, path41, MEM_DIR, SEQUENCE_FILE, RECORDS_FILE;
|
|
336122
|
+
var init_memoryIds = __esm({
|
|
336123
|
+
"core/memoryIds.ts"() {
|
|
336124
|
+
fs39 = __toESM(require("fs"));
|
|
336125
|
+
path41 = __toESM(require("path"));
|
|
336126
|
+
MEM_DIR = path41.join(process.cwd(), "workspace", "memory");
|
|
336127
|
+
SEQUENCE_FILE = path41.join(MEM_DIR, "sequence.json");
|
|
336128
|
+
RECORDS_FILE = path41.join(MEM_DIR, "records.jsonl");
|
|
336129
|
+
}
|
|
336130
|
+
});
|
|
336131
|
+
|
|
336132
|
+
// core/slashAsTool.ts
|
|
336133
|
+
var slashAsTool_exports = {};
|
|
336134
|
+
__export(slashAsTool_exports, {
|
|
336135
|
+
SLASH_MIRROR_TOOL_NAMES: () => SLASH_MIRROR_TOOL_NAMES,
|
|
336136
|
+
registerSlashMirrorTools: () => registerSlashMirrorTools,
|
|
336137
|
+
toolMemoryForget: () => toolMemoryForget,
|
|
336138
|
+
toolMemoryStore: () => toolMemoryStore
|
|
336139
|
+
});
|
|
336140
|
+
function loadLessonsText() {
|
|
336141
|
+
try {
|
|
336142
|
+
if (import_fs37.default.existsSync(LESSONS_PATH2)) return import_fs37.default.readFileSync(LESSONS_PATH2, "utf-8").trim();
|
|
336143
|
+
} catch {
|
|
336144
|
+
}
|
|
336145
|
+
return "";
|
|
336146
|
+
}
|
|
336147
|
+
async function toolStatus(_) {
|
|
336148
|
+
const uptimeSec = Math.floor(process.uptime());
|
|
336149
|
+
const ramMB = Math.round(process.memoryUsage().heapUsed / 1024 / 1024);
|
|
336150
|
+
const sessions = conversationMemory.getSessions().length;
|
|
336151
|
+
const lines = [
|
|
336152
|
+
"SYSTEM STATUS",
|
|
336153
|
+
`Uptime ${Math.floor(uptimeSec / 60)}m ${uptimeSec % 60}s`,
|
|
336154
|
+
`RAM ${ramMB} MB`,
|
|
336155
|
+
`Sessions ${sessions}`,
|
|
336156
|
+
`Platform ${import_os3.default.platform()} ${import_os3.default.arch()}`,
|
|
336157
|
+
`Node ${process.version}`
|
|
336158
|
+
];
|
|
336159
|
+
return { success: true, output: lines.join("\n") };
|
|
336160
|
+
}
|
|
336161
|
+
async function toolAnalytics(_) {
|
|
336162
|
+
const stats = learningMemory.getStats();
|
|
336163
|
+
const lines = [
|
|
336164
|
+
"LEARNING ANALYTICS",
|
|
336165
|
+
`Total tasks ${stats.total}`,
|
|
336166
|
+
`Success rate ${stats.successRate}%`,
|
|
336167
|
+
`Avg duration ${stats.avgDuration}ms`
|
|
336168
|
+
];
|
|
336169
|
+
return { success: true, output: lines.join("\n") };
|
|
336170
|
+
}
|
|
336171
|
+
async function toolSpend(_) {
|
|
336172
|
+
try {
|
|
336173
|
+
const summary = costTracker.getDailySummary();
|
|
336174
|
+
const byProvider = Object.entries(summary.byProvider || {}).map(([p, c]) => ` ${p}: $${c.toFixed(4)}`).join("\n");
|
|
336175
|
+
const lines = [
|
|
336176
|
+
`SPEND \u2014 ${summary.date}`,
|
|
336177
|
+
`Total $${summary.totalUSD.toFixed(4)}`,
|
|
336178
|
+
`User $${summary.userUSD.toFixed(4)}`,
|
|
336179
|
+
`System $${summary.systemUSD.toFixed(4)}`,
|
|
336180
|
+
byProvider ? `By provider:
|
|
336181
|
+
${byProvider}` : ""
|
|
336182
|
+
].filter(Boolean);
|
|
336183
|
+
return { success: true, output: lines.join("\n") };
|
|
336184
|
+
} catch {
|
|
336185
|
+
return { success: true, output: "Spend data unavailable." };
|
|
336186
|
+
}
|
|
336187
|
+
}
|
|
336188
|
+
async function toolMemoryShow(_) {
|
|
336189
|
+
const facts = conversationMemory.getFacts();
|
|
336190
|
+
const history2 = conversationMemory.getRecentHistory();
|
|
336191
|
+
const lines = [
|
|
336192
|
+
"MEMORY FACTS",
|
|
336193
|
+
facts.lastFilesCreated.length ? `Files created : ${facts.lastFilesCreated.join(", ")}` : "",
|
|
336194
|
+
facts.lastSearchQueries.length ? `Last searches : ${facts.lastSearchQueries.join(", ")}` : "",
|
|
336195
|
+
facts.lastToolsUsed.length ? `Last tools : ${facts.lastToolsUsed.join(", ")}` : "",
|
|
336196
|
+
facts.mentionedEntities.length ? `Topics : ${facts.mentionedEntities.slice(-10).join(", ")}` : "",
|
|
336197
|
+
"",
|
|
336198
|
+
`Recent exchanges: ${history2.length}`,
|
|
336199
|
+
...history2.slice(-3).map(
|
|
336200
|
+
(e) => e.userMessage ? ` User: ${e.userMessage.slice(0, 80)}` : ""
|
|
336201
|
+
).filter(Boolean)
|
|
336202
|
+
].filter((l) => l !== void 0);
|
|
336203
|
+
return { success: true, output: lines.join("\n") };
|
|
336204
|
+
}
|
|
336205
|
+
async function toolLessons(_) {
|
|
336206
|
+
const lessons = loadLessonsText();
|
|
336207
|
+
if (!lessons) return { success: true, output: "No lessons recorded yet." };
|
|
336208
|
+
return { success: true, output: `LESSONS (permanent failure rules):
|
|
336209
|
+
${lessons}` };
|
|
336210
|
+
}
|
|
336211
|
+
async function toolSkillsList(_) {
|
|
336212
|
+
const skills = skillLoader.loadAll();
|
|
336213
|
+
if (skills.length === 0) return { success: true, output: "No skills loaded." };
|
|
336214
|
+
const lines = [
|
|
336215
|
+
`SKILLS (${skills.length} loaded)`,
|
|
336216
|
+
...skills.map((s) => ` ${s.name.padEnd(20)} ${s.description || ""}`)
|
|
336217
|
+
];
|
|
336218
|
+
return { success: true, output: lines.join("\n") };
|
|
336219
|
+
}
|
|
336220
|
+
async function toolToolsList(_) {
|
|
336221
|
+
const { TOOLS: TOOLS3 } = await Promise.resolve().then(() => (init_toolRegistry(), toolRegistry_exports));
|
|
336222
|
+
const names = Object.keys(TOOLS3).sort();
|
|
336223
|
+
return { success: true, output: `TOOLS (${names.length}):
|
|
336224
|
+
${names.join(", ")}` };
|
|
336225
|
+
}
|
|
336226
|
+
async function toolWhoami(_) {
|
|
336227
|
+
const cfg = loadConfig();
|
|
336228
|
+
const userName = cfg.userName || process.env.USERNAME || import_os3.default.userInfo().username || "User";
|
|
336229
|
+
const homeDir = import_os3.default.homedir();
|
|
336230
|
+
const lines = [
|
|
336231
|
+
"USER PROFILE",
|
|
336232
|
+
`Name ${userName}`,
|
|
336233
|
+
`Home ${homeDir}`,
|
|
336234
|
+
`Platform ${import_os3.default.platform()}`
|
|
336235
|
+
];
|
|
336236
|
+
return { success: true, output: lines.join("\n") };
|
|
336237
|
+
}
|
|
336238
|
+
async function toolChannelsStatus(_) {
|
|
336239
|
+
try {
|
|
336240
|
+
const cfg = loadConfig();
|
|
336241
|
+
const apis = cfg?.providers?.apis || [];
|
|
336242
|
+
const lines = [
|
|
336243
|
+
"PROVIDER CHANNELS",
|
|
336244
|
+
...apis.map((api) => {
|
|
336245
|
+
const key = String(api.key || "");
|
|
336246
|
+
const hasKey = key.startsWith("env:") ? !!(process.env[key.replace("env:", "")] || "").trim() : key.trim().length > 0;
|
|
336247
|
+
const status = !api.enabled ? "disabled" : api.rateLimited ? "rate-limited" : hasKey ? "active" : "no key";
|
|
336248
|
+
return ` ${(api.name || api.provider || "").padEnd(20)} ${api.model || ""} [${status}]`;
|
|
336249
|
+
})
|
|
336250
|
+
];
|
|
336251
|
+
return { success: true, output: lines.join("\n") };
|
|
336252
|
+
} catch {
|
|
336253
|
+
return { success: true, output: "Provider status unavailable." };
|
|
336254
|
+
}
|
|
336255
|
+
}
|
|
336256
|
+
async function toolMemoryStore(input) {
|
|
336257
|
+
const fact = String(
|
|
336258
|
+
input?.fact || input?.content || input?.text || input?.preference || input?.value || input?.memory || input?.note || input?.data || input?.information || input?.detail || input?.message || input?.entry || input?.record || (input && typeof input === "object" ? Object.values(input).find((v) => typeof v === "string" && v.trim().length > 0) : "") || ""
|
|
336259
|
+
).trim();
|
|
336260
|
+
if (!fact) return { success: false, output: 'No fact provided. Pass { fact: "the thing to remember" }' };
|
|
336261
|
+
const record2 = assignId({
|
|
336262
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
336263
|
+
type: input?.type ?? "fact",
|
|
336264
|
+
content: fact,
|
|
336265
|
+
summary: fact.slice(0, 100),
|
|
336266
|
+
tags: Array.isArray(input?.tags) ? input.tags : []
|
|
336267
|
+
});
|
|
336268
|
+
return { success: true, output: `Stored as ${record2.id}: ${record2.summary}` };
|
|
336269
|
+
}
|
|
336270
|
+
async function toolMemoryForget(input) {
|
|
336271
|
+
const keyword = String(
|
|
336272
|
+
input?.fact || input?.keyword || input?.content || input?.text || input?.query || input?.topic || input?.subject || (input && typeof input === "object" ? Object.values(input).find((v) => typeof v === "string" && v.trim().length > 0) : "") || ""
|
|
336273
|
+
).trim().toLowerCase();
|
|
336274
|
+
if (!keyword)
|
|
336275
|
+
return { success: false, output: 'No keyword provided. Pass { fact: "thing to forget" }' };
|
|
336276
|
+
const removed = removeRecords(
|
|
336277
|
+
(r) => r.content.toLowerCase().includes(keyword) || r.summary.toLowerCase().includes(keyword)
|
|
336278
|
+
);
|
|
336279
|
+
if (removed === 0)
|
|
336280
|
+
return { success: true, output: `No memory entries matched "${keyword}".` };
|
|
336281
|
+
return { success: true, output: `Removed ${removed} memory entry(s) matching "${keyword}".` };
|
|
336282
|
+
}
|
|
336283
|
+
async function toolGoals(_) {
|
|
336284
|
+
const summary = getActiveGoalsSummary();
|
|
336285
|
+
return { success: true, output: summary ? `ACTIVE GOALS:
|
|
336286
|
+
${summary}` : "No active goals." };
|
|
336287
|
+
}
|
|
336288
|
+
function registerSlashMirrorTools() {
|
|
336289
|
+
const isDebug = (process.env.AIDEN_LOG_LEVEL || "info") === "debug";
|
|
336290
|
+
for (const { name, description, fn } of MIRROR_TOOLS) {
|
|
336291
|
+
registerExternalTool(name, fn, "slash-mirror");
|
|
336292
|
+
if (isDebug) {
|
|
336293
|
+
console.log("[SlashAsTool] Registered mirror tool: " + name + " \u2014 " + description);
|
|
336294
|
+
}
|
|
336295
|
+
}
|
|
336296
|
+
if (!isDebug) {
|
|
336297
|
+
console.log("[SlashAsTool] Registered " + MIRROR_TOOLS.length + " mirror tools (AIDEN_LOG_LEVEL=debug for detail)");
|
|
336298
|
+
}
|
|
336299
|
+
}
|
|
336300
|
+
var import_fs37, import_path39, import_os3, LESSONS_PATH2, MIRROR_TOOLS, SLASH_MIRROR_TOOL_NAMES;
|
|
336301
|
+
var init_slashAsTool = __esm({
|
|
336302
|
+
"core/slashAsTool.ts"() {
|
|
336303
|
+
import_fs37 = __toESM(require("fs"));
|
|
336304
|
+
import_path39 = __toESM(require("path"));
|
|
336305
|
+
import_os3 = __toESM(require("os"));
|
|
336306
|
+
init_toolRegistry();
|
|
336307
|
+
init_memoryIds();
|
|
336308
|
+
init_conversationMemory();
|
|
336309
|
+
init_learningMemory();
|
|
336310
|
+
init_skillLoader();
|
|
336311
|
+
init_costTracker();
|
|
336312
|
+
init_goalTracker();
|
|
336313
|
+
init_providers();
|
|
336314
|
+
LESSONS_PATH2 = import_path39.default.join(process.cwd(), "workspace", "LESSONS.md");
|
|
336315
|
+
MIRROR_TOOLS = [
|
|
336316
|
+
{ name: "status", description: "Show system status: uptime, RAM, session count", fn: toolStatus },
|
|
336317
|
+
{ name: "analytics", description: "Show learning analytics: task count, success rate", fn: toolAnalytics },
|
|
336318
|
+
{ name: "spend", description: "Show today's token cost and spend by provider", fn: toolSpend },
|
|
336319
|
+
{ name: "memory_show", description: "Show conversation memory facts and recent history", fn: toolMemoryShow },
|
|
336320
|
+
{ name: "memory_store", description: 'Persist a fact or preference to permanent memory (records.jsonl) right now. Pass { fact: "..." }', fn: toolMemoryStore },
|
|
336321
|
+
{ name: "memory_forget", description: 'Remove a fact or preference from permanent memory (records.jsonl). Pass { fact: "thing to forget" }', fn: toolMemoryForget },
|
|
336322
|
+
{ name: "lessons", description: "Show permanent failure rules learned from past tasks", fn: toolLessons },
|
|
336323
|
+
{ name: "skills_list", description: "List all loaded skills with descriptions", fn: toolSkillsList },
|
|
336324
|
+
{ name: "tools_list", description: "List all registered tool names", fn: toolToolsList },
|
|
336325
|
+
{ name: "whoami", description: "Show current user profile: name, home dir, platform", fn: toolWhoami },
|
|
336326
|
+
{ name: "channels_status", description: "Show provider channel status: active, disabled, no-key", fn: toolChannelsStatus },
|
|
336327
|
+
{ name: "goals", description: "Show currently active goals", fn: toolGoals }
|
|
336328
|
+
];
|
|
336329
|
+
SLASH_MIRROR_TOOL_NAMES = MIRROR_TOOLS.map((t) => t.name);
|
|
336330
|
+
}
|
|
336331
|
+
});
|
|
336332
|
+
|
|
335995
336333
|
// core/clarifyBus.ts
|
|
335996
336334
|
var clarifyBus_exports = {};
|
|
335997
336335
|
__export(clarifyBus_exports, {
|
|
@@ -336121,15 +336459,15 @@ __export(cronManager_exports, {
|
|
|
336121
336459
|
});
|
|
336122
336460
|
function save() {
|
|
336123
336461
|
try {
|
|
336124
|
-
if (!
|
|
336125
|
-
|
|
336462
|
+
if (!fs41.existsSync(DATA_DIR)) fs41.mkdirSync(DATA_DIR, { recursive: true });
|
|
336463
|
+
fs41.writeFileSync(DATA_FILE, JSON.stringify(Array.from(jobs.values()), null, 2), "utf8");
|
|
336126
336464
|
} catch {
|
|
336127
336465
|
}
|
|
336128
336466
|
}
|
|
336129
336467
|
function loadJobs() {
|
|
336130
336468
|
try {
|
|
336131
|
-
if (!
|
|
336132
|
-
const data = JSON.parse(
|
|
336469
|
+
if (!fs41.existsSync(DATA_FILE)) return;
|
|
336470
|
+
const data = JSON.parse(fs41.readFileSync(DATA_FILE, "utf8"));
|
|
336133
336471
|
for (const job of data) {
|
|
336134
336472
|
jobs.set(job.id, job);
|
|
336135
336473
|
const num2 = parseInt(job.id, 10);
|
|
@@ -336247,17 +336585,17 @@ async function triggerJob(id) {
|
|
|
336247
336585
|
return false;
|
|
336248
336586
|
}
|
|
336249
336587
|
}
|
|
336250
|
-
var
|
|
336588
|
+
var fs41, path43, os4, jobs, timers, jobSeq, DATA_DIR, DATA_FILE;
|
|
336251
336589
|
var init_cronManager = __esm({
|
|
336252
336590
|
"core/cronManager.ts"() {
|
|
336253
|
-
|
|
336254
|
-
|
|
336255
|
-
|
|
336591
|
+
fs41 = __toESM(require("fs"));
|
|
336592
|
+
path43 = __toESM(require("path"));
|
|
336593
|
+
os4 = __toESM(require("os"));
|
|
336256
336594
|
jobs = /* @__PURE__ */ new Map();
|
|
336257
336595
|
timers = /* @__PURE__ */ new Map();
|
|
336258
336596
|
jobSeq = 1;
|
|
336259
|
-
DATA_DIR =
|
|
336260
|
-
DATA_FILE =
|
|
336597
|
+
DATA_DIR = path43.join(os4.homedir(), ".aiden");
|
|
336598
|
+
DATA_FILE = path43.join(DATA_DIR, "cron_jobs.json");
|
|
336261
336599
|
}
|
|
336262
336600
|
});
|
|
336263
336601
|
|
|
@@ -336283,10 +336621,10 @@ async function analyzeImage(imageSource, prompt = "Describe this image in detail
|
|
|
336283
336621
|
let base64Data = "";
|
|
336284
336622
|
let mediaType = "image/jpeg";
|
|
336285
336623
|
if (!isUrl) {
|
|
336286
|
-
const absPath =
|
|
336287
|
-
const buf =
|
|
336624
|
+
const absPath = path44.isAbsolute(imageSource) ? imageSource : path44.resolve(process.cwd(), imageSource);
|
|
336625
|
+
const buf = fs42.readFileSync(absPath);
|
|
336288
336626
|
base64Data = buf.toString("base64");
|
|
336289
|
-
mediaType = extToMediaType(
|
|
336627
|
+
mediaType = extToMediaType(path44.extname(absPath));
|
|
336290
336628
|
}
|
|
336291
336629
|
const anthropicKey = process.env.ANTHROPIC_API_KEY;
|
|
336292
336630
|
if (anthropicKey) {
|
|
@@ -336366,11 +336704,11 @@ async function analyzeImage(imageSource, prompt = "Describe this image in detail
|
|
|
336366
336704
|
throw new Error(`vision_analyze: all providers exhausted. ${e.message}`);
|
|
336367
336705
|
}
|
|
336368
336706
|
}
|
|
336369
|
-
var
|
|
336707
|
+
var fs42, path44;
|
|
336370
336708
|
var init_visionAnalyze = __esm({
|
|
336371
336709
|
"core/visionAnalyze.ts"() {
|
|
336372
|
-
|
|
336373
|
-
|
|
336710
|
+
fs42 = __toESM(require("fs"));
|
|
336711
|
+
path44 = __toESM(require("path"));
|
|
336374
336712
|
init_axios2();
|
|
336375
336713
|
}
|
|
336376
336714
|
});
|
|
@@ -336378,9 +336716,9 @@ var init_visionAnalyze = __esm({
|
|
|
336378
336716
|
// core/dreamEngine.ts
|
|
336379
336717
|
function acquireLock() {
|
|
336380
336718
|
try {
|
|
336381
|
-
|
|
336382
|
-
if (
|
|
336383
|
-
const raw = JSON.parse(
|
|
336719
|
+
import_fs38.default.mkdirSync(import_path40.default.dirname(LOCK_FILE), { recursive: true });
|
|
336720
|
+
if (import_fs38.default.existsSync(LOCK_FILE)) {
|
|
336721
|
+
const raw = JSON.parse(import_fs38.default.readFileSync(LOCK_FILE, "utf-8"));
|
|
336384
336722
|
const alive = isPidAlive(raw.pid);
|
|
336385
336723
|
if (alive) {
|
|
336386
336724
|
console.log(`[DreamEngine] Lock held by PID ${raw.pid} \u2014 skipping`);
|
|
@@ -336389,7 +336727,7 @@ function acquireLock() {
|
|
|
336389
336727
|
console.log(`[DreamEngine] Stale lock (PID ${raw.pid} dead) \u2014 stealing`);
|
|
336390
336728
|
}
|
|
336391
336729
|
const data = { pid: process.pid, startedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
336392
|
-
|
|
336730
|
+
import_fs38.default.writeFileSync(LOCK_FILE, JSON.stringify(data));
|
|
336393
336731
|
return true;
|
|
336394
336732
|
} catch {
|
|
336395
336733
|
return false;
|
|
@@ -336399,9 +336737,9 @@ function releaseLock(prevMtime) {
|
|
|
336399
336737
|
try {
|
|
336400
336738
|
if (prevMtime !== void 0) {
|
|
336401
336739
|
const now = Date.now() / 1e3;
|
|
336402
|
-
|
|
336740
|
+
import_fs38.default.utimesSync(LOCK_FILE, now, now);
|
|
336403
336741
|
} else {
|
|
336404
|
-
|
|
336742
|
+
import_fs38.default.unlinkSync(LOCK_FILE);
|
|
336405
336743
|
}
|
|
336406
336744
|
} catch {
|
|
336407
336745
|
}
|
|
@@ -336416,8 +336754,8 @@ function isPidAlive(pid) {
|
|
|
336416
336754
|
}
|
|
336417
336755
|
function getLockMtime() {
|
|
336418
336756
|
try {
|
|
336419
|
-
if (!
|
|
336420
|
-
return
|
|
336757
|
+
if (!import_fs38.default.existsSync(LOCK_FILE)) return 0;
|
|
336758
|
+
return import_fs38.default.statSync(LOCK_FILE).mtimeMs;
|
|
336421
336759
|
} catch {
|
|
336422
336760
|
return 0;
|
|
336423
336761
|
}
|
|
@@ -336429,11 +336767,11 @@ function checkTimeGate(lockMtime) {
|
|
|
336429
336767
|
}
|
|
336430
336768
|
function checkSessionGate(lockMtime) {
|
|
336431
336769
|
try {
|
|
336432
|
-
if (!
|
|
336770
|
+
if (!import_fs38.default.existsSync(SESSIONS_DIR3)) return false;
|
|
336433
336771
|
const cutoff = lockMtime || 0;
|
|
336434
|
-
const newSessions =
|
|
336772
|
+
const newSessions = import_fs38.default.readdirSync(SESSIONS_DIR3).filter((f) => f.endsWith(".md")).filter((f) => {
|
|
336435
336773
|
try {
|
|
336436
|
-
return
|
|
336774
|
+
return import_fs38.default.statSync(import_path40.default.join(SESSIONS_DIR3, f)).mtimeMs > cutoff;
|
|
336437
336775
|
} catch {
|
|
336438
336776
|
return false;
|
|
336439
336777
|
}
|
|
@@ -336449,8 +336787,8 @@ function allGatesPass() {
|
|
|
336449
336787
|
}
|
|
336450
336788
|
async function phaseOrient() {
|
|
336451
336789
|
try {
|
|
336452
|
-
const indexContent =
|
|
336453
|
-
const memFiles =
|
|
336790
|
+
const indexContent = import_fs38.default.existsSync(INDEX_PATH2) ? import_fs38.default.readFileSync(INDEX_PATH2, "utf-8") : "(empty)";
|
|
336791
|
+
const memFiles = import_fs38.default.existsSync(MEMORY_DIR3) ? import_fs38.default.readdirSync(MEMORY_DIR3).filter((f) => f.endsWith(".md") && f !== "MEMORY_INDEX.md") : [];
|
|
336454
336792
|
return `MEMORY DIRECTORY (${memFiles.length} files):
|
|
336455
336793
|
${memFiles.join("\n")}
|
|
336456
336794
|
|
|
@@ -336462,10 +336800,10 @@ ${indexContent.slice(0, 2e3)}`;
|
|
|
336462
336800
|
}
|
|
336463
336801
|
async function phaseGather(lockMtime) {
|
|
336464
336802
|
try {
|
|
336465
|
-
if (!
|
|
336466
|
-
const recentSessions =
|
|
336803
|
+
if (!import_fs38.default.existsSync(SESSIONS_DIR3)) return "(no sessions)";
|
|
336804
|
+
const recentSessions = import_fs38.default.readdirSync(SESSIONS_DIR3).filter((f) => f.endsWith(".md")).filter((f) => {
|
|
336467
336805
|
try {
|
|
336468
|
-
return
|
|
336806
|
+
return import_fs38.default.statSync(import_path40.default.join(SESSIONS_DIR3, f)).mtimeMs > lockMtime;
|
|
336469
336807
|
} catch {
|
|
336470
336808
|
return false;
|
|
336471
336809
|
}
|
|
@@ -336473,7 +336811,7 @@ async function phaseGather(lockMtime) {
|
|
|
336473
336811
|
if (recentSessions.length === 0) return "(no new sessions)";
|
|
336474
336812
|
const excerpts = recentSessions.map((f) => {
|
|
336475
336813
|
try {
|
|
336476
|
-
const content =
|
|
336814
|
+
const content = import_fs38.default.readFileSync(import_path40.default.join(SESSIONS_DIR3, f), "utf-8");
|
|
336477
336815
|
return `=== ${f} ===
|
|
336478
336816
|
${content.slice(0, 800)}`;
|
|
336479
336817
|
} catch {
|
|
@@ -336523,11 +336861,11 @@ Rules:
|
|
|
336523
336861
|
const now = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
336524
336862
|
for (const item of items) {
|
|
336525
336863
|
if (!item.filename || !item.content) continue;
|
|
336526
|
-
const filePath =
|
|
336864
|
+
const filePath = import_path40.default.join(MEMORY_DIR3, item.filename);
|
|
336527
336865
|
let created = now;
|
|
336528
|
-
if (
|
|
336866
|
+
if (import_fs38.default.existsSync(filePath)) {
|
|
336529
336867
|
try {
|
|
336530
|
-
const existing =
|
|
336868
|
+
const existing = import_fs38.default.readFileSync(filePath, "utf-8");
|
|
336531
336869
|
const m = existing.match(/^created:\s*(.+)$/m);
|
|
336532
336870
|
if (m) created = m[1].trim();
|
|
336533
336871
|
} catch {
|
|
@@ -336543,7 +336881,7 @@ updated: ${now}
|
|
|
336543
336881
|
${item.content.trim()}
|
|
336544
336882
|
`;
|
|
336545
336883
|
try {
|
|
336546
|
-
|
|
336884
|
+
import_fs38.default.writeFileSync(filePath, fileContent, "utf-8");
|
|
336547
336885
|
filesUpdated++;
|
|
336548
336886
|
} catch {
|
|
336549
336887
|
}
|
|
@@ -336556,10 +336894,10 @@ ${item.content.trim()}
|
|
|
336556
336894
|
}
|
|
336557
336895
|
async function phasePrune(filesUpdated) {
|
|
336558
336896
|
try {
|
|
336559
|
-
if (!
|
|
336560
|
-
const files =
|
|
336897
|
+
if (!import_fs38.default.existsSync(MEMORY_DIR3)) return;
|
|
336898
|
+
const files = import_fs38.default.readdirSync(MEMORY_DIR3).filter((f) => f.endsWith(".md") && f !== "MEMORY_INDEX.md").map((f) => {
|
|
336561
336899
|
try {
|
|
336562
|
-
const content =
|
|
336900
|
+
const content = import_fs38.default.readFileSync(import_path40.default.join(MEMORY_DIR3, f), "utf-8");
|
|
336563
336901
|
const titleM = content.match(/^title:\s*(.+)$/m);
|
|
336564
336902
|
const sumM = content.match(/---\n+([\s\S]+?)(?:\n\n|$)/);
|
|
336565
336903
|
const title = titleM ? titleM[1].trim() : f.replace(".md", "");
|
|
@@ -336569,7 +336907,7 @@ async function phasePrune(filesUpdated) {
|
|
|
336569
336907
|
return null;
|
|
336570
336908
|
}
|
|
336571
336909
|
}).filter((l) => l !== null).slice(0, 100);
|
|
336572
|
-
|
|
336910
|
+
import_fs38.default.writeFileSync(INDEX_PATH2, files.join("\n") + "\n", "utf-8");
|
|
336573
336911
|
console.log(`[DreamEngine] Pruned index to ${files.length} entries (${filesUpdated} files updated)`);
|
|
336574
336912
|
} catch (e) {
|
|
336575
336913
|
console.error("[DreamEngine] Prune phase failed:", e.message);
|
|
@@ -336587,7 +336925,7 @@ async function runDream() {
|
|
|
336587
336925
|
let sessionsReviewed = 0;
|
|
336588
336926
|
let filesUpdated = 0;
|
|
336589
336927
|
try {
|
|
336590
|
-
|
|
336928
|
+
import_fs38.default.mkdirSync(MEMORY_DIR3, { recursive: true });
|
|
336591
336929
|
console.log("[DreamEngine] Phase 1: Orient");
|
|
336592
336930
|
const orientData = await phaseOrient();
|
|
336593
336931
|
console.log("[DreamEngine] Phase 2: Gather");
|
|
@@ -336617,9 +336955,9 @@ async function runDream() {
|
|
|
336617
336955
|
try {
|
|
336618
336956
|
if (prevMtime > 0) {
|
|
336619
336957
|
const t = prevMtime / 1e3;
|
|
336620
|
-
|
|
336958
|
+
import_fs38.default.utimesSync(LOCK_FILE, t, t);
|
|
336621
336959
|
} else {
|
|
336622
|
-
|
|
336960
|
+
import_fs38.default.unlinkSync(LOCK_FILE);
|
|
336623
336961
|
}
|
|
336624
336962
|
} catch {
|
|
336625
336963
|
}
|
|
@@ -336629,17 +336967,17 @@ function checkAndRunDream() {
|
|
|
336629
336967
|
if (!allGatesPass()) return;
|
|
336630
336968
|
runDream().catch((e) => console.error("[DreamEngine] Unhandled error:", e.message));
|
|
336631
336969
|
}
|
|
336632
|
-
var
|
|
336970
|
+
var import_fs38, import_path40, LOCK_FILE, MEMORY_DIR3, SESSIONS_DIR3, INDEX_PATH2, GATE_HOURS, GATE_SESSIONS;
|
|
336633
336971
|
var init_dreamEngine = __esm({
|
|
336634
336972
|
"core/dreamEngine.ts"() {
|
|
336635
|
-
|
|
336636
|
-
|
|
336973
|
+
import_fs38 = __toESM(require("fs"));
|
|
336974
|
+
import_path40 = __toESM(require("path"));
|
|
336637
336975
|
init_auxiliaryClient();
|
|
336638
336976
|
init_auditTrail();
|
|
336639
|
-
LOCK_FILE =
|
|
336640
|
-
MEMORY_DIR3 =
|
|
336641
|
-
SESSIONS_DIR3 =
|
|
336642
|
-
INDEX_PATH2 =
|
|
336977
|
+
LOCK_FILE = import_path40.default.join(process.cwd(), "workspace", "dream.lock");
|
|
336978
|
+
MEMORY_DIR3 = import_path40.default.join(process.cwd(), "workspace", "memory");
|
|
336979
|
+
SESSIONS_DIR3 = import_path40.default.join(process.cwd(), "workspace", "sessions");
|
|
336980
|
+
INDEX_PATH2 = import_path40.default.join(MEMORY_DIR3, "MEMORY_INDEX.md");
|
|
336643
336981
|
GATE_HOURS = 24;
|
|
336644
336982
|
GATE_SESSIONS = 5;
|
|
336645
336983
|
}
|
|
@@ -336647,11 +336985,11 @@ var init_dreamEngine = __esm({
|
|
|
336647
336985
|
|
|
336648
336986
|
// core/patternDetector.ts
|
|
336649
336987
|
async function detectPatterns() {
|
|
336650
|
-
if (!(0,
|
|
336988
|
+
if (!(0, import_fs39.existsSync)(SESSION_DIR)) return [];
|
|
336651
336989
|
const messages = [];
|
|
336652
|
-
for (const file of (0,
|
|
336990
|
+
for (const file of (0, import_fs39.readdirSync)(SESSION_DIR).slice(-30)) {
|
|
336653
336991
|
try {
|
|
336654
|
-
const content = (0,
|
|
336992
|
+
const content = (0, import_fs39.readFileSync)((0, import_path41.join)(SESSION_DIR, file), "utf8");
|
|
336655
336993
|
if (file.endsWith(".json")) {
|
|
336656
336994
|
const session = JSON.parse(content);
|
|
336657
336995
|
(session.messages ?? []).filter((m) => m.role === "user").forEach((m) => messages.push({
|
|
@@ -336687,12 +337025,12 @@ function getPatternSummary(patterns) {
|
|
|
336687
337025
|
if (patterns.length === 0) return "";
|
|
336688
337026
|
return "Detected usage patterns:\n" + patterns.slice(0, 3).map((p) => `- ${p.description} (${p.frequency})`).join("\n");
|
|
336689
337027
|
}
|
|
336690
|
-
var
|
|
337028
|
+
var import_fs39, import_path41, SESSION_DIR;
|
|
336691
337029
|
var init_patternDetector = __esm({
|
|
336692
337030
|
"core/patternDetector.ts"() {
|
|
336693
|
-
|
|
336694
|
-
|
|
336695
|
-
SESSION_DIR = (0,
|
|
337031
|
+
import_fs39 = require("fs");
|
|
337032
|
+
import_path41 = require("path");
|
|
337033
|
+
SESSION_DIR = (0, import_path41.join)(process.cwd(), "workspace", "sessions");
|
|
336696
337034
|
}
|
|
336697
337035
|
});
|
|
336698
337036
|
|
|
@@ -336710,8 +337048,8 @@ __export(scheduler_exports, {
|
|
|
336710
337048
|
function loadHeartbeatConfig() {
|
|
336711
337049
|
const isDebug = (process.env.AIDEN_LOG_LEVEL || "info") === "debug";
|
|
336712
337050
|
try {
|
|
336713
|
-
if (!
|
|
336714
|
-
const content =
|
|
337051
|
+
if (!import_fs40.default.existsSync(HEARTBEAT_PATH)) return;
|
|
337052
|
+
const content = import_fs40.default.readFileSync(HEARTBEAT_PATH, "utf-8");
|
|
336715
337053
|
const sections = content.split(/^## /m).slice(1);
|
|
336716
337054
|
let loaded = 0;
|
|
336717
337055
|
for (const section of sections) {
|
|
@@ -336806,8 +337144,8 @@ function cronMatchesNow(cronExpr) {
|
|
|
336806
337144
|
}
|
|
336807
337145
|
function _rsave() {
|
|
336808
337146
|
try {
|
|
336809
|
-
if (!
|
|
336810
|
-
|
|
337147
|
+
if (!import_fs40.default.existsSync(_RDATA_DIR)) import_fs40.default.mkdirSync(_RDATA_DIR, { recursive: true });
|
|
337148
|
+
import_fs40.default.writeFileSync(_RDATA_FILE, JSON.stringify(Array.from(_reminders.values()), null, 2), "utf8");
|
|
336811
337149
|
} catch {
|
|
336812
337150
|
}
|
|
336813
337151
|
}
|
|
@@ -336865,11 +337203,11 @@ function cancelReminder(id) {
|
|
|
336865
337203
|
}
|
|
336866
337204
|
function initReminderScheduler() {
|
|
336867
337205
|
try {
|
|
336868
|
-
if (!
|
|
337206
|
+
if (!import_fs40.default.existsSync(_RDATA_FILE)) {
|
|
336869
337207
|
console.log("[Reminders] No saved reminders");
|
|
336870
337208
|
return;
|
|
336871
337209
|
}
|
|
336872
|
-
const stored = JSON.parse(
|
|
337210
|
+
const stored = JSON.parse(import_fs40.default.readFileSync(_RDATA_FILE, "utf8"));
|
|
336873
337211
|
const now = Date.now();
|
|
336874
337212
|
let loaded = 0;
|
|
336875
337213
|
for (const r of stored) {
|
|
@@ -336889,18 +337227,18 @@ function initReminderScheduler() {
|
|
|
336889
337227
|
console.error("[Reminders] Init error:", e.message);
|
|
336890
337228
|
}
|
|
336891
337229
|
}
|
|
336892
|
-
var
|
|
337230
|
+
var import_fs40, import_path42, os5, TASKS_PATH, HEARTBEAT_PATH, Scheduler, scheduler, _reminders, _rtimers, _rseq, _RDATA_DIR, _RDATA_FILE;
|
|
336893
337231
|
var init_scheduler = __esm({
|
|
336894
337232
|
"core/scheduler.ts"() {
|
|
336895
|
-
|
|
336896
|
-
|
|
337233
|
+
import_fs40 = __toESM(require("fs"));
|
|
337234
|
+
import_path42 = __toESM(require("path"));
|
|
336897
337235
|
init_morningBriefing();
|
|
336898
337236
|
init_dreamEngine();
|
|
336899
337237
|
init_goalTracker();
|
|
336900
337238
|
init_patternDetector();
|
|
336901
|
-
|
|
336902
|
-
TASKS_PATH =
|
|
336903
|
-
HEARTBEAT_PATH =
|
|
337239
|
+
os5 = __toESM(require("os"));
|
|
337240
|
+
TASKS_PATH = import_path42.default.join(process.cwd(), "workspace", "scheduled-tasks.json");
|
|
337241
|
+
HEARTBEAT_PATH = import_path42.default.join(process.cwd(), "workspace", "HEARTBEAT.md");
|
|
336904
337242
|
Scheduler = class _Scheduler {
|
|
336905
337243
|
constructor() {
|
|
336906
337244
|
this.tasks = [];
|
|
@@ -336967,8 +337305,8 @@ var init_scheduler = __esm({
|
|
|
336967
337305
|
const ACTIVE_START = 8;
|
|
336968
337306
|
const ACTIVE_END = 23;
|
|
336969
337307
|
if (hour < ACTIVE_START || hour >= ACTIVE_END) return;
|
|
336970
|
-
if (!
|
|
336971
|
-
const checklist =
|
|
337308
|
+
if (!import_fs40.default.existsSync(HEARTBEAT_PATH)) return;
|
|
337309
|
+
const checklist = import_fs40.default.readFileSync(HEARTBEAT_PATH, "utf-8").trim();
|
|
336972
337310
|
if (!checklist) return;
|
|
336973
337311
|
let heartbeatPrompt = checklist;
|
|
336974
337312
|
const goalsSummary = getActiveGoalsSummary();
|
|
@@ -337109,8 +337447,8 @@ var init_scheduler = __esm({
|
|
|
337109
337447
|
}
|
|
337110
337448
|
load() {
|
|
337111
337449
|
try {
|
|
337112
|
-
if (!
|
|
337113
|
-
const raw =
|
|
337450
|
+
if (!import_fs40.default.existsSync(TASKS_PATH)) return;
|
|
337451
|
+
const raw = import_fs40.default.readFileSync(TASKS_PATH, "utf-8");
|
|
337114
337452
|
this.tasks = JSON.parse(raw);
|
|
337115
337453
|
const enabled = this.tasks.filter((t) => t.enabled);
|
|
337116
337454
|
enabled.forEach((t) => this.scheduleTask(t));
|
|
@@ -337124,8 +337462,8 @@ var init_scheduler = __esm({
|
|
|
337124
337462
|
}
|
|
337125
337463
|
save() {
|
|
337126
337464
|
try {
|
|
337127
|
-
|
|
337128
|
-
|
|
337465
|
+
import_fs40.default.mkdirSync(import_path42.default.dirname(TASKS_PATH), { recursive: true });
|
|
337466
|
+
import_fs40.default.writeFileSync(TASKS_PATH, JSON.stringify(this.tasks, null, 2));
|
|
337129
337467
|
} catch (e) {
|
|
337130
337468
|
console.warn(`[Scheduler] Failed to save tasks: ${e.message}`);
|
|
337131
337469
|
}
|
|
@@ -337135,8 +337473,8 @@ var init_scheduler = __esm({
|
|
|
337135
337473
|
_reminders = /* @__PURE__ */ new Map();
|
|
337136
337474
|
_rtimers = /* @__PURE__ */ new Map();
|
|
337137
337475
|
_rseq = 1;
|
|
337138
|
-
_RDATA_DIR =
|
|
337139
|
-
_RDATA_FILE =
|
|
337476
|
+
_RDATA_DIR = import_path42.default.join(os5.homedir(), ".aiden");
|
|
337477
|
+
_RDATA_FILE = import_path42.default.join(_RDATA_DIR, "scheduled.json");
|
|
337140
337478
|
}
|
|
337141
337479
|
});
|
|
337142
337480
|
|
|
@@ -337217,15 +337555,15 @@ function isCommandAllowed(cmd) {
|
|
|
337217
337555
|
return { allowed: false, needsApproval: true };
|
|
337218
337556
|
}
|
|
337219
337557
|
function cleanOldBrowserProfiles() {
|
|
337220
|
-
if (!
|
|
337558
|
+
if (!import_fs41.default.existsSync(BROWSER_DATA_DIR)) return;
|
|
337221
337559
|
const cutoff = Date.now() - 24 * 60 * 60 * 1e3;
|
|
337222
337560
|
try {
|
|
337223
|
-
for (const entry of
|
|
337224
|
-
const fullPath =
|
|
337561
|
+
for (const entry of import_fs41.default.readdirSync(BROWSER_DATA_DIR)) {
|
|
337562
|
+
const fullPath = import_path43.default.join(BROWSER_DATA_DIR, entry);
|
|
337225
337563
|
try {
|
|
337226
|
-
const stat =
|
|
337564
|
+
const stat = import_fs41.default.statSync(fullPath);
|
|
337227
337565
|
if (stat.mtimeMs < cutoff) {
|
|
337228
|
-
|
|
337566
|
+
import_fs41.default.rmSync(fullPath, { recursive: true, force: true });
|
|
337229
337567
|
console.log(`[Browser] Cleaned old profile: ${entry}`);
|
|
337230
337568
|
}
|
|
337231
337569
|
} catch {
|
|
@@ -337255,15 +337593,15 @@ function setProgressEmitter(fn) {
|
|
|
337255
337593
|
_emitProgress = fn;
|
|
337256
337594
|
}
|
|
337257
337595
|
function resolveWritePath(rawPath, opts) {
|
|
337258
|
-
const home = opts?.home ??
|
|
337596
|
+
const home = opts?.home ?? import_os4.default.homedir();
|
|
337259
337597
|
const cwd = opts?.cwd ?? process.cwd();
|
|
337260
|
-
const user = process.env.USERNAME || process.env.USER ||
|
|
337261
|
-
let p = rawPath.replace(/^~[\/\\]/, home +
|
|
337262
|
-
const resolved = /^[A-Za-z]:[/\\]/.test(p) || p.startsWith("/") ? p :
|
|
337598
|
+
const user = process.env.USERNAME || process.env.USER || import_os4.default.userInfo().username || "User";
|
|
337599
|
+
let p = rawPath.replace(/^~[\/\\]/, home + import_path43.default.sep).replace(/^Desktop[\/\\]/i, import_path43.default.join(home, "Desktop") + import_path43.default.sep).replace(/^C:\\Users\\Aiden\\/i, `C:\\Users\\${user}\\`).replace(/^C:\/Users\/Aiden\//i, `C:/Users/${user}/`);
|
|
337600
|
+
const resolved = /^[A-Za-z]:[/\\]/.test(p) || p.startsWith("/") ? p : import_path43.default.join(cwd, p);
|
|
337263
337601
|
const allowedRoots = [
|
|
337264
337602
|
cwd,
|
|
337265
|
-
|
|
337266
|
-
|
|
337603
|
+
import_path43.default.join(home, "Desktop"),
|
|
337604
|
+
import_path43.default.join(home, "Documents")
|
|
337267
337605
|
];
|
|
337268
337606
|
const norm = (s) => s.toLowerCase().replace(/\//g, "\\").replace(/\\$/, "");
|
|
337269
337607
|
const nr = norm(resolved);
|
|
@@ -337498,14 +337836,14 @@ function getToolsForCategories(categories) {
|
|
|
337498
337836
|
}
|
|
337499
337837
|
return Array.from(tools);
|
|
337500
337838
|
}
|
|
337501
|
-
var import_child_process10, import_util10,
|
|
337839
|
+
var import_child_process10, import_util10, import_fs41, import_path43, import_os4, import_minimatch2, execAsync8, PROTECTED_FILES2, DENIED_PATHS, DENIED_COMMANDS, activeWatchers, SHELL_DANGEROUS_PATTERNS, PROTECTED_PATH_PATTERNS, CODE_DESTRUCTIVE_NODE, CODE_DESTRUCTIVE_PYTHON, SHELL_ALLOWLIST, BROWSER_DATA_DIR, TOOL_TIMEOUTS, _emitProgress, APP_ALIASES, DISPLAY_ALIASES, TOOLS, externalTools, externalToolsMeta, _generation2, TOOL_DESCRIPTIONS, TOOL_NAMES_ONLY, TOOL_TIERS, TOOL_CATEGORIES, TOOL_REGISTRY, registryNames, registryDescriptions, registryTiers, registryCategories, registryTimeouts, registryAllowedTools, registryValidTools, registryNoRetrySet, registryParallelSafeSet, registrySequentialOnlySet, registryMcpSafeList, registryMcpDestructiveList;
|
|
337502
337840
|
var init_toolRegistry = __esm({
|
|
337503
337841
|
"core/toolRegistry.ts"() {
|
|
337504
337842
|
import_child_process10 = require("child_process");
|
|
337505
337843
|
import_util10 = require("util");
|
|
337506
|
-
|
|
337507
|
-
|
|
337508
|
-
|
|
337844
|
+
import_fs41 = __toESM(require("fs"));
|
|
337845
|
+
import_path43 = __toESM(require("path"));
|
|
337846
|
+
import_os4 = __toESM(require("os"));
|
|
337509
337847
|
init_paths();
|
|
337510
337848
|
init_computerControl();
|
|
337511
337849
|
init_webSearch();
|
|
@@ -337677,7 +338015,7 @@ var init_toolRegistry = __esm({
|
|
|
337677
338015
|
// 16. Windows window management
|
|
337678
338016
|
/^(start|explorer)\b/i
|
|
337679
338017
|
];
|
|
337680
|
-
BROWSER_DATA_DIR =
|
|
338018
|
+
BROWSER_DATA_DIR = import_path43.default.join(getUserDataDir(), "browser-profiles");
|
|
337681
338019
|
try {
|
|
337682
338020
|
cleanOldBrowserProfiles();
|
|
337683
338021
|
} catch {
|
|
@@ -338020,9 +338358,9 @@ stderr: ${sr.stderr}` : "")).trim() || "(completed)";
|
|
|
338020
338358
|
return { success: false, output: "", error: "Blocked: this command pattern is not allowed. Dangerous operations require explicit user approval." };
|
|
338021
338359
|
}
|
|
338022
338360
|
}
|
|
338023
|
-
const tmpFile =
|
|
338024
|
-
|
|
338025
|
-
|
|
338361
|
+
const tmpFile = import_path43.default.join(process.cwd(), "workspace", `tmp_${Date.now()}.ps1`);
|
|
338362
|
+
import_fs41.default.mkdirSync(import_path43.default.dirname(tmpFile), { recursive: true });
|
|
338363
|
+
import_fs41.default.writeFileSync(tmpFile, script);
|
|
338026
338364
|
try {
|
|
338027
338365
|
const { stdout, stderr } = await execAsync8(
|
|
338028
338366
|
`powershell.exe -ExecutionPolicy Bypass -File "${tmpFile}"`,
|
|
@@ -338033,7 +338371,7 @@ stderr: ${sr.stderr}` : "")).trim() || "(completed)";
|
|
|
338033
338371
|
return { success: false, output: "", error: e.message };
|
|
338034
338372
|
} finally {
|
|
338035
338373
|
try {
|
|
338036
|
-
|
|
338374
|
+
import_fs41.default.unlinkSync(tmpFile);
|
|
338037
338375
|
} catch {
|
|
338038
338376
|
}
|
|
338039
338377
|
}
|
|
@@ -338137,9 +338475,9 @@ stderr: ${sr.stderr}` : "")).trim() || "(completed)";
|
|
|
338137
338475
|
}
|
|
338138
338476
|
try {
|
|
338139
338477
|
const resolved = resolveWritePath(filePath);
|
|
338140
|
-
|
|
338141
|
-
|
|
338142
|
-
const written =
|
|
338478
|
+
import_fs41.default.mkdirSync(import_path43.default.dirname(resolved), { recursive: true });
|
|
338479
|
+
import_fs41.default.writeFileSync(resolved, content, "utf-8");
|
|
338480
|
+
const written = import_fs41.default.existsSync(resolved);
|
|
338143
338481
|
return {
|
|
338144
338482
|
success: written,
|
|
338145
338483
|
output: written ? `Written and verified: ${resolved} (${content.length} chars)` : "Write failed"
|
|
@@ -338163,10 +338501,10 @@ stderr: ${sr.stderr}` : "")).trim() || "(completed)";
|
|
|
338163
338501
|
try {
|
|
338164
338502
|
const _user = process.env.USERNAME || process.env.USER || require("os").userInfo().username || "User";
|
|
338165
338503
|
const _home = require("os").homedir();
|
|
338166
|
-
filePath = filePath.replace(/^~[\/\\]/i, _home +
|
|
338167
|
-
const resolved = filePath.match(/^[A-Z]:/i) || filePath.startsWith("/") ? filePath :
|
|
338168
|
-
if (!
|
|
338169
|
-
return { success: true, output:
|
|
338504
|
+
filePath = filePath.replace(/^~[\/\\]/i, _home + import_path43.default.sep).replace(/^Desktop[\/\\]/i, import_path43.default.join(_home, "Desktop") + import_path43.default.sep).replace(/^C:\\Users\\Aiden\\/i, `C:\\Users\\${_user}\\`).replace(/^C:\/Users\/Aiden\//i, `C:/Users/${_user}/`);
|
|
338505
|
+
const resolved = filePath.match(/^[A-Z]:/i) || filePath.startsWith("/") ? filePath : import_path43.default.join(process.cwd(), filePath);
|
|
338506
|
+
if (!import_fs41.default.existsSync(resolved)) return { success: false, output: "", error: `Not found: ${resolved}` };
|
|
338507
|
+
return { success: true, output: import_fs41.default.readFileSync(resolved, "utf-8").slice(0, 5e3) };
|
|
338170
338508
|
} catch (e) {
|
|
338171
338509
|
return { success: false, output: "", error: e.message };
|
|
338172
338510
|
}
|
|
@@ -338176,9 +338514,9 @@ stderr: ${sr.stderr}` : "")).trim() || "(completed)";
|
|
|
338176
338514
|
try {
|
|
338177
338515
|
const _user = process.env.USERNAME || process.env.USER || require("os").userInfo().username || "User";
|
|
338178
338516
|
const _home = require("os").homedir();
|
|
338179
|
-
dirPath = dirPath.replace(/^~[\/\\]/i, _home +
|
|
338180
|
-
const resolved = dirPath.match(/^[A-Z]:/i) ? dirPath :
|
|
338181
|
-
return { success: true, output:
|
|
338517
|
+
dirPath = dirPath.replace(/^~[\/\\]/i, _home + import_path43.default.sep).replace(/^Desktop[\/\\]?$/i, import_path43.default.join(_home, "Desktop")).replace(/^Desktop[\/\\]/i, import_path43.default.join(_home, "Desktop") + import_path43.default.sep).replace(/^C:\\Users\\Aiden\\/i, `C:\\Users\\${_user}\\`).replace(/^C:\/Users\/Aiden\//i, `C:/Users/${_user}/`);
|
|
338518
|
+
const resolved = dirPath.match(/^[A-Z]:/i) ? dirPath : import_path43.default.join(process.cwd(), dirPath);
|
|
338519
|
+
return { success: true, output: import_fs41.default.readdirSync(resolved).join("\n") };
|
|
338182
338520
|
} catch (e) {
|
|
338183
338521
|
return { success: false, output: "", error: e.message };
|
|
338184
338522
|
}
|
|
@@ -338200,9 +338538,9 @@ stderr: ${sr.stderr}` : "")).trim() || "Script completed with no output";
|
|
|
338200
338538
|
console.warn("[Sandbox] auto-mode fell back to host:", sandboxErr.message);
|
|
338201
338539
|
}
|
|
338202
338540
|
}
|
|
338203
|
-
const tmp =
|
|
338204
|
-
|
|
338205
|
-
|
|
338541
|
+
const tmp = import_path43.default.join(process.cwd(), "workspace", `py_${Date.now()}.py`);
|
|
338542
|
+
import_fs41.default.mkdirSync(import_path43.default.dirname(tmp), { recursive: true });
|
|
338543
|
+
import_fs41.default.writeFileSync(tmp, script);
|
|
338206
338544
|
const showProgress = process.env.AIDEN_SHOW_TOOL_OUTPUT !== "false";
|
|
338207
338545
|
return new Promise((resolve2) => {
|
|
338208
338546
|
let stdout = "";
|
|
@@ -338228,7 +338566,7 @@ stderr: ${sr.stderr}` : "")).trim() || "Script completed with no output";
|
|
|
338228
338566
|
proc.on("close", (code) => {
|
|
338229
338567
|
clearTimeout(timer);
|
|
338230
338568
|
try {
|
|
338231
|
-
|
|
338569
|
+
import_fs41.default.unlinkSync(tmp);
|
|
338232
338570
|
} catch {
|
|
338233
338571
|
}
|
|
338234
338572
|
const output = (stdout || stderr || "").trim() || "Script completed with no output";
|
|
@@ -338241,9 +338579,9 @@ stderr: ${sr.stderr}` : "")).trim() || "Script completed with no output";
|
|
|
338241
338579
|
if (!script) return { success: false, output: "", error: "No script" };
|
|
338242
338580
|
const nodeGuard = scanCodeForDestructivePaths(script, "node");
|
|
338243
338581
|
if (nodeGuard.denied) return { success: false, output: "", error: nodeGuard.reason };
|
|
338244
|
-
const tmp =
|
|
338245
|
-
|
|
338246
|
-
|
|
338582
|
+
const tmp = import_path43.default.join(process.cwd(), "workspace", `js_${Date.now()}.js`);
|
|
338583
|
+
import_fs41.default.mkdirSync(import_path43.default.dirname(tmp), { recursive: true });
|
|
338584
|
+
import_fs41.default.writeFileSync(tmp, script);
|
|
338247
338585
|
try {
|
|
338248
338586
|
const { stdout, stderr } = await execAsync8(`node "${tmp}"`, {
|
|
338249
338587
|
timeout: 6e4,
|
|
@@ -338254,7 +338592,7 @@ stderr: ${sr.stderr}` : "")).trim() || "Script completed with no output";
|
|
|
338254
338592
|
return { success: false, output: e.stdout || "", error: `Node error: ${e.message}` };
|
|
338255
338593
|
} finally {
|
|
338256
338594
|
try {
|
|
338257
|
-
|
|
338595
|
+
import_fs41.default.unlinkSync(tmp);
|
|
338258
338596
|
} catch {
|
|
338259
338597
|
}
|
|
338260
338598
|
}
|
|
@@ -338976,12 +339314,12 @@ Files created: ${result.files.join(", ")}` : "";
|
|
|
338976
339314
|
}
|
|
338977
339315
|
try {
|
|
338978
339316
|
const { execSync: execSync2 } = await import("child_process");
|
|
338979
|
-
const { writeFileSync:
|
|
339317
|
+
const { writeFileSync: writeFileSync8, unlinkSync: unlinkSync2 } = await import("fs");
|
|
338980
339318
|
const { tmpdir } = await import("os");
|
|
338981
|
-
const { join:
|
|
339319
|
+
const { join: join9 } = await import("path");
|
|
338982
339320
|
const runPs = (script, label) => {
|
|
338983
|
-
const f =
|
|
338984
|
-
|
|
339321
|
+
const f = join9(tmpdir(), `_aiden_${label}_${Date.now()}.ps1`);
|
|
339322
|
+
writeFileSync8(f, script, "utf8");
|
|
338985
339323
|
try {
|
|
338986
339324
|
return execSync2(
|
|
338987
339325
|
`powershell.exe -NoProfile -ExecutionPolicy Bypass -File "${f}"`,
|
|
@@ -339071,7 +339409,7 @@ public class AidenVolSet {
|
|
|
339071
339409
|
const stop = !!p.stop;
|
|
339072
339410
|
if (!rawFolder) return { success: false, output: "", error: "No folder specified" };
|
|
339073
339411
|
const userName = process.env.USERPROFILE || process.env.HOME || "";
|
|
339074
|
-
const folderPath = rawFolder.replace(/%USERPROFILE%/gi, userName).replace(/^~[\/\\]/, userName +
|
|
339412
|
+
const folderPath = rawFolder.replace(/%USERPROFILE%/gi, userName).replace(/^~[\/\\]/, userName + import_path43.default.sep);
|
|
339075
339413
|
if (stop) {
|
|
339076
339414
|
const watcher2 = activeWatchers.get(folderPath);
|
|
339077
339415
|
if (watcher2) {
|
|
@@ -339082,20 +339420,20 @@ public class AidenVolSet {
|
|
|
339082
339420
|
return { success: false, output: `No active watcher for: ${folderPath}` };
|
|
339083
339421
|
}
|
|
339084
339422
|
if (!goal) return { success: false, output: "", error: "No goal specified" };
|
|
339085
|
-
if (!
|
|
339423
|
+
if (!import_fs41.default.existsSync(folderPath)) return { success: false, output: "", error: `Folder not found: ${folderPath}` };
|
|
339086
339424
|
const existing = activeWatchers.get(folderPath);
|
|
339087
339425
|
if (existing) {
|
|
339088
339426
|
existing.close();
|
|
339089
339427
|
activeWatchers.delete(folderPath);
|
|
339090
339428
|
}
|
|
339091
|
-
const watcher =
|
|
339429
|
+
const watcher = import_fs41.default.watch(folderPath, async (eventType, filename) => {
|
|
339092
339430
|
if (eventType !== "rename" || !filename) return;
|
|
339093
|
-
const fullPath =
|
|
339431
|
+
const fullPath = import_path43.default.join(folderPath, filename);
|
|
339094
339432
|
await new Promise((r) => setTimeout(r, 500));
|
|
339095
|
-
if (!
|
|
339433
|
+
if (!import_fs41.default.existsSync(fullPath)) return;
|
|
339096
339434
|
let isFile2 = false;
|
|
339097
339435
|
try {
|
|
339098
|
-
isFile2 =
|
|
339436
|
+
isFile2 = import_fs41.default.statSync(fullPath).isFile();
|
|
339099
339437
|
} catch {
|
|
339100
339438
|
return;
|
|
339101
339439
|
}
|
|
@@ -339366,28 +339704,28 @@ ${formatted}` };
|
|
|
339366
339704
|
});
|
|
339367
339705
|
return 2 * n / (sa.size + sb.size + 1e-3);
|
|
339368
339706
|
};
|
|
339369
|
-
const skillFolders = ["learned", "approved", "installed"].map((f) =>
|
|
339707
|
+
const skillFolders = ["learned", "approved", "installed"].map((f) => import_path43.default.join(cwd, "workspace", "skills", f)).filter((d) => import_fs41.default.existsSync(d));
|
|
339370
339708
|
if (skillFolders.length === 0) return { success: false, output: "", error: "No skills yet" };
|
|
339371
339709
|
let best = { score: 0, dir: "", name: "" };
|
|
339372
339710
|
for (const folder of skillFolders) {
|
|
339373
|
-
for (const entry of
|
|
339711
|
+
for (const entry of import_fs41.default.readdirSync(folder, { withFileTypes: true })) {
|
|
339374
339712
|
if (!entry.isDirectory()) continue;
|
|
339375
|
-
const metaPath2 =
|
|
339713
|
+
const metaPath2 = import_path43.default.join(folder, entry.name, "meta.json");
|
|
339376
339714
|
let taskPattern = entry.name;
|
|
339377
339715
|
try {
|
|
339378
|
-
const meta = JSON.parse(
|
|
339716
|
+
const meta = JSON.parse(import_fs41.default.readFileSync(metaPath2, "utf-8"));
|
|
339379
339717
|
taskPattern = meta.taskPattern || meta.description || entry.name;
|
|
339380
339718
|
} catch {
|
|
339381
339719
|
}
|
|
339382
339720
|
const score = Math.max(dice(query, entry.name), dice(query, taskPattern));
|
|
339383
|
-
if (score > best.score) best = { score, dir:
|
|
339721
|
+
if (score > best.score) best = { score, dir: import_path43.default.join(folder, entry.name), name: entry.name };
|
|
339384
339722
|
}
|
|
339385
339723
|
}
|
|
339386
339724
|
const THRESHOLD = 0.25;
|
|
339387
339725
|
if (best.score < THRESHOLD) return { success: false, output: "", error: `No matching skill found (best: ${best.name} @ ${best.score.toFixed(2)})` };
|
|
339388
|
-
const skillPath =
|
|
339389
|
-
if (!
|
|
339390
|
-
const content =
|
|
339726
|
+
const skillPath = import_path43.default.join(best.dir, "SKILL.md");
|
|
339727
|
+
if (!import_fs41.default.existsSync(skillPath)) return { success: false, output: "", error: `Skill "${best.name}" has no SKILL.md` };
|
|
339728
|
+
const content = import_fs41.default.readFileSync(skillPath, "utf-8");
|
|
339391
339729
|
return { success: true, output: `[Skill: ${best.name} \u2014 match score ${best.score.toFixed(2)}]
|
|
339392
339730
|
|
|
339393
339731
|
${content}` };
|
|
@@ -339494,6 +339832,20 @@ ${content}` };
|
|
|
339494
339832
|
return { success: false, output: "", error: e.message };
|
|
339495
339833
|
}
|
|
339496
339834
|
},
|
|
339835
|
+
// ── memory_store — persist a fact to permanent memory ──
|
|
339836
|
+
memory_store: async (p) => {
|
|
339837
|
+
const fact = p.fact || p.text || p.content || "";
|
|
339838
|
+
if (!fact) return { success: false, output: "", error: "No fact provided" };
|
|
339839
|
+
const { toolMemoryStore: toolMemoryStore2 } = await Promise.resolve().then(() => (init_slashAsTool(), slashAsTool_exports));
|
|
339840
|
+
return toolMemoryStore2(p);
|
|
339841
|
+
},
|
|
339842
|
+
// ── memory_forget — remove a fact from permanent memory ──
|
|
339843
|
+
memory_forget: async (p) => {
|
|
339844
|
+
const fact = p.fact || p.keyword || p.text || "";
|
|
339845
|
+
if (!fact) return { success: false, output: "", error: "No fact provided" };
|
|
339846
|
+
const { toolMemoryForget: toolMemoryForget2 } = await Promise.resolve().then(() => (init_slashAsTool(), slashAsTool_exports));
|
|
339847
|
+
return toolMemoryForget2(p);
|
|
339848
|
+
},
|
|
339497
339849
|
// ── clarify — ask the user a multi-choice or free-text question mid-task ──
|
|
339498
339850
|
clarify: async (p) => {
|
|
339499
339851
|
const question = p.question || p.q || "";
|
|
@@ -340872,9 +341224,9 @@ async function getRegistrySkill(name) {
|
|
|
340872
341224
|
}
|
|
340873
341225
|
async function installSkill(name) {
|
|
340874
341226
|
const manifest = await getRegistrySkill(name);
|
|
340875
|
-
const skillDir =
|
|
340876
|
-
|
|
340877
|
-
|
|
341227
|
+
const skillDir = import_path44.default.join(INSTALLED_DIR, manifest.name);
|
|
341228
|
+
import_fs42.default.mkdirSync(skillDir, { recursive: true });
|
|
341229
|
+
import_fs42.default.writeFileSync(import_path44.default.join(skillDir, "SKILL.md"), manifest.content, "utf-8");
|
|
340878
341230
|
const meta = {
|
|
340879
341231
|
name: manifest.name,
|
|
340880
341232
|
version: manifest.version,
|
|
@@ -340884,10 +341236,10 @@ async function installSkill(name) {
|
|
|
340884
341236
|
source: "registry",
|
|
340885
341237
|
installedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
340886
341238
|
};
|
|
340887
|
-
|
|
341239
|
+
import_fs42.default.writeFileSync(import_path44.default.join(skillDir, "meta.json"), JSON.stringify(meta, null, 2) + "\n", "utf-8");
|
|
340888
341240
|
for (const [filename, content] of Object.entries(manifest.files ?? {})) {
|
|
340889
|
-
const safe =
|
|
340890
|
-
|
|
341241
|
+
const safe = import_path44.default.basename(filename);
|
|
341242
|
+
import_fs42.default.writeFileSync(import_path44.default.join(skillDir, safe), content, "utf-8");
|
|
340891
341243
|
}
|
|
340892
341244
|
console.log(`[skillRegistry] installed "${manifest.name}" \u2192 ${skillDir}`);
|
|
340893
341245
|
return { path: skillDir };
|
|
@@ -340898,18 +341250,18 @@ async function publishSkill(skillName, license) {
|
|
|
340898
341250
|
}
|
|
340899
341251
|
const cwd = process.cwd();
|
|
340900
341252
|
const candidates = [
|
|
340901
|
-
|
|
340902
|
-
|
|
340903
|
-
|
|
341253
|
+
import_path44.default.join(cwd, "workspace", "skills", "learned", skillName),
|
|
341254
|
+
import_path44.default.join(cwd, "workspace", "skills", "approved", skillName),
|
|
341255
|
+
import_path44.default.join(cwd, "workspace", "skills", "installed", skillName)
|
|
340904
341256
|
];
|
|
340905
|
-
const skillDir = candidates.find((d) =>
|
|
341257
|
+
const skillDir = candidates.find((d) => import_fs42.default.existsSync(import_path44.default.join(d, "SKILL.md")));
|
|
340906
341258
|
if (!skillDir) {
|
|
340907
341259
|
throw new Error(`Skill "${skillName}" not found in learned/, approved/, or installed/`);
|
|
340908
341260
|
}
|
|
340909
|
-
const content =
|
|
341261
|
+
const content = import_fs42.default.readFileSync(import_path44.default.join(skillDir, "SKILL.md"), "utf-8");
|
|
340910
341262
|
let meta = {};
|
|
340911
341263
|
try {
|
|
340912
|
-
meta = JSON.parse(
|
|
341264
|
+
meta = JSON.parse(import_fs42.default.readFileSync(import_path44.default.join(skillDir, "meta.json"), "utf-8"));
|
|
340913
341265
|
} catch {
|
|
340914
341266
|
}
|
|
340915
341267
|
const body = {
|
|
@@ -340935,13 +341287,13 @@ async function publishSkill(skillName, license) {
|
|
|
340935
341287
|
return { url: data.url };
|
|
340936
341288
|
}
|
|
340937
341289
|
function listInstalled() {
|
|
340938
|
-
if (!
|
|
341290
|
+
if (!import_fs42.default.existsSync(INSTALLED_DIR)) return [];
|
|
340939
341291
|
const out = [];
|
|
340940
|
-
for (const entry of
|
|
341292
|
+
for (const entry of import_fs42.default.readdirSync(INSTALLED_DIR, { withFileTypes: true })) {
|
|
340941
341293
|
if (!entry.isDirectory()) continue;
|
|
340942
341294
|
try {
|
|
340943
341295
|
const meta = JSON.parse(
|
|
340944
|
-
|
|
341296
|
+
import_fs42.default.readFileSync(import_path44.default.join(INSTALLED_DIR, entry.name, "meta.json"), "utf-8")
|
|
340945
341297
|
);
|
|
340946
341298
|
out.push({
|
|
340947
341299
|
name: meta.name ?? entry.name,
|
|
@@ -340957,13 +341309,13 @@ function listInstalled() {
|
|
|
340957
341309
|
}
|
|
340958
341310
|
return out;
|
|
340959
341311
|
}
|
|
340960
|
-
var
|
|
341312
|
+
var import_fs42, import_path44, BASE, INSTALLED_DIR;
|
|
340961
341313
|
var init_skillRegistry = __esm({
|
|
340962
341314
|
"core/skillRegistry.ts"() {
|
|
340963
|
-
|
|
340964
|
-
|
|
341315
|
+
import_fs42 = __toESM(require("fs"));
|
|
341316
|
+
import_path44 = __toESM(require("path"));
|
|
340965
341317
|
BASE = (process.env.AIDEN_SKILL_REGISTRY_URL ?? "https://skills.taracod.com").replace(/\/$/, "");
|
|
340966
|
-
INSTALLED_DIR =
|
|
341318
|
+
INSTALLED_DIR = import_path44.default.join(process.cwd(), "workspace", "skills", "installed");
|
|
340967
341319
|
}
|
|
340968
341320
|
});
|
|
340969
341321
|
|
|
@@ -340977,7 +341329,7 @@ function inferCategory(text) {
|
|
|
340977
341329
|
function parseLessons() {
|
|
340978
341330
|
let raw = "";
|
|
340979
341331
|
try {
|
|
340980
|
-
raw =
|
|
341332
|
+
raw = import_fs43.default.readFileSync(LESSONS_PATH3, "utf-8");
|
|
340981
341333
|
} catch {
|
|
340982
341334
|
return [];
|
|
340983
341335
|
}
|
|
@@ -341016,23 +341368,23 @@ function appendLesson2(text) {
|
|
|
341016
341368
|
const entry = `${id}. [${date3}] ${text}
|
|
341017
341369
|
`;
|
|
341018
341370
|
try {
|
|
341019
|
-
if (!
|
|
341371
|
+
if (!import_fs43.default.existsSync(LESSONS_PATH3)) {
|
|
341020
341372
|
const header = "# LESSONS.md \u2014 Permanent Failure Rules\n# Auto-appended after task failures.\n\n## Rules\n\n";
|
|
341021
|
-
|
|
341022
|
-
|
|
341373
|
+
import_fs43.default.mkdirSync(import_path45.default.dirname(LESSONS_PATH3), { recursive: true });
|
|
341374
|
+
import_fs43.default.writeFileSync(LESSONS_PATH3, header + entry, "utf-8");
|
|
341023
341375
|
} else {
|
|
341024
|
-
|
|
341376
|
+
import_fs43.default.appendFileSync(LESSONS_PATH3, entry, "utf-8");
|
|
341025
341377
|
}
|
|
341026
341378
|
} catch {
|
|
341027
341379
|
}
|
|
341028
341380
|
return { id, date: date3, text, category: inferCategory(text), source: "manual" };
|
|
341029
341381
|
}
|
|
341030
|
-
var
|
|
341382
|
+
var import_fs43, import_path45, LESSONS_PATH3, CATEGORY_RULES;
|
|
341031
341383
|
var init_lessonsBrowser = __esm({
|
|
341032
341384
|
"core/lessonsBrowser.ts"() {
|
|
341033
|
-
|
|
341034
|
-
|
|
341035
|
-
|
|
341385
|
+
import_fs43 = __toESM(require("fs"));
|
|
341386
|
+
import_path45 = __toESM(require("path"));
|
|
341387
|
+
LESSONS_PATH3 = import_path45.default.join(process.cwd(), "workspace", "LESSONS.md");
|
|
341036
341388
|
CATEGORY_RULES = [
|
|
341037
341389
|
[/web_search|search|query|url/i, "web"],
|
|
341038
341390
|
[/shell_exec|run_python|command|bash/i, "shell"],
|
|
@@ -341114,10 +341466,10 @@ function _degradeSkill(skillName, rootCause) {
|
|
|
341114
341466
|
const cwd = process.cwd();
|
|
341115
341467
|
const folders = ["learned", "approved", "installed"];
|
|
341116
341468
|
for (const folder of folders) {
|
|
341117
|
-
const metaPath2 =
|
|
341118
|
-
if (!
|
|
341469
|
+
const metaPath2 = import_path46.default.join(cwd, "workspace", "skills", folder, skillName, "meta.json");
|
|
341470
|
+
if (!import_fs44.default.existsSync(metaPath2)) continue;
|
|
341119
341471
|
try {
|
|
341120
|
-
const meta = JSON.parse(
|
|
341472
|
+
const meta = JSON.parse(import_fs44.default.readFileSync(metaPath2, "utf-8"));
|
|
341121
341473
|
meta.failCount = (meta.failCount ?? 0) + 1;
|
|
341122
341474
|
meta.lastFailureReason = rootCause;
|
|
341123
341475
|
meta.confidence = Math.max(0.1, (meta.confidence ?? 1) - 0.15);
|
|
@@ -341125,7 +341477,7 @@ function _degradeSkill(skillName, rootCause) {
|
|
|
341125
341477
|
meta.deprecated = true;
|
|
341126
341478
|
console.warn(`[failureAnalyzer] skill "${skillName}" auto-deprecated after ${meta.failCount} failures`);
|
|
341127
341479
|
}
|
|
341128
|
-
|
|
341480
|
+
import_fs44.default.writeFileSync(metaPath2, JSON.stringify(meta, null, 2) + "\n", "utf-8");
|
|
341129
341481
|
console.log(`[failureAnalyzer] degraded skill "${skillName}" \u2192 confidence ${meta.confidence.toFixed(2)}, failCount ${meta.failCount}`);
|
|
341130
341482
|
} catch (e) {
|
|
341131
341483
|
console.warn(`[failureAnalyzer] could not update meta for "${skillName}":`, e.message);
|
|
@@ -341133,11 +341485,11 @@ function _degradeSkill(skillName, rootCause) {
|
|
|
341133
341485
|
break;
|
|
341134
341486
|
}
|
|
341135
341487
|
}
|
|
341136
|
-
var
|
|
341488
|
+
var import_fs44, import_path46, FAILURE_KEYWORDS;
|
|
341137
341489
|
var init_failureAnalyzer = __esm({
|
|
341138
341490
|
"core/failureAnalyzer.ts"() {
|
|
341139
|
-
|
|
341140
|
-
|
|
341491
|
+
import_fs44 = __toESM(require("fs"));
|
|
341492
|
+
import_path46 = __toESM(require("path"));
|
|
341141
341493
|
init_lessonsBrowser();
|
|
341142
341494
|
FAILURE_KEYWORDS = [
|
|
341143
341495
|
"that's wrong",
|
|
@@ -348777,10 +349129,10 @@ var require_lib4 = __commonJS({
|
|
|
348777
349129
|
exports2.analyse = analyse;
|
|
348778
349130
|
var detectFile = (filepath, opts = {}) => new Promise((resolve2, reject) => {
|
|
348779
349131
|
let fd;
|
|
348780
|
-
const
|
|
349132
|
+
const fs50 = (0, node_1.default)();
|
|
348781
349133
|
const handler = (err, buffer) => {
|
|
348782
349134
|
if (fd) {
|
|
348783
|
-
|
|
349135
|
+
fs50.closeSync(fd);
|
|
348784
349136
|
}
|
|
348785
349137
|
if (err) {
|
|
348786
349138
|
reject(err);
|
|
@@ -348792,9 +349144,9 @@ var require_lib4 = __commonJS({
|
|
|
348792
349144
|
};
|
|
348793
349145
|
const sampleSize = (opts === null || opts === void 0 ? void 0 : opts.sampleSize) || 0;
|
|
348794
349146
|
if (sampleSize > 0) {
|
|
348795
|
-
fd =
|
|
349147
|
+
fd = fs50.openSync(filepath, "r");
|
|
348796
349148
|
let sample = Buffer.allocUnsafe(sampleSize);
|
|
348797
|
-
|
|
349149
|
+
fs50.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
|
|
348798
349150
|
if (err) {
|
|
348799
349151
|
handler(err, null);
|
|
348800
349152
|
} else {
|
|
@@ -348806,22 +349158,22 @@ var require_lib4 = __commonJS({
|
|
|
348806
349158
|
});
|
|
348807
349159
|
return;
|
|
348808
349160
|
}
|
|
348809
|
-
|
|
349161
|
+
fs50.readFile(filepath, handler);
|
|
348810
349162
|
});
|
|
348811
349163
|
exports2.detectFile = detectFile;
|
|
348812
349164
|
var detectFileSync = (filepath, opts = {}) => {
|
|
348813
|
-
const
|
|
349165
|
+
const fs50 = (0, node_1.default)();
|
|
348814
349166
|
if (opts && opts.sampleSize) {
|
|
348815
|
-
const fd =
|
|
349167
|
+
const fd = fs50.openSync(filepath, "r");
|
|
348816
349168
|
let sample = Buffer.allocUnsafe(opts.sampleSize);
|
|
348817
|
-
const bytesRead =
|
|
349169
|
+
const bytesRead = fs50.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
|
|
348818
349170
|
if (bytesRead < opts.sampleSize) {
|
|
348819
349171
|
sample = sample.subarray(0, bytesRead);
|
|
348820
349172
|
}
|
|
348821
|
-
|
|
349173
|
+
fs50.closeSync(fd);
|
|
348822
349174
|
return (0, exports2.detect)(sample);
|
|
348823
349175
|
}
|
|
348824
|
-
return (0, exports2.detect)(
|
|
349176
|
+
return (0, exports2.detect)(fs50.readFileSync(filepath));
|
|
348825
349177
|
};
|
|
348826
349178
|
exports2.detectFileSync = detectFileSync;
|
|
348827
349179
|
exports2.default = {
|
|
@@ -353991,10 +354343,10 @@ function assignProp(target, prop, value) {
|
|
|
353991
354343
|
configurable: true
|
|
353992
354344
|
});
|
|
353993
354345
|
}
|
|
353994
|
-
function getElementAtPath(obj2,
|
|
353995
|
-
if (!
|
|
354346
|
+
function getElementAtPath(obj2, path54) {
|
|
354347
|
+
if (!path54)
|
|
353996
354348
|
return obj2;
|
|
353997
|
-
return
|
|
354349
|
+
return path54.reduce((acc, key) => acc?.[key], obj2);
|
|
353998
354350
|
}
|
|
353999
354351
|
function promiseAllObject(promisesObj) {
|
|
354000
354352
|
const keys = Object.keys(promisesObj);
|
|
@@ -354243,11 +354595,11 @@ function aborted(x, startIndex = 0) {
|
|
|
354243
354595
|
}
|
|
354244
354596
|
return false;
|
|
354245
354597
|
}
|
|
354246
|
-
function prefixIssues(
|
|
354598
|
+
function prefixIssues(path54, issues) {
|
|
354247
354599
|
return issues.map((iss) => {
|
|
354248
354600
|
var _a;
|
|
354249
354601
|
(_a = iss).path ?? (_a.path = []);
|
|
354250
|
-
iss.path.unshift(
|
|
354602
|
+
iss.path.unshift(path54);
|
|
354251
354603
|
return iss;
|
|
354252
354604
|
});
|
|
354253
354605
|
}
|
|
@@ -363893,8 +364245,8 @@ var require_utils4 = __commonJS({
|
|
|
363893
364245
|
}
|
|
363894
364246
|
return ind;
|
|
363895
364247
|
}
|
|
363896
|
-
function removeDotSegments(
|
|
363897
|
-
let input =
|
|
364248
|
+
function removeDotSegments(path54) {
|
|
364249
|
+
let input = path54;
|
|
363898
364250
|
const output = [];
|
|
363899
364251
|
let nextSlash = -1;
|
|
363900
364252
|
let len = 0;
|
|
@@ -364093,8 +364445,8 @@ var require_schemes = __commonJS({
|
|
|
364093
364445
|
wsComponent.secure = void 0;
|
|
364094
364446
|
}
|
|
364095
364447
|
if (wsComponent.resourceName) {
|
|
364096
|
-
const [
|
|
364097
|
-
wsComponent.path =
|
|
364448
|
+
const [path54, query] = wsComponent.resourceName.split("?");
|
|
364449
|
+
wsComponent.path = path54 && path54 !== "/" ? path54 : void 0;
|
|
364098
364450
|
wsComponent.query = query;
|
|
364099
364451
|
wsComponent.resourceName = void 0;
|
|
364100
364452
|
}
|
|
@@ -373151,12 +373503,12 @@ var require_dist3 = __commonJS({
|
|
|
373151
373503
|
throw new Error(`Unknown format "${name}"`);
|
|
373152
373504
|
return f;
|
|
373153
373505
|
};
|
|
373154
|
-
function addFormats(ajv, list2,
|
|
373506
|
+
function addFormats(ajv, list2, fs50, exportName) {
|
|
373155
373507
|
var _a;
|
|
373156
373508
|
var _b;
|
|
373157
373509
|
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
373158
373510
|
for (const f of list2)
|
|
373159
|
-
ajv.addFormat(f,
|
|
373511
|
+
ajv.addFormat(f, fs50[f]);
|
|
373160
373512
|
}
|
|
373161
373513
|
module2.exports = exports2 = formatsPlugin;
|
|
373162
373514
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -374185,8 +374537,8 @@ __export(aiden_exports, {
|
|
|
374185
374537
|
});
|
|
374186
374538
|
module.exports = __toCommonJS(aiden_exports);
|
|
374187
374539
|
var import_readline = __toESM(require("readline"));
|
|
374188
|
-
var
|
|
374189
|
-
var
|
|
374540
|
+
var import_fs45 = __toESM(require("fs"));
|
|
374541
|
+
var import_path47 = __toESM(require("path"));
|
|
374190
374542
|
init_theme();
|
|
374191
374543
|
|
|
374192
374544
|
// core/statusBar.ts
|
|
@@ -374745,7 +375097,7 @@ var SESSION_ID = `session_${Date.now()}`;
|
|
|
374745
375097
|
var _activeRL = null;
|
|
374746
375098
|
var SESSION_START = Date.now();
|
|
374747
375099
|
var RESUMED_FROM = null;
|
|
374748
|
-
var CONFIG_PATH3 =
|
|
375100
|
+
var CONFIG_PATH3 = import_path47.default.join(__dirname, "..", "config", "devos.config.json");
|
|
374749
375101
|
var MAX_TURNS = 15;
|
|
374750
375102
|
var THEMES = {
|
|
374751
375103
|
default: {
|
|
@@ -374803,14 +375155,14 @@ function applyTheme(name) {
|
|
|
374803
375155
|
}
|
|
374804
375156
|
function loadCfg() {
|
|
374805
375157
|
try {
|
|
374806
|
-
return JSON.parse(
|
|
375158
|
+
return JSON.parse(import_fs45.default.readFileSync(CONFIG_PATH3, "utf8"));
|
|
374807
375159
|
} catch {
|
|
374808
375160
|
return {};
|
|
374809
375161
|
}
|
|
374810
375162
|
}
|
|
374811
375163
|
function saveCfg(cfg) {
|
|
374812
375164
|
try {
|
|
374813
|
-
|
|
375165
|
+
import_fs45.default.writeFileSync(CONFIG_PATH3, JSON.stringify(cfg, null, 2) + "\n");
|
|
374814
375166
|
} catch {
|
|
374815
375167
|
}
|
|
374816
375168
|
}
|
|
@@ -375658,12 +376010,12 @@ ${h.content}
|
|
|
375658
376010
|
`;
|
|
375659
376011
|
}
|
|
375660
376012
|
const fname = `aiden-${ts}.md`;
|
|
375661
|
-
|
|
376013
|
+
import_fs45.default.writeFileSync(fname, md);
|
|
375662
376014
|
console.log(` ${T.success}\u2713 Exported to ${fname}${T.reset}
|
|
375663
376015
|
`);
|
|
375664
376016
|
} else {
|
|
375665
376017
|
const fname = `aiden-${ts}.json`;
|
|
375666
|
-
|
|
376018
|
+
import_fs45.default.writeFileSync(fname, JSON.stringify({ session: SESSION_ID, exported: (/* @__PURE__ */ new Date()).toISOString(), history: state.history }, null, 2));
|
|
375667
376019
|
console.log(` ${T.success}\u2713 Exported to ${fname}${T.reset}
|
|
375668
376020
|
`);
|
|
375669
376021
|
}
|
|
@@ -375677,7 +376029,7 @@ ${h.content}
|
|
|
375677
376029
|
`);
|
|
375678
376030
|
} else {
|
|
375679
376031
|
const fname = `aiden-fork-${name.replace(/\s+/g, "-")}-${Date.now()}.json`;
|
|
375680
|
-
|
|
376032
|
+
import_fs45.default.writeFileSync(fname, JSON.stringify({ name, parent: SESSION_ID, history: state.history, created: (/* @__PURE__ */ new Date()).toISOString() }, null, 2));
|
|
375681
376033
|
console.log(` ${T.success}\u2713 Fork saved: ${fname}${T.reset}
|
|
375682
376034
|
`);
|
|
375683
376035
|
}
|
|
@@ -375685,7 +376037,7 @@ ${h.content}
|
|
|
375685
376037
|
}
|
|
375686
376038
|
if (command === "/checkpoint") {
|
|
375687
376039
|
const fname = `aiden-checkpoint-${Date.now()}.json`;
|
|
375688
|
-
|
|
376040
|
+
import_fs45.default.writeFileSync(fname, JSON.stringify({ sessionId: SESSION_ID, history: state.history, turnCount: state.turnCount, timestamp: (/* @__PURE__ */ new Date()).toISOString() }, null, 2));
|
|
375689
376041
|
console.log(` ${T.success}\u2713 Checkpoint saved: ${fname}${T.reset}
|
|
375690
376042
|
`);
|
|
375691
376043
|
return true;
|
|
@@ -376932,10 +377284,10 @@ ${h.content}
|
|
|
376932
377284
|
...yes ? ["-Yes"] : []
|
|
376933
377285
|
];
|
|
376934
377286
|
const { spawn: spawn5 } = await import("child_process");
|
|
376935
|
-
const { existsSync:
|
|
377287
|
+
const { existsSync: existsSync8 } = await import("fs");
|
|
376936
377288
|
const { resolve: resolve2 } = await import("path");
|
|
376937
377289
|
const localScript = resolve2(__dirname, "..", "scripts", "uninstall.ps1");
|
|
376938
|
-
const hasLocal =
|
|
377290
|
+
const hasLocal = existsSync8(localScript);
|
|
376939
377291
|
let ps;
|
|
376940
377292
|
if (hasLocal) {
|
|
376941
377293
|
ps = spawn5(
|
|
@@ -377837,10 +378189,10 @@ ${h.content}
|
|
|
377837
378189
|
}
|
|
377838
378190
|
if (command === "/save") {
|
|
377839
378191
|
const filename = parts[1] ? parts.slice(1).join("_").replace(/[^a-zA-Z0-9._-]/g, "_") : `session_${SESSION_ID.slice(0, 12)}_${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.md`;
|
|
377840
|
-
const exportsDir =
|
|
378192
|
+
const exportsDir = import_path47.default.join(__dirname, "..", "workspace", "exports");
|
|
377841
378193
|
try {
|
|
377842
|
-
|
|
377843
|
-
const outPath =
|
|
378194
|
+
import_fs45.default.mkdirSync(exportsDir, { recursive: true });
|
|
378195
|
+
const outPath = import_path47.default.join(exportsDir, filename.endsWith(".md") ? filename : filename + ".md");
|
|
377844
378196
|
const label = state.sessionName ? `**Session:** ${state.sessionName}
|
|
377845
378197
|
` : "";
|
|
377846
378198
|
const header = `# Aiden Conversation Export
|
|
@@ -377854,8 +378206,8 @@ ${label}**ID:** ${SESSION_ID}
|
|
|
377854
378206
|
(h) => `**${h.role === "user" ? "You" : "Aiden"}:** ${h.content}
|
|
377855
378207
|
`
|
|
377856
378208
|
).join("\n");
|
|
377857
|
-
|
|
377858
|
-
console.log(` ${fg(COLORS.success)}\u2713${RST} Saved to ${T.dim}workspace/exports/${
|
|
378209
|
+
import_fs45.default.writeFileSync(outPath, header + body, "utf-8");
|
|
378210
|
+
console.log(` ${fg(COLORS.success)}\u2713${RST} Saved to ${T.dim}workspace/exports/${import_path47.default.basename(outPath)}${T.reset}
|
|
377859
378211
|
`);
|
|
377860
378212
|
} catch (e) {
|
|
377861
378213
|
console.log(` ${T.error}Save failed: ${e.message}${T.reset}
|
|
@@ -377967,16 +378319,16 @@ ${label}**ID:** ${SESSION_ID}
|
|
|
377967
378319
|
return true;
|
|
377968
378320
|
}
|
|
377969
378321
|
const filePath = parts.slice(1).join(" ");
|
|
377970
|
-
const resolved =
|
|
377971
|
-
if (!
|
|
378322
|
+
const resolved = import_path47.default.isAbsolute(filePath) ? filePath : import_path47.default.join(process.cwd(), filePath);
|
|
378323
|
+
if (!import_fs45.default.existsSync(resolved)) {
|
|
377972
378324
|
console.log(` ${T.error}File not found: ${resolved}${T.reset}
|
|
377973
378325
|
`);
|
|
377974
378326
|
return true;
|
|
377975
378327
|
}
|
|
377976
378328
|
state.attachments.push(resolved);
|
|
377977
|
-
const stat =
|
|
378329
|
+
const stat = import_fs45.default.statSync(resolved);
|
|
377978
378330
|
const kb = Math.round(stat.size / 1024);
|
|
377979
|
-
console.log(` ${fg(COLORS.success)}\u2713${RST} Attached ${T.dim}${
|
|
378331
|
+
console.log(` ${fg(COLORS.success)}\u2713${RST} Attached ${T.dim}${import_path47.default.basename(resolved)}${T.reset} ${T.dim}(${kb}KB \xB7 ${state.attachments.length} pending)${T.reset}
|
|
377980
378332
|
`);
|
|
377981
378333
|
return true;
|
|
377982
378334
|
}
|
|
@@ -378911,15 +379263,15 @@ ${label}**ID:** ${SESSION_ID}
|
|
|
378911
379263
|
return true;
|
|
378912
379264
|
}
|
|
378913
379265
|
if (sub === "examples") {
|
|
378914
|
-
const scriptDir =
|
|
379266
|
+
const scriptDir = import_path47.default.join(__dirname, "..", "scripts");
|
|
378915
379267
|
const lines = [""];
|
|
378916
379268
|
try {
|
|
378917
|
-
const files =
|
|
379269
|
+
const files = import_fs45.default.readdirSync(scriptDir).filter((f) => f.endsWith(".js") || f.endsWith(".ts"));
|
|
378918
379270
|
if (!files.length) {
|
|
378919
379271
|
lines.push(` ${D}No scripts found in scripts/${R}`);
|
|
378920
379272
|
} else {
|
|
378921
379273
|
for (const f of files) {
|
|
378922
|
-
const firstLine =
|
|
379274
|
+
const firstLine = import_fs45.default.readFileSync(import_path47.default.join(scriptDir, f), "utf8").split("\n").find((l) => l.startsWith("//"))?.replace(/^\/\/\s*/, "") ?? "";
|
|
378923
379275
|
lines.push(` ${O}${f.padEnd(32)}${R}${D}${firstLine}${R}`);
|
|
378924
379276
|
}
|
|
378925
379277
|
lines.push("");
|
|
@@ -378958,10 +379310,10 @@ ${label}**ID:** ${SESSION_ID}
|
|
|
378958
379310
|
return true;
|
|
378959
379311
|
}
|
|
378960
379312
|
if (sub) {
|
|
378961
|
-
const filePath =
|
|
379313
|
+
const filePath = import_path47.default.isAbsolute(sub) ? sub : import_path47.default.resolve(process.cwd(), sub);
|
|
378962
379314
|
try {
|
|
378963
|
-
const code =
|
|
378964
|
-
const desc = parts.slice(2).join(" ") ||
|
|
379315
|
+
const code = import_fs45.default.readFileSync(filePath, "utf8");
|
|
379316
|
+
const desc = parts.slice(2).join(" ") || import_path47.default.basename(filePath);
|
|
378965
379317
|
await _executeRunCode(code, desc, O, G2, R, D);
|
|
378966
379318
|
} catch (e) {
|
|
378967
379319
|
console.log(`
|
|
@@ -379746,8 +380098,8 @@ ${label}**ID:** ${SESSION_ID}
|
|
|
379746
380098
|
`);
|
|
379747
380099
|
return true;
|
|
379748
380100
|
}
|
|
379749
|
-
const
|
|
379750
|
-
if (!
|
|
380101
|
+
const fs50 = require("fs");
|
|
380102
|
+
if (!fs50.existsSync(refPath)) {
|
|
379751
380103
|
console.log(`
|
|
379752
380104
|
${T.error}\u2717 Reference audio file not found: ${refPath}${T.reset}
|
|
379753
380105
|
`);
|
|
@@ -380547,7 +380899,7 @@ async function main() {
|
|
|
380547
380899
|
const parts = [];
|
|
380548
380900
|
for (const p of state.attachments) {
|
|
380549
380901
|
try {
|
|
380550
|
-
const content =
|
|
380902
|
+
const content = import_fs45.default.readFileSync(p, "utf-8").slice(0, 8e3);
|
|
380551
380903
|
parts.push(`<attachment path="${p}">
|
|
380552
380904
|
${content}
|
|
380553
380905
|
</attachment>`);
|
|
@@ -380574,14 +380926,14 @@ async function run() {
|
|
|
380574
380926
|
if (require.main === module) {
|
|
380575
380927
|
if (process.argv[2] === "uninstall") {
|
|
380576
380928
|
const { spawnSync: spawnSync2 } = require("child_process");
|
|
380577
|
-
const { existsSync:
|
|
380929
|
+
const { existsSync: existsSync8 } = require("fs");
|
|
380578
380930
|
const { resolve: resolve2 } = require("path");
|
|
380579
380931
|
const flags = [];
|
|
380580
380932
|
if (process.argv.includes("--keep-workspace")) flags.push("-KeepWorkspace");
|
|
380581
380933
|
if (process.argv.includes("--keep-config")) flags.push("-KeepConfig");
|
|
380582
380934
|
if (process.argv.includes("--yes") || process.argv.includes("-y")) flags.push("-Yes");
|
|
380583
380935
|
const localScript = resolve2(__dirname, "..", "scripts", "uninstall.ps1");
|
|
380584
|
-
const hasLocal =
|
|
380936
|
+
const hasLocal = existsSync8(localScript);
|
|
380585
380937
|
let result;
|
|
380586
380938
|
if (hasLocal) {
|
|
380587
380939
|
result = spawnSync2(
|