hypha-debugger 0.2.9 → 0.3.1

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.
@@ -2,13 +2,15 @@
2
2
  * Wrap a function with correct, unminified parameter names for hypha-rpc.
3
3
  *
4
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
5
+ * hypha-rpc's getFunctionInfo() parses Function.toString() to map kwargs to
6
6
  * positional args. With minified names, kwargs like {code: '...'} can't be
7
7
  * mapped and args are silently dropped.
8
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.
9
+ * CSP NOTE: this used to build the wrapper with `new Function(...)`, but that is
10
+ * blocked on pages whose Content Security Policy lacks `'unsafe-eval'` (the exact
11
+ * pages the bookmarklet targets). Instead we use a normal closure and OVERRIDE its
12
+ * `.toString()` so hypha-rpc still reads the real, unminified parameter names from
13
+ * the schema — no eval / Function constructor involved.
12
14
  *
13
15
  * Additionally, it handles the case where hypha-rpc passes kwargs as a single
14
16
  * object argument (e.g. `fn({url: "..."})` instead of `fn("...")`). The
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypha-debugger",
3
- "version": "0.2.9",
3
+ "version": "0.3.1",
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",
@@ -18,6 +18,8 @@
18
18
  ],
19
19
  "scripts": {
20
20
  "build": "rollup -c && tsc --declaration --emitDeclarationOnly --outDir dist",
21
+ "postbuild": "node scripts/build-bookmarklet.mjs",
22
+ "build:bookmarklet": "node scripts/build-bookmarklet.mjs",
21
23
  "dev": "rollup -c -w",
22
24
  "test": "vitest run",
23
25
  "test:watch": "vitest",