nothing-browser 0.0.19 → 0.0.21

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/piggy.js CHANGED
@@ -6105,7 +6105,7 @@ var require_file_uri_to_path = __commonJS((exports, module) => {
6105
6105
 
6106
6106
  // node_modules/bindings/bindings.js
6107
6107
  var require_bindings = __commonJS((exports, module) => {
6108
- var __filename = "/home/pease/projects/libraries/browserlibs/nothing-browser/node_modules/bindings/bindings.js";
6108
+ var __filename = "C:\\Users\\CENTURY CYBER\\Desktop\\piggy\\nothing-browser\\node_modules\\bindings\\bindings.js";
6109
6109
  var fs = __require("fs");
6110
6110
  var path = __require("path");
6111
6111
  var fileURLToPath = require_file_uri_to_path();
@@ -6870,15 +6870,20 @@ var BINARY_NAMES = {
6870
6870
  headful: "nothing-browser-headful"
6871
6871
  };
6872
6872
  function detectBinary(mode = "headless") {
6873
+ const cwd = process.cwd();
6873
6874
  if (mode !== "headless" && mode !== "headful") {
6874
6875
  if (existsSync(mode)) {
6875
6876
  logger_default.success(`Binary found (custom path): ${mode}`);
6876
6877
  return mode;
6877
6878
  }
6878
- logger_default.error(`❌ Binary not found at custom path: ${mode}`);
6879
+ const abs = join(cwd, mode);
6880
+ if (existsSync(abs)) {
6881
+ logger_default.success(`Binary found (custom path): ${abs}`);
6882
+ return abs;
6883
+ }
6884
+ logger_default.error(`Binary not found at custom path: ${mode}`);
6879
6885
  return null;
6880
6886
  }
6881
- const cwd = process.cwd();
6882
6887
  const name = BINARY_NAMES[mode];
6883
6888
  if (process.platform === "win32") {
6884
6889
  const p2 = join(cwd, `${name}.exe`);
@@ -28776,7 +28781,7 @@ function createSiteObject(name, registeredUrl, client, tabId, pool) {
28776
28781
  return client.hover(selector, t2);
28777
28782
  }), `hover(${selector})`),
28778
28783
  type: (selector, text, opts) => withErrScreen(() => withTab(async (t2) => {
28779
- await client.waitForSelector(selector, 15000, t2);
28784
+ await client.waitForSelector(selector, 30000, t2);
28780
28785
  if (humanMode && !opts?.fact) {
28781
28786
  const seq = humanTypeSequence(text);
28782
28787
  let current = "";
@@ -28785,7 +28790,15 @@ function createSiteObject(name, registeredUrl, client, tabId, pool) {
28785
28790
  current = current.slice(0, -1);
28786
28791
  else
28787
28792
  current += action;
28788
- await client.type(selector, current, t2);
28793
+ await client.evaluate(`
28794
+ (function() {
28795
+ const el = document.querySelector('${selector}');
28796
+ const nativeSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set;
28797
+ nativeSetter.call(el, '${current.replace(/'/g, "\\'")}');
28798
+ el.dispatchEvent(new Event('input', { bubbles: true }));
28799
+ el.dispatchEvent(new Event('change', { bubbles: true }));
28800
+ })()
28801
+ `, t2);
28789
28802
  const wpm = opts?.wpm ?? 120;
28790
28803
  const msPerChar = Math.round(60000 / (wpm * 5));
28791
28804
  await randomDelay(msPerChar * 0.5, msPerChar * 1.8);
@@ -28798,6 +28811,9 @@ function createSiteObject(name, registeredUrl, client, tabId, pool) {
28798
28811
  } else {
28799
28812
  await client.type(selector, text, t2);
28800
28813
  }
28814
+ await client.evaluate(`
28815
+ document.querySelector('${selector}').dispatchEvent(new Event('blur', { bubbles: true }))
28816
+ `, t2);
28801
28817
  logger_default.success(`[${name}] typed into: ${selector}`);
28802
28818
  return true;
28803
28819
  }), `type(${selector})`),
@@ -6105,7 +6105,7 @@ var require_file_uri_to_path = __commonJS((exports, module) => {
6105
6105
 
6106
6106
  // node_modules/bindings/bindings.js
6107
6107
  var require_bindings = __commonJS((exports, module) => {
6108
- var __filename = "/home/pease/projects/libraries/browserlibs/nothing-browser/node_modules/bindings/bindings.js";
6108
+ var __filename = "C:\\Users\\CENTURY CYBER\\Desktop\\piggy\\nothing-browser\\node_modules\\bindings\\bindings.js";
6109
6109
  var fs = __require("fs");
6110
6110
  var path = __require("path");
6111
6111
  var fileURLToPath = require_file_uri_to_path();
@@ -23054,7 +23054,7 @@ function createSiteObject(name, registeredUrl, client, tabId, pool) {
23054
23054
  return client.hover(selector, t2);
23055
23055
  }), `hover(${selector})`),
23056
23056
  type: (selector, text, opts) => withErrScreen(() => withTab(async (t2) => {
23057
- await client.waitForSelector(selector, 15000, t2);
23057
+ await client.waitForSelector(selector, 30000, t2);
23058
23058
  if (humanMode && !opts?.fact) {
23059
23059
  const seq = humanTypeSequence(text);
23060
23060
  let current = "";
@@ -23063,7 +23063,15 @@ function createSiteObject(name, registeredUrl, client, tabId, pool) {
23063
23063
  current = current.slice(0, -1);
23064
23064
  else
23065
23065
  current += action;
23066
- await client.type(selector, current, t2);
23066
+ await client.evaluate(`
23067
+ (function() {
23068
+ const el = document.querySelector('${selector}');
23069
+ const nativeSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set;
23070
+ nativeSetter.call(el, '${current.replace(/'/g, "\\'")}');
23071
+ el.dispatchEvent(new Event('input', { bubbles: true }));
23072
+ el.dispatchEvent(new Event('change', { bubbles: true }));
23073
+ })()
23074
+ `, t2);
23067
23075
  const wpm = opts?.wpm ?? 120;
23068
23076
  const msPerChar = Math.round(60000 / (wpm * 5));
23069
23077
  await randomDelay(msPerChar * 0.5, msPerChar * 1.8);
@@ -23076,6 +23084,9 @@ function createSiteObject(name, registeredUrl, client, tabId, pool) {
23076
23084
  } else {
23077
23085
  await client.type(selector, text, t2);
23078
23086
  }
23087
+ await client.evaluate(`
23088
+ document.querySelector('${selector}').dispatchEvent(new Event('blur', { bubbles: true }))
23089
+ `, t2);
23079
23090
  logger_default.success(`[${name}] typed into: ${selector}`);
23080
23091
  return true;
23081
23092
  }), `type(${selector})`),
@@ -1,59 +1,59 @@
1
- <svg width="100%" viewBox="0 0 680 620" role="img" xmlns="http://www.w3.org/2000/svg">
2
- <title style="fill:rgb(0, 0, 0);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto">Nothing Browser pink pig logo</title>
3
- <desc style="fill:rgb(0, 0, 0);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto">Pink version of the pig face shield logo</desc>
4
-
5
-
6
-
7
- <!-- SHIELD BACKGROUND (was black) -->
8
- <path d="M340 55&#xA; C380 55 460 75 490 120&#xA; C515 158 510 220 495 270&#xA; C475 335 430 390 375 430&#xA; C362 439 351 445 340 450&#xA; C329 445 318 439 305 430&#xA; C250 390 205 335 185 270&#xA; C170 220 165 158 190 120&#xA; C220 75 300 55 340 55 Z" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
9
-
10
- <!-- FACE circle (was white) -->
11
- <circle cx="340" cy="268" r="130" style="fill:rgb(255, 224, 240);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
12
-
13
- <!-- LEFT EAR outer (dark) -->
14
- <ellipse cx="262" cy="152" rx="42" ry="52" transform="rotate(-18 262 152)" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
15
- <!-- LEFT EAR inner (light) -->
16
- <ellipse cx="262" cy="153" rx="24" ry="30" transform="rotate(-18 262 153)" style="fill:rgb(255, 110, 180);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
17
-
18
- <!-- RIGHT EAR outer (dark) -->
19
- <ellipse cx="418" cy="152" rx="42" ry="52" transform="rotate(18 418 152)" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
20
- <!-- RIGHT EAR inner (light) -->
21
- <ellipse cx="418" cy="153" rx="24" ry="30" transform="rotate(18 418 153)" style="fill:rgb(255, 110, 180);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
22
-
23
- <!-- LEFT EYE outer (dark oval) -->
24
- <ellipse cx="298" cy="248" rx="22" ry="26" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
25
- <!-- LEFT EYE white -->
26
- <ellipse cx="298" cy="248" rx="14" ry="18" style="fill:rgb(255, 224, 240);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
27
- <!-- LEFT EYE pupil -->
28
- <circle cx="301" cy="251" r="9" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
29
- <!-- LEFT EYE shine -->
30
- <circle cx="305" cy="246" r="4" style="fill:rgb(255, 224, 240);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
31
-
32
- <!-- RIGHT EYE outer -->
33
- <ellipse cx="382" cy="248" rx="22" ry="26" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
34
- <!-- RIGHT EYE white -->
35
- <ellipse cx="382" cy="248" rx="14" ry="18" style="fill:rgb(255, 224, 240);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
36
- <!-- RIGHT EYE pupil -->
37
- <circle cx="385" cy="251" r="9" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
38
- <!-- RIGHT EYE shine -->
39
- <circle cx="389" cy="246" r="4" style="fill:rgb(255, 224, 240);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
40
-
41
- <!-- SNOUT outer (dark) -->
42
- <ellipse cx="340" cy="306" rx="54" ry="42" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
43
- <!-- SNOUT inner (light) -->
44
- <ellipse cx="340" cy="305" rx="44" ry="33" style="fill:rgb(255, 110, 180);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
45
- <!-- LEFT NOSTRIL -->
46
- <ellipse cx="320" cy="308" rx="11" ry="13" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
47
- <!-- RIGHT NOSTRIL -->
48
- <ellipse cx="360" cy="308" rx="11" ry="13" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
49
-
50
- <!-- SMILE lines -->
51
- <path d="M 295 345 Q 310 362 340 365 Q 370 362 385 345" fill="none" stroke="#e0449a" stroke-width="5" stroke-linecap="round" style="fill:none;stroke:rgb(224, 68, 154);color:rgb(251, 251, 254);stroke-width:5px;stroke-linecap:round;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
52
-
53
- <!-- Cheek blush dots -->
54
- <circle cx="270" cy="310" r="6" opacity="0.5" style="fill:rgb(255, 110, 180);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:0.5;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
55
- <circle cx="256" cy="322" r="4" opacity="0.4" style="fill:rgb(255, 110, 180);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:0.4;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
56
- <circle cx="410" cy="310" r="6" opacity="0.5" style="fill:rgb(255, 110, 180);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:0.5;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
57
- <circle cx="424" cy="322" r="4" opacity="0.4" style="fill:rgb(255, 110, 180);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:0.4;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
58
-
1
+ <svg width="100%" viewBox="0 0 680 620" role="img" xmlns="http://www.w3.org/2000/svg">
2
+ <title style="fill:rgb(0, 0, 0);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto">Nothing Browser pink pig logo</title>
3
+ <desc style="fill:rgb(0, 0, 0);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto">Pink version of the pig face shield logo</desc>
4
+
5
+
6
+
7
+ <!-- SHIELD BACKGROUND (was black) -->
8
+ <path d="M340 55&#xA; C380 55 460 75 490 120&#xA; C515 158 510 220 495 270&#xA; C475 335 430 390 375 430&#xA; C362 439 351 445 340 450&#xA; C329 445 318 439 305 430&#xA; C250 390 205 335 185 270&#xA; C170 220 165 158 190 120&#xA; C220 75 300 55 340 55 Z" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
9
+
10
+ <!-- FACE circle (was white) -->
11
+ <circle cx="340" cy="268" r="130" style="fill:rgb(255, 224, 240);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
12
+
13
+ <!-- LEFT EAR outer (dark) -->
14
+ <ellipse cx="262" cy="152" rx="42" ry="52" transform="rotate(-18 262 152)" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
15
+ <!-- LEFT EAR inner (light) -->
16
+ <ellipse cx="262" cy="153" rx="24" ry="30" transform="rotate(-18 262 153)" style="fill:rgb(255, 110, 180);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
17
+
18
+ <!-- RIGHT EAR outer (dark) -->
19
+ <ellipse cx="418" cy="152" rx="42" ry="52" transform="rotate(18 418 152)" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
20
+ <!-- RIGHT EAR inner (light) -->
21
+ <ellipse cx="418" cy="153" rx="24" ry="30" transform="rotate(18 418 153)" style="fill:rgb(255, 110, 180);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
22
+
23
+ <!-- LEFT EYE outer (dark oval) -->
24
+ <ellipse cx="298" cy="248" rx="22" ry="26" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
25
+ <!-- LEFT EYE white -->
26
+ <ellipse cx="298" cy="248" rx="14" ry="18" style="fill:rgb(255, 224, 240);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
27
+ <!-- LEFT EYE pupil -->
28
+ <circle cx="301" cy="251" r="9" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
29
+ <!-- LEFT EYE shine -->
30
+ <circle cx="305" cy="246" r="4" style="fill:rgb(255, 224, 240);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
31
+
32
+ <!-- RIGHT EYE outer -->
33
+ <ellipse cx="382" cy="248" rx="22" ry="26" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
34
+ <!-- RIGHT EYE white -->
35
+ <ellipse cx="382" cy="248" rx="14" ry="18" style="fill:rgb(255, 224, 240);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
36
+ <!-- RIGHT EYE pupil -->
37
+ <circle cx="385" cy="251" r="9" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
38
+ <!-- RIGHT EYE shine -->
39
+ <circle cx="389" cy="246" r="4" style="fill:rgb(255, 224, 240);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
40
+
41
+ <!-- SNOUT outer (dark) -->
42
+ <ellipse cx="340" cy="306" rx="54" ry="42" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
43
+ <!-- SNOUT inner (light) -->
44
+ <ellipse cx="340" cy="305" rx="44" ry="33" style="fill:rgb(255, 110, 180);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
45
+ <!-- LEFT NOSTRIL -->
46
+ <ellipse cx="320" cy="308" rx="11" ry="13" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
47
+ <!-- RIGHT NOSTRIL -->
48
+ <ellipse cx="360" cy="308" rx="11" ry="13" style="fill:rgb(224, 68, 154);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
49
+
50
+ <!-- SMILE lines -->
51
+ <path d="M 295 345 Q 310 362 340 365 Q 370 362 385 345" fill="none" stroke="#e0449a" stroke-width="5" stroke-linecap="round" style="fill:none;stroke:rgb(224, 68, 154);color:rgb(251, 251, 254);stroke-width:5px;stroke-linecap:round;stroke-linejoin:miter;opacity:1;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
52
+
53
+ <!-- Cheek blush dots -->
54
+ <circle cx="270" cy="310" r="6" opacity="0.5" style="fill:rgb(255, 110, 180);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:0.5;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
55
+ <circle cx="256" cy="322" r="4" opacity="0.4" style="fill:rgb(255, 110, 180);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:0.4;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
56
+ <circle cx="410" cy="310" r="6" opacity="0.5" style="fill:rgb(255, 110, 180);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:0.5;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
57
+ <circle cx="424" cy="322" r="4" opacity="0.4" style="fill:rgb(255, 110, 180);stroke:none;color:rgb(251, 251, 254);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;opacity:0.4;font-family:&quot;Anthropic Sans&quot;, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, sans-serif;font-size:16px;font-weight:400;text-anchor:start;dominant-baseline:auto"/>
58
+
59
59
  </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nothing-browser",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "description": "Browser automation library powered by Nothing Browser",
5
5
  "homepage": "https://github.com/ernest-tech-house-co-operation/nothing-browser#readme",
6
6
  "repository": {
@@ -51,7 +51,8 @@
51
51
  "dependencies": {
52
52
  "@elysiajs/openapi": "^1.4.15",
53
53
  "better-sqlite3": "^12.9.0",
54
- "elysia": "^1.0.0"
54
+ "elysia": "^1.0.0",
55
+ "ernest-logger": "2.0.4"
55
56
  },
56
57
  "peerDependencies": {
57
58
  "elysia": "^1.0.0"
@@ -59,7 +60,7 @@
59
60
  "devDependencies": {
60
61
  "@types/node": "^20.0.0",
61
62
  "bun-types": "latest",
62
- "typescript": "^5.8.0"
63
+ "typescript": "^6.0.3"
63
64
  },
64
65
  "engines": {
65
66
  "node": ">=18.0.0",
@@ -1,7 +1,7 @@
1
- export declare function get(key: string): any | null;
2
- export declare function set(key: string, data: any, ttlMs: number): void;
3
- export declare function del(key: string): void;
4
- export declare function clear(): void;
5
- export declare function size(): number;
6
- export declare function keys(): string[];
1
+ export declare function get(key: string): any | null;
2
+ export declare function set(key: string, data: any, ttlMs: number): void;
3
+ export declare function del(key: string): void;
4
+ export declare function clear(): void;
5
+ export declare function size(): number;
6
+ export declare function keys(): string[];
7
7
  //# sourceMappingURL=memory.d.ts.map
@@ -1,38 +1,38 @@
1
- // piggy/cache/memory.ts
2
-
3
- interface CacheEntry {
4
- data: any;
5
- expires: number;
6
- }
7
-
8
- const store = new Map<string, CacheEntry>();
9
-
10
- export function get(key: string): any | null {
11
- const entry = store.get(key);
12
- if (!entry) return null;
13
- if (Date.now() > entry.expires) {
14
- store.delete(key);
15
- return null;
16
- }
17
- return entry.data;
18
- }
19
-
20
- export function set(key: string, data: any, ttlMs: number) {
21
- store.set(key, { data, expires: Date.now() + ttlMs });
22
- }
23
-
24
- export function del(key: string) {
25
- store.delete(key);
26
- }
27
-
28
- export function clear() {
29
- store.clear();
30
- }
31
-
32
- export function size() {
33
- return store.size;
34
- }
35
-
36
- export function keys() {
37
- return Array.from(store.keys());
1
+ // piggy/cache/memory.ts
2
+
3
+ interface CacheEntry {
4
+ data: any;
5
+ expires: number;
6
+ }
7
+
8
+ const store = new Map<string, CacheEntry>();
9
+
10
+ export function get(key: string): any | null {
11
+ const entry = store.get(key);
12
+ if (!entry) return null;
13
+ if (Date.now() > entry.expires) {
14
+ store.delete(key);
15
+ return null;
16
+ }
17
+ return entry.data;
18
+ }
19
+
20
+ export function set(key: string, data: any, ttlMs: number) {
21
+ store.set(key, { data, expires: Date.now() + ttlMs });
22
+ }
23
+
24
+ export function del(key: string) {
25
+ store.delete(key);
26
+ }
27
+
28
+ export function clear() {
29
+ store.clear();
30
+ }
31
+
32
+ export function size() {
33
+ return store.size;
34
+ }
35
+
36
+ export function keys() {
37
+ return Array.from(store.keys());
38
38
  }
@@ -1,79 +1,79 @@
1
- export declare class PiggyClient {
2
- private socketPath;
3
- private socket;
4
- private reqId;
5
- private pending;
6
- private buf;
7
- private eventBuffer;
8
- private eventHandlers;
9
- private globalEventHandlers;
10
- constructor(socketPath?: string);
11
- connect(): Promise<void>;
12
- private handleEvent;
13
- onEvent(eventName: string, tabId: string, handler: (data: any) => void): () => void;
14
- disconnect(): void;
15
- send<T = any>(cmd: string, payload?: Record<string, any>): Promise<T>;
16
- newTab(): Promise<string>;
17
- closeTab(tabId: string): Promise<void>;
18
- listTabs(): Promise<string[]>;
19
- navigate(url: string, tabId?: string): Promise<void>;
20
- reload(tabId?: string): Promise<void>;
21
- goBack(tabId?: string): Promise<void>;
22
- goForward(tabId?: string): Promise<void>;
23
- getTitle(tabId?: string): Promise<string>;
24
- getUrl(tabId?: string): Promise<string>;
25
- content(tabId?: string): Promise<string>;
26
- evaluate(js: string, tabId?: string): Promise<any>;
27
- addInitScript(js: string, tabId?: string): Promise<void>;
28
- click(selector: string, tabId?: string): Promise<boolean>;
29
- doubleClick(selector: string, tabId?: string): Promise<boolean>;
30
- hover(selector: string, tabId?: string): Promise<boolean>;
31
- type(selector: string, text: string, tabId?: string): Promise<boolean>;
32
- select(selector: string, value: string, tabId?: string): Promise<boolean>;
33
- keyPress(key: string, tabId?: string): Promise<boolean>;
34
- keyCombo(combo: string, tabId?: string): Promise<boolean>;
35
- mouseMove(x: number, y: number, tabId?: string): Promise<boolean>;
36
- mouseDrag(from: {
37
- x: number;
38
- y: number;
39
- }, to: {
40
- x: number;
41
- y: number;
42
- }, tabId?: string): Promise<boolean>;
43
- scrollTo(selector: string, tabId?: string): Promise<boolean>;
44
- scrollBy(px: number, tabId?: string): Promise<boolean>;
45
- fetchText(query: string, tabId?: string): Promise<string | null>;
46
- fetchLinks(query: string, tabId?: string): Promise<string[]>;
47
- fetchImages(query: string, tabId?: string): Promise<string[]>;
48
- searchCss(query: string, tabId?: string): Promise<any>;
49
- searchId(query: string, tabId?: string): Promise<any>;
50
- waitForSelector(selector: string, timeout?: number, tabId?: string): Promise<void>;
51
- waitForNavigation(tabId?: string): Promise<void>;
52
- waitForResponse(urlPattern: string, timeout?: number, tabId?: string): Promise<void>;
53
- screenshot(filePath?: string, tabId?: string): Promise<string>;
54
- pdf(filePath?: string, tabId?: string): Promise<string>;
55
- blockImages(tabId?: string): Promise<void>;
56
- unblockImages(tabId?: string): Promise<void>;
57
- setCookie(name: string, value: string, domain: string, path?: string, tabId?: string): Promise<void>;
58
- getCookie(name: string, tabId?: string): Promise<any>;
59
- deleteCookie(name: string, tabId?: string): Promise<void>;
60
- listCookies(tabId?: string): Promise<any[]>;
61
- addInterceptRule(action: "block" | "redirect" | "modifyHeaders", pattern: string, options?: {
62
- redirectUrl?: string;
63
- headers?: Record<string, string>;
64
- }, tabId?: string): Promise<void>;
65
- clearInterceptRules(tabId?: string): Promise<void>;
66
- captureStart(tabId?: string): Promise<void>;
67
- captureStop(tabId?: string): Promise<void>;
68
- captureRequests(tabId?: string): Promise<any[]>;
69
- captureWs(tabId?: string): Promise<any[]>;
70
- captureCookies(tabId?: string): Promise<any[]>;
71
- captureStorage(tabId?: string): Promise<any>;
72
- captureClear(tabId?: string): Promise<void>;
73
- sessionExport(tabId?: string): Promise<any>;
74
- sessionImport(data: any, tabId?: string): Promise<void>;
75
- exposeFunction(name: string, handler: (data: any) => Promise<any> | any, tabId?: string): Promise<void>;
76
- unexposeFunction(name: string, tabId?: string): Promise<void>;
77
- clearExposedFunctions(tabId?: string): Promise<void>;
78
- }
1
+ export declare class PiggyClient {
2
+ private socketPath;
3
+ private socket;
4
+ private reqId;
5
+ private pending;
6
+ private buf;
7
+ private eventBuffer;
8
+ private eventHandlers;
9
+ private globalEventHandlers;
10
+ constructor(socketPath?: string);
11
+ connect(): Promise<void>;
12
+ private handleEvent;
13
+ onEvent(eventName: string, tabId: string, handler: (data: any) => void): () => void;
14
+ disconnect(): void;
15
+ send<T = any>(cmd: string, payload?: Record<string, any>): Promise<T>;
16
+ newTab(): Promise<string>;
17
+ closeTab(tabId: string): Promise<void>;
18
+ listTabs(): Promise<string[]>;
19
+ navigate(url: string, tabId?: string): Promise<void>;
20
+ reload(tabId?: string): Promise<void>;
21
+ goBack(tabId?: string): Promise<void>;
22
+ goForward(tabId?: string): Promise<void>;
23
+ getTitle(tabId?: string): Promise<string>;
24
+ getUrl(tabId?: string): Promise<string>;
25
+ content(tabId?: string): Promise<string>;
26
+ evaluate(js: string, tabId?: string): Promise<any>;
27
+ addInitScript(js: string, tabId?: string): Promise<void>;
28
+ click(selector: string, tabId?: string): Promise<boolean>;
29
+ doubleClick(selector: string, tabId?: string): Promise<boolean>;
30
+ hover(selector: string, tabId?: string): Promise<boolean>;
31
+ type(selector: string, text: string, tabId?: string): Promise<boolean>;
32
+ select(selector: string, value: string, tabId?: string): Promise<boolean>;
33
+ keyPress(key: string, tabId?: string): Promise<boolean>;
34
+ keyCombo(combo: string, tabId?: string): Promise<boolean>;
35
+ mouseMove(x: number, y: number, tabId?: string): Promise<boolean>;
36
+ mouseDrag(from: {
37
+ x: number;
38
+ y: number;
39
+ }, to: {
40
+ x: number;
41
+ y: number;
42
+ }, tabId?: string): Promise<boolean>;
43
+ scrollTo(selector: string, tabId?: string): Promise<boolean>;
44
+ scrollBy(px: number, tabId?: string): Promise<boolean>;
45
+ fetchText(query: string, tabId?: string): Promise<string | null>;
46
+ fetchLinks(query: string, tabId?: string): Promise<string[]>;
47
+ fetchImages(query: string, tabId?: string): Promise<string[]>;
48
+ searchCss(query: string, tabId?: string): Promise<any>;
49
+ searchId(query: string, tabId?: string): Promise<any>;
50
+ waitForSelector(selector: string, timeout?: number, tabId?: string): Promise<void>;
51
+ waitForNavigation(tabId?: string): Promise<void>;
52
+ waitForResponse(urlPattern: string, timeout?: number, tabId?: string): Promise<void>;
53
+ screenshot(filePath?: string, tabId?: string): Promise<string>;
54
+ pdf(filePath?: string, tabId?: string): Promise<string>;
55
+ blockImages(tabId?: string): Promise<void>;
56
+ unblockImages(tabId?: string): Promise<void>;
57
+ setCookie(name: string, value: string, domain: string, path?: string, tabId?: string): Promise<void>;
58
+ getCookie(name: string, tabId?: string): Promise<any>;
59
+ deleteCookie(name: string, tabId?: string): Promise<void>;
60
+ listCookies(tabId?: string): Promise<any[]>;
61
+ addInterceptRule(action: "block" | "redirect" | "modifyHeaders", pattern: string, options?: {
62
+ redirectUrl?: string;
63
+ headers?: Record<string, string>;
64
+ }, tabId?: string): Promise<void>;
65
+ clearInterceptRules(tabId?: string): Promise<void>;
66
+ captureStart(tabId?: string): Promise<void>;
67
+ captureStop(tabId?: string): Promise<void>;
68
+ captureRequests(tabId?: string): Promise<any[]>;
69
+ captureWs(tabId?: string): Promise<any[]>;
70
+ captureCookies(tabId?: string): Promise<any[]>;
71
+ captureStorage(tabId?: string): Promise<any>;
72
+ captureClear(tabId?: string): Promise<void>;
73
+ sessionExport(tabId?: string): Promise<any>;
74
+ sessionImport(data: any, tabId?: string): Promise<void>;
75
+ exposeFunction(name: string, handler: (data: any) => Promise<any> | any, tabId?: string): Promise<void>;
76
+ unexposeFunction(name: string, tabId?: string): Promise<void>;
77
+ clearExposedFunctions(tabId?: string): Promise<void>;
78
+ }
79
79
  //# sourceMappingURL=index.d.ts.map