hypha-debugger 0.1.3 → 0.1.5

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/index.d.ts CHANGED
@@ -11,10 +11,25 @@
11
11
  * Programmatic usage:
12
12
  * import { startDebugger } from 'hypha-debugger';
13
13
  * const session = await startDebugger({ server_url: 'https://hypha.aicell.io' });
14
+ *
15
+ * Library usage (import individual functions):
16
+ * import { getPageInfo, clickElement, wrapFn, PageController } from 'hypha-debugger';
14
17
  */
15
18
  export { HyphaDebugger } from "./debugger.js";
16
19
  export type { DebuggerConfig, DebugSession } from "./debugger.js";
20
+ export { getPageInfo, getConsoleLogs, installConsoleCapture } from "./services/info.js";
21
+ export { queryDom, clickElement, fillInput, scrollTo, getHtml, getComputedStyles, getElementBounds, } from "./services/dom.js";
22
+ export { takeScreenshot } from "./services/screenshot.js";
23
+ export { executeScript } from "./services/execute.js";
24
+ export { navigate, goBack, goForward, reload } from "./services/navigate.js";
25
+ export { getReactTree } from "./services/react.js";
26
+ export { getBrowserState, clickElementByIndex, inputText, selectOption, scroll, removeHighlights, disposeController, } from "./services/page-controller.js";
27
+ export { generateSkillMd } from "./services/skill.js";
28
+ export { wrapFn } from "./utils/wrap-fn.js";
29
+ export { AICursor } from "./ui/cursor.js";
30
+ export { PageController } from "./page-controller/index.js";
17
31
  export type { PageInfo } from "./utils/env.js";
32
+ export type { FlatDomTree, DomNode, TextDomNode, ElementDomNode, InteractiveElementDomNode, } from "./page-controller/types.js";
18
33
  import { type DebuggerConfig, type DebugSession } from "./debugger.js";
19
34
  /**
20
35
  * Start the Hypha debugger. Connects to a Hypha server and registers
@@ -1,5 +1,15 @@
1
1
  /**
2
- * Navigation service.
2
+ * Navigation service with auto-reconnect support.
3
+ *
4
+ * For agent-triggered reload() and same-origin navigate(), we use a "soft"
5
+ * approach: fetch the target HTML, inject the debugger <script> tag, then
6
+ * replace the document via document.write(). The injected script auto-starts
7
+ * from sessionStorage config, so the debugger reconnects with the same
8
+ * workspace and service ID. The agent's URL stays stable.
9
+ *
10
+ * For cross-origin navigate(), goBack(), and goForward(), we fall back to
11
+ * normal navigation. The debugger config is saved to sessionStorage so
12
+ * re-clicking the bookmarklet reconnects seamlessly.
3
13
  */
4
14
  export declare function navigate(url: string): {
5
15
  success: boolean;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Wrap a function with correct, unminified parameter names for hypha-rpc.
3
+ *
4
+ * In production builds, Babel/Terser minifies parameter names (e.g. 'code' → 'e').
5
+ * hypha-rpc's getParamNames() parses Function.toString() to map kwargs to
6
+ * positional args. With minified names, kwargs like {code: '...'} can't be
7
+ * mapped and args are silently dropped.
8
+ *
9
+ * This helper uses new Function() to create a wrapper whose parameter names
10
+ * are taken from the function's __schema__ property, so hypha-rpc always sees
11
+ * the real parameter names regardless of minification.
12
+ */
13
+ export declare function wrapFn(fn: any): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypha-debugger",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Injectable debugger for web pages and AI agents, powered by Hypha RPC",
5
5
  "type": "module",
6
6
  "main": "dist/hypha-debugger.js",