@hasna/browser 0.4.8 → 0.4.9
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/index.js +349 -248
- package/dist/db/gallery.d.ts.map +1 -1
- package/dist/engines/tui.d.ts.map +1 -1
- package/dist/index.js +121 -96
- package/dist/lib/auth.d.ts +7 -1
- package/dist/lib/auth.d.ts.map +1 -1
- package/dist/lib/gallery-diff.d.ts +1 -1
- package/dist/lib/gallery-diff.d.ts.map +1 -1
- package/dist/lib/recorder.d.ts +1 -0
- package/dist/lib/recorder.d.ts.map +1 -1
- package/dist/lib/session.d.ts.map +1 -1
- package/dist/lib/stealth.d.ts.map +1 -1
- package/dist/lib/tui-recording.d.ts +3 -0
- package/dist/lib/tui-recording.d.ts.map +1 -0
- package/dist/mcp/http.d.ts +17 -0
- package/dist/mcp/http.d.ts.map +1 -0
- package/dist/mcp/http.test.d.ts +2 -0
- package/dist/mcp/http.test.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +2 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +18 -18
- package/dist/mcp/integration.d.ts.map +1 -1
- package/dist/mcp/tui.d.ts.map +1 -1
- package/dist/server/index.js +103 -101
- package/package.json +1 -1
package/dist/db/gallery.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gallery.d.ts","sourceRoot":"","sources":["../../src/db/gallery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gallery.d.ts","sourceRoot":"","sources":["../../src/db/gallery.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAiEpE,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,YAAY,CAAC,GAAG,YAAY,CA8BvF;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG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EACV,MAAM,GAAE,aAAwB,EAChC,SAAS,GAAE,MAAgC,GAC1C,OAAO,CAAC,QAAQ,CAAC,CAcnB;AAID,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,MAAgC,GAC1C,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAsB,cAAc,CAClC,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,MAAM,EACX,SAAS,GAAE,MAAgC,GAC1C,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAsB,eAAe,CACnC,IAAI,EAAE,IAAI,EACV,SAAS,GAAE,MAAgC,EAC3C,MAAM,GAAE,aAAwB,GAC/B,OAAO,CAAC,MAAM,CAAC,CAGjB;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,MAAe,EAC1B,MAAM,GAAE,aAAwB,GAC/B,OAAO,CAAC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC,CA2BjE;AAID,wBAAsB,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAMjE"}
|
package/dist/index.js
CHANGED
|
@@ -9888,40 +9888,6 @@ var init_schema = __esm(() => {
|
|
|
9888
9888
|
init_dist();
|
|
9889
9889
|
});
|
|
9890
9890
|
|
|
9891
|
-
// src/db/console-log.ts
|
|
9892
|
-
var exports_console_log = {};
|
|
9893
|
-
__export(exports_console_log, {
|
|
9894
|
-
logConsoleMessage: () => logConsoleMessage,
|
|
9895
|
-
getConsoleMessage: () => getConsoleMessage,
|
|
9896
|
-
getConsoleLog: () => getConsoleLog,
|
|
9897
|
-
clearConsoleLog: () => clearConsoleLog
|
|
9898
|
-
});
|
|
9899
|
-
import { randomUUID as randomUUID6 } from "crypto";
|
|
9900
|
-
function logConsoleMessage(data) {
|
|
9901
|
-
const db = getDatabase();
|
|
9902
|
-
const id = randomUUID6();
|
|
9903
|
-
db.prepare("INSERT INTO console_log (id, session_id, level, message, source, line_number) VALUES (?, ?, ?, ?, ?, ?)").run(id, data.session_id, data.level, data.message, data.source ?? null, data.line_number ?? null);
|
|
9904
|
-
return getConsoleMessage(id);
|
|
9905
|
-
}
|
|
9906
|
-
function getConsoleMessage(id) {
|
|
9907
|
-
const db = getDatabase();
|
|
9908
|
-
return db.query("SELECT * FROM console_log WHERE id = ?").get(id) ?? null;
|
|
9909
|
-
}
|
|
9910
|
-
function getConsoleLog(sessionId, level) {
|
|
9911
|
-
const db = getDatabase();
|
|
9912
|
-
if (level) {
|
|
9913
|
-
return db.query("SELECT * FROM console_log WHERE session_id = ? AND level = ? ORDER BY timestamp ASC").all(sessionId, level);
|
|
9914
|
-
}
|
|
9915
|
-
return db.query("SELECT * FROM console_log WHERE session_id = ? ORDER BY timestamp ASC").all(sessionId);
|
|
9916
|
-
}
|
|
9917
|
-
function clearConsoleLog(sessionId) {
|
|
9918
|
-
const db = getDatabase();
|
|
9919
|
-
db.prepare("DELETE FROM console_log WHERE session_id = ?").run(sessionId);
|
|
9920
|
-
}
|
|
9921
|
-
var init_console_log = __esm(() => {
|
|
9922
|
-
init_schema();
|
|
9923
|
-
});
|
|
9924
|
-
|
|
9925
9891
|
// src/engines/cdp.ts
|
|
9926
9892
|
var exports_cdp = {};
|
|
9927
9893
|
__export(exports_cdp, {
|
|
@@ -17622,10 +17588,30 @@ function deleteNetworkRequest(id) {
|
|
|
17622
17588
|
const db = getDatabase();
|
|
17623
17589
|
db.prepare("DELETE FROM network_log WHERE id = ?").run(id);
|
|
17624
17590
|
}
|
|
17625
|
-
|
|
17626
|
-
|
|
17627
|
-
|
|
17628
|
-
|
|
17591
|
+
// src/db/console-log.ts
|
|
17592
|
+
init_schema();
|
|
17593
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
17594
|
+
function logConsoleMessage(data) {
|
|
17595
|
+
const db = getDatabase();
|
|
17596
|
+
const id = randomUUID6();
|
|
17597
|
+
db.prepare("INSERT INTO console_log (id, session_id, level, message, source, line_number) VALUES (?, ?, ?, ?, ?, ?)").run(id, data.session_id, data.level, data.message, data.source ?? null, data.line_number ?? null);
|
|
17598
|
+
return getConsoleMessage(id);
|
|
17599
|
+
}
|
|
17600
|
+
function getConsoleMessage(id) {
|
|
17601
|
+
const db = getDatabase();
|
|
17602
|
+
return db.query("SELECT * FROM console_log WHERE id = ?").get(id) ?? null;
|
|
17603
|
+
}
|
|
17604
|
+
function getConsoleLog(sessionId, level) {
|
|
17605
|
+
const db = getDatabase();
|
|
17606
|
+
if (level) {
|
|
17607
|
+
return db.query("SELECT * FROM console_log WHERE session_id = ? AND level = ? ORDER BY timestamp ASC").all(sessionId, level);
|
|
17608
|
+
}
|
|
17609
|
+
return db.query("SELECT * FROM console_log WHERE session_id = ? ORDER BY timestamp ASC").all(sessionId);
|
|
17610
|
+
}
|
|
17611
|
+
function clearConsoleLog(sessionId) {
|
|
17612
|
+
const db = getDatabase();
|
|
17613
|
+
db.prepare("DELETE FROM console_log WHERE session_id = ?").run(sessionId);
|
|
17614
|
+
}
|
|
17629
17615
|
// src/db/recordings.ts
|
|
17630
17616
|
init_schema();
|
|
17631
17617
|
init_types();
|
|
@@ -18832,6 +18818,16 @@ function inferUseCase(label) {
|
|
|
18832
18818
|
init_types();
|
|
18833
18819
|
init_types();
|
|
18834
18820
|
|
|
18821
|
+
// src/lib/tui-recording.ts
|
|
18822
|
+
var recordingIntervals = new Map;
|
|
18823
|
+
function stopTuiRecording(sessionId) {
|
|
18824
|
+
const intervalId = recordingIntervals.get(sessionId);
|
|
18825
|
+
if (!intervalId)
|
|
18826
|
+
return;
|
|
18827
|
+
clearInterval(intervalId);
|
|
18828
|
+
recordingIntervals.delete(sessionId);
|
|
18829
|
+
}
|
|
18830
|
+
|
|
18835
18831
|
// src/lib/network.ts
|
|
18836
18832
|
function enableNetworkLogging(page, sessionId) {
|
|
18837
18833
|
const requestStart = new Map;
|
|
@@ -18955,7 +18951,6 @@ function startHAR(page) {
|
|
|
18955
18951
|
}
|
|
18956
18952
|
|
|
18957
18953
|
// src/lib/console.ts
|
|
18958
|
-
init_console_log();
|
|
18959
18954
|
function enableConsoleCapture(page, sessionId) {
|
|
18960
18955
|
const onConsole = (msg) => {
|
|
18961
18956
|
const levelMap = {
|
|
@@ -19047,6 +19042,12 @@ if (!window.chrome.runtime) {
|
|
|
19047
19042
|
id: undefined,
|
|
19048
19043
|
};
|
|
19049
19044
|
}
|
|
19045
|
+
|
|
19046
|
+
// \u2500\u2500 5. Override navigator.userAgent to match HTTP header \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
19047
|
+
Object.defineProperty(navigator, 'userAgent', {
|
|
19048
|
+
get: () => "${REALISTIC_USER_AGENT}",
|
|
19049
|
+
configurable: true,
|
|
19050
|
+
});
|
|
19050
19051
|
`;
|
|
19051
19052
|
async function applyStealthPatches(page) {
|
|
19052
19053
|
await page.context().addInitScript(STEALTH_SCRIPT);
|
|
@@ -19091,6 +19092,29 @@ if (dbPruneInterval.unref)
|
|
|
19091
19092
|
function createBunProxy(view) {
|
|
19092
19093
|
return view;
|
|
19093
19094
|
}
|
|
19095
|
+
function attachPlaywrightListeners(page, sessionId, cleanups, opts = {}) {
|
|
19096
|
+
if (opts.captureNetwork !== false) {
|
|
19097
|
+
try {
|
|
19098
|
+
cleanups.push(enableNetworkLogging(page, sessionId));
|
|
19099
|
+
} catch {}
|
|
19100
|
+
}
|
|
19101
|
+
if (opts.captureConsole !== false) {
|
|
19102
|
+
try {
|
|
19103
|
+
cleanups.push(enableConsoleCapture(page, sessionId));
|
|
19104
|
+
} catch {}
|
|
19105
|
+
}
|
|
19106
|
+
try {
|
|
19107
|
+
cleanups.push(setupDialogHandler(page, sessionId));
|
|
19108
|
+
} catch {}
|
|
19109
|
+
}
|
|
19110
|
+
function detachPlaywrightListeners(cleanups) {
|
|
19111
|
+
while (cleanups.length > 1) {
|
|
19112
|
+
const cleanup = cleanups.pop();
|
|
19113
|
+
try {
|
|
19114
|
+
cleanup?.();
|
|
19115
|
+
} catch {}
|
|
19116
|
+
}
|
|
19117
|
+
}
|
|
19094
19118
|
async function createSession2(opts = {}) {
|
|
19095
19119
|
if (opts.cdpUrl) {
|
|
19096
19120
|
const { connectToExistingBrowser: connectToExistingBrowser2 } = await Promise.resolve().then(() => (init_cdp(), exports_cdp));
|
|
@@ -19128,9 +19152,11 @@ async function createSession2(opts = {}) {
|
|
|
19128
19152
|
let browser = null;
|
|
19129
19153
|
let bunView = null;
|
|
19130
19154
|
let page;
|
|
19155
|
+
let actualEngine = resolvedEngine;
|
|
19131
19156
|
if (resolvedEngine === "bun") {
|
|
19132
19157
|
if (!isBunWebViewAvailable()) {
|
|
19133
19158
|
console.warn("[browser] Bun.WebView requested but not available \u2014 falling back to playwright. Run: bun upgrade --canary");
|
|
19159
|
+
actualEngine = "playwright";
|
|
19134
19160
|
browser = await launchPlaywright({ headless: opts.headless ?? true, viewport: opts.viewport, userAgent: opts.userAgent });
|
|
19135
19161
|
page = await getPage(browser, { viewport: opts.viewport, userAgent: opts.userAgent });
|
|
19136
19162
|
} else {
|
|
@@ -19150,9 +19176,11 @@ async function createSession2(opts = {}) {
|
|
|
19150
19176
|
}
|
|
19151
19177
|
if (!bunWorks) {
|
|
19152
19178
|
console.warn("[browser] Bun.WebView exists but Chrome not available \u2014 falling back to playwright");
|
|
19179
|
+
actualEngine = "playwright";
|
|
19153
19180
|
browser = await launchPlaywright({ headless: opts.headless ?? true, viewport: opts.viewport, userAgent: opts.userAgent });
|
|
19154
19181
|
page = await getPage(browser, { viewport: opts.viewport, userAgent: opts.userAgent });
|
|
19155
19182
|
} else {
|
|
19183
|
+
actualEngine = "bun";
|
|
19156
19184
|
bunView = testView;
|
|
19157
19185
|
if (opts.stealth) {}
|
|
19158
19186
|
page = createBunProxy(bunView);
|
|
@@ -19182,19 +19210,10 @@ async function createSession2(opts = {}) {
|
|
|
19182
19210
|
});
|
|
19183
19211
|
const cleanups2 = [];
|
|
19184
19212
|
cleanups2.push(() => closeTui(tuiSess));
|
|
19185
|
-
|
|
19186
|
-
|
|
19187
|
-
|
|
19188
|
-
|
|
19189
|
-
}
|
|
19190
|
-
if (opts.captureConsole !== false) {
|
|
19191
|
-
try {
|
|
19192
|
-
cleanups2.push(enableConsoleCapture(page, session2.id));
|
|
19193
|
-
} catch {}
|
|
19194
|
-
}
|
|
19195
|
-
try {
|
|
19196
|
-
cleanups2.push(setupDialogHandler(page, session2.id));
|
|
19197
|
-
} catch {}
|
|
19213
|
+
attachPlaywrightListeners(page, session2.id, cleanups2, {
|
|
19214
|
+
captureNetwork: opts.captureNetwork,
|
|
19215
|
+
captureConsole: opts.captureConsole
|
|
19216
|
+
});
|
|
19198
19217
|
handles.set(session2.id, { browser, bunView: null, tuiSession: tuiSess, page, engine: "tui", cleanups: cleanups2, tokenBudget: { total: 0, used: 0 }, lastActivity: Date.now(), autoGallery: opts.autoGallery ?? false, startUrl: opts.startUrl ?? "bash" });
|
|
19199
19218
|
return { session: session2, page };
|
|
19200
19219
|
} else {
|
|
@@ -19224,7 +19243,7 @@ async function createSession2(opts = {}) {
|
|
|
19224
19243
|
}
|
|
19225
19244
|
})() : undefined);
|
|
19226
19245
|
const session = createSession({
|
|
19227
|
-
engine:
|
|
19246
|
+
engine: actualEngine,
|
|
19228
19247
|
projectId: opts.projectId,
|
|
19229
19248
|
agentId: opts.agentId,
|
|
19230
19249
|
startUrl: opts.startUrl,
|
|
@@ -19237,37 +19256,12 @@ async function createSession2(opts = {}) {
|
|
|
19237
19256
|
}
|
|
19238
19257
|
const cleanups = [];
|
|
19239
19258
|
if (!bunView) {
|
|
19240
|
-
|
|
19241
|
-
|
|
19242
|
-
|
|
19243
|
-
|
|
19244
|
-
}
|
|
19245
|
-
if (opts.captureConsole !== false) {
|
|
19246
|
-
try {
|
|
19247
|
-
cleanups.push(enableConsoleCapture(page, session.id));
|
|
19248
|
-
} catch {}
|
|
19249
|
-
}
|
|
19250
|
-
try {
|
|
19251
|
-
cleanups.push(setupDialogHandler(page, session.id));
|
|
19252
|
-
} catch {}
|
|
19253
|
-
} else {
|
|
19254
|
-
if (opts.captureConsole !== false) {
|
|
19255
|
-
try {
|
|
19256
|
-
const { logConsoleMessage: logConsoleMessage2 } = await Promise.resolve().then(() => (init_console_log(), exports_console_log));
|
|
19257
|
-
await bunView.addInitScript(`
|
|
19258
|
-
(() => {
|
|
19259
|
-
const orig = { log: console.log, warn: console.warn, error: console.error, debug: console.debug, info: console.info };
|
|
19260
|
-
['log','warn','error','debug','info'].forEach(level => {
|
|
19261
|
-
console[level] = (...args) => {
|
|
19262
|
-
orig[level](...args);
|
|
19263
|
-
};
|
|
19264
|
-
});
|
|
19265
|
-
})()
|
|
19266
|
-
`);
|
|
19267
|
-
} catch {}
|
|
19268
|
-
}
|
|
19259
|
+
attachPlaywrightListeners(page, session.id, cleanups, {
|
|
19260
|
+
captureNetwork: opts.captureNetwork,
|
|
19261
|
+
captureConsole: opts.captureConsole
|
|
19262
|
+
});
|
|
19269
19263
|
}
|
|
19270
|
-
handles.set(session.id, { browser, bunView, tuiSession: null, page, engine:
|
|
19264
|
+
handles.set(session.id, { browser, bunView, tuiSession: null, page, engine: actualEngine, cleanups, tokenBudget: { total: 0, used: 0 }, lastActivity: Date.now(), autoGallery: opts.autoGallery ?? false, startUrl: opts.startUrl ?? "" });
|
|
19271
19265
|
if (opts.startUrl) {
|
|
19272
19266
|
try {
|
|
19273
19267
|
if (bunView) {
|
|
@@ -19300,7 +19294,8 @@ function getSessionBunView(sessionId) {
|
|
|
19300
19294
|
return handles.get(sessionId)?.bunView ?? null;
|
|
19301
19295
|
}
|
|
19302
19296
|
function isBunSession(sessionId) {
|
|
19303
|
-
|
|
19297
|
+
const handle = handles.get(sessionId);
|
|
19298
|
+
return handle?.engine === "bun" && handle.bunView !== null;
|
|
19304
19299
|
}
|
|
19305
19300
|
function getSessionBrowser(sessionId) {
|
|
19306
19301
|
const handle = handles.get(sessionId);
|
|
@@ -19326,11 +19321,16 @@ function setSessionTui(sessionId, tuiSess) {
|
|
|
19326
19321
|
const handle = handles.get(sessionId);
|
|
19327
19322
|
if (!handle)
|
|
19328
19323
|
throw new SessionNotFoundError(sessionId);
|
|
19324
|
+
detachPlaywrightListeners(handle.cleanups);
|
|
19329
19325
|
handle.tuiSession = tuiSess;
|
|
19330
19326
|
handle.page = tuiSess.page;
|
|
19331
19327
|
if (tuiSess.browser !== handle.browser) {
|
|
19332
19328
|
handle.browser = tuiSess.browser;
|
|
19333
19329
|
}
|
|
19330
|
+
attachPlaywrightListeners(tuiSess.page, sessionId, handle.cleanups, {
|
|
19331
|
+
captureNetwork: true,
|
|
19332
|
+
captureConsole: true
|
|
19333
|
+
});
|
|
19334
19334
|
handle.lastActivity = Date.now();
|
|
19335
19335
|
}
|
|
19336
19336
|
function getSessionCommand(sessionId) {
|
|
@@ -19346,9 +19346,12 @@ async function closeSession2(sessionId) {
|
|
|
19346
19346
|
const handle = handles.get(sessionId);
|
|
19347
19347
|
try {
|
|
19348
19348
|
if (handle) {
|
|
19349
|
+
if (handle.engine === "tui") {
|
|
19350
|
+
stopTuiRecording(sessionId);
|
|
19351
|
+
}
|
|
19349
19352
|
for (const cleanup of handle.cleanups) {
|
|
19350
19353
|
try {
|
|
19351
|
-
cleanup();
|
|
19354
|
+
await cleanup();
|
|
19352
19355
|
} catch {}
|
|
19353
19356
|
}
|
|
19354
19357
|
if (handle.bunView) {
|
|
@@ -19706,16 +19709,23 @@ async function startCoverage(page) {
|
|
|
19706
19709
|
// src/lib/screenshot.ts
|
|
19707
19710
|
init_types();
|
|
19708
19711
|
var import_sharp = __toESM(require_lib3(), 1);
|
|
19709
|
-
import { join as
|
|
19712
|
+
import { join as join10 } from "path";
|
|
19710
19713
|
import { mkdirSync as mkdirSync7 } from "fs";
|
|
19711
19714
|
|
|
19712
19715
|
// src/db/gallery.ts
|
|
19713
19716
|
init_schema();
|
|
19714
19717
|
import { randomUUID as randomUUID10 } from "crypto";
|
|
19718
|
+
import { join as join9, resolve, relative as relative2, isAbsolute } from "path";
|
|
19715
19719
|
function validateDataPath(filePath) {
|
|
19716
19720
|
if (filePath.includes("..")) {
|
|
19717
19721
|
throw new Error(`File path must not contain '..': ${filePath}`);
|
|
19718
19722
|
}
|
|
19723
|
+
const dataDir = resolve(getDataDir2());
|
|
19724
|
+
const resolved = resolve(isAbsolute(filePath) ? filePath : join9(dataDir, filePath));
|
|
19725
|
+
const rel = relative2(dataDir, resolved);
|
|
19726
|
+
if (rel.startsWith("..") || isAbsolute(rel)) {
|
|
19727
|
+
throw new Error(`File path must be within data directory: ${filePath}`);
|
|
19728
|
+
}
|
|
19719
19729
|
return filePath;
|
|
19720
19730
|
}
|
|
19721
19731
|
function deserialize3(row) {
|
|
@@ -19733,7 +19743,13 @@ function deserialize3(row) {
|
|
|
19733
19743
|
original_size_bytes: row.original_size_bytes ?? undefined,
|
|
19734
19744
|
compressed_size_bytes: row.compressed_size_bytes ?? undefined,
|
|
19735
19745
|
compression_ratio: row.compression_ratio ?? undefined,
|
|
19736
|
-
tags:
|
|
19746
|
+
tags: (() => {
|
|
19747
|
+
try {
|
|
19748
|
+
return JSON.parse(row.tags);
|
|
19749
|
+
} catch {
|
|
19750
|
+
return [];
|
|
19751
|
+
}
|
|
19752
|
+
})(),
|
|
19737
19753
|
notes: row.notes ?? undefined,
|
|
19738
19754
|
is_favorite: row.is_favorite === 1,
|
|
19739
19755
|
created_at: row.created_at
|
|
@@ -19763,9 +19779,9 @@ function getEntry(id) {
|
|
|
19763
19779
|
// src/lib/screenshot.ts
|
|
19764
19780
|
init_schema();
|
|
19765
19781
|
function getScreenshotDir(projectId) {
|
|
19766
|
-
const base =
|
|
19782
|
+
const base = join10(getDataDir2(), "screenshots");
|
|
19767
19783
|
const date = new Date().toISOString().split("T")[0];
|
|
19768
|
-
const dir = projectId ?
|
|
19784
|
+
const dir = projectId ? join10(base, projectId, date) : join10(base, date);
|
|
19769
19785
|
mkdirSync7(dir, { recursive: true });
|
|
19770
19786
|
return dir;
|
|
19771
19787
|
}
|
|
@@ -19781,7 +19797,7 @@ async function compressBuffer(raw, format, quality, maxWidth) {
|
|
|
19781
19797
|
}
|
|
19782
19798
|
}
|
|
19783
19799
|
async function generateThumbnail(raw, dir, stem) {
|
|
19784
|
-
const thumbPath =
|
|
19800
|
+
const thumbPath = join10(dir, `${stem}.thumb.webp`);
|
|
19785
19801
|
const thumbBuffer = await import_sharp.default(raw).resize({ width: 200, withoutEnlargement: true }).webp({ quality: 70, effort: 3 }).toBuffer();
|
|
19786
19802
|
await Bun.write(thumbPath, thumbBuffer);
|
|
19787
19803
|
return { path: thumbPath, base64: thumbBuffer.toString("base64") };
|
|
@@ -19849,7 +19865,7 @@ async function takeScreenshot(page, opts) {
|
|
|
19849
19865
|
const compressedSizeBytes = finalBuffer.length;
|
|
19850
19866
|
const compressionRatio = originalSizeBytes > 0 ? compressedSizeBytes / originalSizeBytes : 1;
|
|
19851
19867
|
const ext = format;
|
|
19852
|
-
const screenshotPath = opts?.path ??
|
|
19868
|
+
const screenshotPath = opts?.path ?? join10(dir, `${stem}.${ext}`);
|
|
19853
19869
|
await Bun.write(screenshotPath, finalBuffer);
|
|
19854
19870
|
let thumbnailPath;
|
|
19855
19871
|
let thumbnailBase64;
|
|
@@ -19909,12 +19925,12 @@ async function takeScreenshot(page, opts) {
|
|
|
19909
19925
|
}
|
|
19910
19926
|
async function generatePDF(page, opts) {
|
|
19911
19927
|
try {
|
|
19912
|
-
const base =
|
|
19928
|
+
const base = join10(getDataDir2(), "pdfs");
|
|
19913
19929
|
const date = new Date().toISOString().split("T")[0];
|
|
19914
|
-
const dir = opts?.projectId ?
|
|
19930
|
+
const dir = opts?.projectId ? join10(base, opts.projectId, date) : join10(base, date);
|
|
19915
19931
|
mkdirSync7(dir, { recursive: true });
|
|
19916
19932
|
const timestamp = Date.now();
|
|
19917
|
-
const pdfPath = opts?.path ??
|
|
19933
|
+
const pdfPath = opts?.path ?? join10(dir, `${timestamp}.pdf`);
|
|
19918
19934
|
const buffer = await page.pdf({
|
|
19919
19935
|
path: pdfPath,
|
|
19920
19936
|
format: opts?.format ?? "A4",
|
|
@@ -19990,14 +20006,14 @@ async function clearSessionStorage(page) {
|
|
|
19990
20006
|
await page.evaluate(() => sessionStorage.clear());
|
|
19991
20007
|
}
|
|
19992
20008
|
async function getIndexedDB(page, dbName, storeName) {
|
|
19993
|
-
return page.evaluate(([db, store]) => new Promise((
|
|
20009
|
+
return page.evaluate(([db, store]) => new Promise((resolve2, reject) => {
|
|
19994
20010
|
const req = indexedDB.open(db);
|
|
19995
20011
|
req.onsuccess = () => {
|
|
19996
20012
|
const database = req.result;
|
|
19997
20013
|
const tx = database.transaction(store, "readonly");
|
|
19998
20014
|
const objectStore = tx.objectStore(store);
|
|
19999
20015
|
const all = objectStore.getAll();
|
|
20000
|
-
all.onsuccess = () =>
|
|
20016
|
+
all.onsuccess = () => resolve2(all.result);
|
|
20001
20017
|
all.onerror = () => reject(all.error);
|
|
20002
20018
|
};
|
|
20003
20019
|
req.onerror = () => reject(req.error);
|
|
@@ -20007,6 +20023,14 @@ async function getIndexedDB(page, dbName, storeName) {
|
|
|
20007
20023
|
init_actions();
|
|
20008
20024
|
init_types();
|
|
20009
20025
|
var activeRecordings = new Map;
|
|
20026
|
+
function resetRecorderState() {
|
|
20027
|
+
for (const active of activeRecordings.values()) {
|
|
20028
|
+
try {
|
|
20029
|
+
active.cleanup();
|
|
20030
|
+
} catch {}
|
|
20031
|
+
}
|
|
20032
|
+
activeRecordings.clear();
|
|
20033
|
+
}
|
|
20010
20034
|
function startRecording(sessionId, name, startUrl) {
|
|
20011
20035
|
const steps = [];
|
|
20012
20036
|
const recording = createRecording({ name, start_url: startUrl, steps });
|
|
@@ -20269,6 +20293,7 @@ export {
|
|
|
20269
20293
|
selectEngine,
|
|
20270
20294
|
scrollTo,
|
|
20271
20295
|
scroll,
|
|
20296
|
+
resetRecorderState,
|
|
20272
20297
|
resetDatabase,
|
|
20273
20298
|
replayRecording,
|
|
20274
20299
|
renameSession2 as renameSession,
|
package/dist/lib/auth.d.ts
CHANGED
|
@@ -9,13 +9,18 @@ export interface Credential {
|
|
|
9
9
|
password?: string;
|
|
10
10
|
totp?: string;
|
|
11
11
|
}
|
|
12
|
+
export interface CredentialLookup {
|
|
13
|
+
credential: Credential | null;
|
|
14
|
+
method: LoginResult["method"];
|
|
15
|
+
}
|
|
12
16
|
export interface LoginResult {
|
|
13
17
|
logged_in: boolean;
|
|
14
18
|
redirect_url: string;
|
|
15
19
|
profile_saved: boolean;
|
|
16
|
-
method: "secrets_vault" | "env_file" | "not_found";
|
|
20
|
+
method: "secrets_vault" | "env_file" | "process_env" | "not_found";
|
|
17
21
|
error?: string;
|
|
18
22
|
}
|
|
23
|
+
export declare function lookupCredentials(service: string): Promise<CredentialLookup>;
|
|
19
24
|
export declare function getCredentials(service: string): Promise<Credential | null>;
|
|
20
25
|
export declare function loginWithCredentials(page: Page, credentials: Credential, opts?: {
|
|
21
26
|
loginUrl?: string;
|
|
@@ -24,5 +29,6 @@ export declare function loginWithCredentials(page: Page, credentials: Credential
|
|
|
24
29
|
submitSelector?: string;
|
|
25
30
|
waitForText?: string;
|
|
26
31
|
saveProfile?: string;
|
|
32
|
+
method?: LoginResult["method"];
|
|
27
33
|
}): Promise<LoginResult>;
|
|
28
34
|
//# sourceMappingURL=auth.d.ts.map
|
package/dist/lib/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/lib/auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,MAAM,WAAW,UAAU;IACzB,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U,EACvB,IAAI,CAAC,EAAE;IACL,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;CAChC,GACA,OAAO,CAAC,WAAW,CAAC,CAkFtB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { GalleryDiffResult } from "../types/index.js";
|
|
2
|
-
export declare function diffImages(path1: string, path2: string): Promise<GalleryDiffResult>;
|
|
2
|
+
export declare function diffImages(path1: string, path2: string, threshold?: number): Promise<GalleryDiffResult>;
|
|
3
3
|
//# sourceMappingURL=gallery-diff.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gallery-diff.d.ts","sourceRoot":"","sources":["../../src/lib/gallery-diff.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"gallery-diff.d.ts","sourceRoot":"","sources":["../../src/lib/gallery-diff.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,SAAK,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA2DzG"}
|
package/dist/lib/recorder.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Page } from "playwright";
|
|
2
2
|
import type { Recording, RecordingStep, ReplayResult } from "../types/index.js";
|
|
3
3
|
import { getRecording, listRecordings } from "../db/recordings.js";
|
|
4
|
+
export declare function resetRecorderState(): void;
|
|
4
5
|
export declare function startRecording(sessionId: string, name: string, startUrl?: string): Recording;
|
|
5
6
|
export declare function attachPageListeners(page: Page, recordingId: string): void;
|
|
6
7
|
export declare function recordStep(recordingId: string, step: Omit<RecordingStep, "timestamp">): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../../src/lib/recorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAmB,YAAY,EAAmB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAYrG,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAa5F;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAmBzE;AAED,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,GAAG,IAAI,CAI5F;AAED,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAQ5D;AAED,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,YAAY,CAAC,CAuDvB;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,YAAY,GAAG,WAAoB,GAAG,MAAM,CAqDjH;AAED,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../../src/lib/recorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAmB,YAAY,EAAmB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAYrG,wBAAgB,kBAAkB,IAAI,IAAI,CAKzC;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAa5F;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAmBzE;AAED,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,GAAG,IAAI,CAI5F;AAED,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAQ5D;AAED,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,YAAY,CAAC,CAuDvB;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,YAAY,GAAG,WAAoB,GAAG,MAAM,CAqDjH;AAED,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/lib/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,aAAa,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,CAExD;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stealth.d.ts","sourceRoot":"","sources":["../../src/lib/stealth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAOvC,QAAA,MAAM,oBAAoB,0HAC+F,CAAC;
|
|
1
|
+
{"version":3,"file":"stealth.d.ts","sourceRoot":"","sources":["../../src/lib/stealth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAOvC,QAAA,MAAM,oBAAoB,0HAC+F,CAAC;AA0D1H,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAQnE;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tui-recording.d.ts","sourceRoot":"","sources":["../../src/lib/tui-recording.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,GAAG,IAAI,CAGrG;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAKxD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
export declare const MCP_HTTP_SERVICE_NAME = "browser";
|
|
3
|
+
export declare const DEFAULT_MCP_HTTP_PORT = 8851;
|
|
4
|
+
export declare function isHttpMode(argv?: string[], env?: NodeJS.ProcessEnv): boolean;
|
|
5
|
+
export declare function isStdioMode(argv?: string[], env?: NodeJS.ProcessEnv): boolean;
|
|
6
|
+
export declare function resolveMcpHttpPort(argv?: string[], env?: NodeJS.ProcessEnv): number;
|
|
7
|
+
export type McpHttpServerHandle = {
|
|
8
|
+
port: number;
|
|
9
|
+
host: string;
|
|
10
|
+
close: () => Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
export declare function startMcpHttpServer(buildServer: () => McpServer, options?: {
|
|
13
|
+
port?: number;
|
|
14
|
+
host?: string;
|
|
15
|
+
serviceName?: string;
|
|
16
|
+
}): Promise<McpHttpServerHandle>;
|
|
17
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/mcp/http.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAC/C,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAE1C,wBAAgB,UAAU,CACxB,IAAI,GAAE,MAAM,EAAiB,EAC7B,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAET;AAED,wBAAgB,WAAW,CACzB,IAAI,GAAE,MAAM,EAAiB,EAC7B,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAET;AAED,wBAAgB,kBAAkB,CAChC,IAAI,GAAE,MAAM,EAAiB,EAC7B,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,MAAM,CASR;AAoBD,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B,CAAC;AAEF,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,MAAM,SAAS,EAC5B,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/D,OAAO,CAAC,mBAAmB,CAAC,CAwE9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.test.d.ts","sourceRoot":"","sources":["../../src/mcp/http.test.ts"],"names":[],"mappings":""}
|
package/dist/mcp/index.d.ts
CHANGED
package/dist/mcp/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgBpE,wBAAgB,WAAW,IAAI,SAAS,CAevC"}
|
package/dist/mcp/index.js
CHANGED
|
@@ -78568,9 +78568,9 @@ CONDITION SYNTAX:
|
|
|
78568
78568
|
import { createServer } from "http";
|
|
78569
78569
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
78570
78570
|
var MCP_HTTP_SERVICE_NAME = "browser";
|
|
78571
|
-
var DEFAULT_MCP_HTTP_PORT =
|
|
78572
|
-
function
|
|
78573
|
-
return argv.includes("--
|
|
78571
|
+
var DEFAULT_MCP_HTTP_PORT = 8851;
|
|
78572
|
+
function isStdioMode(argv = process.argv, env = process.env) {
|
|
78573
|
+
return argv.includes("--stdio") || env.MCP_STDIO === "1";
|
|
78574
78574
|
}
|
|
78575
78575
|
function resolveMcpHttpPort(argv = process.argv, env = process.env) {
|
|
78576
78576
|
const portIdx = argv.indexOf("--port");
|
|
@@ -78704,23 +78704,23 @@ async function main() {
|
|
|
78704
78704
|
`);
|
|
78705
78705
|
return;
|
|
78706
78706
|
}
|
|
78707
|
-
if (
|
|
78708
|
-
const
|
|
78709
|
-
|
|
78710
|
-
|
|
78711
|
-
await
|
|
78712
|
-
process.on("SIGINT", () => {
|
|
78713
|
-
handle.close().finally(() => process.exit(0));
|
|
78714
|
-
});
|
|
78715
|
-
process.on("SIGTERM", () => {
|
|
78716
|
-
handle.close().finally(() => process.exit(0));
|
|
78717
|
-
});
|
|
78707
|
+
if (isStdioMode()) {
|
|
78708
|
+
const server = buildServer();
|
|
78709
|
+
await logStartup(server);
|
|
78710
|
+
const transport = new StdioServerTransport;
|
|
78711
|
+
await server.connect(transport);
|
|
78718
78712
|
return;
|
|
78719
78713
|
}
|
|
78720
|
-
const
|
|
78721
|
-
|
|
78722
|
-
|
|
78723
|
-
await
|
|
78714
|
+
const handle = await startMcpHttpServer(buildServer, {
|
|
78715
|
+
port: resolveMcpHttpPort()
|
|
78716
|
+
});
|
|
78717
|
+
await logStartup(buildServer());
|
|
78718
|
+
process.on("SIGINT", () => {
|
|
78719
|
+
handle.close().finally(() => process.exit(0));
|
|
78720
|
+
});
|
|
78721
|
+
process.on("SIGTERM", () => {
|
|
78722
|
+
handle.close().finally(() => process.exit(0));
|
|
78723
|
+
});
|
|
78724
78724
|
}
|
|
78725
78725
|
if (import.meta.main) {
|
|
78726
78726
|
main().catch((error) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../src/mcp/integration.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAsBzE,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../src/mcp/integration.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAsBzE,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,QAgc3D"}
|
package/dist/mcp/tui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../../src/mcp/tui.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../../src/mcp/tui.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA+IzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,QAwczC"}
|