haltija 1.3.2 → 1.3.3

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haltija-desktop",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "private": true,
5
5
  "description": "Haltija Desktop - God Mode Browser for AI Agents",
6
6
  "homepage": "https://github.com/tonioloewald/haltija",
@@ -46,7 +46,7 @@
46
46
  });
47
47
 
48
48
  // src/version.ts
49
- var VERSION = "1.3.2";
49
+ var VERSION = "1.3.3";
50
50
 
51
51
  // src/text-selector.ts
52
52
  var TEXT_PSEUDO_RE = /:(?:text-is|has-text|text)\(/;
@@ -1761,6 +1761,7 @@
1761
1761
  displayStream = null;
1762
1762
  displayVideo = null;
1763
1763
  isActive = true;
1764
+ visibilityHandler = null;
1764
1765
  homeLeft = 0;
1765
1766
  homeBottom = 16;
1766
1767
  headless = false;
@@ -1952,6 +1953,16 @@
1952
1953
  }
1953
1954
  this.interceptConsole();
1954
1955
  this.interceptDialogs();
1956
+ if (typeof document !== "undefined") {
1957
+ this.visibilityHandler = () => {
1958
+ if (document.visibilityState === "hidden") {
1959
+ this.deactivate();
1960
+ } else {
1961
+ this.activate();
1962
+ }
1963
+ };
1964
+ document.addEventListener("visibilitychange", this.visibilityHandler);
1965
+ }
1955
1966
  this.connect();
1956
1967
  }
1957
1968
  disconnectedCallback() {
@@ -1962,6 +1973,10 @@
1962
1973
  this.clearEventWatchers();
1963
1974
  this.stopMutationWatch();
1964
1975
  this.stopScreenCapture();
1976
+ if (this.visibilityHandler && typeof document !== "undefined") {
1977
+ document.removeEventListener("visibilitychange", this.visibilityHandler);
1978
+ this.visibilityHandler = null;
1979
+ }
1965
1980
  }
1966
1981
  attributeChangedCallback(name, _old, value) {
1967
1982
  if (name === "server") {
@@ -5100,6 +5115,7 @@ ${elementSummary}${moreText}`;
5100
5115
  this.state = "connected";
5101
5116
  this.show();
5102
5117
  const windowType = window.opener ? "popup" : window.parent !== window ? "iframe" : "tab";
5118
+ this.isActive = typeof document === "undefined" || document.visibilityState !== "hidden";
5103
5119
  this.send("system", "connected", {
5104
5120
  windowId: this.windowId,
5105
5121
  browserId: this.browserId,
@@ -63,6 +63,8 @@ export declare const tree: EndpointDef<{
63
63
  pierceFrames?: boolean | undefined;
64
64
  compact?: boolean | undefined;
65
65
  ancestors?: boolean | undefined;
66
+ includeBox?: boolean | undefined;
67
+ mode?: string | undefined;
66
68
  window?: string | undefined;
67
69
  }>;
68
70
  export declare const query: EndpointDef<{
@@ -354,6 +356,8 @@ export declare const endpoints: {
354
356
  pierceFrames?: boolean | undefined;
355
357
  compact?: boolean | undefined;
356
358
  ancestors?: boolean | undefined;
359
+ includeBox?: boolean | undefined;
360
+ mode?: string | undefined;
357
361
  window?: string | undefined;
358
362
  }>;
359
363
  readonly query: EndpointDef<{
@@ -645,6 +649,8 @@ export declare const ALL_ENDPOINTS: (EndpointDef<{
645
649
  pierceFrames?: boolean | undefined;
646
650
  compact?: boolean | undefined;
647
651
  ancestors?: boolean | undefined;
652
+ includeBox?: boolean | undefined;
653
+ mode?: string | undefined;
648
654
  window?: string | undefined;
649
655
  }> | EndpointDef<{
650
656
  selector?: string | undefined;
@@ -20,7 +20,7 @@
20
20
  * - Option+Tab toggles visibility (but active state always shows briefly)
21
21
  * - Localhost only by default
22
22
  */
23
- export declare const VERSION = "1.3.2";
23
+ export declare const VERSION = "1.3.3";
24
24
  export declare class DevChannel extends HTMLElement {
25
25
  static get tagName(): string;
26
26
  static elementCreator(): () => DevChannel;
@@ -50,6 +50,7 @@ export declare class DevChannel extends HTMLElement {
50
50
  private displayStream;
51
51
  private displayVideo;
52
52
  private isActive;
53
+ private visibilityHandler;
53
54
  private homeLeft;
54
55
  private homeBottom;
55
56
  private headless;
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "1.3.2";
2
+ var VERSION = "1.3.3";
3
3
 
4
4
  // src/text-selector.ts
5
5
  var TEXT_PSEUDO_RE = /:(?:text-is|has-text|text)\(/;
@@ -1714,6 +1714,7 @@ class DevChannel extends HTMLElement {
1714
1714
  displayStream = null;
1715
1715
  displayVideo = null;
1716
1716
  isActive = true;
1717
+ visibilityHandler = null;
1717
1718
  homeLeft = 0;
1718
1719
  homeBottom = 16;
1719
1720
  headless = false;
@@ -1905,6 +1906,16 @@ class DevChannel extends HTMLElement {
1905
1906
  }
1906
1907
  this.interceptConsole();
1907
1908
  this.interceptDialogs();
1909
+ if (typeof document !== "undefined") {
1910
+ this.visibilityHandler = () => {
1911
+ if (document.visibilityState === "hidden") {
1912
+ this.deactivate();
1913
+ } else {
1914
+ this.activate();
1915
+ }
1916
+ };
1917
+ document.addEventListener("visibilitychange", this.visibilityHandler);
1918
+ }
1908
1919
  this.connect();
1909
1920
  }
1910
1921
  disconnectedCallback() {
@@ -1915,6 +1926,10 @@ class DevChannel extends HTMLElement {
1915
1926
  this.clearEventWatchers();
1916
1927
  this.stopMutationWatch();
1917
1928
  this.stopScreenCapture();
1929
+ if (this.visibilityHandler && typeof document !== "undefined") {
1930
+ document.removeEventListener("visibilitychange", this.visibilityHandler);
1931
+ this.visibilityHandler = null;
1932
+ }
1918
1933
  }
1919
1934
  attributeChangedCallback(name, _old, value) {
1920
1935
  if (name === "server") {
@@ -5053,6 +5068,7 @@ ${elementSummary}${moreText}`;
5053
5068
  this.state = "connected";
5054
5069
  this.show();
5055
5070
  const windowType = window.opener ? "popup" : window.parent !== window ? "iframe" : "tab";
5071
+ this.isActive = typeof document === "undefined" || document.visibilityState !== "hidden";
5056
5072
  this.send("system", "connected", {
5057
5073
  windowId: this.windowId,
5058
5074
  browserId: this.browserId,
package/dist/component.js CHANGED
@@ -46,7 +46,7 @@
46
46
  });
47
47
 
48
48
  // src/version.ts
49
- var VERSION = "1.3.2";
49
+ var VERSION = "1.3.3";
50
50
 
51
51
  // src/text-selector.ts
52
52
  var TEXT_PSEUDO_RE = /:(?:text-is|has-text|text)\(/;
@@ -1761,6 +1761,7 @@
1761
1761
  displayStream = null;
1762
1762
  displayVideo = null;
1763
1763
  isActive = true;
1764
+ visibilityHandler = null;
1764
1765
  homeLeft = 0;
1765
1766
  homeBottom = 16;
1766
1767
  headless = false;
@@ -1952,6 +1953,16 @@
1952
1953
  }
1953
1954
  this.interceptConsole();
1954
1955
  this.interceptDialogs();
1956
+ if (typeof document !== "undefined") {
1957
+ this.visibilityHandler = () => {
1958
+ if (document.visibilityState === "hidden") {
1959
+ this.deactivate();
1960
+ } else {
1961
+ this.activate();
1962
+ }
1963
+ };
1964
+ document.addEventListener("visibilitychange", this.visibilityHandler);
1965
+ }
1955
1966
  this.connect();
1956
1967
  }
1957
1968
  disconnectedCallback() {
@@ -1962,6 +1973,10 @@
1962
1973
  this.clearEventWatchers();
1963
1974
  this.stopMutationWatch();
1964
1975
  this.stopScreenCapture();
1976
+ if (this.visibilityHandler && typeof document !== "undefined") {
1977
+ document.removeEventListener("visibilitychange", this.visibilityHandler);
1978
+ this.visibilityHandler = null;
1979
+ }
1965
1980
  }
1966
1981
  attributeChangedCallback(name, _old, value) {
1967
1982
  if (name === "server") {
@@ -5100,6 +5115,7 @@ ${elementSummary}${moreText}`;
5100
5115
  this.state = "connected";
5101
5116
  this.show();
5102
5117
  const windowType = window.opener ? "popup" : window.parent !== window ? "iframe" : "tab";
5118
+ this.isActive = typeof document === "undefined" || document.visibilityState !== "hidden";
5103
5119
  this.send("system", "connected", {
5104
5120
  windowId: this.windowId,
5105
5121
  browserId: this.browserId,
package/dist/index.js CHANGED
@@ -674,7 +674,7 @@ var injectorCode = `
674
674
  `;
675
675
 
676
676
  // src/version.ts
677
- var VERSION = "1.3.2";
677
+ var VERSION = "1.3.3";
678
678
 
679
679
  // src/embedded-assets.ts
680
680
  var APP_MD = `# Haltija App
@@ -1086,6 +1086,8 @@ Use ancestors:true to see parent elements when inspecting deep elements.
1086
1086
  | \`pierceFrames\` | boolean,null | Pierce same-origin iframes (default true) |
1087
1087
  | \`compact\` | boolean,null | Minimal output (default false) |
1088
1088
  | \`ancestors\` | boolean,null | Include ancestor path from root (default false) |
1089
+ | \`includeBox\` | boolean,null | Include each node's bounding box { x, y, w, h, visible } (default false) |
1090
+ | \`mode\` | string,null | 'actionable' returns a page action summary (url, title, headings, buttons, links, inputs, selects) instead of the DOM tree |
1089
1091
  | \`window\` | string,null | Target window ID |
1090
1092
 
1091
1093
  **Examples:**
@@ -3019,7 +3021,7 @@ var COMPONENT_JS = `(() => {
3019
3021
  });
3020
3022
 
3021
3023
  // src/version.ts
3022
- var VERSION = "1.3.2";
3024
+ var VERSION = "1.3.3";
3023
3025
 
3024
3026
  // src/text-selector.ts
3025
3027
  var TEXT_PSEUDO_RE = /:(?:text-is|has-text|text)\\(/;
@@ -4734,6 +4736,7 @@ var COMPONENT_JS = `(() => {
4734
4736
  displayStream = null;
4735
4737
  displayVideo = null;
4736
4738
  isActive = true;
4739
+ visibilityHandler = null;
4737
4740
  homeLeft = 0;
4738
4741
  homeBottom = 16;
4739
4742
  headless = false;
@@ -4925,6 +4928,16 @@ var COMPONENT_JS = `(() => {
4925
4928
  }
4926
4929
  this.interceptConsole();
4927
4930
  this.interceptDialogs();
4931
+ if (typeof document !== "undefined") {
4932
+ this.visibilityHandler = () => {
4933
+ if (document.visibilityState === "hidden") {
4934
+ this.deactivate();
4935
+ } else {
4936
+ this.activate();
4937
+ }
4938
+ };
4939
+ document.addEventListener("visibilitychange", this.visibilityHandler);
4940
+ }
4928
4941
  this.connect();
4929
4942
  }
4930
4943
  disconnectedCallback() {
@@ -4935,6 +4948,10 @@ var COMPONENT_JS = `(() => {
4935
4948
  this.clearEventWatchers();
4936
4949
  this.stopMutationWatch();
4937
4950
  this.stopScreenCapture();
4951
+ if (this.visibilityHandler && typeof document !== "undefined") {
4952
+ document.removeEventListener("visibilitychange", this.visibilityHandler);
4953
+ this.visibilityHandler = null;
4954
+ }
4938
4955
  }
4939
4956
  attributeChangedCallback(name, _old, value) {
4940
4957
  if (name === "server") {
@@ -8073,6 +8090,7 @@ var COMPONENT_JS = `(() => {
8073
8090
  this.state = "connected";
8074
8091
  this.show();
8075
8092
  const windowType = window.opener ? "popup" : window.parent !== window ? "iframe" : "tab";
8093
+ this.isActive = typeof document === "undefined" || document.visibilityState !== "hidden";
8076
8094
  this.send("system", "connected", {
8077
8095
  windowId: this.windowId,
8078
8096
  browserId: this.browserId,
@@ -11373,6 +11391,8 @@ Use ancestors:true to see parent elements when inspecting deep elements.`,
11373
11391
  pierceFrames: L.boolean.describe("Pierce same-origin iframes (default true)").optional,
11374
11392
  compact: L.boolean.describe("Minimal output (default false)").optional,
11375
11393
  ancestors: L.boolean.describe("Include ancestor path from root (default false)").optional,
11394
+ includeBox: L.boolean.describe("Include each node's bounding box { x, y, w, h, visible } (default false)").optional,
11395
+ mode: L.string.describe("'actionable' returns a page action summary (url, title, headings, buttons, links, inputs, selects) instead of the DOM tree").optional,
11376
11396
  window: L.string.describe("Target window ID").optional
11377
11397
  }),
11378
11398
  examples: [
@@ -14063,7 +14083,10 @@ registerHandler(tree, async (body, ctx) => {
14063
14083
  pierceShadow: body.pierceShadow,
14064
14084
  pierceFrames: body.pierceFrames,
14065
14085
  visibleOnly: body.visibleOnly,
14066
- ancestors: body.ancestors
14086
+ interactiveOnly: body.interactiveOnly,
14087
+ ancestors: body.ancestors,
14088
+ includeBox: body.includeBox,
14089
+ mode: body.mode
14067
14090
  }, 5000, windowId);
14068
14091
  return Response.json(response, { headers: ctx.headers });
14069
14092
  });
@@ -18525,7 +18548,8 @@ var serverConfig = {
18525
18548
  label: existingWindow?.label,
18526
18549
  windowType: windowType || "tab"
18527
18550
  });
18528
- if (!focusedWindowId || focusedWindowId === windowId) {
18551
+ const isVisibleTab = (windowType || "tab") === "tab" && active !== false;
18552
+ if (!focusedWindowId || focusedWindowId === windowId || isVisibleTab) {
18529
18553
  focusedWindowId = windowId;
18530
18554
  }
18531
18555
  console.log(`${LOG_PREFIX} Window connected: ${windowId} (${url})`);
@@ -18569,6 +18593,9 @@ var serverConfig = {
18569
18593
  if (win) {
18570
18594
  win.active = active;
18571
18595
  win.lastSeen = Date.now();
18596
+ if (active && win.windowType === "tab") {
18597
+ focusedWindowId = windowId;
18598
+ }
18572
18599
  }
18573
18600
  }
18574
18601
  } catch {}
package/dist/server.js CHANGED
@@ -674,7 +674,7 @@ var injectorCode = `
674
674
  `;
675
675
 
676
676
  // src/version.ts
677
- var VERSION = "1.3.2";
677
+ var VERSION = "1.3.3";
678
678
 
679
679
  // src/embedded-assets.ts
680
680
  var APP_MD = `# Haltija App
@@ -1086,6 +1086,8 @@ Use ancestors:true to see parent elements when inspecting deep elements.
1086
1086
  | \`pierceFrames\` | boolean,null | Pierce same-origin iframes (default true) |
1087
1087
  | \`compact\` | boolean,null | Minimal output (default false) |
1088
1088
  | \`ancestors\` | boolean,null | Include ancestor path from root (default false) |
1089
+ | \`includeBox\` | boolean,null | Include each node's bounding box { x, y, w, h, visible } (default false) |
1090
+ | \`mode\` | string,null | 'actionable' returns a page action summary (url, title, headings, buttons, links, inputs, selects) instead of the DOM tree |
1089
1091
  | \`window\` | string,null | Target window ID |
1090
1092
 
1091
1093
  **Examples:**
@@ -3019,7 +3021,7 @@ var COMPONENT_JS = `(() => {
3019
3021
  });
3020
3022
 
3021
3023
  // src/version.ts
3022
- var VERSION = "1.3.2";
3024
+ var VERSION = "1.3.3";
3023
3025
 
3024
3026
  // src/text-selector.ts
3025
3027
  var TEXT_PSEUDO_RE = /:(?:text-is|has-text|text)\\(/;
@@ -4734,6 +4736,7 @@ var COMPONENT_JS = `(() => {
4734
4736
  displayStream = null;
4735
4737
  displayVideo = null;
4736
4738
  isActive = true;
4739
+ visibilityHandler = null;
4737
4740
  homeLeft = 0;
4738
4741
  homeBottom = 16;
4739
4742
  headless = false;
@@ -4925,6 +4928,16 @@ var COMPONENT_JS = `(() => {
4925
4928
  }
4926
4929
  this.interceptConsole();
4927
4930
  this.interceptDialogs();
4931
+ if (typeof document !== "undefined") {
4932
+ this.visibilityHandler = () => {
4933
+ if (document.visibilityState === "hidden") {
4934
+ this.deactivate();
4935
+ } else {
4936
+ this.activate();
4937
+ }
4938
+ };
4939
+ document.addEventListener("visibilitychange", this.visibilityHandler);
4940
+ }
4928
4941
  this.connect();
4929
4942
  }
4930
4943
  disconnectedCallback() {
@@ -4935,6 +4948,10 @@ var COMPONENT_JS = `(() => {
4935
4948
  this.clearEventWatchers();
4936
4949
  this.stopMutationWatch();
4937
4950
  this.stopScreenCapture();
4951
+ if (this.visibilityHandler && typeof document !== "undefined") {
4952
+ document.removeEventListener("visibilitychange", this.visibilityHandler);
4953
+ this.visibilityHandler = null;
4954
+ }
4938
4955
  }
4939
4956
  attributeChangedCallback(name, _old, value) {
4940
4957
  if (name === "server") {
@@ -8073,6 +8090,7 @@ var COMPONENT_JS = `(() => {
8073
8090
  this.state = "connected";
8074
8091
  this.show();
8075
8092
  const windowType = window.opener ? "popup" : window.parent !== window ? "iframe" : "tab";
8093
+ this.isActive = typeof document === "undefined" || document.visibilityState !== "hidden";
8076
8094
  this.send("system", "connected", {
8077
8095
  windowId: this.windowId,
8078
8096
  browserId: this.browserId,
@@ -11373,6 +11391,8 @@ Use ancestors:true to see parent elements when inspecting deep elements.`,
11373
11391
  pierceFrames: L.boolean.describe("Pierce same-origin iframes (default true)").optional,
11374
11392
  compact: L.boolean.describe("Minimal output (default false)").optional,
11375
11393
  ancestors: L.boolean.describe("Include ancestor path from root (default false)").optional,
11394
+ includeBox: L.boolean.describe("Include each node's bounding box { x, y, w, h, visible } (default false)").optional,
11395
+ mode: L.string.describe("'actionable' returns a page action summary (url, title, headings, buttons, links, inputs, selects) instead of the DOM tree").optional,
11376
11396
  window: L.string.describe("Target window ID").optional
11377
11397
  }),
11378
11398
  examples: [
@@ -14063,7 +14083,10 @@ registerHandler(tree, async (body, ctx) => {
14063
14083
  pierceShadow: body.pierceShadow,
14064
14084
  pierceFrames: body.pierceFrames,
14065
14085
  visibleOnly: body.visibleOnly,
14066
- ancestors: body.ancestors
14086
+ interactiveOnly: body.interactiveOnly,
14087
+ ancestors: body.ancestors,
14088
+ includeBox: body.includeBox,
14089
+ mode: body.mode
14067
14090
  }, 5000, windowId);
14068
14091
  return Response.json(response, { headers: ctx.headers });
14069
14092
  });
@@ -18525,7 +18548,8 @@ var serverConfig = {
18525
18548
  label: existingWindow?.label,
18526
18549
  windowType: windowType || "tab"
18527
18550
  });
18528
- if (!focusedWindowId || focusedWindowId === windowId) {
18551
+ const isVisibleTab = (windowType || "tab") === "tab" && active !== false;
18552
+ if (!focusedWindowId || focusedWindowId === windowId || isVisibleTab) {
18529
18553
  focusedWindowId = windowId;
18530
18554
  }
18531
18555
  console.log(`${LOG_PREFIX} Window connected: ${windowId} (${url})`);
@@ -18569,6 +18593,9 @@ var serverConfig = {
18569
18593
  if (win) {
18570
18594
  win.active = active;
18571
18595
  win.lastSeen = Date.now();
18596
+ if (active && win.windowType === "tab") {
18597
+ focusedWindowId = windowId;
18598
+ }
18572
18599
  }
18573
18600
  }
18574
18601
  } catch {}
package/dist/version.d.ts CHANGED
@@ -8,4 +8,4 @@
8
8
  * ⚠️ AUTO-GENERATED FROM package.json - DO NOT EDIT THIS FILE
9
9
  * ⚠️ To change the version, update package.json and run: bun run build
10
10
  */
11
- export declare const VERSION = "1.3.2";
11
+ export declare const VERSION = "1.3.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haltija",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Browser control for AI agents - query DOM, click, type, run JS, watch mutations",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",