cbrowser 2.2.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.js ADDED
@@ -0,0 +1,342 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /**
4
+ * CBrowser CLI
5
+ *
6
+ * AI-powered browser automation from the command line.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ const browser_js_1 = require("./browser.js");
10
+ const personas_js_1 = require("./personas.js");
11
+ function showHelp() {
12
+ console.log(`
13
+ ╔══════════════════════════════════════════════════════════════════════════════╗
14
+ ║ CBrowser CLI v2.2.0 ║
15
+ ║ AI-powered browser automation with safety ║
16
+ ╚══════════════════════════════════════════════════════════════════════════════╝
17
+
18
+ NAVIGATION
19
+ navigate <url> Navigate and take screenshot
20
+ screenshot [path] Take screenshot of current page
21
+
22
+ INTERACTION
23
+ click <selector> Click element (tries text, label, role, CSS)
24
+ fill <selector> <value> Fill input field
25
+
26
+ EXTRACTION
27
+ extract <what> Extract data (links, images, headings, forms)
28
+
29
+ AUTONOMOUS JOURNEYS
30
+ journey <persona> Run autonomous exploration
31
+ --start <url> Starting URL (required)
32
+ --goal <goal> What to accomplish
33
+
34
+ PERSONAS
35
+ persona list List available personas
36
+
37
+ SESSION MANAGEMENT
38
+ session save <name> Save browser session (cookies, storage, URL)
39
+ --url <url> Navigate to URL before saving
40
+ session load <name> Load a saved session
41
+ session list List all saved sessions
42
+ session delete <name> Delete a saved session
43
+
44
+ STORAGE & CLEANUP
45
+ storage Show storage usage statistics
46
+ cleanup Clean up old files
47
+ --dry-run Preview what would be deleted
48
+ --older-than <days> Delete files older than N days (default: 7)
49
+ --keep-screenshots <n> Keep at least N screenshots (default: 10)
50
+ --keep-journeys <n> Keep at least N journeys (default: 5)
51
+
52
+ OPTIONS
53
+ --force Bypass red zone safety checks
54
+ --headless Run browser in headless mode
55
+
56
+ ENVIRONMENT VARIABLES
57
+ CBROWSER_DATA_DIR Custom data directory (default: ~/.cbrowser)
58
+ CBROWSER_HEADLESS Run headless by default (true/false)
59
+ CBROWSER_TIMEOUT Default timeout in ms (default: 30000)
60
+
61
+ EXAMPLES
62
+ npx cbrowser navigate "https://example.com"
63
+ npx cbrowser click "Sign in"
64
+ npx cbrowser fill "email" "user@example.com"
65
+ npx cbrowser journey first-timer --start "https://example.com" --goal "Find products"
66
+ npx cbrowser session save "logged-in" --url "https://myapp.com"
67
+ npx cbrowser cleanup --dry-run
68
+ `);
69
+ }
70
+ function parseArgs(args) {
71
+ const command = args[0] || "help";
72
+ const restArgs = [];
73
+ const options = {};
74
+ for (let i = 1; i < args.length; i++) {
75
+ if (args[i].startsWith("--")) {
76
+ const key = args[i].slice(2);
77
+ const next = args[i + 1];
78
+ if (next && !next.startsWith("--")) {
79
+ options[key] = next;
80
+ i++;
81
+ }
82
+ else {
83
+ options[key] = true;
84
+ }
85
+ }
86
+ else {
87
+ restArgs.push(args[i]);
88
+ }
89
+ }
90
+ return { command, args: restArgs, options };
91
+ }
92
+ function formatBytes(bytes) {
93
+ if (bytes < 1024)
94
+ return `${bytes} B`;
95
+ if (bytes < 1024 * 1024)
96
+ return `${(bytes / 1024).toFixed(1)} KB`;
97
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
98
+ }
99
+ async function main() {
100
+ const { command, args, options } = parseArgs(process.argv.slice(2));
101
+ if (command === "help" || options.help) {
102
+ showHelp();
103
+ process.exit(0);
104
+ }
105
+ const browser = new browser_js_1.CBrowser({
106
+ headless: options.headless === true || options.headless === "true",
107
+ });
108
+ try {
109
+ switch (command) {
110
+ case "navigate": {
111
+ const url = args[0];
112
+ if (!url) {
113
+ console.error("Error: URL required");
114
+ process.exit(1);
115
+ }
116
+ const result = await browser.navigate(url);
117
+ console.log(`✓ Navigated to: ${result.url}`);
118
+ console.log(` Title: ${result.title}`);
119
+ console.log(` Load time: ${result.loadTime}ms`);
120
+ console.log(` Screenshot: ${result.screenshot}`);
121
+ if (result.errors.length > 0) {
122
+ console.log(` Errors: ${result.errors.length}`);
123
+ }
124
+ break;
125
+ }
126
+ case "click": {
127
+ const selector = args[0];
128
+ if (!selector) {
129
+ console.error("Error: Selector required");
130
+ process.exit(1);
131
+ }
132
+ // Navigate first if URL provided
133
+ if (options.url) {
134
+ await browser.navigate(options.url);
135
+ }
136
+ const result = await browser.click(selector, { force: options.force === true });
137
+ if (result.success) {
138
+ console.log(`✓ ${result.message}`);
139
+ }
140
+ else {
141
+ console.error(`✗ ${result.message}`);
142
+ process.exit(1);
143
+ }
144
+ break;
145
+ }
146
+ case "fill": {
147
+ const selector = args[0];
148
+ const value = args[1];
149
+ if (!selector || !value) {
150
+ console.error("Error: Selector and value required");
151
+ process.exit(1);
152
+ }
153
+ if (options.url) {
154
+ await browser.navigate(options.url);
155
+ }
156
+ const result = await browser.fill(selector, value);
157
+ if (result.success) {
158
+ console.log(`✓ ${result.message}`);
159
+ }
160
+ else {
161
+ console.error(`✗ ${result.message}`);
162
+ process.exit(1);
163
+ }
164
+ break;
165
+ }
166
+ case "extract": {
167
+ const what = args[0] || "text";
168
+ if (options.url) {
169
+ await browser.navigate(options.url);
170
+ }
171
+ const result = await browser.extract(what);
172
+ console.log(JSON.stringify(result.data, null, 2));
173
+ break;
174
+ }
175
+ case "screenshot": {
176
+ const path = args[0];
177
+ if (options.url) {
178
+ await browser.navigate(options.url);
179
+ }
180
+ const file = await browser.screenshot(path);
181
+ console.log(`✓ Screenshot saved: ${file}`);
182
+ break;
183
+ }
184
+ case "journey": {
185
+ const persona = args[0] || "first-timer";
186
+ const startUrl = options.start;
187
+ const goal = options.goal || "Explore the site";
188
+ if (!startUrl) {
189
+ console.error("Error: --start URL required");
190
+ process.exit(1);
191
+ }
192
+ console.log(`🚀 Starting journey as "${persona}"...`);
193
+ console.log(` Goal: ${goal}`);
194
+ console.log("");
195
+ const result = await browser.journey({ persona, startUrl, goal });
196
+ console.log("");
197
+ console.log(`📊 Journey Results`);
198
+ console.log(` Success: ${result.success ? "✓" : "✗"}`);
199
+ console.log(` Steps: ${result.steps.length}`);
200
+ console.log(` Time: ${result.totalTime}ms`);
201
+ console.log(` Friction points: ${result.frictionPoints.length}`);
202
+ if (result.frictionPoints.length > 0) {
203
+ console.log("");
204
+ console.log("⚠️ Friction Points:");
205
+ for (const point of result.frictionPoints) {
206
+ console.log(` - ${point}`);
207
+ }
208
+ }
209
+ break;
210
+ }
211
+ case "persona": {
212
+ const subcommand = args[0];
213
+ if (subcommand === "list") {
214
+ console.log("\n📋 Available Personas:\n");
215
+ for (const [name, persona] of Object.entries(personas_js_1.BUILTIN_PERSONAS)) {
216
+ console.log(` ${name}`);
217
+ console.log(` ${persona.description}`);
218
+ console.log(` Tech level: ${persona.demographics.tech_level}`);
219
+ console.log("");
220
+ }
221
+ }
222
+ else {
223
+ console.error("Usage: cbrowser persona list");
224
+ }
225
+ break;
226
+ }
227
+ case "session": {
228
+ const subcommand = args[0];
229
+ const name = args[1];
230
+ switch (subcommand) {
231
+ case "save": {
232
+ if (!name) {
233
+ console.error("Error: Session name required");
234
+ process.exit(1);
235
+ }
236
+ if (options.url) {
237
+ await browser.navigate(options.url);
238
+ }
239
+ await browser.saveSession(name);
240
+ console.log(`✓ Session saved: ${name}`);
241
+ break;
242
+ }
243
+ case "load": {
244
+ if (!name) {
245
+ console.error("Error: Session name required");
246
+ process.exit(1);
247
+ }
248
+ const loaded = await browser.loadSession(name);
249
+ if (loaded) {
250
+ console.log(`✓ Session loaded: ${name}`);
251
+ }
252
+ else {
253
+ console.error(`✗ Session not found: ${name}`);
254
+ process.exit(1);
255
+ }
256
+ break;
257
+ }
258
+ case "list": {
259
+ const sessions = browser.listSessions();
260
+ if (sessions.length === 0) {
261
+ console.log("No saved sessions");
262
+ }
263
+ else {
264
+ console.log("\n📋 Saved Sessions:\n");
265
+ for (const session of sessions) {
266
+ console.log(` - ${session}`);
267
+ }
268
+ }
269
+ break;
270
+ }
271
+ case "delete": {
272
+ if (!name) {
273
+ console.error("Error: Session name required");
274
+ process.exit(1);
275
+ }
276
+ const deleted = browser.deleteSession(name);
277
+ if (deleted) {
278
+ console.log(`✓ Session deleted: ${name}`);
279
+ }
280
+ else {
281
+ console.error(`✗ Session not found: ${name}`);
282
+ }
283
+ break;
284
+ }
285
+ default:
286
+ console.error("Usage: cbrowser session [save|load|list|delete] <name>");
287
+ }
288
+ break;
289
+ }
290
+ case "storage":
291
+ case "stats": {
292
+ const stats = browser.getStorageStats();
293
+ console.log("\n📊 Storage Usage:\n");
294
+ let totalSize = 0;
295
+ let totalCount = 0;
296
+ for (const [category, { count, size }] of Object.entries(stats)) {
297
+ console.log(` ${category}: ${count} files (${formatBytes(size)})`);
298
+ totalSize += size;
299
+ totalCount += count;
300
+ }
301
+ console.log("");
302
+ console.log(` TOTAL: ${totalCount} files (${formatBytes(totalSize)})`);
303
+ break;
304
+ }
305
+ case "cleanup": {
306
+ const cleanupOptions = {
307
+ dryRun: options["dry-run"] === true,
308
+ olderThan: options["older-than"] ? parseInt(options["older-than"], 10) : 7,
309
+ keepScreenshots: options["keep-screenshots"] ? parseInt(options["keep-screenshots"], 10) : 10,
310
+ keepJourneys: options["keep-journeys"] ? parseInt(options["keep-journeys"], 10) : 5,
311
+ keepSessions: options["keep-sessions"] ? parseInt(options["keep-sessions"], 10) : 3,
312
+ };
313
+ const result = browser.cleanup(cleanupOptions);
314
+ if (cleanupOptions.dryRun) {
315
+ console.log("\n🔍 Cleanup Preview (dry run):\n");
316
+ }
317
+ else {
318
+ console.log("\n🧹 Cleanup Complete:\n");
319
+ }
320
+ console.log(` Screenshots: ${result.details.screenshots.deleted} files (${formatBytes(result.details.screenshots.freed)})`);
321
+ console.log(` Journeys: ${result.details.journeys.deleted} files (${formatBytes(result.details.journeys.freed)})`);
322
+ console.log(` Sessions: ${result.details.sessions.deleted} files (${formatBytes(result.details.sessions.freed)})`);
323
+ console.log(` Audit: ${result.details.audit.deleted} files (${formatBytes(result.details.audit.freed)})`);
324
+ console.log("");
325
+ console.log(` TOTAL: ${result.deleted} files | ${formatBytes(result.freedBytes)} ${cleanupOptions.dryRun ? "would be " : ""}freed`);
326
+ break;
327
+ }
328
+ default:
329
+ console.error(`Unknown command: ${command}`);
330
+ console.error("Run 'cbrowser help' for usage");
331
+ process.exit(1);
332
+ }
333
+ }
334
+ finally {
335
+ await browser.close();
336
+ }
337
+ }
338
+ main().catch((error) => {
339
+ console.error("Error:", error.message);
340
+ process.exit(1);
341
+ });
342
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AACA;;;;GAIG;;AAEH,6CAAwC;AACxC,+CAAiD;AAEjD,SAAS,QAAQ;IACf,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDb,CAAC,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC;IAClC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,OAAO,GAAqC,EAAE,CAAC;IAErD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7B,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAEzB,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;gBACpB,CAAC,EAAE,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gBAC3G,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAChB,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,OAAO,YAAY,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;gBACrI,MAAM;YACR,CAAC;YAED;gBACE,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;gBAC7C,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;gBAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;YAAS,CAAC;QACT,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * CBrowser Configuration
3
+ *
4
+ * All paths are configurable via environment variables or constructor options.
5
+ * Default: ~/.cbrowser/
6
+ */
7
+ export interface CBrowserConfig {
8
+ /** Base directory for all CBrowser data. Default: ~/.cbrowser/ */
9
+ dataDir: string;
10
+ /** Run browser in headless mode. Default: false */
11
+ headless: boolean;
12
+ /** Browser viewport width. Default: 1280 */
13
+ viewportWidth: number;
14
+ /** Browser viewport height. Default: 800 */
15
+ viewportHeight: number;
16
+ /** Default timeout for operations in ms. Default: 30000 */
17
+ timeout: number;
18
+ /** Enable verbose logging. Default: false */
19
+ verbose: boolean;
20
+ }
21
+ /**
22
+ * Get the data directory from environment or default.
23
+ */
24
+ export declare function getDataDir(): string;
25
+ /**
26
+ * Get default configuration, merging with environment variables.
27
+ */
28
+ export declare function getDefaultConfig(): CBrowserConfig;
29
+ /**
30
+ * Directory paths derived from config.
31
+ */
32
+ export interface CBrowserPaths {
33
+ dataDir: string;
34
+ sessionsDir: string;
35
+ screenshotsDir: string;
36
+ personasDir: string;
37
+ scenariosDir: string;
38
+ helpersDir: string;
39
+ auditDir: string;
40
+ credentialsFile: string;
41
+ }
42
+ /**
43
+ * Get all paths based on the data directory.
44
+ */
45
+ export declare function getPaths(dataDir?: string): CBrowserPaths;
46
+ /**
47
+ * Ensure all required directories exist.
48
+ */
49
+ export declare function ensureDirectories(paths?: CBrowserPaths): CBrowserPaths;
50
+ /**
51
+ * Merge user config with defaults.
52
+ */
53
+ export declare function mergeConfig(userConfig: Partial<CBrowserConfig>): CBrowserConfig;
54
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,cAAc;IAC7B,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,QAAQ,EAAE,OAAO,CAAC;IAClB,4CAA4C;IAC5C,aAAa,EAAE,MAAM,CAAC;IACtB,4CAA4C;IAC5C,cAAc,EAAE,MAAM,CAAC;IACvB,2DAA2D;IAC3D,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,cAAc,CAWjD;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,aAAa,CAaxD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,aAAa,CAoBtE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,cAAc,CAG/E"}
package/dist/config.js ADDED
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ /**
3
+ * CBrowser Configuration
4
+ *
5
+ * All paths are configurable via environment variables or constructor options.
6
+ * Default: ~/.cbrowser/
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.getDataDir = getDataDir;
10
+ exports.getDefaultConfig = getDefaultConfig;
11
+ exports.getPaths = getPaths;
12
+ exports.ensureDirectories = ensureDirectories;
13
+ exports.mergeConfig = mergeConfig;
14
+ const fs_1 = require("fs");
15
+ const os_1 = require("os");
16
+ const path_1 = require("path");
17
+ /**
18
+ * Get the data directory from environment or default.
19
+ */
20
+ function getDataDir() {
21
+ return process.env.CBROWSER_DATA_DIR || (0, path_1.join)((0, os_1.homedir)(), ".cbrowser");
22
+ }
23
+ /**
24
+ * Get default configuration, merging with environment variables.
25
+ */
26
+ function getDefaultConfig() {
27
+ const dataDir = getDataDir();
28
+ return {
29
+ dataDir,
30
+ headless: process.env.CBROWSER_HEADLESS === "true",
31
+ viewportWidth: parseInt(process.env.CBROWSER_VIEWPORT_WIDTH || "1280", 10),
32
+ viewportHeight: parseInt(process.env.CBROWSER_VIEWPORT_HEIGHT || "800", 10),
33
+ timeout: parseInt(process.env.CBROWSER_TIMEOUT || "30000", 10),
34
+ verbose: process.env.CBROWSER_VERBOSE === "true",
35
+ };
36
+ }
37
+ /**
38
+ * Get all paths based on the data directory.
39
+ */
40
+ function getPaths(dataDir) {
41
+ const base = dataDir || getDataDir();
42
+ return {
43
+ dataDir: base,
44
+ sessionsDir: (0, path_1.join)(base, "sessions"),
45
+ screenshotsDir: (0, path_1.join)(base, "screenshots"),
46
+ personasDir: (0, path_1.join)(base, "personas"),
47
+ scenariosDir: (0, path_1.join)(base, "scenarios"),
48
+ helpersDir: (0, path_1.join)(base, "helpers"),
49
+ auditDir: (0, path_1.join)(base, "audit"),
50
+ credentialsFile: (0, path_1.join)(base, "credentials.json"),
51
+ };
52
+ }
53
+ /**
54
+ * Ensure all required directories exist.
55
+ */
56
+ function ensureDirectories(paths) {
57
+ const p = paths || getPaths();
58
+ const dirs = [
59
+ p.dataDir,
60
+ p.sessionsDir,
61
+ p.screenshotsDir,
62
+ p.personasDir,
63
+ p.scenariosDir,
64
+ p.helpersDir,
65
+ p.auditDir,
66
+ ];
67
+ for (const dir of dirs) {
68
+ if (!(0, fs_1.existsSync)(dir)) {
69
+ (0, fs_1.mkdirSync)(dir, { recursive: true });
70
+ }
71
+ }
72
+ return p;
73
+ }
74
+ /**
75
+ * Merge user config with defaults.
76
+ */
77
+ function mergeConfig(userConfig) {
78
+ const defaults = getDefaultConfig();
79
+ return { ...defaults, ...userConfig };
80
+ }
81
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAwBH,gCAEC;AAKD,4CAWC;AAmBD,4BAaC;AAKD,8CAoBC;AAKD,kCAGC;AAzGD,2BAA2C;AAC3C,2BAA6B;AAC7B,+BAA4B;AAiB5B;;GAEG;AACH,SAAgB,UAAU;IACxB,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,IAAA,WAAI,EAAC,IAAA,YAAO,GAAE,EAAE,WAAW,CAAC,CAAC;AACvE,CAAC;AAED;;GAEG;AACH,SAAgB,gBAAgB;IAC9B,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,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AChB,CAAC,CAAC,WAAW;QACb,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,UAAU;QACZ,CAAC,CAAC,QAAQ;KACX,CAAC;IAEF,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,IAAA,eAAU,EAAC,GAAG,CAAC,EAAE,CAAC;YACrB,IAAA,cAAS,EAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;GAEG;AACH,SAAgB,WAAW,CAAC,UAAmC;IAC7D,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IACpC,OAAO,EAAE,GAAG,QAAQ,EAAE,GAAG,UAAU,EAAE,CAAC;AACxC,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * CBrowser - AI-powered browser automation
3
+ *
4
+ * @example
5
+ * ```typescript
6
+ * import { CBrowser } from 'cbrowser';
7
+ *
8
+ * const browser = new CBrowser();
9
+ * await browser.navigate('https://example.com');
10
+ * await browser.click('Sign In');
11
+ * await browser.close();
12
+ * ```
13
+ */
14
+ export { CBrowser } from "./browser.js";
15
+ export { getDefaultConfig, getPaths, ensureDirectories, mergeConfig } from "./config.js";
16
+ export type { CBrowserConfig, CBrowserPaths } from "./config.js";
17
+ export * from "./types.js";
18
+ export { BUILTIN_PERSONAS } from "./personas.js";
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACzF,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjE,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /**
3
+ * CBrowser - AI-powered browser automation
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * import { CBrowser } from 'cbrowser';
8
+ *
9
+ * const browser = new CBrowser();
10
+ * await browser.navigate('https://example.com');
11
+ * await browser.click('Sign In');
12
+ * await browser.close();
13
+ * ```
14
+ */
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ }) : (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ }));
26
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
27
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.BUILTIN_PERSONAS = exports.mergeConfig = exports.ensureDirectories = exports.getPaths = exports.getDefaultConfig = exports.CBrowser = void 0;
31
+ var browser_js_1 = require("./browser.js");
32
+ Object.defineProperty(exports, "CBrowser", { enumerable: true, get: function () { return browser_js_1.CBrowser; } });
33
+ var config_js_1 = require("./config.js");
34
+ Object.defineProperty(exports, "getDefaultConfig", { enumerable: true, get: function () { return config_js_1.getDefaultConfig; } });
35
+ Object.defineProperty(exports, "getPaths", { enumerable: true, get: function () { return config_js_1.getPaths; } });
36
+ Object.defineProperty(exports, "ensureDirectories", { enumerable: true, get: function () { return config_js_1.ensureDirectories; } });
37
+ Object.defineProperty(exports, "mergeConfig", { enumerable: true, get: function () { return config_js_1.mergeConfig; } });
38
+ __exportStar(require("./types.js"), exports);
39
+ var personas_js_1 = require("./personas.js");
40
+ Object.defineProperty(exports, "BUILTIN_PERSONAS", { enumerable: true, get: function () { return personas_js_1.BUILTIN_PERSONAS; } });
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;;AAEH,2CAAwC;AAA/B,sGAAA,QAAQ,OAAA;AACjB,yCAAyF;AAAhF,6GAAA,gBAAgB,OAAA;AAAE,qGAAA,QAAQ,OAAA;AAAE,8GAAA,iBAAiB,OAAA;AAAE,wGAAA,WAAW,OAAA;AAEnE,6CAA2B;AAC3B,6CAAiD;AAAxC,+GAAA,gBAAgB,OAAA"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Built-in Personas for CBrowser
3
+ *
4
+ * Each persona represents a different user archetype with specific
5
+ * behaviors, timing, and interaction patterns.
6
+ */
7
+ import type { Persona } from "./types.js";
8
+ export declare const BUILTIN_PERSONAS: Record<string, Persona>;
9
+ /**
10
+ * Get a persona by name.
11
+ */
12
+ export declare function getPersona(name: string): Persona | undefined;
13
+ /**
14
+ * List all available persona names.
15
+ */
16
+ export declare function listPersonas(): string[];
17
+ //# sourceMappingURL=personas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personas.d.ts","sourceRoot":"","sources":["../src/personas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAoRpD,CAAC;AAEF;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAE5D;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAEvC"}