@hasna/browser 0.3.8 → 0.4.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/dist/cli/index.js +160 -63
- package/dist/engines/selector.d.ts.map +1 -1
- package/dist/engines/tui.d.ts +49 -0
- package/dist/engines/tui.d.ts.map +1 -0
- package/dist/engines/tui.test.d.ts +2 -0
- package/dist/engines/tui.test.d.ts.map +1 -0
- package/dist/index.js +139 -42
- package/dist/lib/login-scripts.d.ts +89 -0
- package/dist/lib/login-scripts.d.ts.map +1 -0
- package/dist/lib/session.d.ts.map +1 -1
- package/dist/mcp/index.js +156 -59
- package/dist/server/index.js +135 -41
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -5,60 +5,39 @@ var __defProp = Object.defineProperty;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
function __accessProp(key) {
|
|
9
|
-
return this[key];
|
|
10
|
-
}
|
|
11
|
-
var __toESMCache_node;
|
|
12
|
-
var __toESMCache_esm;
|
|
13
8
|
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
-
var canCache = mod != null && typeof mod === "object";
|
|
15
|
-
if (canCache) {
|
|
16
|
-
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
-
var cached = cache.get(mod);
|
|
18
|
-
if (cached)
|
|
19
|
-
return cached;
|
|
20
|
-
}
|
|
21
9
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
10
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
11
|
for (let key of __getOwnPropNames(mod))
|
|
24
12
|
if (!__hasOwnProp.call(to, key))
|
|
25
13
|
__defProp(to, key, {
|
|
26
|
-
get:
|
|
14
|
+
get: () => mod[key],
|
|
27
15
|
enumerable: true
|
|
28
16
|
});
|
|
29
|
-
if (canCache)
|
|
30
|
-
cache.set(mod, to);
|
|
31
17
|
return to;
|
|
32
18
|
};
|
|
19
|
+
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
33
20
|
var __toCommonJS = (from) => {
|
|
34
|
-
var entry =
|
|
21
|
+
var entry = __moduleCache.get(from), desc;
|
|
35
22
|
if (entry)
|
|
36
23
|
return entry;
|
|
37
24
|
entry = __defProp({}, "__esModule", { value: true });
|
|
38
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
44
|
-
});
|
|
45
|
-
}
|
|
25
|
+
if (from && typeof from === "object" || typeof from === "function")
|
|
26
|
+
__getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
|
|
27
|
+
get: () => from[key],
|
|
28
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
+
}));
|
|
46
30
|
__moduleCache.set(from, entry);
|
|
47
31
|
return entry;
|
|
48
32
|
};
|
|
49
|
-
var __moduleCache;
|
|
50
33
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
51
|
-
var __returnValue = (v) => v;
|
|
52
|
-
function __exportSetter(name, newValue) {
|
|
53
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
54
|
-
}
|
|
55
34
|
var __export = (target, all) => {
|
|
56
35
|
for (var name in all)
|
|
57
36
|
__defProp(target, name, {
|
|
58
37
|
get: all[name],
|
|
59
38
|
enumerable: true,
|
|
60
39
|
configurable: true,
|
|
61
|
-
set:
|
|
40
|
+
set: (newValue) => all[name] = () => newValue
|
|
62
41
|
});
|
|
63
42
|
};
|
|
64
43
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -82,6 +61,7 @@ var init_types = __esm(() => {
|
|
|
82
61
|
UseCase2["SCRIPT_INJECT"] = "script_inject";
|
|
83
62
|
UseCase2["COVERAGE"] = "coverage";
|
|
84
63
|
UseCase2["RECORD_REPLAY"] = "record_replay";
|
|
64
|
+
UseCase2["TERMINAL_TEST"] = "terminal_test";
|
|
85
65
|
})(UseCase ||= {});
|
|
86
66
|
BrowserError = class BrowserError extends Error {
|
|
87
67
|
code;
|
|
@@ -158,11 +138,11 @@ import { homedir as homedir4 } from "os";
|
|
|
158
138
|
import { join as join4 } from "path";
|
|
159
139
|
import { join as join6, dirname } from "path";
|
|
160
140
|
import { homedir as homedir5, platform } from "os";
|
|
161
|
-
function
|
|
141
|
+
function __accessProp(key) {
|
|
162
142
|
return this[key];
|
|
163
143
|
}
|
|
164
|
-
function
|
|
165
|
-
this[name] =
|
|
144
|
+
function __exportSetter(name, newValue) {
|
|
145
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
166
146
|
}
|
|
167
147
|
function translateSql(sql, dialect) {
|
|
168
148
|
if (dialect === "sqlite")
|
|
@@ -1192,10 +1172,10 @@ class SyncProgressTracker {
|
|
|
1192
1172
|
}
|
|
1193
1173
|
}
|
|
1194
1174
|
}
|
|
1195
|
-
var __create2, __getProtoOf2, __defProp2, __getOwnPropNames2, __hasOwnProp2,
|
|
1175
|
+
var __create2, __getProtoOf2, __defProp2, __getOwnPropNames2, __hasOwnProp2, __toESMCache_node, __toESMCache_esm, __toESM2 = (mod, isNodeMode, target) => {
|
|
1196
1176
|
var canCache = mod != null && typeof mod === "object";
|
|
1197
1177
|
if (canCache) {
|
|
1198
|
-
var cache = isNodeMode ?
|
|
1178
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
1199
1179
|
var cached = cache.get(mod);
|
|
1200
1180
|
if (cached)
|
|
1201
1181
|
return cached;
|
|
@@ -1205,19 +1185,19 @@ var __create2, __getProtoOf2, __defProp2, __getOwnPropNames2, __hasOwnProp2, __t
|
|
|
1205
1185
|
for (let key of __getOwnPropNames2(mod))
|
|
1206
1186
|
if (!__hasOwnProp2.call(to, key))
|
|
1207
1187
|
__defProp2(to, key, {
|
|
1208
|
-
get:
|
|
1188
|
+
get: __accessProp.bind(mod, key),
|
|
1209
1189
|
enumerable: true
|
|
1210
1190
|
});
|
|
1211
1191
|
if (canCache)
|
|
1212
1192
|
cache.set(mod, to);
|
|
1213
1193
|
return to;
|
|
1214
|
-
}, __commonJS2 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports),
|
|
1194
|
+
}, __commonJS2 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports), __returnValue = (v) => v, __export2 = (target, all) => {
|
|
1215
1195
|
for (var name in all)
|
|
1216
1196
|
__defProp2(target, name, {
|
|
1217
1197
|
get: all[name],
|
|
1218
1198
|
enumerable: true,
|
|
1219
1199
|
configurable: true,
|
|
1220
|
-
set:
|
|
1200
|
+
set: __exportSetter.bind(all, name)
|
|
1221
1201
|
});
|
|
1222
1202
|
}, __esm2 = (fn, res) => () => (fn && (res = fn(fn = 0)), res), __require2, require_postgres_array, require_arrayParser, require_postgres_date, require_mutable, require_postgres_interval, require_postgres_bytea, require_textParsers, require_pg_int8, require_binaryParsers, require_builtins, require_pg_types, require_defaults, require_utils, require_utils_legacy, require_utils_webcrypto, require_utils2, require_cert_signatures, require_sasl, require_type_overrides, require_pg_connection_string, require_connection_parameters, require_result, require_query, require_messages, require_buffer_writer, require_serializer, require_buffer_reader, require_parser, require_dist, require_empty, require_stream, require_connection, require_split2, require_helper, require_lib, require_client, require_pg_pool, require_query2, require_client2, require_lib2, import_lib, Client, Pool, Connection, types, Query, DatabaseError, escapeIdentifier, escapeLiteral, Result, TypeOverrides, defaults, esm_default, init_esm, init_adapter, util, objectUtil, ZodParsedType, getParsedType = (data) => {
|
|
1223
1203
|
const t = typeof data;
|
|
@@ -18377,6 +18357,86 @@ class BunWebViewSession {
|
|
|
18377
18357
|
}
|
|
18378
18358
|
}
|
|
18379
18359
|
|
|
18360
|
+
// src/engines/tui.ts
|
|
18361
|
+
init_types();
|
|
18362
|
+
import { execSync as execSync2, spawn as spawn2 } from "child_process";
|
|
18363
|
+
var DEFAULT_TTYD_PORT_START = 7780;
|
|
18364
|
+
var nextPort = DEFAULT_TTYD_PORT_START;
|
|
18365
|
+
function isTuiAvailable() {
|
|
18366
|
+
try {
|
|
18367
|
+
execSync2("which ttyd", { stdio: "ignore" });
|
|
18368
|
+
return true;
|
|
18369
|
+
} catch {
|
|
18370
|
+
return false;
|
|
18371
|
+
}
|
|
18372
|
+
}
|
|
18373
|
+
async function findAvailablePort(startPort) {
|
|
18374
|
+
let port = startPort;
|
|
18375
|
+
for (let i = 0;i < 100; i++) {
|
|
18376
|
+
try {
|
|
18377
|
+
const resp = await fetch(`http://localhost:${port}`);
|
|
18378
|
+
port++;
|
|
18379
|
+
} catch {
|
|
18380
|
+
return port;
|
|
18381
|
+
}
|
|
18382
|
+
}
|
|
18383
|
+
throw new BrowserError("No available port found for ttyd", "TUI_PORT_EXHAUSTED");
|
|
18384
|
+
}
|
|
18385
|
+
async function waitForTtyd(port, timeoutMs = 1e4) {
|
|
18386
|
+
const start = Date.now();
|
|
18387
|
+
while (Date.now() - start < timeoutMs) {
|
|
18388
|
+
try {
|
|
18389
|
+
const resp = await fetch(`http://localhost:${port}`);
|
|
18390
|
+
if (resp.ok || resp.status === 200)
|
|
18391
|
+
return;
|
|
18392
|
+
} catch {}
|
|
18393
|
+
await new Promise((r) => setTimeout(r, 150));
|
|
18394
|
+
}
|
|
18395
|
+
throw new BrowserError(`ttyd did not start within ${timeoutMs}ms`, "TUI_TIMEOUT");
|
|
18396
|
+
}
|
|
18397
|
+
async function launchTui(command, options = {}) {
|
|
18398
|
+
if (!isTuiAvailable()) {
|
|
18399
|
+
throw new BrowserError("ttyd not found \u2014 install with: brew install ttyd", "TUI_NOT_AVAILABLE");
|
|
18400
|
+
}
|
|
18401
|
+
const port = await findAvailablePort(nextPort);
|
|
18402
|
+
nextPort = port + 1;
|
|
18403
|
+
const ttydProcess = spawn2("ttyd", ["--writable", "--port", String(port), "/bin/sh", "-c", command], {
|
|
18404
|
+
stdio: "ignore",
|
|
18405
|
+
detached: false
|
|
18406
|
+
});
|
|
18407
|
+
ttydProcess.on("error", (err) => {
|
|
18408
|
+
console.error(`[tui] ttyd process error: ${err.message}`);
|
|
18409
|
+
});
|
|
18410
|
+
try {
|
|
18411
|
+
await waitForTtyd(port);
|
|
18412
|
+
const viewport = options.viewport ?? { width: 1280, height: 720 };
|
|
18413
|
+
const browser = await launchPlaywright({
|
|
18414
|
+
headless: options.headless ?? true,
|
|
18415
|
+
viewport
|
|
18416
|
+
});
|
|
18417
|
+
const page = await getPage(browser, { viewport });
|
|
18418
|
+
await page.goto(`http://localhost:${port}`, {
|
|
18419
|
+
waitUntil: "domcontentloaded"
|
|
18420
|
+
});
|
|
18421
|
+
await page.waitForSelector(".xterm-screen", { timeout: 1e4 });
|
|
18422
|
+
return { ttydProcess, port, browser, page };
|
|
18423
|
+
} catch (err) {
|
|
18424
|
+
ttydProcess.kill();
|
|
18425
|
+
throw err;
|
|
18426
|
+
}
|
|
18427
|
+
}
|
|
18428
|
+
async function closeTui(session) {
|
|
18429
|
+
try {
|
|
18430
|
+
await session.page.close();
|
|
18431
|
+
} catch {}
|
|
18432
|
+
try {
|
|
18433
|
+
await session.browser.close();
|
|
18434
|
+
} catch {}
|
|
18435
|
+
try {
|
|
18436
|
+
session.ttydProcess.kill("SIGTERM");
|
|
18437
|
+
} catch {}
|
|
18438
|
+
}
|
|
18439
|
+
|
|
18380
18440
|
// src/engines/selector.ts
|
|
18381
18441
|
var ENGINE_MAP = {
|
|
18382
18442
|
["scrape" /* SCRAPE */]: "bun",
|
|
@@ -18388,6 +18448,7 @@ var ENGINE_MAP = {
|
|
|
18388
18448
|
["auth_flow" /* AUTH_FLOW */]: "playwright",
|
|
18389
18449
|
["multi_tab" /* MULTI_TAB */]: "playwright",
|
|
18390
18450
|
["record_replay" /* RECORD_REPLAY */]: "playwright",
|
|
18451
|
+
["terminal_test" /* TERMINAL_TEST */]: "tui",
|
|
18391
18452
|
["network_monitor" /* NETWORK_MONITOR */]: "cdp",
|
|
18392
18453
|
["har_capture" /* HAR_CAPTURE */]: "cdp",
|
|
18393
18454
|
["perf_profile" /* PERF_PROFILE */]: "cdp",
|
|
@@ -18422,6 +18483,8 @@ function isEngineAvailable(engine) {
|
|
|
18422
18483
|
return true;
|
|
18423
18484
|
if (engine === "lightpanda")
|
|
18424
18485
|
return isLightpandaAvailable();
|
|
18486
|
+
if (engine === "tui")
|
|
18487
|
+
return isTuiAvailable();
|
|
18425
18488
|
return false;
|
|
18426
18489
|
}
|
|
18427
18490
|
function inferUseCase(label) {
|
|
@@ -18447,7 +18510,9 @@ function inferUseCase(label) {
|
|
|
18447
18510
|
inject: "script_inject" /* SCRIPT_INJECT */,
|
|
18448
18511
|
coverage: "coverage" /* COVERAGE */,
|
|
18449
18512
|
record: "record_replay" /* RECORD_REPLAY */,
|
|
18450
|
-
replay: "record_replay" /* RECORD_REPLAY
|
|
18513
|
+
replay: "record_replay" /* RECORD_REPLAY */,
|
|
18514
|
+
terminal: "terminal_test" /* TERMINAL_TEST */,
|
|
18515
|
+
tui: "terminal_test" /* TERMINAL_TEST */
|
|
18451
18516
|
};
|
|
18452
18517
|
return map[label.toLowerCase()] ?? "spa_navigate" /* SPA_NAVIGATE */;
|
|
18453
18518
|
}
|
|
@@ -18747,7 +18812,7 @@ async function createSession2(opts = {}) {
|
|
|
18747
18812
|
try {
|
|
18748
18813
|
cleanups2.push(setupDialogHandler(page2, session2.id));
|
|
18749
18814
|
} catch {}
|
|
18750
|
-
handles.set(session2.id, { browser: cdpBrowser, bunView: null, page: page2, engine: "cdp", cleanups: cleanups2, tokenBudget: { total: 0, used: 0 }, lastActivity: Date.now(), autoGallery: opts.autoGallery ?? false });
|
|
18815
|
+
handles.set(session2.id, { browser: cdpBrowser, bunView: null, tuiSession: null, page: page2, engine: "cdp", cleanups: cleanups2, tokenBudget: { total: 0, used: 0 }, lastActivity: Date.now(), autoGallery: opts.autoGallery ?? false });
|
|
18751
18816
|
return { session: session2, page: page2 };
|
|
18752
18817
|
}
|
|
18753
18818
|
const engine = opts.engine === "auto" || !opts.engine ? selectEngine(opts.useCase ?? "spa_navigate" /* SPA_NAVIGATE */, opts.engine) : opts.engine;
|
|
@@ -18773,6 +18838,38 @@ async function createSession2(opts = {}) {
|
|
|
18773
18838
|
browser = await connectLightpanda();
|
|
18774
18839
|
const context = await browser.newContext({ viewport: opts.viewport ?? { width: 1280, height: 720 } });
|
|
18775
18840
|
page = await context.newPage();
|
|
18841
|
+
} else if (resolvedEngine === "tui") {
|
|
18842
|
+
const command = opts.startUrl ?? "bash";
|
|
18843
|
+
const tuiSess = await launchTui(command, {
|
|
18844
|
+
headless: opts.headless ?? true,
|
|
18845
|
+
viewport: opts.viewport
|
|
18846
|
+
});
|
|
18847
|
+
browser = tuiSess.browser;
|
|
18848
|
+
page = tuiSess.page;
|
|
18849
|
+
const session2 = createSession({
|
|
18850
|
+
engine: "tui",
|
|
18851
|
+
projectId: opts.projectId,
|
|
18852
|
+
agentId: opts.agentId,
|
|
18853
|
+
startUrl: opts.startUrl,
|
|
18854
|
+
name: opts.name ?? "tui"
|
|
18855
|
+
});
|
|
18856
|
+
const cleanups2 = [];
|
|
18857
|
+
cleanups2.push(() => closeTui(tuiSess));
|
|
18858
|
+
if (opts.captureNetwork !== false) {
|
|
18859
|
+
try {
|
|
18860
|
+
cleanups2.push(enableNetworkLogging(page, session2.id));
|
|
18861
|
+
} catch {}
|
|
18862
|
+
}
|
|
18863
|
+
if (opts.captureConsole !== false) {
|
|
18864
|
+
try {
|
|
18865
|
+
cleanups2.push(enableConsoleCapture(page, session2.id));
|
|
18866
|
+
} catch {}
|
|
18867
|
+
}
|
|
18868
|
+
try {
|
|
18869
|
+
cleanups2.push(setupDialogHandler(page, session2.id));
|
|
18870
|
+
} catch {}
|
|
18871
|
+
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 });
|
|
18872
|
+
return { session: session2, page };
|
|
18776
18873
|
} else {
|
|
18777
18874
|
browser = await pool.acquire(opts.headless ?? true);
|
|
18778
18875
|
if (opts.storageState) {
|
|
@@ -18843,7 +18940,7 @@ async function createSession2(opts = {}) {
|
|
|
18843
18940
|
} catch {}
|
|
18844
18941
|
}
|
|
18845
18942
|
}
|
|
18846
|
-
handles.set(session.id, { browser, bunView, page, engine: bunView ? "bun" : resolvedEngine, cleanups, tokenBudget: { total: 0, used: 0 }, lastActivity: Date.now(), autoGallery: opts.autoGallery ?? false });
|
|
18943
|
+
handles.set(session.id, { browser, bunView, tuiSession: null, page, engine: bunView ? "bun" : resolvedEngine, cleanups, tokenBudget: { total: 0, used: 0 }, lastActivity: Date.now(), autoGallery: opts.autoGallery ?? false });
|
|
18847
18944
|
if (opts.startUrl) {
|
|
18848
18945
|
try {
|
|
18849
18946
|
if (bunView) {
|
|
@@ -18913,7 +19010,7 @@ async function closeSession2(sessionId) {
|
|
|
18913
19010
|
try {
|
|
18914
19011
|
await handle.bunView.close();
|
|
18915
19012
|
} catch {}
|
|
18916
|
-
} else {
|
|
19013
|
+
} else if (handle.tuiSession) {} else {
|
|
18917
19014
|
try {
|
|
18918
19015
|
await handle.page.context().close();
|
|
18919
19016
|
} catch {}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Login scripts — multi-step workflows that combine browser actions + connector calls.
|
|
3
|
+
* Supports variable interpolation, regex extraction, conditions, and state saving.
|
|
4
|
+
*
|
|
5
|
+
* Usage: save a script once, replay with `browser login-script <name>`
|
|
6
|
+
*/
|
|
7
|
+
import type { Page } from "playwright";
|
|
8
|
+
export type StepType = "browser" | "connector" | "extract" | "wait" | "condition" | "save_state" | "ai";
|
|
9
|
+
export interface ScriptStep {
|
|
10
|
+
type: StepType;
|
|
11
|
+
description?: string;
|
|
12
|
+
action?: "navigate" | "type" | "click" | "click_text" | "wait_for_navigation" | "wait_for_text" | "snapshot";
|
|
13
|
+
url?: string;
|
|
14
|
+
selector?: string;
|
|
15
|
+
text?: string;
|
|
16
|
+
value?: string;
|
|
17
|
+
timeout?: number;
|
|
18
|
+
connector?: string;
|
|
19
|
+
operation?: string;
|
|
20
|
+
args?: string[];
|
|
21
|
+
format?: string;
|
|
22
|
+
pattern?: string;
|
|
23
|
+
json_path?: string;
|
|
24
|
+
save_as?: string;
|
|
25
|
+
prompt?: string;
|
|
26
|
+
model?: string;
|
|
27
|
+
response_format?: "text" | "json";
|
|
28
|
+
seconds?: number;
|
|
29
|
+
check?: string;
|
|
30
|
+
equals?: string;
|
|
31
|
+
contains?: string;
|
|
32
|
+
skip_to?: number;
|
|
33
|
+
name?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface LoginScript {
|
|
36
|
+
name: string;
|
|
37
|
+
domain: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
variables: Record<string, string>;
|
|
40
|
+
steps: ScriptStep[];
|
|
41
|
+
created_at: string;
|
|
42
|
+
updated_at: string;
|
|
43
|
+
}
|
|
44
|
+
export interface ScriptRunResult {
|
|
45
|
+
success: boolean;
|
|
46
|
+
steps_executed: number;
|
|
47
|
+
steps_failed: number;
|
|
48
|
+
variables: Record<string, string>;
|
|
49
|
+
errors: string[];
|
|
50
|
+
duration_ms: number;
|
|
51
|
+
}
|
|
52
|
+
export interface ScriptJob {
|
|
53
|
+
id: string;
|
|
54
|
+
script_name: string;
|
|
55
|
+
status: "running" | "completed" | "failed";
|
|
56
|
+
current_step: number;
|
|
57
|
+
total_steps: number;
|
|
58
|
+
current_step_description: string;
|
|
59
|
+
steps_log: Array<{
|
|
60
|
+
step: number;
|
|
61
|
+
type: string;
|
|
62
|
+
description: string;
|
|
63
|
+
status: "ok" | "failed" | "running";
|
|
64
|
+
duration_ms?: number;
|
|
65
|
+
error?: string;
|
|
66
|
+
}>;
|
|
67
|
+
result?: ScriptRunResult;
|
|
68
|
+
started_at: string;
|
|
69
|
+
}
|
|
70
|
+
export declare function getJob(jobId: string): ScriptJob | null;
|
|
71
|
+
export declare function listJobs(): ScriptJob[];
|
|
72
|
+
export declare function saveScript(script: LoginScript): string;
|
|
73
|
+
export declare function loadScript(name: string): LoginScript | null;
|
|
74
|
+
export declare function listScripts(): Array<{
|
|
75
|
+
name: string;
|
|
76
|
+
domain: string;
|
|
77
|
+
description?: string;
|
|
78
|
+
steps: number;
|
|
79
|
+
}>;
|
|
80
|
+
export declare function deleteScript(name: string): boolean;
|
|
81
|
+
export declare function runScript(script: LoginScript, page: Page, overrides?: Record<string, string>, jobId?: string): Promise<ScriptRunResult>;
|
|
82
|
+
/**
|
|
83
|
+
* Run a script asynchronously — returns immediately with a job ID.
|
|
84
|
+
* Poll with getJob(jobId) for progress.
|
|
85
|
+
*/
|
|
86
|
+
export declare function runScriptAsync(script: LoginScript, page: Page, overrides?: Record<string, string>): string;
|
|
87
|
+
export declare function createScriptFromJSON(jsonStr: string): LoginScript;
|
|
88
|
+
export declare function createScriptFromFile(filePath: string): LoginScript;
|
|
89
|
+
//# sourceMappingURL=login-scripts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login-scripts.d.ts","sourceRoot":"","sources":["../../src/lib/login-scripts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIvC,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,YAAY,GAAG,IAAI,CAAC;AAExG,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,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;CAAE,CAAC,CAY1G;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMlD;AAgBD,wBAAsB,SAAS,CAC7B,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,IAAI,EACV,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,EACtC,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,eAAe,CAAC,CA8G1B;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,IAAI,EACV,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACrC,MAAM,CAqBR;AAwOD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAgBjE;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAGlE"}
|
|
@@ -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,EAAW,MAAM,mBAAmB,CAAC;AAG3D,OAAO,EAA0F,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE/I,OAAO,EAAE,iBAAiB,EAAyB,MAAM,2BAA2B,CAAC;
|
|
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,EAAW,MAAM,m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