@winstonfassett/webdev-gateway 0.1.0-alpha.0
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/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +78 -0
- package/dist/adapter-helpers.d.ts +64 -0
- package/dist/adapter-helpers.d.ts.map +1 -0
- package/dist/adapter-helpers.js +297 -0
- package/dist/adapter-helpers.js.map +1 -0
- package/dist/admin/assets/index-DEDI8OIx.css +2 -0
- package/dist/admin/assets/index-DaI40ww1.js +70 -0
- package/dist/admin/assets/tinykeys.module-CjuTRcEz.js +1 -0
- package/dist/admin/index.html +13 -0
- package/dist/admin-rpc.d.ts +27 -0
- package/dist/admin-rpc.d.ts.map +1 -0
- package/dist/admin-rpc.js +147 -0
- package/dist/admin-rpc.js.map +1 -0
- package/dist/admin.d.ts +10 -0
- package/dist/admin.d.ts.map +1 -0
- package/dist/admin.js +202 -0
- package/dist/admin.js.map +1 -0
- package/dist/auto-register.d.ts +10 -0
- package/dist/auto-register.d.ts.map +1 -0
- package/dist/auto-register.js +145 -0
- package/dist/auto-register.js.map +1 -0
- package/dist/cdp-relay.d.ts +110 -0
- package/dist/cdp-relay.d.ts.map +1 -0
- package/dist/cdp-relay.js +616 -0
- package/dist/cdp-relay.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +95 -0
- package/dist/cli.js.map +1 -0
- package/dist/doctor.d.ts +6 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +149 -0
- package/dist/doctor.js.map +1 -0
- package/dist/element-grab-client.js +305 -0
- package/dist/element-grab.d.ts +15 -0
- package/dist/element-grab.d.ts.map +1 -0
- package/dist/element-grab.js +102 -0
- package/dist/element-grab.js.map +1 -0
- package/dist/gateway.d.ts +5 -0
- package/dist/gateway.d.ts.map +1 -0
- package/dist/gateway.js +534 -0
- package/dist/gateway.js.map +1 -0
- package/dist/installer.d.ts +48 -0
- package/dist/installer.d.ts.map +1 -0
- package/dist/installer.js +637 -0
- package/dist/installer.js.map +1 -0
- package/dist/libs/element-source.js +35 -0
- package/dist/libs/modern-screenshot.js +14 -0
- package/dist/log-reader.d.ts +30 -0
- package/dist/log-reader.d.ts.map +1 -0
- package/dist/log-reader.js +174 -0
- package/dist/log-reader.js.map +1 -0
- package/dist/mcp-server.d.ts +22 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +115 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/mcp-tools-core.d.ts +30 -0
- package/dist/mcp-tools-core.d.ts.map +1 -0
- package/dist/mcp-tools-core.js +375 -0
- package/dist/mcp-tools-core.js.map +1 -0
- package/dist/mcp-tools-full.d.ts +4 -0
- package/dist/mcp-tools-full.d.ts.map +1 -0
- package/dist/mcp-tools-full.js +141 -0
- package/dist/mcp-tools-full.js.map +1 -0
- package/dist/playwright-commands.d.ts +33 -0
- package/dist/playwright-commands.d.ts.map +1 -0
- package/dist/playwright-commands.js +356 -0
- package/dist/playwright-commands.js.map +1 -0
- package/dist/registry.d.ts +83 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +205 -0
- package/dist/registry.js.map +1 -0
- package/dist/rpc-server.d.ts +54 -0
- package/dist/rpc-server.d.ts.map +1 -0
- package/dist/rpc-server.js +207 -0
- package/dist/rpc-server.js.map +1 -0
- package/dist/session.d.ts +13 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +61 -0
- package/dist/session.js.map +1 -0
- package/dist/types.d.ts +76 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/webdev-client.js +20 -0
- package/dist/writers/base.d.ts +24 -0
- package/dist/writers/base.d.ts.map +1 -0
- package/dist/writers/base.js +98 -0
- package/dist/writers/base.js.map +1 -0
- package/dist/writers/console.d.ts +8 -0
- package/dist/writers/console.d.ts.map +1 -0
- package/dist/writers/console.js +14 -0
- package/dist/writers/console.js.map +1 -0
- package/dist/writers/dev-events.d.ts +28 -0
- package/dist/writers/dev-events.d.ts.map +1 -0
- package/dist/writers/dev-events.js +53 -0
- package/dist/writers/dev-events.js.map +1 -0
- package/dist/writers/errors.d.ts +8 -0
- package/dist/writers/errors.d.ts.map +1 -0
- package/dist/writers/errors.js +14 -0
- package/dist/writers/errors.js.map +1 -0
- package/dist/writers/network.d.ts +9 -0
- package/dist/writers/network.d.ts.map +1 -0
- package/dist/writers/network.js +17 -0
- package/dist/writers/network.js.map +1 -0
- package/dist/writers/server-console.d.ts +8 -0
- package/dist/writers/server-console.d.ts.map +1 -0
- package/dist/writers/server-console.js +14 -0
- package/dist/writers/server-console.js.map +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { appendFileSync, statSync, renameSync, writeFileSync, unlinkSync, existsSync } from 'node:fs';
|
|
2
|
+
export class NdjsonWriter {
|
|
3
|
+
filePath;
|
|
4
|
+
channel;
|
|
5
|
+
nextId = 1;
|
|
6
|
+
maxFileSize;
|
|
7
|
+
maxFiles;
|
|
8
|
+
constructor(filePath, channel, maxFileSizeMb, maxFiles) {
|
|
9
|
+
this.filePath = filePath;
|
|
10
|
+
this.channel = channel;
|
|
11
|
+
this.maxFileSize = (maxFileSizeMb ?? 10) * 1024 * 1024;
|
|
12
|
+
this.maxFiles = maxFiles ?? 3;
|
|
13
|
+
}
|
|
14
|
+
write(payload) {
|
|
15
|
+
const event = {
|
|
16
|
+
id: this.nextId++,
|
|
17
|
+
ts: Date.now(),
|
|
18
|
+
channel: this.channel,
|
|
19
|
+
payload,
|
|
20
|
+
};
|
|
21
|
+
const line = JSON.stringify(event) + '\n';
|
|
22
|
+
try {
|
|
23
|
+
const stats = statSync(this.filePath);
|
|
24
|
+
if (stats.size >= this.maxFileSize) {
|
|
25
|
+
this.rotate();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// File might not exist yet
|
|
30
|
+
}
|
|
31
|
+
appendFileSync(this.filePath, line);
|
|
32
|
+
return event;
|
|
33
|
+
}
|
|
34
|
+
/** Rotate current file and clean up old rotated files */
|
|
35
|
+
rotate() {
|
|
36
|
+
// Delete the oldest file if at limit
|
|
37
|
+
const oldest = `${this.filePath}.${this.maxFiles}`;
|
|
38
|
+
if (existsSync(oldest)) {
|
|
39
|
+
unlinkSync(oldest);
|
|
40
|
+
}
|
|
41
|
+
// Shift existing rotated files up: .2 → .3, .1 → .2
|
|
42
|
+
for (let i = this.maxFiles - 1; i >= 1; i--) {
|
|
43
|
+
const from = `${this.filePath}.${i}`;
|
|
44
|
+
const to = `${this.filePath}.${i + 1}`;
|
|
45
|
+
if (existsSync(from)) {
|
|
46
|
+
renameSync(from, to);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// Current → .1
|
|
50
|
+
renameSync(this.filePath, `${this.filePath}.1`);
|
|
51
|
+
writeFileSync(this.filePath, '');
|
|
52
|
+
}
|
|
53
|
+
resetId() {
|
|
54
|
+
this.nextId = 1;
|
|
55
|
+
}
|
|
56
|
+
getLastId() {
|
|
57
|
+
return this.nextId - 1;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export class BufferedNdjsonWriter extends NdjsonWriter {
|
|
61
|
+
flushIntervalMs;
|
|
62
|
+
buffer = [];
|
|
63
|
+
timer = null;
|
|
64
|
+
constructor(filePath, channel, maxFileSizeMb, flushIntervalMs = 100) {
|
|
65
|
+
super(filePath, channel, maxFileSizeMb);
|
|
66
|
+
this.flushIntervalMs = flushIntervalMs;
|
|
67
|
+
}
|
|
68
|
+
writeBuffered(payload) {
|
|
69
|
+
const event = {
|
|
70
|
+
id: 0,
|
|
71
|
+
ts: Date.now(),
|
|
72
|
+
channel: 'network',
|
|
73
|
+
payload,
|
|
74
|
+
};
|
|
75
|
+
this.buffer.push(JSON.stringify({ ...event, id: 0 }));
|
|
76
|
+
if (!this.timer) {
|
|
77
|
+
this.timer = setTimeout(() => this.flush(), this.flushIntervalMs);
|
|
78
|
+
}
|
|
79
|
+
return event;
|
|
80
|
+
}
|
|
81
|
+
flush() {
|
|
82
|
+
if (this.buffer.length === 0)
|
|
83
|
+
return;
|
|
84
|
+
for (const _line of this.buffer) {
|
|
85
|
+
const parsed = JSON.parse(_line);
|
|
86
|
+
this.write(parsed.payload);
|
|
87
|
+
}
|
|
88
|
+
this.buffer = [];
|
|
89
|
+
this.timer = null;
|
|
90
|
+
}
|
|
91
|
+
destroy() {
|
|
92
|
+
if (this.timer) {
|
|
93
|
+
clearTimeout(this.timer);
|
|
94
|
+
this.flush();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/writers/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAGrG,MAAM,OAAO,YAAY;IAMb;IACA;IANF,MAAM,GAAG,CAAC,CAAA;IACV,WAAW,CAAQ;IACnB,QAAQ,CAAQ;IAExB,YACU,QAAgB,EAChB,OAAe,EACvB,aAAsB,EACtB,QAAiB;QAHT,aAAQ,GAAR,QAAQ,CAAQ;QAChB,YAAO,GAAP,OAAO,CAAQ;QAIvB,IAAI,CAAC,WAAW,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA;QACtD,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,CAAC,CAAA;IAC/B,CAAC;IAED,KAAK,CAAC,OAAgB;QACpB,MAAM,KAAK,GAAiB;YAC1B,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE;YACjB,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO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AM,GAAG,EAAE,CAAA;QAChB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;IACnB,CAAC;IAED,OAAO;QACL,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACxB,IAAI,CAAC,KAAK,EAAE,CAAA;QACd,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ConsolePayload } from '../types.js';
|
|
2
|
+
export declare class ConsoleWriter {
|
|
3
|
+
private writer;
|
|
4
|
+
constructor(filePath: string, maxFileSizeMb?: number);
|
|
5
|
+
write(payload: ConsolePayload): import("../types.js").HarnessEvent;
|
|
6
|
+
resetId(): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=console.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../src/writers/console.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAc;gBAEhB,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM;IAIpD,KAAK,CAAC,OAAO,EAAE,cAAc;IAI7B,OAAO;CAGR"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NdjsonWriter } from './base.js';
|
|
2
|
+
export class ConsoleWriter {
|
|
3
|
+
writer;
|
|
4
|
+
constructor(filePath, maxFileSizeMb) {
|
|
5
|
+
this.writer = new NdjsonWriter(filePath, 'console', maxFileSizeMb);
|
|
6
|
+
}
|
|
7
|
+
write(payload) {
|
|
8
|
+
return this.writer.write(payload);
|
|
9
|
+
}
|
|
10
|
+
resetId() {
|
|
11
|
+
this.writer.resetId();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=console.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console.js","sourceRoot":"","sources":["../../src/writers/console.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAGxC,MAAM,OAAO,aAAa;IAChB,MAAM,CAAc;IAE5B,YAAY,QAAgB,EAAE,aAAsB;QAClD,IAAI,CAAC,MAAM,GAAG,IAAI,YAAY,CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa,CAAC,CAAA;IACpE,CAAC;IAED,KAAK,CAAC,OAAuB;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACnC,CAAC;IAED,OAAO;QACL,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface BuildEventPayload {
|
|
2
|
+
type: 'build:update' | 'build:error' | 'build:start' | 'build:complete';
|
|
3
|
+
modules?: string[];
|
|
4
|
+
error?: string;
|
|
5
|
+
duration?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare class DevEventsWriter {
|
|
8
|
+
private writer;
|
|
9
|
+
private lastUpdateAt;
|
|
10
|
+
private lastErrorAt;
|
|
11
|
+
private lastError;
|
|
12
|
+
private updateCount;
|
|
13
|
+
private errorCount;
|
|
14
|
+
private pending;
|
|
15
|
+
constructor(filePath: string, maxFileSizeMb?: number);
|
|
16
|
+
write(payload: BuildEventPayload): import("../types.js").HarnessEvent;
|
|
17
|
+
getStatus(since?: number): {
|
|
18
|
+
last_update_at: number | null;
|
|
19
|
+
last_error_at: number | null;
|
|
20
|
+
last_error: string | undefined;
|
|
21
|
+
update_count: number;
|
|
22
|
+
error_count: number;
|
|
23
|
+
pending: boolean;
|
|
24
|
+
};
|
|
25
|
+
resetId(): void;
|
|
26
|
+
resetCounters(): void;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=dev-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-events.d.ts","sourceRoot":"","sources":["../../src/writers/dev-events.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,cAAc,GAAG,aAAa,GAAG,aAAa,GAAG,gBAAgB,CAAA;IACvE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,YAAY,CAAsB;IAC1C,OAAO,CAAC,WAAW,CAAsB;IACzC,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,WAAW,CAAI;IACvB,OAAO,CAAC,UAAU,CAAI;IACtB,OAAO,CAAC,OAAO,CAAQ;gBAEX,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM;IAIpD,KAAK,CAAC,OAAO,EAAE,iBAAiB;IAkBhC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM;;;;;;;;IAYxB,OAAO;IAIP,aAAa;CAQd"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { NdjsonWriter } from './base.js';
|
|
2
|
+
export class DevEventsWriter {
|
|
3
|
+
writer;
|
|
4
|
+
lastUpdateAt = null;
|
|
5
|
+
lastErrorAt = null;
|
|
6
|
+
lastError;
|
|
7
|
+
updateCount = 0;
|
|
8
|
+
errorCount = 0;
|
|
9
|
+
pending = false;
|
|
10
|
+
constructor(filePath, maxFileSizeMb) {
|
|
11
|
+
this.writer = new NdjsonWriter(filePath, 'dev-events', maxFileSizeMb);
|
|
12
|
+
}
|
|
13
|
+
write(payload) {
|
|
14
|
+
const event = this.writer.write(payload);
|
|
15
|
+
if (payload.type === 'build:error') {
|
|
16
|
+
this.lastErrorAt = event.ts;
|
|
17
|
+
this.lastError = payload.error;
|
|
18
|
+
this.errorCount++;
|
|
19
|
+
}
|
|
20
|
+
else if (payload.type === 'build:update' || payload.type === 'build:complete') {
|
|
21
|
+
this.lastUpdateAt = event.ts;
|
|
22
|
+
this.updateCount++;
|
|
23
|
+
this.pending = false;
|
|
24
|
+
}
|
|
25
|
+
else if (payload.type === 'build:start') {
|
|
26
|
+
this.pending = true;
|
|
27
|
+
}
|
|
28
|
+
return event;
|
|
29
|
+
}
|
|
30
|
+
getStatus(since) {
|
|
31
|
+
const sinceTs = since ?? 0;
|
|
32
|
+
return {
|
|
33
|
+
last_update_at: this.lastUpdateAt,
|
|
34
|
+
last_error_at: this.lastErrorAt,
|
|
35
|
+
last_error: this.lastError,
|
|
36
|
+
update_count: this.lastUpdateAt && this.lastUpdateAt >= sinceTs ? this.updateCount : 0,
|
|
37
|
+
error_count: this.lastErrorAt && this.lastErrorAt >= sinceTs ? this.errorCount : 0,
|
|
38
|
+
pending: this.pending,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
resetId() {
|
|
42
|
+
this.writer.resetId();
|
|
43
|
+
}
|
|
44
|
+
resetCounters() {
|
|
45
|
+
this.updateCount = 0;
|
|
46
|
+
this.errorCount = 0;
|
|
47
|
+
this.lastUpdateAt = null;
|
|
48
|
+
this.lastErrorAt = null;
|
|
49
|
+
this.lastError = undefined;
|
|
50
|
+
this.pending = false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=dev-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-events.js","sourceRoot":"","sources":["../../src/writers/dev-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AASxC,MAAM,OAAO,eAAe;IAClB,MAAM,CAAc;IACpB,YAAY,GAAkB,IAAI,CAAA;IAClC,WAAW,GAAkB,IAAI,CAAA;IACjC,SAAS,CAAoB;IAC7B,WAAW,GAAG,CAAC,CAAA;IACf,UAAU,GAAG,CAAC,CAAA;IACd,OAAO,GAAG,KAA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AI,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YAClF,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAA;IACH,CAAC;IAED,OAAO;QACL,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;IACvB,CAAC;IAED,aAAa;QACX,IAAI,CAAC,WAAW,GAAG,CAAC,CAAA;QACpB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAA;QACnB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAA;QACxB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA;QACvB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;IACtB,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ErrorPayload } from '../types.js';
|
|
2
|
+
export declare class ErrorsWriter {
|
|
3
|
+
private writer;
|
|
4
|
+
constructor(filePath: string, maxFileSizeMb?: number);
|
|
5
|
+
write(payload: ErrorPayload): import("../types.js").HarnessEvent;
|
|
6
|
+
resetId(): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/writers/errors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAc;gBAEhB,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM;IAIpD,KAAK,CAAC,OAAO,EAAE,YAAY;IAI3B,OAAO;CAGR"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NdjsonWriter } from './base.js';
|
|
2
|
+
export class ErrorsWriter {
|
|
3
|
+
writer;
|
|
4
|
+
constructor(filePath, maxFileSizeMb) {
|
|
5
|
+
this.writer = new NdjsonWriter(filePath, 'errors', maxFileSizeMb);
|
|
6
|
+
}
|
|
7
|
+
write(payload) {
|
|
8
|
+
return this.writer.write(payload);
|
|
9
|
+
}
|
|
10
|
+
resetId() {
|
|
11
|
+
this.writer.resetId();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/writers/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAGxC,MAAM,OAAO,YAAY;IACf,MAAM,CAAc;IAE5B,YAAY,QAAgB,EAAE,aAAsB;QAClD,IAAI,CAAC,MAAM,GAAG,IAAI,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAA;IACnE,CAAC;IAED,KAAK,CAAC,OAAqB;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACnC,CAAC;IAED,OAAO;QACL,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NetworkPayload } from '../types.js';
|
|
2
|
+
export declare class NetworkWriter {
|
|
3
|
+
private writer;
|
|
4
|
+
constructor(filePath: string, maxFileSizeMb?: number);
|
|
5
|
+
write(payload: NetworkPayload): import("../types.js").HarnessEvent;
|
|
6
|
+
resetId(): void;
|
|
7
|
+
destroy(): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=network.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/writers/network.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAsB;gBAExB,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM;IAIpD,KAAK,CAAC,OAAO,EAAE,cAAc;IAI7B,OAAO;IAIP,OAAO;CAGR"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BufferedNdjsonWriter } from './base.js';
|
|
2
|
+
export class NetworkWriter {
|
|
3
|
+
writer;
|
|
4
|
+
constructor(filePath, maxFileSizeMb) {
|
|
5
|
+
this.writer = new BufferedNdjsonWriter(filePath, 'network', maxFileSizeMb, 100);
|
|
6
|
+
}
|
|
7
|
+
write(payload) {
|
|
8
|
+
return this.writer.writeBuffered(payload);
|
|
9
|
+
}
|
|
10
|
+
resetId() {
|
|
11
|
+
this.writer.resetId();
|
|
12
|
+
}
|
|
13
|
+
destroy() {
|
|
14
|
+
this.writer.destroy();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=network.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../src/writers/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAGhD,MAAM,OAAO,aAAa;IAChB,MAAM,CAAsB;IAEpC,YAAY,QAAgB,EAAE,aAAsB;QAClD,IAAI,CAAC,MAAM,GAAG,IAAI,oBAAoB,CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,CAAC,CAAA;IACjF,CAAC;IAED,KAAK,CAAC,OAAuB;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;IAC3C,CAAC;IAED,OAAO;QACL,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;IACvB,CAAC;IAED,OAAO;QACL,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ServerConsolePayload } from '../types.js';
|
|
2
|
+
export declare class ServerConsoleWriter {
|
|
3
|
+
private writer;
|
|
4
|
+
constructor(filePath: string, maxFileSizeMb?: number);
|
|
5
|
+
write(payload: ServerConsolePayload): import("../types.js").HarnessEvent;
|
|
6
|
+
resetId(): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=server-console.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-console.d.ts","sourceRoot":"","sources":["../../src/writers/server-console.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEvD,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAc;gBAEhB,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM;IAIpD,KAAK,CAAC,OAAO,EAAE,oBAAoB;IAInC,OAAO;CAGR"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NdjsonWriter } from './base.js';
|
|
2
|
+
export class ServerConsoleWriter {
|
|
3
|
+
writer;
|
|
4
|
+
constructor(filePath, maxFileSizeMb) {
|
|
5
|
+
this.writer = new NdjsonWriter(filePath, 'server-console', maxFileSizeMb);
|
|
6
|
+
}
|
|
7
|
+
write(payload) {
|
|
8
|
+
return this.writer.write(payload);
|
|
9
|
+
}
|
|
10
|
+
resetId() {
|
|
11
|
+
this.writer.resetId();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=server-console.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-console.js","sourceRoot":"","sources":["../../src/writers/server-console.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAGxC,MAAM,OAAO,mBAAmB;IACtB,MAAM,CAAc;IAE5B,YAAY,QAAgB,EAAE,aAAsB;QAClD,IAAI,CAAC,MAAM,GAAG,IAAI,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAA;IAC3E,CAAC;IAED,KAAK,CAAC,OAA6B;QACjC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACnC,CAAC;IAED,OAAO;QACL,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;IACvB,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@winstonfassett/webdev-gateway",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"description": "Universal web development MCP gateway — proxy any dev server with live browser observability for AI agents",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=20.6.0"
|
|
8
|
+
},
|
|
9
|
+
"main": "dist/gateway.js",
|
|
10
|
+
"types": "dist/gateway.d.ts",
|
|
11
|
+
"bin": {
|
|
12
|
+
"webdev": "dist/cli.js"
|
|
13
|
+
},
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/gateway.d.ts",
|
|
17
|
+
"import": "./dist/gateway.js",
|
|
18
|
+
"default": "./dist/gateway.js"
|
|
19
|
+
},
|
|
20
|
+
"./helpers": {
|
|
21
|
+
"types": "./dist/adapter-helpers.d.ts",
|
|
22
|
+
"import": "./dist/adapter-helpers.js",
|
|
23
|
+
"default": "./dist/adapter-helpers.js"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"CHANGELOG.md"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc && node build-client.mjs",
|
|
33
|
+
"build:client": "node build-client.mjs",
|
|
34
|
+
"dev": "tsc --watch",
|
|
35
|
+
"test": "node smoke-exports.mjs"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"mcp",
|
|
39
|
+
"web",
|
|
40
|
+
"devtools",
|
|
41
|
+
"proxy",
|
|
42
|
+
"ai"
|
|
43
|
+
],
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "git+https://github.com/WinstonFassett/webdev.git",
|
|
47
|
+
"directory": "apps/gateway"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/WinstonFassett/webdev",
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://github.com/WinstonFassett/webdev/issues"
|
|
52
|
+
},
|
|
53
|
+
"license": "MIT",
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"access": "public"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@clack/prompts": "^1.2.0",
|
|
59
|
+
"@modelcontextprotocol/sdk": "^1.27.0",
|
|
60
|
+
"@xmorse/playwright-core": "^1.59.10",
|
|
61
|
+
"capnweb": "^0.6.1",
|
|
62
|
+
"commander": "^13.1.0",
|
|
63
|
+
"execa": "^9.6.1",
|
|
64
|
+
"jsonc-parser": "^3.3.1",
|
|
65
|
+
"magicast": "^0.5.2",
|
|
66
|
+
"modern-screenshot": "^4.6.8",
|
|
67
|
+
"package-manager-detector": "^1.6.0",
|
|
68
|
+
"picocolors": "^1.1.1",
|
|
69
|
+
"ws": "^8.20.0",
|
|
70
|
+
"zod": "^4.0.0"
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@types/node": "^25.5.0",
|
|
74
|
+
"@types/ws": "^8.18.1",
|
|
75
|
+
"esbuild": "^0.25.0",
|
|
76
|
+
"playwright-core": "^1.58.2",
|
|
77
|
+
"typescript": "^5.8.0"
|
|
78
|
+
}
|
|
79
|
+
}
|