@quanta-intellect/vessel-browser 0.1.16 → 0.1.17

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/out/main/index.js CHANGED
@@ -80,12 +80,9 @@ function loadSettings() {
80
80
  return settings;
81
81
  }
82
82
  function saveSettings() {
83
- try {
84
- fs.mkdirSync(path.dirname(getSettingsPath()), { recursive: true });
85
- fs.writeFileSync(getSettingsPath(), JSON.stringify(settings, null, 2));
86
- } catch (err) {
87
- console.error("[Vessel] Failed to save settings:", err);
88
- }
83
+ fs.promises.mkdir(path.dirname(getSettingsPath()), { recursive: true }).then(
84
+ () => fs.promises.writeFile(getSettingsPath(), JSON.stringify(settings, null, 2))
85
+ ).catch((err) => console.error("[Vessel] Failed to save settings:", err));
89
86
  }
90
87
  function setSetting(key, value) {
91
88
  loadSettings();
@@ -528,11 +525,7 @@ function load$2() {
528
525
  return state$3;
529
526
  }
530
527
  function save$2() {
531
- try {
532
- fs.writeFileSync(getHighlightsPath(), JSON.stringify(state$3, null, 2), "utf-8");
533
- } catch (err) {
534
- console.error("[Vessel] Failed to save highlights:", err);
535
- }
528
+ fs.promises.writeFile(getHighlightsPath(), JSON.stringify(state$3, null, 2), "utf-8").catch((err) => console.error("[Vessel] Failed to save highlights:", err));
536
529
  }
537
530
  function emit$2() {
538
531
  if (!state$3) return;
@@ -1202,16 +1195,13 @@ function load$1() {
1202
1195
  return state$2;
1203
1196
  }
1204
1197
  function save$1() {
1205
- try {
1206
- fs.mkdirSync(path.dirname(getHistoryPath()), { recursive: true });
1207
- fs.writeFileSync(
1198
+ fs.promises.mkdir(path.dirname(getHistoryPath()), { recursive: true }).then(
1199
+ () => fs.promises.writeFile(
1208
1200
  getHistoryPath(),
1209
1201
  JSON.stringify(state$2, null, 2),
1210
1202
  "utf-8"
1211
- );
1212
- } catch (err) {
1213
- console.error("[Vessel] Failed to save history:", err);
1214
- }
1203
+ )
1204
+ ).catch((err) => console.error("[Vessel] Failed to save history:", err));
1215
1205
  }
1216
1206
  function emit$1() {
1217
1207
  if (!state$2) return;
@@ -7460,12 +7450,13 @@ function load() {
7460
7450
  return state;
7461
7451
  }
7462
7452
  function save() {
7463
- try {
7464
- fs.mkdirSync(path.dirname(getBookmarksPath()), { recursive: true });
7465
- fs.writeFileSync(getBookmarksPath(), JSON.stringify(state, null, 2), "utf-8");
7466
- } catch (err) {
7467
- console.error("[Vessel] Failed to save bookmarks:", err);
7468
- }
7453
+ fs.promises.mkdir(path.dirname(getBookmarksPath()), { recursive: true }).then(
7454
+ () => fs.promises.writeFile(
7455
+ getBookmarksPath(),
7456
+ JSON.stringify(state, null, 2),
7457
+ "utf-8"
7458
+ )
7459
+ ).catch((err) => console.error("[Vessel] Failed to save bookmarks:", err));
7469
7460
  }
7470
7461
  function emit() {
7471
7462
  if (!state) return;
@@ -17236,15 +17227,18 @@ function startMcpServer(tabManager, runtime2, port) {
17236
17227
  res.end("Not found");
17237
17228
  return;
17238
17229
  }
17239
- res.setHeader("Access-Control-Allow-Origin", "null");
17240
- res.setHeader(
17241
- "Access-Control-Allow-Methods",
17242
- "POST, GET, DELETE, OPTIONS"
17243
- );
17244
- res.setHeader(
17245
- "Access-Control-Allow-Headers",
17246
- "Content-Type, mcp-session-id, Authorization"
17247
- );
17230
+ const origin = req.headers.origin;
17231
+ if (origin && /^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?$/.test(origin)) {
17232
+ res.setHeader("Access-Control-Allow-Origin", origin);
17233
+ res.setHeader(
17234
+ "Access-Control-Allow-Methods",
17235
+ "POST, GET, DELETE, OPTIONS"
17236
+ );
17237
+ res.setHeader(
17238
+ "Access-Control-Allow-Headers",
17239
+ "Content-Type, mcp-session-id, Authorization"
17240
+ );
17241
+ }
17248
17242
  if (req.method === "OPTIONS") {
17249
17243
  res.writeHead(204);
17250
17244
  res.end();
@@ -18076,16 +18070,15 @@ ${progress}
18076
18070
  actions: this.state.actions.slice(-120),
18077
18071
  checkpoints: this.state.checkpoints.slice(-20)
18078
18072
  };
18079
- try {
18080
- fs$1.mkdirSync(path$1.dirname(getRuntimeStatePath()), { recursive: true });
18081
- fs$1.writeFileSync(
18073
+ return fs$1.promises.mkdir(path$1.dirname(getRuntimeStatePath()), { recursive: true }).then(
18074
+ () => fs$1.promises.writeFile(
18082
18075
  getRuntimeStatePath(),
18083
18076
  JSON.stringify(persisted, null, 2),
18084
18077
  "utf-8"
18085
- );
18086
- } catch (err) {
18087
- console.error("[Vessel] Failed to persist runtime state:", err);
18088
- }
18078
+ )
18079
+ ).catch(
18080
+ (err) => console.error("[Vessel] Failed to persist runtime state:", err)
18081
+ );
18089
18082
  }
18090
18083
  schedulePersist() {
18091
18084
  this.persistDirty = true;
@@ -18097,7 +18090,7 @@ ${progress}
18097
18090
  }
18098
18091
  /** Flush any pending debounced persist to disk immediately. Call on shutdown. */
18099
18092
  flushPersist() {
18100
- if (this.persistDirty) this.persistNow();
18093
+ return this.persistDirty ? this.persistNow() : Promise.resolve();
18101
18094
  }
18102
18095
  emit() {
18103
18096
  this.schedulePersist();
@@ -3221,7 +3221,7 @@ const Sidebar = (props) => {
3221
3221
  if (sidebarTab() !== "chat") return;
3222
3222
  const poll = async () => {
3223
3223
  try {
3224
- const count = await window.vessel?.highlights?.getCount?.() ?? 0;
3224
+ const count = await window.vessel.highlights.getCount() ?? 0;
3225
3225
  setHighlightCount(count);
3226
3226
  if (count === 0 && highlightIndex() >= 0) setHighlightIndex(-1);
3227
3227
  } catch {
@@ -3236,23 +3236,23 @@ const Sidebar = (props) => {
3236
3236
  if (count === 0) return;
3237
3237
  const clamped = Math.max(0, Math.min(idx, count - 1));
3238
3238
  setHighlightIndex(clamped);
3239
- await window.vessel?.highlights?.scrollTo?.(clamped);
3239
+ await window.vessel.highlights.scrollTo(clamped);
3240
3240
  };
3241
3241
  const removeCurrentHighlight = async () => {
3242
3242
  const idx = highlightIndex();
3243
3243
  if (idx < 0) return;
3244
- await window.vessel?.highlights?.remove?.(idx);
3245
- const newCount = await window.vessel?.highlights?.getCount?.() ?? 0;
3244
+ await window.vessel.highlights.remove(idx);
3245
+ const newCount = await window.vessel.highlights.getCount() ?? 0;
3246
3246
  setHighlightCount(newCount);
3247
3247
  if (newCount === 0) {
3248
3248
  setHighlightIndex(-1);
3249
3249
  } else if (idx >= newCount) {
3250
3250
  setHighlightIndex(newCount - 1);
3251
- await window.vessel?.highlights?.scrollTo?.(newCount - 1);
3251
+ await window.vessel.highlights.scrollTo(newCount - 1);
3252
3252
  }
3253
3253
  };
3254
3254
  const clearAllHighlights = async () => {
3255
- await window.vessel?.highlights?.clearAll?.();
3255
+ await window.vessel.highlights.clearAll();
3256
3256
  setHighlightCount(0);
3257
3257
  setHighlightIndex(-1);
3258
3258
  };
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self'; font-src 'self' data:;" />
7
7
  <title>Vessel</title>
8
- <script type="module" crossorigin src="./assets/index-FJxHleYP.js"></script>
8
+ <script type="module" crossorigin src="./assets/index-iB-6qrfG.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="./assets/index-DMd-y6tm.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@quanta-intellect/vessel-browser",
3
3
  "mcpName": "io.github.unmodeled-tyler/vessel-browser",
4
- "version": "0.1.16",
4
+ "version": "0.1.17",
5
5
  "description": "AI-native web browser for Linux — persistent browser runtime for autonomous agents with human supervision",
6
6
  "main": "./out/main/index.js",
7
7
  "bin": {
@@ -24,7 +24,8 @@
24
24
  "typecheck": "tsc --noEmit",
25
25
  "prepublishOnly": "npm run build",
26
26
  "test:navigation-regression": "electron --no-sandbox --disable-setuid-sandbox scripts/run-navigation-regression.mjs",
27
- "smoke:test": "node scripts/smoke-test.mjs"
27
+ "smoke:test": "node scripts/smoke-test.mjs",
28
+ "test:coverage": "c8 --reporter=text --reporter=html node --test tests/**/*.test.ts"
28
29
  },
29
30
  "keywords": [
30
31
  "agent-browser",
@@ -57,6 +58,7 @@
57
58
  "electron-builder": "^26.8.1",
58
59
  "electron-vite": "^5.0.0",
59
60
  "solid-js": "^1.9.11",
61
+ "c8": "^10.1.3",
60
62
  "tsx": "^4.21.0",
61
63
  "typescript": "^5.9.3",
62
64
  "vite-plugin-solid": "^2.11.11"