@hasna/browser 0.1.0 → 0.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.
@@ -308,6 +308,54 @@ function runMigrations(db) {
308
308
  CREATE INDEX IF NOT EXISTS idx_auth_flows_domain ON auth_flows(domain);
309
309
  CREATE INDEX IF NOT EXISTS idx_auth_flows_name ON auth_flows(name);
310
310
  `
311
+ },
312
+ {
313
+ version: 7,
314
+ sql: `
315
+ CREATE TABLE IF NOT EXISTS workflows (
316
+ id TEXT PRIMARY KEY,
317
+ name TEXT NOT NULL UNIQUE,
318
+ description TEXT,
319
+ steps TEXT NOT NULL DEFAULT '[]',
320
+ start_url TEXT,
321
+ last_run TEXT,
322
+ last_heal TEXT,
323
+ heal_count INTEGER DEFAULT 0,
324
+ run_count INTEGER DEFAULT 0,
325
+ created_at TEXT DEFAULT (datetime('now')),
326
+ updated_at TEXT DEFAULT (datetime('now'))
327
+ );
328
+ `
329
+ },
330
+ {
331
+ version: 8,
332
+ sql: `
333
+ CREATE TABLE IF NOT EXISTS datasets (
334
+ id TEXT PRIMARY KEY,
335
+ name TEXT NOT NULL UNIQUE,
336
+ source_url TEXT,
337
+ source_type TEXT NOT NULL DEFAULT 'page',
338
+ data TEXT NOT NULL DEFAULT '[]',
339
+ schema TEXT,
340
+ row_count INTEGER DEFAULT 0,
341
+ last_refresh TEXT,
342
+ created_at TEXT DEFAULT (datetime('now')),
343
+ updated_at TEXT DEFAULT (datetime('now'))
344
+ );
345
+
346
+ CREATE TABLE IF NOT EXISTS api_endpoints (
347
+ id TEXT PRIMARY KEY,
348
+ session_id TEXT,
349
+ url TEXT NOT NULL,
350
+ method TEXT DEFAULT 'GET',
351
+ response_schema TEXT,
352
+ sample_response TEXT,
353
+ status_code INTEGER,
354
+ content_type TEXT,
355
+ discovered_at TEXT DEFAULT (datetime('now'))
356
+ );
357
+ CREATE INDEX IF NOT EXISTS idx_api_endpoints_session ON api_endpoints(session_id);
358
+ `
311
359
  }
312
360
  ];
313
361
  for (const m of migrations) {
@@ -9094,6 +9142,7 @@ async function diffImages(path1, path2) {
9094
9142
 
9095
9143
  // src/server/index.ts
9096
9144
  var PORT = parseInt(process.env["BROWSER_SERVER_PORT"] ?? "7030");
9145
+ var startTime = Date.now();
9097
9146
  var CORS_HEADERS = {
9098
9147
  "Access-Control-Allow-Origin": "*",
9099
9148
  "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
@@ -9137,6 +9186,14 @@ var server = Bun.serve({
9137
9186
  return new Response(null, { status: 204, headers: CORS_HEADERS });
9138
9187
  }
9139
9188
  try {
9189
+ if (path === "/health" && method === "GET") {
9190
+ const activeSessions = listSessions2({ status: "active" });
9191
+ return ok({
9192
+ status: "ok",
9193
+ active_sessions: activeSessions.length,
9194
+ uptime_ms: Date.now() - startTime
9195
+ });
9196
+ }
9140
9197
  if (path === "/api/sessions" && method === "GET") {
9141
9198
  const status = url.searchParams.get("status");
9142
9199
  const projectId = url.searchParams.get("project_id") ?? undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/browser",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "General-purpose browser agent toolkit — Playwright, Chrome DevTools Protocol, Lightpanda with auto engine selection. CLI + MCP + REST + SDK.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",