agent-theatre 0.1.3 → 0.1.4
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/cli.js +15 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/web/assets/browserAll-CiqqfWAh.js +2 -0
- package/web/assets/{browserAll-CZuhb8E5.js.map → browserAll-CiqqfWAh.js.map} +1 -1
- package/web/assets/{index-BW3_w3GY.js → index-DGa5Ut1l.js} +59 -59
- package/web/assets/index-DGa5Ut1l.js.map +1 -0
- package/web/assets/webworkerAll-BXADk2cD.js +2 -0
- package/web/assets/{webworkerAll-C8_bDDrL.js.map → webworkerAll-BXADk2cD.js.map} +1 -1
- package/web/index.html +1 -1
- package/web/assets/browserAll-CZuhb8E5.js +0 -2
- package/web/assets/index-BW3_w3GY.js.map +0 -1
- package/web/assets/webworkerAll-C8_bDDrL.js +0 -2
package/dist/cli.js
CHANGED
|
@@ -9,9 +9,9 @@ import pc from "picocolors";
|
|
|
9
9
|
|
|
10
10
|
// src/server.ts
|
|
11
11
|
import { createServer } from "http";
|
|
12
|
-
import { existsSync, mkdirSync, readFileSync as readFileSync2, rmSync, writeFileSync } from "fs";
|
|
12
|
+
import { existsSync, mkdirSync, readFileSync as readFileSync2, rmSync, writeFileSync, realpathSync } from "fs";
|
|
13
13
|
import { homedir as homedir2 } from "os";
|
|
14
|
-
import { join as join2, basename as basename2 } from "path";
|
|
14
|
+
import { join as join2, basename as basename2, resolve, sep } from "path";
|
|
15
15
|
import { Hono } from "hono";
|
|
16
16
|
import { getRequestListener } from "@hono/node-server";
|
|
17
17
|
import { WebSocketServer } from "ws";
|
|
@@ -1206,6 +1206,8 @@ var Theatre = class {
|
|
|
1206
1206
|
} catch {
|
|
1207
1207
|
return c.body(null, 204);
|
|
1208
1208
|
}
|
|
1209
|
+
const cwd = typeof payload?.cwd === "string" ? payload.cwd : "";
|
|
1210
|
+
if (cwd && !isWithin(cwd, this.opts.cwd)) return c.body(null, 204);
|
|
1209
1211
|
const { events } = hookPayloadToEvents(payload, { home: homedir2() });
|
|
1210
1212
|
if (events.length) this.ingest(events);
|
|
1211
1213
|
return c.body(null, 204);
|
|
@@ -1306,6 +1308,17 @@ var Theatre = class {
|
|
|
1306
1308
|
return basename2(this.opts.cwd);
|
|
1307
1309
|
}
|
|
1308
1310
|
};
|
|
1311
|
+
function isWithin(dir, root) {
|
|
1312
|
+
const norm3 = (p) => {
|
|
1313
|
+
try {
|
|
1314
|
+
return realpathSync(p);
|
|
1315
|
+
} catch {
|
|
1316
|
+
return resolve(p);
|
|
1317
|
+
}
|
|
1318
|
+
};
|
|
1319
|
+
const d = norm3(dir), r = norm3(root);
|
|
1320
|
+
return d === r || d.startsWith(r.endsWith(sep) ? r : r + sep);
|
|
1321
|
+
}
|
|
1309
1322
|
|
|
1310
1323
|
// src/scan.ts
|
|
1311
1324
|
import { readdirSync as readdirSync2, readFileSync as readFileSync3, statSync as statSync2 } from "fs";
|