@orkestrel/browser 0.0.21 → 0.0.22
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/README.md +6 -3
- package/dist/src/browser/index.d.ts +77 -19
- package/dist/src/browser/index.js +361 -21
- package/dist/src/browser/index.js.map +1 -1
- package/dist/src/core/index.cjs +953 -172
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +354 -78
- package/dist/src/core/index.d.ts +354 -78
- package/dist/src/core/index.js +947 -174
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +36 -11
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +2 -2
- package/dist/src/server/index.d.ts +2 -2
- package/dist/src/server/index.js +36 -11
- package/dist/src/server/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -868,7 +868,7 @@ var FileBrowserWriter = class {
|
|
|
868
868
|
};
|
|
869
869
|
//#endregion
|
|
870
870
|
//#region package.json
|
|
871
|
-
var version = "0.0.
|
|
871
|
+
var version = "0.0.22";
|
|
872
872
|
//#endregion
|
|
873
873
|
//#region src/server/BrowserMCPServer.ts
|
|
874
874
|
/**
|
|
@@ -876,9 +876,9 @@ var version = "0.0.21";
|
|
|
876
876
|
* the Model Context Protocol on stdio, and launches Chromium on the first tool call.
|
|
877
877
|
*
|
|
878
878
|
* @remarks
|
|
879
|
-
* The server's own manager holds one dispatcher per name of the vocabulary — `look`, `read`,
|
|
879
|
+
* The server's own manager holds one dispatcher per name of the vocabulary — `look`, `read`, `plain`,
|
|
880
880
|
* `click`, `type`, `press`, `navigate`, `wait`, `dialog`, `tabs`, `switch`, `record`, `save`,
|
|
881
|
-
* `journeys`, `edit`, and `
|
|
881
|
+
* `journeys`, `edit`, `replay`, and `forget` — each carrying the description, parameters, and annotations
|
|
882
882
|
* `BROWSER_TOOL_COPY` gives, so `tools/list` answers before Chromium starts and with Chromium
|
|
883
883
|
* absent. After the launch, a tool the toolset's manager adds under another name, such as a page
|
|
884
884
|
* tool it adopts, is mirrored as a dispatcher with that tool's definition, and the mirror is
|
|
@@ -1228,7 +1228,13 @@ var FileBrowserStore = class {
|
|
|
1228
1228
|
await this.check(path, options);
|
|
1229
1229
|
await this.check(temporary, options);
|
|
1230
1230
|
options?.signal?.throwIfAborted();
|
|
1231
|
-
|
|
1231
|
+
try {
|
|
1232
|
+
await (0, node_fs_promises.rename)(temporary, path);
|
|
1233
|
+
} catch (error) {
|
|
1234
|
+
const target = await (0, node_fs_promises.lstat)(path).catch(() => void 0);
|
|
1235
|
+
if (error instanceof Error && "code" in error && (error.code === "EISDIR" || error.code === "EPERM") && target?.isDirectory()) throw new _src_core.BrowserError(`Cannot replace directory: ${path}`, "BROWSER_JOURNEY_FILE", { path });
|
|
1236
|
+
throw error;
|
|
1237
|
+
}
|
|
1232
1238
|
owned = false;
|
|
1233
1239
|
} catch (error) {
|
|
1234
1240
|
options?.signal?.throwIfAborted();
|
|
@@ -1429,7 +1435,14 @@ var FileBrowserStore = class {
|
|
|
1429
1435
|
try {
|
|
1430
1436
|
await (0, node_fs_promises.rmdir)(path);
|
|
1431
1437
|
} catch (error) {
|
|
1432
|
-
if (error instanceof Error && "code" in error
|
|
1438
|
+
if (error instanceof Error && "code" in error) {
|
|
1439
|
+
if (error.code === "ENOTEMPTY") return;
|
|
1440
|
+
if (error.code === "ENOENT" || error.code === "EPERM") try {
|
|
1441
|
+
if ((await (0, node_fs_promises.lstat)(path)).isDirectory()) return;
|
|
1442
|
+
} catch (cause) {
|
|
1443
|
+
if (cause instanceof Error && "code" in cause && cause.code === "ENOENT") return;
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1433
1446
|
throw new _src_core.BrowserError(`Cannot remove lock directory: ${path}`, "BROWSER_JOURNEY_ACCESS", { path });
|
|
1434
1447
|
}
|
|
1435
1448
|
}
|
|
@@ -2354,6 +2367,7 @@ var Browser = class {
|
|
|
2354
2367
|
const process = this.#process;
|
|
2355
2368
|
if (process !== void 0) {
|
|
2356
2369
|
if (!await this.#waitForTerminationWithin(process, 3e3)) await this.#terminate(process);
|
|
2370
|
+
await this.#closeProcessPipe(process);
|
|
2357
2371
|
}
|
|
2358
2372
|
this.#process = void 0;
|
|
2359
2373
|
this.#servingPid = void 0;
|
|
@@ -2525,12 +2539,23 @@ var Browser = class {
|
|
|
2525
2539
|
return results[0] && (results[1] === true || final && results[1] === void 0);
|
|
2526
2540
|
}
|
|
2527
2541
|
async #terminate(process) {
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2542
|
+
try {
|
|
2543
|
+
if (process === void 0 || (process.exitCode !== null || process.signalCode !== null) && this.#inspectRemainder(process) === false) return;
|
|
2544
|
+
if (this.#signalProcess(process, "SIGTERM") === false) return;
|
|
2545
|
+
if (await this.#waitForTerminationWithin(process, 3e3)) return;
|
|
2546
|
+
if (this.#signalProcess(process, "SIGKILL") === false) return;
|
|
2547
|
+
if (await this.#waitForTerminationWithin(process, 3e3, true)) return;
|
|
2548
|
+
throw new _src_core.BrowserConnectionError("Browser process did not exit after SIGKILL", { pid: this.#servingPid ?? process.pid });
|
|
2549
|
+
} finally {
|
|
2550
|
+
await this.#closeProcessPipe(process);
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
async #closeProcessPipe(process) {
|
|
2554
|
+
const stream = process?.stderr;
|
|
2555
|
+
if (stream === void 0 || stream === null || stream.closed) return;
|
|
2556
|
+
const closed = (0, node_events.once)(stream, "close");
|
|
2557
|
+
stream.destroy();
|
|
2558
|
+
await closed;
|
|
2534
2559
|
}
|
|
2535
2560
|
#finish() {
|
|
2536
2561
|
this.#unbindTransport();
|