dorkos 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +5 -5
- package/dist/client/assets/{TopologyGraph-BDQJfh8H.js → TopologyGraph-DpgzpmJt.js} +1 -1
- package/dist/client/assets/{highlighted-body-TPN3WLV5-C-9u4GvI.js → highlighted-body-TPN3WLV5-iVIkqCfu.js} +1 -1
- package/dist/client/assets/index-BXpaSRVe.css +1 -0
- package/dist/client/assets/{index-D8O7L1KA.js → index-CUlB5cRr.js} +197 -181
- package/dist/client/index.html +2 -2
- package/dist/server/index.js +293 -263
- package/dist/server/index.js.map +3 -3
- package/package.json +1 -1
- package/dist/client/assets/index-CRsHB5DU.css +0 -1
package/dist/server/index.js
CHANGED
|
@@ -9504,11 +9504,11 @@ var require_mime_types = __commonJS({
|
|
|
9504
9504
|
}
|
|
9505
9505
|
return exts[0];
|
|
9506
9506
|
}
|
|
9507
|
-
function lookup(
|
|
9508
|
-
if (!
|
|
9507
|
+
function lookup(path30) {
|
|
9508
|
+
if (!path30 || typeof path30 !== "string") {
|
|
9509
9509
|
return false;
|
|
9510
9510
|
}
|
|
9511
|
-
var extension2 = extname2("x." +
|
|
9511
|
+
var extension2 = extname2("x." + path30).toLowerCase().substr(1);
|
|
9512
9512
|
if (!extension2) {
|
|
9513
9513
|
return false;
|
|
9514
9514
|
}
|
|
@@ -10017,19 +10017,19 @@ var require_utils = __commonJS({
|
|
|
10017
10017
|
if (decode)
|
|
10018
10018
|
return decode(data, hint);
|
|
10019
10019
|
}
|
|
10020
|
-
function basename4(
|
|
10021
|
-
if (typeof
|
|
10020
|
+
function basename4(path30) {
|
|
10021
|
+
if (typeof path30 !== "string")
|
|
10022
10022
|
return "";
|
|
10023
|
-
for (let i2 =
|
|
10024
|
-
switch (
|
|
10023
|
+
for (let i2 = path30.length - 1; i2 >= 0; --i2) {
|
|
10024
|
+
switch (path30.charCodeAt(i2)) {
|
|
10025
10025
|
case 47:
|
|
10026
10026
|
// '/'
|
|
10027
10027
|
case 92:
|
|
10028
|
-
|
|
10029
|
-
return
|
|
10028
|
+
path30 = path30.slice(i2 + 1);
|
|
10029
|
+
return path30 === ".." || path30 === "." ? "" : path30;
|
|
10030
10030
|
}
|
|
10031
10031
|
}
|
|
10032
|
-
return
|
|
10032
|
+
return path30 === ".." || path30 === "." ? "" : path30;
|
|
10033
10033
|
}
|
|
10034
10034
|
var TOKEN = [
|
|
10035
10035
|
0,
|
|
@@ -13874,7 +13874,7 @@ var require_disk = __commonJS({
|
|
|
13874
13874
|
"../../node_modules/.pnpm/multer@2.1.1/node_modules/multer/storage/disk.js"(exports, module) {
|
|
13875
13875
|
var fs20 = __require("fs");
|
|
13876
13876
|
var os7 = __require("os");
|
|
13877
|
-
var
|
|
13877
|
+
var path30 = __require("path");
|
|
13878
13878
|
var crypto7 = __require("crypto");
|
|
13879
13879
|
function getFilename(req, file, cb) {
|
|
13880
13880
|
crypto7.randomBytes(16, function(err, raw) {
|
|
@@ -13901,7 +13901,7 @@ var require_disk = __commonJS({
|
|
|
13901
13901
|
if (err) return cb(err);
|
|
13902
13902
|
that.getFilename(req, file, function(err2, filename) {
|
|
13903
13903
|
if (err2) return cb(err2);
|
|
13904
|
-
var finalPath =
|
|
13904
|
+
var finalPath = path30.join(destination, filename);
|
|
13905
13905
|
var outStream = fs20.createWriteStream(finalPath);
|
|
13906
13906
|
file.stream.pipe(outStream);
|
|
13907
13907
|
outStream.on("error", cb);
|
|
@@ -13917,11 +13917,11 @@ var require_disk = __commonJS({
|
|
|
13917
13917
|
});
|
|
13918
13918
|
};
|
|
13919
13919
|
DiskStorage.prototype._removeFile = function _removeFile(req, file, cb) {
|
|
13920
|
-
var
|
|
13920
|
+
var path31 = file.path;
|
|
13921
13921
|
delete file.destination;
|
|
13922
13922
|
delete file.filename;
|
|
13923
13923
|
delete file.path;
|
|
13924
|
-
fs20.unlink(
|
|
13924
|
+
fs20.unlink(path31, cb);
|
|
13925
13925
|
};
|
|
13926
13926
|
module.exports = function(opts) {
|
|
13927
13927
|
return new DiskStorage(opts);
|
|
@@ -22440,14 +22440,14 @@ var require_url_state_machine = __commonJS({
|
|
|
22440
22440
|
return url.replace(/\u0009|\u000A|\u000D/g, "");
|
|
22441
22441
|
}
|
|
22442
22442
|
function shortenPath(url) {
|
|
22443
|
-
const
|
|
22444
|
-
if (
|
|
22443
|
+
const path30 = url.path;
|
|
22444
|
+
if (path30.length === 0) {
|
|
22445
22445
|
return;
|
|
22446
22446
|
}
|
|
22447
|
-
if (url.scheme === "file" &&
|
|
22447
|
+
if (url.scheme === "file" && path30.length === 1 && isNormalizedWindowsDriveLetter(path30[0])) {
|
|
22448
22448
|
return;
|
|
22449
22449
|
}
|
|
22450
|
-
|
|
22450
|
+
path30.pop();
|
|
22451
22451
|
}
|
|
22452
22452
|
function includesCredentials(url) {
|
|
22453
22453
|
return url.username !== "" || url.password !== "";
|
|
@@ -35879,8 +35879,8 @@ var require_utils3 = __commonJS({
|
|
|
35879
35879
|
}
|
|
35880
35880
|
return ind;
|
|
35881
35881
|
}
|
|
35882
|
-
function removeDotSegments(
|
|
35883
|
-
let input =
|
|
35882
|
+
function removeDotSegments(path30) {
|
|
35883
|
+
let input = path30;
|
|
35884
35884
|
const output = [];
|
|
35885
35885
|
let nextSlash = -1;
|
|
35886
35886
|
let len = 0;
|
|
@@ -36079,8 +36079,8 @@ var require_schemes = __commonJS({
|
|
|
36079
36079
|
wsComponent.secure = void 0;
|
|
36080
36080
|
}
|
|
36081
36081
|
if (wsComponent.resourceName) {
|
|
36082
|
-
const [
|
|
36083
|
-
wsComponent.path =
|
|
36082
|
+
const [path30, query2] = wsComponent.resourceName.split("?");
|
|
36083
|
+
wsComponent.path = path30 && path30 !== "/" ? path30 : void 0;
|
|
36084
36084
|
wsComponent.query = query2;
|
|
36085
36085
|
wsComponent.resourceName = void 0;
|
|
36086
36086
|
}
|
|
@@ -39456,12 +39456,12 @@ var require_dist = __commonJS({
|
|
|
39456
39456
|
});
|
|
39457
39457
|
|
|
39458
39458
|
// ../../apps/server/src/index.ts
|
|
39459
|
-
import
|
|
39459
|
+
import path29 from "path";
|
|
39460
39460
|
|
|
39461
39461
|
// ../../apps/server/src/app.ts
|
|
39462
39462
|
import express from "express";
|
|
39463
39463
|
import cors from "cors";
|
|
39464
|
-
import
|
|
39464
|
+
import path9 from "path";
|
|
39465
39465
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
39466
39466
|
import { apiReference } from "@scalar/express-api-reference";
|
|
39467
39467
|
|
|
@@ -41700,7 +41700,7 @@ var TunnelManager = class extends EventEmitter {
|
|
|
41700
41700
|
var tunnelManager = new TunnelManager();
|
|
41701
41701
|
|
|
41702
41702
|
// ../../apps/server/src/lib/version.ts
|
|
41703
|
-
var SERVER_VERSION = true ? "0.9.
|
|
41703
|
+
var SERVER_VERSION = true ? "0.9.1" : createRequire(import.meta.url)("../../package.json").version;
|
|
41704
41704
|
|
|
41705
41705
|
// ../../apps/server/src/routes/health.ts
|
|
41706
41706
|
var router3 = Router3();
|
|
@@ -42535,6 +42535,7 @@ var capabilities_default = router10;
|
|
|
42535
42535
|
|
|
42536
42536
|
// ../../apps/server/src/routes/uploads.ts
|
|
42537
42537
|
var import_multer2 = __toESM(require_multer(), 1);
|
|
42538
|
+
import path8 from "path";
|
|
42538
42539
|
import { Router as Router11 } from "express";
|
|
42539
42540
|
|
|
42540
42541
|
// ../../apps/server/src/services/core/upload-handler.ts
|
|
@@ -42629,6 +42630,33 @@ router11.post("/", async (req, res) => {
|
|
|
42629
42630
|
throw err;
|
|
42630
42631
|
}
|
|
42631
42632
|
});
|
|
42633
|
+
router11.get("/:filename", async (req, res) => {
|
|
42634
|
+
try {
|
|
42635
|
+
const cwd = req.query.cwd;
|
|
42636
|
+
if (!cwd || typeof cwd !== "string") {
|
|
42637
|
+
return res.status(400).json({ error: "Missing required parameter: cwd" });
|
|
42638
|
+
}
|
|
42639
|
+
const validatedCwd = await validateBoundary(cwd);
|
|
42640
|
+
const filename = path8.basename(req.params.filename);
|
|
42641
|
+
const filePath = path8.join(uploadHandler.getUploadDir(validatedCwd), filename);
|
|
42642
|
+
const resolvedPath = path8.resolve(filePath);
|
|
42643
|
+
const uploadDir = path8.resolve(uploadHandler.getUploadDir(validatedCwd));
|
|
42644
|
+
if (!resolvedPath.startsWith(uploadDir + path8.sep) && resolvedPath !== uploadDir) {
|
|
42645
|
+
return res.status(403).json({ error: "Access denied" });
|
|
42646
|
+
}
|
|
42647
|
+
res.sendFile(resolvedPath, (err) => {
|
|
42648
|
+
if (err && !res.headersSent) {
|
|
42649
|
+
const status = err.code === "ENOENT" ? 404 : 500;
|
|
42650
|
+
res.status(status).json({ error: status === 404 ? "File not found" : "Internal error" });
|
|
42651
|
+
}
|
|
42652
|
+
});
|
|
42653
|
+
} catch (err) {
|
|
42654
|
+
if (err instanceof BoundaryError) {
|
|
42655
|
+
return res.status(403).json({ error: err.message, code: err.code });
|
|
42656
|
+
}
|
|
42657
|
+
throw err;
|
|
42658
|
+
}
|
|
42659
|
+
});
|
|
42632
42660
|
var uploads_default = router11;
|
|
42633
42661
|
|
|
42634
42662
|
// ../../apps/server/src/services/core/openapi-registry.ts
|
|
@@ -44108,7 +44136,7 @@ function requestLogger(req, res, next) {
|
|
|
44108
44136
|
}
|
|
44109
44137
|
|
|
44110
44138
|
// ../../apps/server/src/app.ts
|
|
44111
|
-
var __dirname =
|
|
44139
|
+
var __dirname = path9.dirname(fileURLToPath2(import.meta.url));
|
|
44112
44140
|
function buildCorsOrigin() {
|
|
44113
44141
|
const envOrigin = process.env.DORKOS_CORS_ORIGIN;
|
|
44114
44142
|
if (envOrigin === "*") return "*";
|
|
@@ -44161,10 +44189,10 @@ function finalizeApp(app) {
|
|
|
44161
44189
|
});
|
|
44162
44190
|
app.use(errorHandler);
|
|
44163
44191
|
if (env.NODE_ENV === "production") {
|
|
44164
|
-
const distPath = env.CLIENT_DIST_PATH ??
|
|
44192
|
+
const distPath = env.CLIENT_DIST_PATH ?? path9.join(__dirname, "../../client/dist");
|
|
44165
44193
|
app.use(express.static(distPath));
|
|
44166
44194
|
app.get("*", (_req, res) => {
|
|
44167
|
-
res.sendFile(
|
|
44195
|
+
res.sendFile(path9.join(distPath, "index.html"));
|
|
44168
44196
|
});
|
|
44169
44197
|
}
|
|
44170
44198
|
}
|
|
@@ -44255,7 +44283,7 @@ var SessionLockManager = class {
|
|
|
44255
44283
|
|
|
44256
44284
|
// ../../apps/server/src/services/runtimes/claude-code/transcript-reader.ts
|
|
44257
44285
|
import fs7 from "fs/promises";
|
|
44258
|
-
import
|
|
44286
|
+
import path10 from "path";
|
|
44259
44287
|
import os2 from "os";
|
|
44260
44288
|
|
|
44261
44289
|
// ../../apps/server/src/services/runtimes/claude-code/transcript-parser.ts
|
|
@@ -44570,7 +44598,7 @@ var TranscriptReader = class {
|
|
|
44570
44598
|
/** Resolve the SDK transcripts directory for a given vault root. */
|
|
44571
44599
|
getTranscriptsDir(vaultRoot2) {
|
|
44572
44600
|
const slug = this.getProjectSlug(vaultRoot2);
|
|
44573
|
-
return
|
|
44601
|
+
return path10.join(os2.homedir(), ".claude", "projects", slug);
|
|
44574
44602
|
}
|
|
44575
44603
|
/**
|
|
44576
44604
|
* List all sessions by scanning SDK JSONL transcript files.
|
|
@@ -44588,7 +44616,7 @@ var TranscriptReader = class {
|
|
|
44588
44616
|
const sessions = [];
|
|
44589
44617
|
for (const file of files) {
|
|
44590
44618
|
const sessionId = file.replace(".jsonl", "");
|
|
44591
|
-
const filePath =
|
|
44619
|
+
const filePath = path10.join(transcriptsDir, file);
|
|
44592
44620
|
try {
|
|
44593
44621
|
const fileStat = await fs7.stat(filePath);
|
|
44594
44622
|
const cached = this.metaCache.get(sessionId);
|
|
@@ -44611,7 +44639,7 @@ var TranscriptReader = class {
|
|
|
44611
44639
|
*/
|
|
44612
44640
|
async getSession(vaultRoot2, sessionId) {
|
|
44613
44641
|
await validateBoundary(vaultRoot2);
|
|
44614
|
-
const filePath =
|
|
44642
|
+
const filePath = path10.join(this.getTranscriptsDir(vaultRoot2), `${sessionId}.jsonl`);
|
|
44615
44643
|
try {
|
|
44616
44644
|
const session = await this.extractSessionMeta(filePath, sessionId);
|
|
44617
44645
|
const tailStatus = await this.readTailStatus(filePath);
|
|
@@ -44767,7 +44795,7 @@ var TranscriptReader = class {
|
|
|
44767
44795
|
async readTranscript(vaultRoot2, sessionId) {
|
|
44768
44796
|
await validateBoundary(vaultRoot2);
|
|
44769
44797
|
const transcriptsDir = this.getTranscriptsDir(vaultRoot2);
|
|
44770
|
-
const filePath =
|
|
44798
|
+
const filePath = path10.join(transcriptsDir, `${sessionId}.jsonl`);
|
|
44771
44799
|
let content;
|
|
44772
44800
|
try {
|
|
44773
44801
|
content = await fs7.readFile(filePath, "utf-8");
|
|
@@ -44793,7 +44821,7 @@ var TranscriptReader = class {
|
|
|
44793
44821
|
/** Get an ETag for a session transcript (mtime + size) for HTTP caching. */
|
|
44794
44822
|
async getTranscriptETag(vaultRoot2, sessionId) {
|
|
44795
44823
|
await validateBoundary(vaultRoot2);
|
|
44796
|
-
const filePath =
|
|
44824
|
+
const filePath = path10.join(this.getTranscriptsDir(vaultRoot2), `${sessionId}.jsonl`);
|
|
44797
44825
|
try {
|
|
44798
44826
|
const stat5 = await fs7.stat(filePath);
|
|
44799
44827
|
return `"${stat5.mtimeMs}-${stat5.size}"`;
|
|
@@ -44808,7 +44836,7 @@ var TranscriptReader = class {
|
|
|
44808
44836
|
async readTasks(vaultRoot2, sessionId) {
|
|
44809
44837
|
await validateBoundary(vaultRoot2);
|
|
44810
44838
|
const transcriptsDir = this.getTranscriptsDir(vaultRoot2);
|
|
44811
|
-
const filePath =
|
|
44839
|
+
const filePath = path10.join(transcriptsDir, `${sessionId}.jsonl`);
|
|
44812
44840
|
let content;
|
|
44813
44841
|
try {
|
|
44814
44842
|
content = await fs7.readFile(filePath, "utf-8");
|
|
@@ -44824,7 +44852,7 @@ var TranscriptReader = class {
|
|
|
44824
44852
|
*/
|
|
44825
44853
|
async readFromOffset(vaultRoot2, sessionId, fromOffset) {
|
|
44826
44854
|
await validateBoundary(vaultRoot2);
|
|
44827
|
-
const filePath =
|
|
44855
|
+
const filePath = path10.join(this.getTranscriptsDir(vaultRoot2), `${sessionId}.jsonl`);
|
|
44828
44856
|
const stat5 = await fs7.stat(filePath);
|
|
44829
44857
|
if (stat5.size <= fromOffset) {
|
|
44830
44858
|
return { content: "", newOffset: fromOffset };
|
|
@@ -44920,7 +44948,7 @@ var ReaddirpStream = class extends Readable {
|
|
|
44920
44948
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
44921
44949
|
const statMethod = opts.lstat ? lstat : stat;
|
|
44922
44950
|
if (wantBigintFsStats) {
|
|
44923
|
-
this._stat = (
|
|
44951
|
+
this._stat = (path30) => statMethod(path30, { bigint: true });
|
|
44924
44952
|
} else {
|
|
44925
44953
|
this._stat = statMethod;
|
|
44926
44954
|
}
|
|
@@ -44945,8 +44973,8 @@ var ReaddirpStream = class extends Readable {
|
|
|
44945
44973
|
const par = this.parent;
|
|
44946
44974
|
const fil = par && par.files;
|
|
44947
44975
|
if (fil && fil.length > 0) {
|
|
44948
|
-
const { path:
|
|
44949
|
-
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent,
|
|
44976
|
+
const { path: path30, depth } = par;
|
|
44977
|
+
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path30));
|
|
44950
44978
|
const awaited = await Promise.all(slice);
|
|
44951
44979
|
for (const entry of awaited) {
|
|
44952
44980
|
if (!entry)
|
|
@@ -44986,20 +45014,20 @@ var ReaddirpStream = class extends Readable {
|
|
|
44986
45014
|
this.reading = false;
|
|
44987
45015
|
}
|
|
44988
45016
|
}
|
|
44989
|
-
async _exploreDir(
|
|
45017
|
+
async _exploreDir(path30, depth) {
|
|
44990
45018
|
let files;
|
|
44991
45019
|
try {
|
|
44992
|
-
files = await readdir(
|
|
45020
|
+
files = await readdir(path30, this._rdOptions);
|
|
44993
45021
|
} catch (error) {
|
|
44994
45022
|
this._onError(error);
|
|
44995
45023
|
}
|
|
44996
|
-
return { files, depth, path:
|
|
45024
|
+
return { files, depth, path: path30 };
|
|
44997
45025
|
}
|
|
44998
|
-
async _formatEntry(dirent,
|
|
45026
|
+
async _formatEntry(dirent, path30) {
|
|
44999
45027
|
let entry;
|
|
45000
45028
|
const basename4 = this._isDirent ? dirent.name : dirent;
|
|
45001
45029
|
try {
|
|
45002
|
-
const fullPath = presolve(pjoin(
|
|
45030
|
+
const fullPath = presolve(pjoin(path30, basename4));
|
|
45003
45031
|
entry = { path: prelative(this._root, fullPath), fullPath, basename: basename4 };
|
|
45004
45032
|
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
45005
45033
|
} catch (err) {
|
|
@@ -45399,16 +45427,16 @@ var delFromSet = (main, prop, item) => {
|
|
|
45399
45427
|
};
|
|
45400
45428
|
var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
|
|
45401
45429
|
var FsWatchInstances = /* @__PURE__ */ new Map();
|
|
45402
|
-
function createFsWatchInstance(
|
|
45430
|
+
function createFsWatchInstance(path30, options, listener, errHandler, emitRaw) {
|
|
45403
45431
|
const handleEvent = (rawEvent, evPath) => {
|
|
45404
|
-
listener(
|
|
45405
|
-
emitRaw(rawEvent, evPath, { watchedPath:
|
|
45406
|
-
if (evPath &&
|
|
45407
|
-
fsWatchBroadcast(sysPath.resolve(
|
|
45432
|
+
listener(path30);
|
|
45433
|
+
emitRaw(rawEvent, evPath, { watchedPath: path30 });
|
|
45434
|
+
if (evPath && path30 !== evPath) {
|
|
45435
|
+
fsWatchBroadcast(sysPath.resolve(path30, evPath), KEY_LISTENERS, sysPath.join(path30, evPath));
|
|
45408
45436
|
}
|
|
45409
45437
|
};
|
|
45410
45438
|
try {
|
|
45411
|
-
return fs_watch(
|
|
45439
|
+
return fs_watch(path30, {
|
|
45412
45440
|
persistent: options.persistent
|
|
45413
45441
|
}, handleEvent);
|
|
45414
45442
|
} catch (error) {
|
|
@@ -45424,12 +45452,12 @@ var fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
|
|
|
45424
45452
|
listener(val1, val2, val3);
|
|
45425
45453
|
});
|
|
45426
45454
|
};
|
|
45427
|
-
var setFsWatchListener = (
|
|
45455
|
+
var setFsWatchListener = (path30, fullPath, options, handlers) => {
|
|
45428
45456
|
const { listener, errHandler, rawEmitter } = handlers;
|
|
45429
45457
|
let cont = FsWatchInstances.get(fullPath);
|
|
45430
45458
|
let watcher;
|
|
45431
45459
|
if (!options.persistent) {
|
|
45432
|
-
watcher = createFsWatchInstance(
|
|
45460
|
+
watcher = createFsWatchInstance(path30, options, listener, errHandler, rawEmitter);
|
|
45433
45461
|
if (!watcher)
|
|
45434
45462
|
return;
|
|
45435
45463
|
return watcher.close.bind(watcher);
|
|
@@ -45440,7 +45468,7 @@ var setFsWatchListener = (path29, fullPath, options, handlers) => {
|
|
|
45440
45468
|
addAndConvert(cont, KEY_RAW, rawEmitter);
|
|
45441
45469
|
} else {
|
|
45442
45470
|
watcher = createFsWatchInstance(
|
|
45443
|
-
|
|
45471
|
+
path30,
|
|
45444
45472
|
options,
|
|
45445
45473
|
fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
|
|
45446
45474
|
errHandler,
|
|
@@ -45455,7 +45483,7 @@ var setFsWatchListener = (path29, fullPath, options, handlers) => {
|
|
|
45455
45483
|
cont.watcherUnusable = true;
|
|
45456
45484
|
if (isWindows2 && error.code === "EPERM") {
|
|
45457
45485
|
try {
|
|
45458
|
-
const fd = await open(
|
|
45486
|
+
const fd = await open(path30, "r");
|
|
45459
45487
|
await fd.close();
|
|
45460
45488
|
broadcastErr(error);
|
|
45461
45489
|
} catch (err) {
|
|
@@ -45486,7 +45514,7 @@ var setFsWatchListener = (path29, fullPath, options, handlers) => {
|
|
|
45486
45514
|
};
|
|
45487
45515
|
};
|
|
45488
45516
|
var FsWatchFileInstances = /* @__PURE__ */ new Map();
|
|
45489
|
-
var setFsWatchFileListener = (
|
|
45517
|
+
var setFsWatchFileListener = (path30, fullPath, options, handlers) => {
|
|
45490
45518
|
const { listener, rawEmitter } = handlers;
|
|
45491
45519
|
let cont = FsWatchFileInstances.get(fullPath);
|
|
45492
45520
|
const copts = cont && cont.options;
|
|
@@ -45508,7 +45536,7 @@ var setFsWatchFileListener = (path29, fullPath, options, handlers) => {
|
|
|
45508
45536
|
});
|
|
45509
45537
|
const currmtime = curr.mtimeMs;
|
|
45510
45538
|
if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
|
|
45511
|
-
foreach(cont.listeners, (listener2) => listener2(
|
|
45539
|
+
foreach(cont.listeners, (listener2) => listener2(path30, curr));
|
|
45512
45540
|
}
|
|
45513
45541
|
})
|
|
45514
45542
|
};
|
|
@@ -45536,13 +45564,13 @@ var NodeFsHandler = class {
|
|
|
45536
45564
|
* @param listener on fs change
|
|
45537
45565
|
* @returns closer for the watcher instance
|
|
45538
45566
|
*/
|
|
45539
|
-
_watchWithNodeFs(
|
|
45567
|
+
_watchWithNodeFs(path30, listener) {
|
|
45540
45568
|
const opts = this.fsw.options;
|
|
45541
|
-
const directory = sysPath.dirname(
|
|
45542
|
-
const basename4 = sysPath.basename(
|
|
45569
|
+
const directory = sysPath.dirname(path30);
|
|
45570
|
+
const basename4 = sysPath.basename(path30);
|
|
45543
45571
|
const parent = this.fsw._getWatchedDir(directory);
|
|
45544
45572
|
parent.add(basename4);
|
|
45545
|
-
const absolutePath = sysPath.resolve(
|
|
45573
|
+
const absolutePath = sysPath.resolve(path30);
|
|
45546
45574
|
const options = {
|
|
45547
45575
|
persistent: opts.persistent
|
|
45548
45576
|
};
|
|
@@ -45552,12 +45580,12 @@ var NodeFsHandler = class {
|
|
|
45552
45580
|
if (opts.usePolling) {
|
|
45553
45581
|
const enableBin = opts.interval !== opts.binaryInterval;
|
|
45554
45582
|
options.interval = enableBin && isBinaryPath(basename4) ? opts.binaryInterval : opts.interval;
|
|
45555
|
-
closer = setFsWatchFileListener(
|
|
45583
|
+
closer = setFsWatchFileListener(path30, absolutePath, options, {
|
|
45556
45584
|
listener,
|
|
45557
45585
|
rawEmitter: this.fsw._emitRaw
|
|
45558
45586
|
});
|
|
45559
45587
|
} else {
|
|
45560
|
-
closer = setFsWatchListener(
|
|
45588
|
+
closer = setFsWatchListener(path30, absolutePath, options, {
|
|
45561
45589
|
listener,
|
|
45562
45590
|
errHandler: this._boundHandleError,
|
|
45563
45591
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -45579,7 +45607,7 @@ var NodeFsHandler = class {
|
|
|
45579
45607
|
let prevStats = stats;
|
|
45580
45608
|
if (parent.has(basename4))
|
|
45581
45609
|
return;
|
|
45582
|
-
const listener = async (
|
|
45610
|
+
const listener = async (path30, newStats) => {
|
|
45583
45611
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
|
|
45584
45612
|
return;
|
|
45585
45613
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
@@ -45593,11 +45621,11 @@ var NodeFsHandler = class {
|
|
|
45593
45621
|
this.fsw._emit(EV.CHANGE, file, newStats2);
|
|
45594
45622
|
}
|
|
45595
45623
|
if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
|
|
45596
|
-
this.fsw._closeFile(
|
|
45624
|
+
this.fsw._closeFile(path30);
|
|
45597
45625
|
prevStats = newStats2;
|
|
45598
45626
|
const closer2 = this._watchWithNodeFs(file, listener);
|
|
45599
45627
|
if (closer2)
|
|
45600
|
-
this.fsw._addPathCloser(
|
|
45628
|
+
this.fsw._addPathCloser(path30, closer2);
|
|
45601
45629
|
} else {
|
|
45602
45630
|
prevStats = newStats2;
|
|
45603
45631
|
}
|
|
@@ -45629,7 +45657,7 @@ var NodeFsHandler = class {
|
|
|
45629
45657
|
* @param item basename of this item
|
|
45630
45658
|
* @returns true if no more processing is needed for this entry.
|
|
45631
45659
|
*/
|
|
45632
|
-
async _handleSymlink(entry, directory,
|
|
45660
|
+
async _handleSymlink(entry, directory, path30, item) {
|
|
45633
45661
|
if (this.fsw.closed) {
|
|
45634
45662
|
return;
|
|
45635
45663
|
}
|
|
@@ -45639,7 +45667,7 @@ var NodeFsHandler = class {
|
|
|
45639
45667
|
this.fsw._incrReadyCount();
|
|
45640
45668
|
let linkPath;
|
|
45641
45669
|
try {
|
|
45642
|
-
linkPath = await fsrealpath(
|
|
45670
|
+
linkPath = await fsrealpath(path30);
|
|
45643
45671
|
} catch (e2) {
|
|
45644
45672
|
this.fsw._emitReady();
|
|
45645
45673
|
return true;
|
|
@@ -45649,12 +45677,12 @@ var NodeFsHandler = class {
|
|
|
45649
45677
|
if (dir.has(item)) {
|
|
45650
45678
|
if (this.fsw._symlinkPaths.get(full) !== linkPath) {
|
|
45651
45679
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
45652
|
-
this.fsw._emit(EV.CHANGE,
|
|
45680
|
+
this.fsw._emit(EV.CHANGE, path30, entry.stats);
|
|
45653
45681
|
}
|
|
45654
45682
|
} else {
|
|
45655
45683
|
dir.add(item);
|
|
45656
45684
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
45657
|
-
this.fsw._emit(EV.ADD,
|
|
45685
|
+
this.fsw._emit(EV.ADD, path30, entry.stats);
|
|
45658
45686
|
}
|
|
45659
45687
|
this.fsw._emitReady();
|
|
45660
45688
|
return true;
|
|
@@ -45683,9 +45711,9 @@ var NodeFsHandler = class {
|
|
|
45683
45711
|
return;
|
|
45684
45712
|
}
|
|
45685
45713
|
const item = entry.path;
|
|
45686
|
-
let
|
|
45714
|
+
let path30 = sysPath.join(directory, item);
|
|
45687
45715
|
current.add(item);
|
|
45688
|
-
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory,
|
|
45716
|
+
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path30, item)) {
|
|
45689
45717
|
return;
|
|
45690
45718
|
}
|
|
45691
45719
|
if (this.fsw.closed) {
|
|
@@ -45694,8 +45722,8 @@ var NodeFsHandler = class {
|
|
|
45694
45722
|
}
|
|
45695
45723
|
if (item === target || !target && !previous.has(item)) {
|
|
45696
45724
|
this.fsw._incrReadyCount();
|
|
45697
|
-
|
|
45698
|
-
this._addToNodeFs(
|
|
45725
|
+
path30 = sysPath.join(dir, sysPath.relative(dir, path30));
|
|
45726
|
+
this._addToNodeFs(path30, initialAdd, wh, depth + 1);
|
|
45699
45727
|
}
|
|
45700
45728
|
}).on(EV.ERROR, this._boundHandleError);
|
|
45701
45729
|
return new Promise((resolve4, reject) => {
|
|
@@ -45764,13 +45792,13 @@ var NodeFsHandler = class {
|
|
|
45764
45792
|
* @param depth Child path actually targeted for watch
|
|
45765
45793
|
* @param target Child path actually targeted for watch
|
|
45766
45794
|
*/
|
|
45767
|
-
async _addToNodeFs(
|
|
45795
|
+
async _addToNodeFs(path30, initialAdd, priorWh, depth, target) {
|
|
45768
45796
|
const ready = this.fsw._emitReady;
|
|
45769
|
-
if (this.fsw._isIgnored(
|
|
45797
|
+
if (this.fsw._isIgnored(path30) || this.fsw.closed) {
|
|
45770
45798
|
ready();
|
|
45771
45799
|
return false;
|
|
45772
45800
|
}
|
|
45773
|
-
const wh = this.fsw._getWatchHelpers(
|
|
45801
|
+
const wh = this.fsw._getWatchHelpers(path30);
|
|
45774
45802
|
if (priorWh) {
|
|
45775
45803
|
wh.filterPath = (entry) => priorWh.filterPath(entry);
|
|
45776
45804
|
wh.filterDir = (entry) => priorWh.filterDir(entry);
|
|
@@ -45786,8 +45814,8 @@ var NodeFsHandler = class {
|
|
|
45786
45814
|
const follow = this.fsw.options.followSymlinks;
|
|
45787
45815
|
let closer;
|
|
45788
45816
|
if (stats.isDirectory()) {
|
|
45789
|
-
const absPath = sysPath.resolve(
|
|
45790
|
-
const targetPath = follow ? await fsrealpath(
|
|
45817
|
+
const absPath = sysPath.resolve(path30);
|
|
45818
|
+
const targetPath = follow ? await fsrealpath(path30) : path30;
|
|
45791
45819
|
if (this.fsw.closed)
|
|
45792
45820
|
return;
|
|
45793
45821
|
closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
|
|
@@ -45797,29 +45825,29 @@ var NodeFsHandler = class {
|
|
|
45797
45825
|
this.fsw._symlinkPaths.set(absPath, targetPath);
|
|
45798
45826
|
}
|
|
45799
45827
|
} else if (stats.isSymbolicLink()) {
|
|
45800
|
-
const targetPath = follow ? await fsrealpath(
|
|
45828
|
+
const targetPath = follow ? await fsrealpath(path30) : path30;
|
|
45801
45829
|
if (this.fsw.closed)
|
|
45802
45830
|
return;
|
|
45803
45831
|
const parent = sysPath.dirname(wh.watchPath);
|
|
45804
45832
|
this.fsw._getWatchedDir(parent).add(wh.watchPath);
|
|
45805
45833
|
this.fsw._emit(EV.ADD, wh.watchPath, stats);
|
|
45806
|
-
closer = await this._handleDir(parent, stats, initialAdd, depth,
|
|
45834
|
+
closer = await this._handleDir(parent, stats, initialAdd, depth, path30, wh, targetPath);
|
|
45807
45835
|
if (this.fsw.closed)
|
|
45808
45836
|
return;
|
|
45809
45837
|
if (targetPath !== void 0) {
|
|
45810
|
-
this.fsw._symlinkPaths.set(sysPath.resolve(
|
|
45838
|
+
this.fsw._symlinkPaths.set(sysPath.resolve(path30), targetPath);
|
|
45811
45839
|
}
|
|
45812
45840
|
} else {
|
|
45813
45841
|
closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
|
45814
45842
|
}
|
|
45815
45843
|
ready();
|
|
45816
45844
|
if (closer)
|
|
45817
|
-
this.fsw._addPathCloser(
|
|
45845
|
+
this.fsw._addPathCloser(path30, closer);
|
|
45818
45846
|
return false;
|
|
45819
45847
|
} catch (error) {
|
|
45820
45848
|
if (this.fsw._handleError(error)) {
|
|
45821
45849
|
ready();
|
|
45822
|
-
return
|
|
45850
|
+
return path30;
|
|
45823
45851
|
}
|
|
45824
45852
|
}
|
|
45825
45853
|
}
|
|
@@ -45862,26 +45890,26 @@ function createPattern(matcher) {
|
|
|
45862
45890
|
}
|
|
45863
45891
|
return () => false;
|
|
45864
45892
|
}
|
|
45865
|
-
function normalizePath(
|
|
45866
|
-
if (typeof
|
|
45893
|
+
function normalizePath(path30) {
|
|
45894
|
+
if (typeof path30 !== "string")
|
|
45867
45895
|
throw new Error("string expected");
|
|
45868
|
-
|
|
45869
|
-
|
|
45896
|
+
path30 = sysPath2.normalize(path30);
|
|
45897
|
+
path30 = path30.replace(/\\/g, "/");
|
|
45870
45898
|
let prepend = false;
|
|
45871
|
-
if (
|
|
45899
|
+
if (path30.startsWith("//"))
|
|
45872
45900
|
prepend = true;
|
|
45873
45901
|
const DOUBLE_SLASH_RE2 = /\/\//;
|
|
45874
|
-
while (
|
|
45875
|
-
|
|
45902
|
+
while (path30.match(DOUBLE_SLASH_RE2))
|
|
45903
|
+
path30 = path30.replace(DOUBLE_SLASH_RE2, "/");
|
|
45876
45904
|
if (prepend)
|
|
45877
|
-
|
|
45878
|
-
return
|
|
45905
|
+
path30 = "/" + path30;
|
|
45906
|
+
return path30;
|
|
45879
45907
|
}
|
|
45880
45908
|
function matchPatterns(patterns, testString, stats) {
|
|
45881
|
-
const
|
|
45909
|
+
const path30 = normalizePath(testString);
|
|
45882
45910
|
for (let index = 0; index < patterns.length; index++) {
|
|
45883
45911
|
const pattern = patterns[index];
|
|
45884
|
-
if (pattern(
|
|
45912
|
+
if (pattern(path30, stats)) {
|
|
45885
45913
|
return true;
|
|
45886
45914
|
}
|
|
45887
45915
|
}
|
|
@@ -45921,19 +45949,19 @@ var toUnix = (string2) => {
|
|
|
45921
45949
|
}
|
|
45922
45950
|
return str;
|
|
45923
45951
|
};
|
|
45924
|
-
var normalizePathToUnix = (
|
|
45925
|
-
var normalizeIgnored = (cwd = "") => (
|
|
45926
|
-
if (typeof
|
|
45927
|
-
return normalizePathToUnix(sysPath2.isAbsolute(
|
|
45952
|
+
var normalizePathToUnix = (path30) => toUnix(sysPath2.normalize(toUnix(path30)));
|
|
45953
|
+
var normalizeIgnored = (cwd = "") => (path30) => {
|
|
45954
|
+
if (typeof path30 === "string") {
|
|
45955
|
+
return normalizePathToUnix(sysPath2.isAbsolute(path30) ? path30 : sysPath2.join(cwd, path30));
|
|
45928
45956
|
} else {
|
|
45929
|
-
return
|
|
45957
|
+
return path30;
|
|
45930
45958
|
}
|
|
45931
45959
|
};
|
|
45932
|
-
var getAbsolutePath = (
|
|
45933
|
-
if (sysPath2.isAbsolute(
|
|
45934
|
-
return
|
|
45960
|
+
var getAbsolutePath = (path30, cwd) => {
|
|
45961
|
+
if (sysPath2.isAbsolute(path30)) {
|
|
45962
|
+
return path30;
|
|
45935
45963
|
}
|
|
45936
|
-
return sysPath2.join(cwd,
|
|
45964
|
+
return sysPath2.join(cwd, path30);
|
|
45937
45965
|
};
|
|
45938
45966
|
var EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
|
|
45939
45967
|
var DirEntry = class {
|
|
@@ -45988,10 +46016,10 @@ var DirEntry = class {
|
|
|
45988
46016
|
var STAT_METHOD_F = "stat";
|
|
45989
46017
|
var STAT_METHOD_L = "lstat";
|
|
45990
46018
|
var WatchHelper = class {
|
|
45991
|
-
constructor(
|
|
46019
|
+
constructor(path30, follow, fsw) {
|
|
45992
46020
|
this.fsw = fsw;
|
|
45993
|
-
const watchPath =
|
|
45994
|
-
this.path =
|
|
46021
|
+
const watchPath = path30;
|
|
46022
|
+
this.path = path30 = path30.replace(REPLACER_RE, "");
|
|
45995
46023
|
this.watchPath = watchPath;
|
|
45996
46024
|
this.fullWatchPath = sysPath2.resolve(watchPath);
|
|
45997
46025
|
this.dirParts = [];
|
|
@@ -46113,20 +46141,20 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
46113
46141
|
this._closePromise = void 0;
|
|
46114
46142
|
let paths = unifyPaths(paths_);
|
|
46115
46143
|
if (cwd) {
|
|
46116
|
-
paths = paths.map((
|
|
46117
|
-
const absPath = getAbsolutePath(
|
|
46144
|
+
paths = paths.map((path30) => {
|
|
46145
|
+
const absPath = getAbsolutePath(path30, cwd);
|
|
46118
46146
|
return absPath;
|
|
46119
46147
|
});
|
|
46120
46148
|
}
|
|
46121
|
-
paths.forEach((
|
|
46122
|
-
this._removeIgnoredPath(
|
|
46149
|
+
paths.forEach((path30) => {
|
|
46150
|
+
this._removeIgnoredPath(path30);
|
|
46123
46151
|
});
|
|
46124
46152
|
this._userIgnored = void 0;
|
|
46125
46153
|
if (!this._readyCount)
|
|
46126
46154
|
this._readyCount = 0;
|
|
46127
46155
|
this._readyCount += paths.length;
|
|
46128
|
-
Promise.all(paths.map(async (
|
|
46129
|
-
const res = await this._nodeFsHandler._addToNodeFs(
|
|
46156
|
+
Promise.all(paths.map(async (path30) => {
|
|
46157
|
+
const res = await this._nodeFsHandler._addToNodeFs(path30, !_internal, void 0, 0, _origAdd);
|
|
46130
46158
|
if (res)
|
|
46131
46159
|
this._emitReady();
|
|
46132
46160
|
return res;
|
|
@@ -46148,17 +46176,17 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
46148
46176
|
return this;
|
|
46149
46177
|
const paths = unifyPaths(paths_);
|
|
46150
46178
|
const { cwd } = this.options;
|
|
46151
|
-
paths.forEach((
|
|
46152
|
-
if (!sysPath2.isAbsolute(
|
|
46179
|
+
paths.forEach((path30) => {
|
|
46180
|
+
if (!sysPath2.isAbsolute(path30) && !this._closers.has(path30)) {
|
|
46153
46181
|
if (cwd)
|
|
46154
|
-
|
|
46155
|
-
|
|
46182
|
+
path30 = sysPath2.join(cwd, path30);
|
|
46183
|
+
path30 = sysPath2.resolve(path30);
|
|
46156
46184
|
}
|
|
46157
|
-
this._closePath(
|
|
46158
|
-
this._addIgnoredPath(
|
|
46159
|
-
if (this._watched.has(
|
|
46185
|
+
this._closePath(path30);
|
|
46186
|
+
this._addIgnoredPath(path30);
|
|
46187
|
+
if (this._watched.has(path30)) {
|
|
46160
46188
|
this._addIgnoredPath({
|
|
46161
|
-
path:
|
|
46189
|
+
path: path30,
|
|
46162
46190
|
recursive: true
|
|
46163
46191
|
});
|
|
46164
46192
|
}
|
|
@@ -46222,38 +46250,38 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
46222
46250
|
* @param stats arguments to be passed with event
|
|
46223
46251
|
* @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
|
46224
46252
|
*/
|
|
46225
|
-
async _emit(event,
|
|
46253
|
+
async _emit(event, path30, stats) {
|
|
46226
46254
|
if (this.closed)
|
|
46227
46255
|
return;
|
|
46228
46256
|
const opts = this.options;
|
|
46229
46257
|
if (isWindows2)
|
|
46230
|
-
|
|
46258
|
+
path30 = sysPath2.normalize(path30);
|
|
46231
46259
|
if (opts.cwd)
|
|
46232
|
-
|
|
46233
|
-
const args = [
|
|
46260
|
+
path30 = sysPath2.relative(opts.cwd, path30);
|
|
46261
|
+
const args = [path30];
|
|
46234
46262
|
if (stats != null)
|
|
46235
46263
|
args.push(stats);
|
|
46236
46264
|
const awf = opts.awaitWriteFinish;
|
|
46237
46265
|
let pw;
|
|
46238
|
-
if (awf && (pw = this._pendingWrites.get(
|
|
46266
|
+
if (awf && (pw = this._pendingWrites.get(path30))) {
|
|
46239
46267
|
pw.lastChange = /* @__PURE__ */ new Date();
|
|
46240
46268
|
return this;
|
|
46241
46269
|
}
|
|
46242
46270
|
if (opts.atomic) {
|
|
46243
46271
|
if (event === EVENTS.UNLINK) {
|
|
46244
|
-
this._pendingUnlinks.set(
|
|
46272
|
+
this._pendingUnlinks.set(path30, [event, ...args]);
|
|
46245
46273
|
setTimeout(() => {
|
|
46246
|
-
this._pendingUnlinks.forEach((entry,
|
|
46274
|
+
this._pendingUnlinks.forEach((entry, path31) => {
|
|
46247
46275
|
this.emit(...entry);
|
|
46248
46276
|
this.emit(EVENTS.ALL, ...entry);
|
|
46249
|
-
this._pendingUnlinks.delete(
|
|
46277
|
+
this._pendingUnlinks.delete(path31);
|
|
46250
46278
|
});
|
|
46251
46279
|
}, typeof opts.atomic === "number" ? opts.atomic : 100);
|
|
46252
46280
|
return this;
|
|
46253
46281
|
}
|
|
46254
|
-
if (event === EVENTS.ADD && this._pendingUnlinks.has(
|
|
46282
|
+
if (event === EVENTS.ADD && this._pendingUnlinks.has(path30)) {
|
|
46255
46283
|
event = EVENTS.CHANGE;
|
|
46256
|
-
this._pendingUnlinks.delete(
|
|
46284
|
+
this._pendingUnlinks.delete(path30);
|
|
46257
46285
|
}
|
|
46258
46286
|
}
|
|
46259
46287
|
if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
|
|
@@ -46271,16 +46299,16 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
46271
46299
|
this.emitWithAll(event, args);
|
|
46272
46300
|
}
|
|
46273
46301
|
};
|
|
46274
|
-
this._awaitWriteFinish(
|
|
46302
|
+
this._awaitWriteFinish(path30, awf.stabilityThreshold, event, awfEmit);
|
|
46275
46303
|
return this;
|
|
46276
46304
|
}
|
|
46277
46305
|
if (event === EVENTS.CHANGE) {
|
|
46278
|
-
const isThrottled = !this._throttle(EVENTS.CHANGE,
|
|
46306
|
+
const isThrottled = !this._throttle(EVENTS.CHANGE, path30, 50);
|
|
46279
46307
|
if (isThrottled)
|
|
46280
46308
|
return this;
|
|
46281
46309
|
}
|
|
46282
46310
|
if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
|
|
46283
|
-
const fullPath = opts.cwd ? sysPath2.join(opts.cwd,
|
|
46311
|
+
const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path30) : path30;
|
|
46284
46312
|
let stats2;
|
|
46285
46313
|
try {
|
|
46286
46314
|
stats2 = await stat3(fullPath);
|
|
@@ -46311,23 +46339,23 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
46311
46339
|
* @param timeout duration of time to suppress duplicate actions
|
|
46312
46340
|
* @returns tracking object or false if action should be suppressed
|
|
46313
46341
|
*/
|
|
46314
|
-
_throttle(actionType,
|
|
46342
|
+
_throttle(actionType, path30, timeout) {
|
|
46315
46343
|
if (!this._throttled.has(actionType)) {
|
|
46316
46344
|
this._throttled.set(actionType, /* @__PURE__ */ new Map());
|
|
46317
46345
|
}
|
|
46318
46346
|
const action = this._throttled.get(actionType);
|
|
46319
46347
|
if (!action)
|
|
46320
46348
|
throw new Error("invalid throttle");
|
|
46321
|
-
const actionPath = action.get(
|
|
46349
|
+
const actionPath = action.get(path30);
|
|
46322
46350
|
if (actionPath) {
|
|
46323
46351
|
actionPath.count++;
|
|
46324
46352
|
return false;
|
|
46325
46353
|
}
|
|
46326
46354
|
let timeoutObject;
|
|
46327
46355
|
const clear = () => {
|
|
46328
|
-
const item = action.get(
|
|
46356
|
+
const item = action.get(path30);
|
|
46329
46357
|
const count2 = item ? item.count : 0;
|
|
46330
|
-
action.delete(
|
|
46358
|
+
action.delete(path30);
|
|
46331
46359
|
clearTimeout(timeoutObject);
|
|
46332
46360
|
if (item)
|
|
46333
46361
|
clearTimeout(item.timeoutObject);
|
|
@@ -46335,7 +46363,7 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
46335
46363
|
};
|
|
46336
46364
|
timeoutObject = setTimeout(clear, timeout);
|
|
46337
46365
|
const thr = { timeoutObject, clear, count: 0 };
|
|
46338
|
-
action.set(
|
|
46366
|
+
action.set(path30, thr);
|
|
46339
46367
|
return thr;
|
|
46340
46368
|
}
|
|
46341
46369
|
_incrReadyCount() {
|
|
@@ -46349,44 +46377,44 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
46349
46377
|
* @param event
|
|
46350
46378
|
* @param awfEmit Callback to be called when ready for event to be emitted.
|
|
46351
46379
|
*/
|
|
46352
|
-
_awaitWriteFinish(
|
|
46380
|
+
_awaitWriteFinish(path30, threshold, event, awfEmit) {
|
|
46353
46381
|
const awf = this.options.awaitWriteFinish;
|
|
46354
46382
|
if (typeof awf !== "object")
|
|
46355
46383
|
return;
|
|
46356
46384
|
const pollInterval = awf.pollInterval;
|
|
46357
46385
|
let timeoutHandler;
|
|
46358
|
-
let fullPath =
|
|
46359
|
-
if (this.options.cwd && !sysPath2.isAbsolute(
|
|
46360
|
-
fullPath = sysPath2.join(this.options.cwd,
|
|
46386
|
+
let fullPath = path30;
|
|
46387
|
+
if (this.options.cwd && !sysPath2.isAbsolute(path30)) {
|
|
46388
|
+
fullPath = sysPath2.join(this.options.cwd, path30);
|
|
46361
46389
|
}
|
|
46362
46390
|
const now = /* @__PURE__ */ new Date();
|
|
46363
46391
|
const writes = this._pendingWrites;
|
|
46364
46392
|
function awaitWriteFinishFn(prevStat) {
|
|
46365
46393
|
statcb(fullPath, (err, curStat) => {
|
|
46366
|
-
if (err || !writes.has(
|
|
46394
|
+
if (err || !writes.has(path30)) {
|
|
46367
46395
|
if (err && err.code !== "ENOENT")
|
|
46368
46396
|
awfEmit(err);
|
|
46369
46397
|
return;
|
|
46370
46398
|
}
|
|
46371
46399
|
const now2 = Number(/* @__PURE__ */ new Date());
|
|
46372
46400
|
if (prevStat && curStat.size !== prevStat.size) {
|
|
46373
|
-
writes.get(
|
|
46401
|
+
writes.get(path30).lastChange = now2;
|
|
46374
46402
|
}
|
|
46375
|
-
const pw = writes.get(
|
|
46403
|
+
const pw = writes.get(path30);
|
|
46376
46404
|
const df = now2 - pw.lastChange;
|
|
46377
46405
|
if (df >= threshold) {
|
|
46378
|
-
writes.delete(
|
|
46406
|
+
writes.delete(path30);
|
|
46379
46407
|
awfEmit(void 0, curStat);
|
|
46380
46408
|
} else {
|
|
46381
46409
|
timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
|
|
46382
46410
|
}
|
|
46383
46411
|
});
|
|
46384
46412
|
}
|
|
46385
|
-
if (!writes.has(
|
|
46386
|
-
writes.set(
|
|
46413
|
+
if (!writes.has(path30)) {
|
|
46414
|
+
writes.set(path30, {
|
|
46387
46415
|
lastChange: now,
|
|
46388
46416
|
cancelWait: () => {
|
|
46389
|
-
writes.delete(
|
|
46417
|
+
writes.delete(path30);
|
|
46390
46418
|
clearTimeout(timeoutHandler);
|
|
46391
46419
|
return event;
|
|
46392
46420
|
}
|
|
@@ -46397,8 +46425,8 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
46397
46425
|
/**
|
|
46398
46426
|
* Determines whether user has asked to ignore this path.
|
|
46399
46427
|
*/
|
|
46400
|
-
_isIgnored(
|
|
46401
|
-
if (this.options.atomic && DOT_RE.test(
|
|
46428
|
+
_isIgnored(path30, stats) {
|
|
46429
|
+
if (this.options.atomic && DOT_RE.test(path30))
|
|
46402
46430
|
return true;
|
|
46403
46431
|
if (!this._userIgnored) {
|
|
46404
46432
|
const { cwd } = this.options;
|
|
@@ -46408,17 +46436,17 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
46408
46436
|
const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
|
|
46409
46437
|
this._userIgnored = anymatch(list, void 0);
|
|
46410
46438
|
}
|
|
46411
|
-
return this._userIgnored(
|
|
46439
|
+
return this._userIgnored(path30, stats);
|
|
46412
46440
|
}
|
|
46413
|
-
_isntIgnored(
|
|
46414
|
-
return !this._isIgnored(
|
|
46441
|
+
_isntIgnored(path30, stat5) {
|
|
46442
|
+
return !this._isIgnored(path30, stat5);
|
|
46415
46443
|
}
|
|
46416
46444
|
/**
|
|
46417
46445
|
* Provides a set of common helpers and properties relating to symlink handling.
|
|
46418
46446
|
* @param path file or directory pattern being watched
|
|
46419
46447
|
*/
|
|
46420
|
-
_getWatchHelpers(
|
|
46421
|
-
return new WatchHelper(
|
|
46448
|
+
_getWatchHelpers(path30) {
|
|
46449
|
+
return new WatchHelper(path30, this.options.followSymlinks, this);
|
|
46422
46450
|
}
|
|
46423
46451
|
// Directory helpers
|
|
46424
46452
|
// -----------------
|
|
@@ -46450,63 +46478,63 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
46450
46478
|
* @param item base path of item/directory
|
|
46451
46479
|
*/
|
|
46452
46480
|
_remove(directory, item, isDirectory) {
|
|
46453
|
-
const
|
|
46454
|
-
const fullPath = sysPath2.resolve(
|
|
46455
|
-
isDirectory = isDirectory != null ? isDirectory : this._watched.has(
|
|
46456
|
-
if (!this._throttle("remove",
|
|
46481
|
+
const path30 = sysPath2.join(directory, item);
|
|
46482
|
+
const fullPath = sysPath2.resolve(path30);
|
|
46483
|
+
isDirectory = isDirectory != null ? isDirectory : this._watched.has(path30) || this._watched.has(fullPath);
|
|
46484
|
+
if (!this._throttle("remove", path30, 100))
|
|
46457
46485
|
return;
|
|
46458
46486
|
if (!isDirectory && this._watched.size === 1) {
|
|
46459
46487
|
this.add(directory, item, true);
|
|
46460
46488
|
}
|
|
46461
|
-
const wp = this._getWatchedDir(
|
|
46489
|
+
const wp = this._getWatchedDir(path30);
|
|
46462
46490
|
const nestedDirectoryChildren = wp.getChildren();
|
|
46463
|
-
nestedDirectoryChildren.forEach((nested) => this._remove(
|
|
46491
|
+
nestedDirectoryChildren.forEach((nested) => this._remove(path30, nested));
|
|
46464
46492
|
const parent = this._getWatchedDir(directory);
|
|
46465
46493
|
const wasTracked = parent.has(item);
|
|
46466
46494
|
parent.remove(item);
|
|
46467
46495
|
if (this._symlinkPaths.has(fullPath)) {
|
|
46468
46496
|
this._symlinkPaths.delete(fullPath);
|
|
46469
46497
|
}
|
|
46470
|
-
let relPath =
|
|
46498
|
+
let relPath = path30;
|
|
46471
46499
|
if (this.options.cwd)
|
|
46472
|
-
relPath = sysPath2.relative(this.options.cwd,
|
|
46500
|
+
relPath = sysPath2.relative(this.options.cwd, path30);
|
|
46473
46501
|
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
|
46474
46502
|
const event = this._pendingWrites.get(relPath).cancelWait();
|
|
46475
46503
|
if (event === EVENTS.ADD)
|
|
46476
46504
|
return;
|
|
46477
46505
|
}
|
|
46478
|
-
this._watched.delete(
|
|
46506
|
+
this._watched.delete(path30);
|
|
46479
46507
|
this._watched.delete(fullPath);
|
|
46480
46508
|
const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
|
|
46481
|
-
if (wasTracked && !this._isIgnored(
|
|
46482
|
-
this._emit(eventName,
|
|
46483
|
-
this._closePath(
|
|
46509
|
+
if (wasTracked && !this._isIgnored(path30))
|
|
46510
|
+
this._emit(eventName, path30);
|
|
46511
|
+
this._closePath(path30);
|
|
46484
46512
|
}
|
|
46485
46513
|
/**
|
|
46486
46514
|
* Closes all watchers for a path
|
|
46487
46515
|
*/
|
|
46488
|
-
_closePath(
|
|
46489
|
-
this._closeFile(
|
|
46490
|
-
const dir = sysPath2.dirname(
|
|
46491
|
-
this._getWatchedDir(dir).remove(sysPath2.basename(
|
|
46516
|
+
_closePath(path30) {
|
|
46517
|
+
this._closeFile(path30);
|
|
46518
|
+
const dir = sysPath2.dirname(path30);
|
|
46519
|
+
this._getWatchedDir(dir).remove(sysPath2.basename(path30));
|
|
46492
46520
|
}
|
|
46493
46521
|
/**
|
|
46494
46522
|
* Closes only file-specific watchers
|
|
46495
46523
|
*/
|
|
46496
|
-
_closeFile(
|
|
46497
|
-
const closers = this._closers.get(
|
|
46524
|
+
_closeFile(path30) {
|
|
46525
|
+
const closers = this._closers.get(path30);
|
|
46498
46526
|
if (!closers)
|
|
46499
46527
|
return;
|
|
46500
46528
|
closers.forEach((closer) => closer());
|
|
46501
|
-
this._closers.delete(
|
|
46529
|
+
this._closers.delete(path30);
|
|
46502
46530
|
}
|
|
46503
|
-
_addPathCloser(
|
|
46531
|
+
_addPathCloser(path30, closer) {
|
|
46504
46532
|
if (!closer)
|
|
46505
46533
|
return;
|
|
46506
|
-
let list = this._closers.get(
|
|
46534
|
+
let list = this._closers.get(path30);
|
|
46507
46535
|
if (!list) {
|
|
46508
46536
|
list = [];
|
|
46509
|
-
this._closers.set(
|
|
46537
|
+
this._closers.set(path30, list);
|
|
46510
46538
|
}
|
|
46511
46539
|
list.push(closer);
|
|
46512
46540
|
}
|
|
@@ -46971,7 +46999,7 @@ data: ${JSON.stringify(event)}
|
|
|
46971
46999
|
|
|
46972
47000
|
// ../../apps/server/src/services/runtimes/claude-code/command-registry.ts
|
|
46973
47001
|
import fs8 from "fs/promises";
|
|
46974
|
-
import
|
|
47002
|
+
import path11 from "path";
|
|
46975
47003
|
import matter from "gray-matter";
|
|
46976
47004
|
function parseFrontmatterFallback(content) {
|
|
46977
47005
|
const match = content.match(/^---\n([\s\S]*?)\n---/);
|
|
@@ -46994,7 +47022,7 @@ var CommandRegistryService = class _CommandRegistryService {
|
|
|
46994
47022
|
commandsDir;
|
|
46995
47023
|
/** @param vaultRoot - Must be pre-validated against directory boundary by caller */
|
|
46996
47024
|
constructor(vaultRoot2) {
|
|
46997
|
-
this.commandsDir =
|
|
47025
|
+
this.commandsDir = path11.join(vaultRoot2, ".claude", "commands");
|
|
46998
47026
|
}
|
|
46999
47027
|
async getCommands(forceRefresh = false) {
|
|
47000
47028
|
const cacheExpired = Date.now() - this.cacheTime > _CommandRegistryService.CACHE_TTL_MS;
|
|
@@ -47006,11 +47034,11 @@ var CommandRegistryService = class _CommandRegistryService {
|
|
|
47006
47034
|
});
|
|
47007
47035
|
for (const entry of entries) {
|
|
47008
47036
|
if (!entry.isDirectory()) continue;
|
|
47009
|
-
const nsPath =
|
|
47037
|
+
const nsPath = path11.join(this.commandsDir, entry.name);
|
|
47010
47038
|
const files = await fs8.readdir(nsPath);
|
|
47011
47039
|
for (const file of files) {
|
|
47012
47040
|
if (!file.endsWith(".md")) continue;
|
|
47013
|
-
const filePath =
|
|
47041
|
+
const filePath = path11.join(nsPath, file);
|
|
47014
47042
|
try {
|
|
47015
47043
|
const content = await fs8.readFile(filePath, "utf-8");
|
|
47016
47044
|
let frontmatter;
|
|
@@ -47028,7 +47056,7 @@ var CommandRegistryService = class _CommandRegistryService {
|
|
|
47028
47056
|
description: frontmatter.description || "",
|
|
47029
47057
|
argumentHint: frontmatter["argument-hint"],
|
|
47030
47058
|
allowedTools: typeof allowedToolsRaw === "string" ? allowedToolsRaw.split(",").map((t2) => t2.trim()) : allowedToolsRaw,
|
|
47031
|
-
filePath:
|
|
47059
|
+
filePath: path11.relative(process.cwd(), filePath)
|
|
47032
47060
|
});
|
|
47033
47061
|
} catch (fileErr) {
|
|
47034
47062
|
logger.warn(
|
|
@@ -47351,12 +47379,12 @@ import os3 from "node:os";
|
|
|
47351
47379
|
|
|
47352
47380
|
// ../shared/dist/manifest.js
|
|
47353
47381
|
import fs9 from "fs/promises";
|
|
47354
|
-
import
|
|
47382
|
+
import path12 from "path";
|
|
47355
47383
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
47356
47384
|
var MANIFEST_DIR = ".dork";
|
|
47357
47385
|
var MANIFEST_FILE = "agent.json";
|
|
47358
47386
|
async function readManifest(projectPath) {
|
|
47359
|
-
const manifestPath =
|
|
47387
|
+
const manifestPath = path12.join(projectPath, MANIFEST_DIR, MANIFEST_FILE);
|
|
47360
47388
|
try {
|
|
47361
47389
|
const content = await fs9.readFile(manifestPath, "utf-8");
|
|
47362
47390
|
const parsed = JSON.parse(content);
|
|
@@ -47367,17 +47395,17 @@ async function readManifest(projectPath) {
|
|
|
47367
47395
|
}
|
|
47368
47396
|
}
|
|
47369
47397
|
async function writeManifest(projectPath, manifest) {
|
|
47370
|
-
const dorkDir =
|
|
47398
|
+
const dorkDir = path12.join(projectPath, MANIFEST_DIR);
|
|
47371
47399
|
await fs9.mkdir(dorkDir, { recursive: true });
|
|
47372
|
-
const manifestPath =
|
|
47373
|
-
const tempPath =
|
|
47400
|
+
const manifestPath = path12.join(dorkDir, MANIFEST_FILE);
|
|
47401
|
+
const tempPath = path12.join(dorkDir, `.agent-${randomUUID2()}.tmp`);
|
|
47374
47402
|
const content = JSON.stringify(manifest, null, 2) + "\n";
|
|
47375
47403
|
await fs9.writeFile(tempPath, content, "utf-8");
|
|
47376
47404
|
await fs9.rename(tempPath, manifestPath);
|
|
47377
47405
|
}
|
|
47378
47406
|
async function removeManifest(projectPath) {
|
|
47379
47407
|
try {
|
|
47380
|
-
await fs9.unlink(
|
|
47408
|
+
await fs9.unlink(path12.join(projectPath, MANIFEST_DIR, MANIFEST_FILE));
|
|
47381
47409
|
} catch {
|
|
47382
47410
|
}
|
|
47383
47411
|
}
|
|
@@ -50620,7 +50648,7 @@ var QueryPromise = class {
|
|
|
50620
50648
|
function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
50621
50649
|
const nullifyMap = {};
|
|
50622
50650
|
const result2 = columns.reduce(
|
|
50623
|
-
(result22, { path:
|
|
50651
|
+
(result22, { path: path30, field }, columnIndex) => {
|
|
50624
50652
|
let decoder;
|
|
50625
50653
|
if (is(field, Column)) {
|
|
50626
50654
|
decoder = field;
|
|
@@ -50630,8 +50658,8 @@ function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
|
50630
50658
|
decoder = field.sql.decoder;
|
|
50631
50659
|
}
|
|
50632
50660
|
let node = result22;
|
|
50633
|
-
for (const [pathChunkIndex, pathChunk] of
|
|
50634
|
-
if (pathChunkIndex <
|
|
50661
|
+
for (const [pathChunkIndex, pathChunk] of path30.entries()) {
|
|
50662
|
+
if (pathChunkIndex < path30.length - 1) {
|
|
50635
50663
|
if (!(pathChunk in node)) {
|
|
50636
50664
|
node[pathChunk] = {};
|
|
50637
50665
|
}
|
|
@@ -50639,8 +50667,8 @@ function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
|
50639
50667
|
} else {
|
|
50640
50668
|
const rawValue = row[columnIndex];
|
|
50641
50669
|
const value = node[pathChunk] = rawValue === null ? null : decoder.mapFromDriverValue(rawValue);
|
|
50642
|
-
if (joinsNotNullableMap && is(field, Column) &&
|
|
50643
|
-
const objectName =
|
|
50670
|
+
if (joinsNotNullableMap && is(field, Column) && path30.length === 2) {
|
|
50671
|
+
const objectName = path30[0];
|
|
50644
50672
|
if (!(objectName in nullifyMap)) {
|
|
50645
50673
|
nullifyMap[objectName] = value === null ? getTableName(field.table) : false;
|
|
50646
50674
|
} else if (typeof nullifyMap[objectName] === "string" && nullifyMap[objectName] !== getTableName(field.table)) {
|
|
@@ -54502,9 +54530,9 @@ var rateLimitBuckets = sqliteTable(
|
|
|
54502
54530
|
);
|
|
54503
54531
|
|
|
54504
54532
|
// ../db/src/index.ts
|
|
54505
|
-
import
|
|
54533
|
+
import path13 from "path";
|
|
54506
54534
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
54507
|
-
var __dirname2 =
|
|
54535
|
+
var __dirname2 = path13.dirname(fileURLToPath3(import.meta.url));
|
|
54508
54536
|
function createDb(dbPath) {
|
|
54509
54537
|
const sqlite = new Database(dbPath);
|
|
54510
54538
|
sqlite.pragma("journal_mode = WAL");
|
|
@@ -54514,7 +54542,7 @@ function createDb(dbPath) {
|
|
|
54514
54542
|
return drizzle(sqlite, { schema: schema_exports });
|
|
54515
54543
|
}
|
|
54516
54544
|
function runMigrations(db) {
|
|
54517
|
-
const migrationsFolder =
|
|
54545
|
+
const migrationsFolder = path13.join(__dirname2, "../drizzle");
|
|
54518
54546
|
migrate(db, { migrationsFolder });
|
|
54519
54547
|
}
|
|
54520
54548
|
|
|
@@ -55954,7 +55982,7 @@ import { Router as Router12 } from "express";
|
|
|
55954
55982
|
|
|
55955
55983
|
// ../../apps/server/src/services/pulse/pulse-presets.ts
|
|
55956
55984
|
import { readFile, writeFile, mkdir } from "node:fs/promises";
|
|
55957
|
-
import
|
|
55985
|
+
import path14 from "node:path";
|
|
55958
55986
|
var DEFAULT_PRESETS = [
|
|
55959
55987
|
{
|
|
55960
55988
|
id: "health-check",
|
|
@@ -55994,7 +56022,7 @@ var DEFAULT_PRESETS = [
|
|
|
55994
56022
|
}
|
|
55995
56023
|
];
|
|
55996
56024
|
function resolvePresetsPath(dorkHome) {
|
|
55997
|
-
return
|
|
56025
|
+
return path14.join(dorkHome, "pulse", "presets.json");
|
|
55998
56026
|
}
|
|
55999
56027
|
async function loadPresets(dorkHome) {
|
|
56000
56028
|
const presetsPath = resolvePresetsPath(dorkHome);
|
|
@@ -56129,7 +56157,7 @@ function createPulseRouter(store, scheduler, meshCore2) {
|
|
|
56129
56157
|
}
|
|
56130
56158
|
|
|
56131
56159
|
// ../relay/dist/relay-core.js
|
|
56132
|
-
import * as
|
|
56160
|
+
import * as path19 from "node:path";
|
|
56133
56161
|
import * as os4 from "node:os";
|
|
56134
56162
|
import fs14 from "node:fs";
|
|
56135
56163
|
|
|
@@ -56649,7 +56677,7 @@ var noopHandler = () => {
|
|
|
56649
56677
|
|
|
56650
56678
|
// ../relay/dist/maildir-store.js
|
|
56651
56679
|
import * as fs11 from "node:fs/promises";
|
|
56652
|
-
import * as
|
|
56680
|
+
import * as path15 from "node:path";
|
|
56653
56681
|
import { constants } from "node:fs";
|
|
56654
56682
|
var DIR_MODE = 448;
|
|
56655
56683
|
var FILE_MODE = 384;
|
|
@@ -56673,7 +56701,7 @@ var MaildirStore = class {
|
|
|
56673
56701
|
async ensureMaildir(endpointHash) {
|
|
56674
56702
|
const base = this.endpointDir(endpointHash);
|
|
56675
56703
|
for (const subdir of MAILDIR_SUBDIRS) {
|
|
56676
|
-
await fs11.mkdir(
|
|
56704
|
+
await fs11.mkdir(path15.join(base, subdir), { recursive: true, mode: DIR_MODE });
|
|
56677
56705
|
}
|
|
56678
56706
|
}
|
|
56679
56707
|
// --- Delivery ---
|
|
@@ -56695,8 +56723,8 @@ var MaildirStore = class {
|
|
|
56695
56723
|
const messageId = generateUlid2();
|
|
56696
56724
|
const filename = messageId + FILE_EXT;
|
|
56697
56725
|
const base = this.endpointDir(endpointHash);
|
|
56698
|
-
const tmpPath =
|
|
56699
|
-
const newPath =
|
|
56726
|
+
const tmpPath = path15.join(base, "tmp", filename);
|
|
56727
|
+
const newPath = path15.join(base, "new", filename);
|
|
56700
56728
|
try {
|
|
56701
56729
|
const data = JSON.stringify(envelope, null, 2);
|
|
56702
56730
|
await writeFileExclusive(tmpPath, data);
|
|
@@ -56722,8 +56750,8 @@ var MaildirStore = class {
|
|
|
56722
56750
|
async claim(endpointHash, messageId) {
|
|
56723
56751
|
const filename = messageId + FILE_EXT;
|
|
56724
56752
|
const base = this.endpointDir(endpointHash);
|
|
56725
|
-
const newPath =
|
|
56726
|
-
const curPath =
|
|
56753
|
+
const newPath = path15.join(base, "new", filename);
|
|
56754
|
+
const curPath = path15.join(base, "cur", filename);
|
|
56727
56755
|
try {
|
|
56728
56756
|
await fs11.rename(newPath, curPath);
|
|
56729
56757
|
const data = await fs11.readFile(curPath, "utf-8");
|
|
@@ -56743,7 +56771,7 @@ var MaildirStore = class {
|
|
|
56743
56771
|
*/
|
|
56744
56772
|
async complete(endpointHash, messageId) {
|
|
56745
56773
|
const filename = messageId + FILE_EXT;
|
|
56746
|
-
const curPath =
|
|
56774
|
+
const curPath = path15.join(this.endpointDir(endpointHash), "cur", filename);
|
|
56747
56775
|
await fs11.unlink(curPath);
|
|
56748
56776
|
}
|
|
56749
56777
|
// --- Fail ---
|
|
@@ -56761,8 +56789,8 @@ var MaildirStore = class {
|
|
|
56761
56789
|
async fail(endpointHash, messageId, reason) {
|
|
56762
56790
|
const filename = messageId + FILE_EXT;
|
|
56763
56791
|
const base = this.endpointDir(endpointHash);
|
|
56764
|
-
const curPath =
|
|
56765
|
-
const failedPath =
|
|
56792
|
+
const curPath = path15.join(base, "cur", filename);
|
|
56793
|
+
const failedPath = path15.join(base, "failed", filename);
|
|
56766
56794
|
try {
|
|
56767
56795
|
await fs11.rename(curPath, failedPath);
|
|
56768
56796
|
const data = await fs11.readFile(failedPath, "utf-8");
|
|
@@ -56773,7 +56801,7 @@ var MaildirStore = class {
|
|
|
56773
56801
|
failedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
56774
56802
|
endpointHash
|
|
56775
56803
|
};
|
|
56776
|
-
const reasonPath =
|
|
56804
|
+
const reasonPath = path15.join(base, "failed", `${messageId}.reason.json`);
|
|
56777
56805
|
await writeFileExclusive(reasonPath, JSON.stringify(deadLetter, null, 2));
|
|
56778
56806
|
return { ok: true, path: failedPath };
|
|
56779
56807
|
} catch (err) {
|
|
@@ -56796,7 +56824,7 @@ var MaildirStore = class {
|
|
|
56796
56824
|
const messageId = envelope.id;
|
|
56797
56825
|
const filename = messageId + FILE_EXT;
|
|
56798
56826
|
const base = this.endpointDir(endpointHash);
|
|
56799
|
-
const failedPath =
|
|
56827
|
+
const failedPath = path15.join(base, "failed", filename);
|
|
56800
56828
|
try {
|
|
56801
56829
|
await writeFileExclusive(failedPath, JSON.stringify(envelope, null, 2));
|
|
56802
56830
|
const deadLetter = {
|
|
@@ -56805,7 +56833,7 @@ var MaildirStore = class {
|
|
|
56805
56833
|
failedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
56806
56834
|
endpointHash
|
|
56807
56835
|
};
|
|
56808
|
-
const reasonPath =
|
|
56836
|
+
const reasonPath = path15.join(base, "failed", `${messageId}.reason.json`);
|
|
56809
56837
|
await writeFileExclusive(reasonPath, JSON.stringify(deadLetter, null, 2));
|
|
56810
56838
|
return { ok: true, path: failedPath };
|
|
56811
56839
|
} catch (err) {
|
|
@@ -56856,7 +56884,7 @@ var MaildirStore = class {
|
|
|
56856
56884
|
*/
|
|
56857
56885
|
async readEnvelope(endpointHash, subdir, messageId) {
|
|
56858
56886
|
const filename = messageId + FILE_EXT;
|
|
56859
|
-
const filePath =
|
|
56887
|
+
const filePath = path15.join(this.endpointDir(endpointHash), subdir, filename);
|
|
56860
56888
|
try {
|
|
56861
56889
|
const data = await fs11.readFile(filePath, "utf-8");
|
|
56862
56890
|
return JSON.parse(data);
|
|
@@ -56872,7 +56900,7 @@ var MaildirStore = class {
|
|
|
56872
56900
|
* @returns The parsed DeadLetter, or null if not found.
|
|
56873
56901
|
*/
|
|
56874
56902
|
async readDeadLetter(endpointHash, messageId) {
|
|
56875
|
-
const reasonPath =
|
|
56903
|
+
const reasonPath = path15.join(this.endpointDir(endpointHash), "failed", `${messageId}.reason.json`);
|
|
56876
56904
|
try {
|
|
56877
56905
|
const data = await fs11.readFile(reasonPath, "utf-8");
|
|
56878
56906
|
return JSON.parse(data);
|
|
@@ -56887,7 +56915,7 @@ var MaildirStore = class {
|
|
|
56887
56915
|
* @param endpointHash - The hash identifying the endpoint.
|
|
56888
56916
|
*/
|
|
56889
56917
|
endpointDir(endpointHash) {
|
|
56890
|
-
return
|
|
56918
|
+
return path15.join(this.rootDir, endpointHash);
|
|
56891
56919
|
}
|
|
56892
56920
|
/**
|
|
56893
56921
|
* List message IDs in a given Maildir subdirectory.
|
|
@@ -56899,7 +56927,7 @@ var MaildirStore = class {
|
|
|
56899
56927
|
* @param subdir - The subdirectory to list.
|
|
56900
56928
|
*/
|
|
56901
56929
|
async listSubdir(endpointHash, subdir) {
|
|
56902
|
-
const dirPath =
|
|
56930
|
+
const dirPath = path15.join(this.endpointDir(endpointHash), subdir);
|
|
56903
56931
|
try {
|
|
56904
56932
|
const entries = await fs11.readdir(dirPath);
|
|
56905
56933
|
return entries.filter((f4) => f4.endsWith(FILE_EXT) && !f4.endsWith(".reason.json")).map((f4) => f4.slice(0, -FILE_EXT.length)).sort();
|
|
@@ -57201,7 +57229,7 @@ async function listMessageIds(store, hash, subdir) {
|
|
|
57201
57229
|
|
|
57202
57230
|
// ../relay/dist/dead-letter-queue.js
|
|
57203
57231
|
import * as fs12 from "node:fs/promises";
|
|
57204
|
-
import * as
|
|
57232
|
+
import * as path16 from "node:path";
|
|
57205
57233
|
var DeadLetterQueue = class {
|
|
57206
57234
|
maildirStore;
|
|
57207
57235
|
sqliteIndex;
|
|
@@ -57416,9 +57444,9 @@ var DeadLetterQueue = class {
|
|
|
57416
57444
|
* @param messageId - The message ID to remove.
|
|
57417
57445
|
*/
|
|
57418
57446
|
async removeDeadLetter(endpointHash, messageId) {
|
|
57419
|
-
const failedDir =
|
|
57420
|
-
await silentUnlink2(
|
|
57421
|
-
await silentUnlink2(
|
|
57447
|
+
const failedDir = path16.join(this.rootDir, endpointHash, "failed");
|
|
57448
|
+
await silentUnlink2(path16.join(failedDir, `${messageId}.json`));
|
|
57449
|
+
await silentUnlink2(path16.join(failedDir, `${messageId}.reason.json`));
|
|
57422
57450
|
this.sqliteIndex.insertMessage({
|
|
57423
57451
|
id: messageId,
|
|
57424
57452
|
subject: "",
|
|
@@ -57439,7 +57467,7 @@ async function silentUnlink2(filePath) {
|
|
|
57439
57467
|
|
|
57440
57468
|
// ../relay/dist/access-control.js
|
|
57441
57469
|
import fs13 from "node:fs";
|
|
57442
|
-
import
|
|
57470
|
+
import path17 from "node:path";
|
|
57443
57471
|
var RULES_FILENAME = "access-rules.json";
|
|
57444
57472
|
function byPriorityDesc(a2, b3) {
|
|
57445
57473
|
return b3.priority - a2.priority;
|
|
@@ -57468,7 +57496,7 @@ var AccessControl = class {
|
|
|
57468
57496
|
* @param dataDir - Directory containing (or to contain) `access-rules.json`
|
|
57469
57497
|
*/
|
|
57470
57498
|
constructor(dataDir) {
|
|
57471
|
-
this.rulesPath =
|
|
57499
|
+
this.rulesPath = path17.join(dataDir, RULES_FILENAME);
|
|
57472
57500
|
this.loadRules();
|
|
57473
57501
|
this.startWatcher();
|
|
57474
57502
|
}
|
|
@@ -58078,7 +58106,7 @@ var AdapterDelivery = class _AdapterDelivery {
|
|
|
58078
58106
|
};
|
|
58079
58107
|
|
|
58080
58108
|
// ../relay/dist/watcher-manager.js
|
|
58081
|
-
import * as
|
|
58109
|
+
import * as path18 from "node:path";
|
|
58082
58110
|
var WatcherManager = class {
|
|
58083
58111
|
maildirStore;
|
|
58084
58112
|
subscriptionRegistry;
|
|
@@ -58116,7 +58144,7 @@ var WatcherManager = class {
|
|
|
58116
58144
|
startWatcher(endpoint) {
|
|
58117
58145
|
if (this.watchers.has(endpoint.hash))
|
|
58118
58146
|
return Promise.resolve();
|
|
58119
|
-
const newDir =
|
|
58147
|
+
const newDir = path18.join(endpoint.maildirPath, "new");
|
|
58120
58148
|
const watcher = esm_default.watch(newDir, {
|
|
58121
58149
|
persistent: true,
|
|
58122
58150
|
ignoreInitial: true
|
|
@@ -58164,7 +58192,7 @@ var WatcherManager = class {
|
|
|
58164
58192
|
* @param filePath - The path to the new message file
|
|
58165
58193
|
*/
|
|
58166
58194
|
async handleNewMessage(endpoint, filePath) {
|
|
58167
|
-
const filename =
|
|
58195
|
+
const filename = path18.basename(filePath);
|
|
58168
58196
|
if (!filename.endsWith(".json"))
|
|
58169
58197
|
return;
|
|
58170
58198
|
const messageId = filename.slice(0, -5);
|
|
@@ -58203,7 +58231,7 @@ function inferEndpointType2(subject) {
|
|
|
58203
58231
|
}
|
|
58204
58232
|
|
|
58205
58233
|
// ../relay/dist/relay-core.js
|
|
58206
|
-
var DEFAULT_DATA_DIR =
|
|
58234
|
+
var DEFAULT_DATA_DIR = path19.join(os4.homedir(), ".dork", "relay");
|
|
58207
58235
|
var DEFAULT_TTL_MS2 = 36e5;
|
|
58208
58236
|
var DEFAULT_MAX_HOPS2 = 5;
|
|
58209
58237
|
var DEFAULT_CALL_BUDGET2 = 10;
|
|
@@ -58241,14 +58269,14 @@ var RelayCore = class {
|
|
|
58241
58269
|
defaultCallBudget: options?.defaultCallBudget ?? DEFAULT_CALL_BUDGET2
|
|
58242
58270
|
};
|
|
58243
58271
|
fs14.mkdirSync(dataDir, { recursive: true });
|
|
58244
|
-
const mailboxesDir =
|
|
58272
|
+
const mailboxesDir = path19.join(dataDir, "mailboxes");
|
|
58245
58273
|
this.endpointRegistry = new EndpointRegistry(dataDir);
|
|
58246
58274
|
this.subscriptionRegistry = new SubscriptionRegistry(dataDir);
|
|
58247
58275
|
this.maildirStore = new MaildirStore({ rootDir: mailboxesDir });
|
|
58248
58276
|
if (options?.db) {
|
|
58249
58277
|
this.sqliteIndex = new SqliteIndex(options.db);
|
|
58250
58278
|
} else {
|
|
58251
|
-
const dbPath =
|
|
58279
|
+
const dbPath = path19.join(dataDir, "index.db");
|
|
58252
58280
|
const legacyDb = createDb(dbPath);
|
|
58253
58281
|
runMigrations(legacyDb);
|
|
58254
58282
|
this.sqliteIndex = new SqliteIndex(legacyDb);
|
|
@@ -58280,7 +58308,7 @@ var RelayCore = class {
|
|
|
58280
58308
|
this.adapterDelivery = new AdapterDelivery(options?.adapterRegistry, this.sqliteIndex);
|
|
58281
58309
|
this.watcherManager = new WatcherManager(this.maildirStore, this.subscriptionRegistry, this.sqliteIndex, this.circuitBreaker);
|
|
58282
58310
|
this.watcherManager.setWasDispatched((id) => this.deliveryPipeline.wasDispatched(id));
|
|
58283
|
-
this.configPath =
|
|
58311
|
+
this.configPath = path19.join(dataDir, "config.json");
|
|
58284
58312
|
this.loadReliabilityConfig();
|
|
58285
58313
|
this.startConfigWatcher();
|
|
58286
58314
|
this.dispatchInboxTtlMs = options?.dispatchInboxTtlMs ?? 30 * 60 * 1e3;
|
|
@@ -59945,13 +59973,15 @@ var ClaudeCodeAdapter = class {
|
|
|
59945
59973
|
error: null
|
|
59946
59974
|
};
|
|
59947
59975
|
this.deps.traceStore.insertSpan(span);
|
|
59976
|
+
const payloadCwd = typeof envelope.payload === "object" && envelope.payload !== null ? envelope.payload.cwd : void 0;
|
|
59948
59977
|
const agentCwd = context?.agent?.directory;
|
|
59978
|
+
const effectiveCwd = payloadCwd ?? agentCwd;
|
|
59949
59979
|
const log = this.deps.logger ?? console;
|
|
59950
|
-
log.debug?.(`[CCA] handleAgentMessage agentId=${agentId} ccaSessionKey=${ccaSessionKey}, context.agent.directory=${context?.agent?.directory ?? "(none)"}, resolvedCwd=${
|
|
59980
|
+
log.debug?.(`[CCA] handleAgentMessage agentId=${agentId} ccaSessionKey=${ccaSessionKey}, payloadCwd=${payloadCwd ?? "(none)"}, context.agent.directory=${context?.agent?.directory ?? "(none)"}, resolvedCwd=${effectiveCwd ?? "(deferred to session)"}`);
|
|
59951
59981
|
this.deps.agentManager.ensureSession(ccaSessionKey, {
|
|
59952
59982
|
permissionMode: "default",
|
|
59953
59983
|
hasStarted: true,
|
|
59954
|
-
...
|
|
59984
|
+
...effectiveCwd ? { cwd: effectiveCwd } : {}
|
|
59955
59985
|
});
|
|
59956
59986
|
this.deps.traceStore.updateSpan(envelope.id, {
|
|
59957
59987
|
status: "delivered",
|
|
@@ -59991,7 +60021,7 @@ var ClaudeCodeAdapter = class {
|
|
|
59991
60021
|
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
59992
60022
|
const isInboxReplyTo = envelope.replyTo?.startsWith("relay.inbox.");
|
|
59993
60023
|
const eventStream = this.deps.agentManager.sendMessage(ccaSessionKey, prompt2, {
|
|
59994
|
-
...
|
|
60024
|
+
...effectiveCwd ? { cwd: effectiveCwd } : {}
|
|
59995
60025
|
});
|
|
59996
60026
|
let eventCount = 0;
|
|
59997
60027
|
let collectedText = "";
|
|
@@ -62125,7 +62155,7 @@ var TraceStore = class {
|
|
|
62125
62155
|
};
|
|
62126
62156
|
|
|
62127
62157
|
// ../mesh/dist/mesh-core.js
|
|
62128
|
-
import
|
|
62158
|
+
import path26 from "path";
|
|
62129
62159
|
import os5 from "os";
|
|
62130
62160
|
|
|
62131
62161
|
// ../mesh/dist/health.js
|
|
@@ -62558,7 +62588,7 @@ var DenialList = class {
|
|
|
62558
62588
|
};
|
|
62559
62589
|
|
|
62560
62590
|
// ../mesh/dist/relay-bridge.js
|
|
62561
|
-
import
|
|
62591
|
+
import path20 from "path";
|
|
62562
62592
|
var SAME_NAMESPACE_ALLOW_PRIORITY = 100;
|
|
62563
62593
|
var CROSS_NAMESPACE_DENY_PRIORITY = 10;
|
|
62564
62594
|
var RelayBridge = class {
|
|
@@ -62587,7 +62617,7 @@ var RelayBridge = class {
|
|
|
62587
62617
|
async registerAgent(agent, projectPath, namespace, _scanRoot) {
|
|
62588
62618
|
if (!this.relayCore)
|
|
62589
62619
|
return null;
|
|
62590
|
-
const ns = namespace ||
|
|
62620
|
+
const ns = namespace || path20.basename(projectPath);
|
|
62591
62621
|
const subject = `relay.agent.${ns}.${agent.id}`;
|
|
62592
62622
|
try {
|
|
62593
62623
|
await this.relayCore.registerEndpoint(subject);
|
|
@@ -62813,7 +62843,7 @@ var TopologyManager = class {
|
|
|
62813
62843
|
};
|
|
62814
62844
|
|
|
62815
62845
|
// ../mesh/dist/namespace-resolver.js
|
|
62816
|
-
import
|
|
62846
|
+
import path21 from "path";
|
|
62817
62847
|
var MAX_NAMESPACE_LENGTH = 64;
|
|
62818
62848
|
function normalizeNamespace(raw) {
|
|
62819
62849
|
return raw.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
@@ -62836,8 +62866,8 @@ function resolveNamespace(projectPath, scanRoot, manifestNamespace) {
|
|
|
62836
62866
|
}
|
|
62837
62867
|
return normalized2;
|
|
62838
62868
|
}
|
|
62839
|
-
const relative3 =
|
|
62840
|
-
const firstSegment = relative3.split(
|
|
62869
|
+
const relative3 = path21.relative(scanRoot, projectPath);
|
|
62870
|
+
const firstSegment = relative3.split(path21.sep)[0];
|
|
62841
62871
|
if (!firstSegment) {
|
|
62842
62872
|
throw new Error(`Cannot derive namespace: projectPath '${projectPath}' is at or above scanRoot '${scanRoot}'`);
|
|
62843
62873
|
}
|
|
@@ -62851,21 +62881,21 @@ function resolveNamespace(projectPath, scanRoot, manifestNamespace) {
|
|
|
62851
62881
|
|
|
62852
62882
|
// ../mesh/dist/strategies/claude-code-strategy.js
|
|
62853
62883
|
import fs15 from "fs/promises";
|
|
62854
|
-
import
|
|
62884
|
+
import path22 from "path";
|
|
62855
62885
|
var MAX_CLAUDEMD_BYTES = 4096;
|
|
62856
62886
|
var ClaudeCodeStrategy = class {
|
|
62857
62887
|
name = "claude-code";
|
|
62858
62888
|
runtime = "claude-code";
|
|
62859
62889
|
async detect(dir) {
|
|
62860
62890
|
try {
|
|
62861
|
-
const stat5 = await fs15.stat(
|
|
62891
|
+
const stat5 = await fs15.stat(path22.join(dir, "CLAUDE.md"));
|
|
62862
62892
|
return stat5.isFile();
|
|
62863
62893
|
} catch {
|
|
62864
62894
|
return false;
|
|
62865
62895
|
}
|
|
62866
62896
|
}
|
|
62867
62897
|
async extractHints(dir) {
|
|
62868
|
-
const suggestedName =
|
|
62898
|
+
const suggestedName = path22.basename(dir);
|
|
62869
62899
|
const description = await this.extractDescription(dir);
|
|
62870
62900
|
return {
|
|
62871
62901
|
suggestedName,
|
|
@@ -62881,7 +62911,7 @@ var ClaudeCodeStrategy = class {
|
|
|
62881
62911
|
*/
|
|
62882
62912
|
async extractDescription(dir) {
|
|
62883
62913
|
try {
|
|
62884
|
-
const claudeMdPath =
|
|
62914
|
+
const claudeMdPath = path22.join(dir, "CLAUDE.md");
|
|
62885
62915
|
const fd = await fs15.open(claudeMdPath, "r");
|
|
62886
62916
|
try {
|
|
62887
62917
|
const buf = Buffer.alloc(MAX_CLAUDEMD_BYTES);
|
|
@@ -62925,13 +62955,13 @@ function extractFirstParagraph(content) {
|
|
|
62925
62955
|
|
|
62926
62956
|
// ../mesh/dist/strategies/cursor-strategy.js
|
|
62927
62957
|
import fs16 from "fs/promises";
|
|
62928
|
-
import
|
|
62958
|
+
import path23 from "path";
|
|
62929
62959
|
var CursorStrategy = class {
|
|
62930
62960
|
name = "cursor";
|
|
62931
62961
|
runtime = "cursor";
|
|
62932
62962
|
async detect(dir) {
|
|
62933
62963
|
try {
|
|
62934
|
-
const stat5 = await fs16.stat(
|
|
62964
|
+
const stat5 = await fs16.stat(path23.join(dir, ".cursor"));
|
|
62935
62965
|
return stat5.isDirectory();
|
|
62936
62966
|
} catch {
|
|
62937
62967
|
return false;
|
|
@@ -62939,7 +62969,7 @@ var CursorStrategy = class {
|
|
|
62939
62969
|
}
|
|
62940
62970
|
async extractHints(dir) {
|
|
62941
62971
|
return {
|
|
62942
|
-
suggestedName:
|
|
62972
|
+
suggestedName: path23.basename(dir),
|
|
62943
62973
|
detectedRuntime: "cursor",
|
|
62944
62974
|
inferredCapabilities: ["code"]
|
|
62945
62975
|
};
|
|
@@ -62948,13 +62978,13 @@ var CursorStrategy = class {
|
|
|
62948
62978
|
|
|
62949
62979
|
// ../mesh/dist/strategies/codex-strategy.js
|
|
62950
62980
|
import fs17 from "fs/promises";
|
|
62951
|
-
import
|
|
62981
|
+
import path24 from "path";
|
|
62952
62982
|
var CodexStrategy = class {
|
|
62953
62983
|
name = "codex";
|
|
62954
62984
|
runtime = "codex";
|
|
62955
62985
|
async detect(dir) {
|
|
62956
62986
|
try {
|
|
62957
|
-
const stat5 = await fs17.stat(
|
|
62987
|
+
const stat5 = await fs17.stat(path24.join(dir, ".codex"));
|
|
62958
62988
|
return stat5.isDirectory();
|
|
62959
62989
|
} catch {
|
|
62960
62990
|
return false;
|
|
@@ -62962,7 +62992,7 @@ var CodexStrategy = class {
|
|
|
62962
62992
|
}
|
|
62963
62993
|
async extractHints(dir) {
|
|
62964
62994
|
return {
|
|
62965
|
-
suggestedName:
|
|
62995
|
+
suggestedName: path24.basename(dir),
|
|
62966
62996
|
detectedRuntime: "codex",
|
|
62967
62997
|
inferredCapabilities: ["code"]
|
|
62968
62998
|
};
|
|
@@ -62972,7 +63002,7 @@ var CodexStrategy = class {
|
|
|
62972
63002
|
// ../mesh/dist/discovery/unified-scanner.js
|
|
62973
63003
|
import fs18 from "fs/promises";
|
|
62974
63004
|
import { realpathSync as realpathSync2 } from "fs";
|
|
62975
|
-
import
|
|
63005
|
+
import path25 from "path";
|
|
62976
63006
|
|
|
62977
63007
|
// ../mesh/dist/discovery/types.js
|
|
62978
63008
|
var UNIFIED_EXCLUDE_PATTERNS = /* @__PURE__ */ new Set([
|
|
@@ -63029,7 +63059,7 @@ async function* unifiedScan(options, strategies, registry2, denialList) {
|
|
|
63029
63059
|
if (!item)
|
|
63030
63060
|
continue;
|
|
63031
63061
|
const { dir, depth } = item;
|
|
63032
|
-
const dirName =
|
|
63062
|
+
const dirName = path25.basename(dir);
|
|
63033
63063
|
if (UNIFIED_EXCLUDE_PATTERNS.has(dirName) || extraExcludes.has(dirName))
|
|
63034
63064
|
continue;
|
|
63035
63065
|
if (dirName.startsWith(".") && !ALLOWED_DOT_DIRS.has(dirName))
|
|
@@ -63096,7 +63126,7 @@ async function* unifiedScan(options, strategies, registry2, denialList) {
|
|
|
63096
63126
|
continue;
|
|
63097
63127
|
if (isSymlink && !followSymlinks)
|
|
63098
63128
|
continue;
|
|
63099
|
-
queue2.push({ dir:
|
|
63129
|
+
queue2.push({ dir: path25.join(dir, entry.name), depth: depth + 1 });
|
|
63100
63130
|
}
|
|
63101
63131
|
}
|
|
63102
63132
|
}
|
|
@@ -63384,7 +63414,7 @@ var MeshCore = class {
|
|
|
63384
63414
|
return;
|
|
63385
63415
|
await removeManifest(agent.projectPath);
|
|
63386
63416
|
const namespace = agent.namespace;
|
|
63387
|
-
const subject = `relay.agent.${namespace ||
|
|
63417
|
+
const subject = `relay.agent.${namespace || path26.basename(agent.projectPath)}.${agent.id}`;
|
|
63388
63418
|
await this.relayBridge.unregisterAgent(subject, agent.id, agent.name);
|
|
63389
63419
|
this.registry.remove(agentId);
|
|
63390
63420
|
for (const cb of this.onUnregisterCallbacks) {
|
|
@@ -63620,7 +63650,7 @@ var MeshCore = class {
|
|
|
63620
63650
|
if (!health)
|
|
63621
63651
|
return void 0;
|
|
63622
63652
|
const manifest = this.toManifest(entry);
|
|
63623
|
-
const ns = entry.namespace ||
|
|
63653
|
+
const ns = entry.namespace || path26.basename(entry.projectPath);
|
|
63624
63654
|
const relaySubject = `relay.agent.${ns}.${agentId}`;
|
|
63625
63655
|
return { agent: manifest, health, relaySubject };
|
|
63626
63656
|
}
|
|
@@ -64024,7 +64054,7 @@ function createMeshRouter(deps) {
|
|
|
64024
64054
|
|
|
64025
64055
|
// ../../apps/server/src/routes/agents.ts
|
|
64026
64056
|
import { Router as Router15 } from "express";
|
|
64027
|
-
import
|
|
64057
|
+
import path27 from "path";
|
|
64028
64058
|
function createAgentsRouter(meshCore2) {
|
|
64029
64059
|
const router12 = Router15();
|
|
64030
64060
|
router12.get("/current", async (req, res) => {
|
|
@@ -64084,7 +64114,7 @@ function createAgentsRouter(meshCore2) {
|
|
|
64084
64114
|
}
|
|
64085
64115
|
const manifest = {
|
|
64086
64116
|
id: ulid(),
|
|
64087
|
-
name: name ??
|
|
64117
|
+
name: name ?? path27.basename(agentPath),
|
|
64088
64118
|
description: description ?? "",
|
|
64089
64119
|
runtime: runtime ?? "claude-code",
|
|
64090
64120
|
capabilities: [],
|
|
@@ -72349,13 +72379,13 @@ function validateMcpOrigin(req, res, next) {
|
|
|
72349
72379
|
|
|
72350
72380
|
// ../../apps/server/src/lib/dork-home.ts
|
|
72351
72381
|
import os6 from "os";
|
|
72352
|
-
import
|
|
72382
|
+
import path28 from "path";
|
|
72353
72383
|
function resolveDorkHome() {
|
|
72354
72384
|
if (process.env.DORK_HOME) return process.env.DORK_HOME;
|
|
72355
72385
|
if (process.env.NODE_ENV !== "production") {
|
|
72356
|
-
return
|
|
72386
|
+
return path28.join(process.cwd(), ".temp", ".dork");
|
|
72357
72387
|
}
|
|
72358
|
-
return
|
|
72388
|
+
return path28.join(os6.homedir(), ".dork");
|
|
72359
72389
|
}
|
|
72360
72390
|
|
|
72361
72391
|
// ../../apps/server/src/index.ts
|
|
@@ -72373,18 +72403,18 @@ async function start() {
|
|
|
72373
72403
|
process.env.DORK_HOME = dorkHome;
|
|
72374
72404
|
console.log(`[DorkOS] Data directory: ${dorkHome}`);
|
|
72375
72405
|
const logLevel = env.DORKOS_LOG_LEVEL;
|
|
72376
|
-
initLogger({ level: logLevel, logDir:
|
|
72406
|
+
initLogger({ level: logLevel, logDir: path29.join(dorkHome, "logs") });
|
|
72377
72407
|
initConfigManager(dorkHome);
|
|
72378
72408
|
const loggingConfig = configManager.get("logging");
|
|
72379
72409
|
if (loggingConfig?.maxLogSizeKb || loggingConfig?.maxLogFiles) {
|
|
72380
72410
|
initLogger({
|
|
72381
72411
|
level: logLevel,
|
|
72382
|
-
logDir:
|
|
72412
|
+
logDir: path29.join(dorkHome, "logs"),
|
|
72383
72413
|
maxLogSize: (loggingConfig.maxLogSizeKb ?? 500) * 1024,
|
|
72384
72414
|
maxLogFiles: loggingConfig.maxLogFiles ?? 14
|
|
72385
72415
|
});
|
|
72386
72416
|
}
|
|
72387
|
-
const dbPath =
|
|
72417
|
+
const dbPath = path29.join(dorkHome, "dork.db");
|
|
72388
72418
|
const db = createDb(dbPath);
|
|
72389
72419
|
runMigrations(db);
|
|
72390
72420
|
logger.info(`[DB] Consolidated database ready at ${dbPath}`);
|
|
@@ -72409,7 +72439,7 @@ async function start() {
|
|
|
72409
72439
|
}
|
|
72410
72440
|
const relayConfig = configManager.get("relay");
|
|
72411
72441
|
const relayEnabled = env.DORKOS_RELAY_ENABLED || relayConfig?.enabled;
|
|
72412
|
-
const relayDataDir = relayConfig?.dataDir ??
|
|
72442
|
+
const relayDataDir = relayConfig?.dataDir ?? path29.join(dorkHome, "relay");
|
|
72413
72443
|
if (relayEnabled) {
|
|
72414
72444
|
try {
|
|
72415
72445
|
adapterRegistry = new AdapterRegistry();
|
|
@@ -72451,7 +72481,7 @@ async function start() {
|
|
|
72451
72481
|
}
|
|
72452
72482
|
if (relayEnabled && relayCore && adapterRegistry && traceStore) {
|
|
72453
72483
|
try {
|
|
72454
|
-
const adapterConfigPath =
|
|
72484
|
+
const adapterConfigPath = path29.join(dorkHome, "relay", "adapters.json");
|
|
72455
72485
|
adapterManager = new AdapterManager(adapterRegistry, adapterConfigPath, {
|
|
72456
72486
|
agentManager: claudeRuntime,
|
|
72457
72487
|
traceStore,
|