hypha-debugger 0.1.4 → 0.1.6

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
@@ -21,7 +21,7 @@ export { getPageInfo, getConsoleLogs, installConsoleCapture } from "./services/i
21
21
  export { queryDom, clickElement, fillInput, scrollTo, getHtml, getComputedStyles, getElementBounds, } from "./services/dom.js";
22
22
  export { takeScreenshot } from "./services/screenshot.js";
23
23
  export { executeScript } from "./services/execute.js";
24
- export { navigate, goBack, goForward, reload } from "./services/navigate.js";
24
+ export { navigate, goBack, goForward, reload, softReplace, installNavigationInterceptor } from "./services/navigate.js";
25
25
  export { getReactTree } from "./services/react.js";
26
26
  export { getBrowserState, clickElementByIndex, inputText, selectOption, scroll, removeHighlights, disposeController, } from "./services/page-controller.js";
27
27
  export { generateSkillMd } from "./services/skill.js";
@@ -1,6 +1,30 @@
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
  */
14
+ /**
15
+ * Perform a soft page replacement: fetch HTML, inject debugger script,
16
+ * replace the document via document.write(). If the fetch or write fails,
17
+ * falls back to hard navigation.
18
+ */
19
+ export declare function softReplace(url: string, pushState?: string): void;
20
+ /**
21
+ * Install global listeners that intercept same-origin link clicks and
22
+ * form submissions, routing them through soft navigation so the debugger
23
+ * stays connected.
24
+ *
25
+ * Called once from HyphaDebugger.start().
26
+ */
27
+ export declare function installNavigationInterceptor(): () => void;
4
28
  export declare function navigate(url: string): {
5
29
  success: boolean;
6
30
  message: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypha-debugger",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
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",