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