@demigodmode/pi-web-agent 1.7.0 → 1.7.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.
package/CHANGELOG.md CHANGED
@@ -18,6 +18,19 @@ The format is intentionally simple and release-oriented.
18
18
  ### Breaking
19
19
  - None.
20
20
 
21
+ ## [1.7.1] - 2026-07-31
22
+ ### Added
23
+ - None.
24
+
25
+ ### Changed
26
+ - None.
27
+
28
+ ### Fixed
29
+ - The issue #34 Pi-loader compatibility patch now resolves hoisted and nested `tr46` and `cssstyle` installations correctly instead of assuming they live inside `pi-web-agent/node_modules`.
30
+
31
+ ### Breaking
32
+ - None.
33
+
21
34
  ## [1.7.0] - 2026-07-17
22
35
  ### Added
23
36
  - Exa is now available as a hosted search backend for `web_explore`, aimed at research-quality source discovery. Set `EXA_API_KEY` in the environment and choose `exa` from **Settings → Backends**. Closes #2.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@demigodmode/pi-web-agent",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Pi package for reliable web access with explicit search, fetch, and headless boundaries.",
5
5
  "type": "module",
6
6
  "main": "./dist/extension.js",
@@ -11,14 +11,30 @@
11
11
  // Safe to run multiple times and safe to no-op if the target files or
12
12
  // patterns are missing (e.g. a future dependency bump changes the shape).
13
13
  import { readFileSync, writeFileSync, existsSync } from "node:fs";
14
- import { fileURLToPath } from "node:url";
15
- import { dirname, join } from "node:path";
14
+ import { createRequire } from "node:module";
15
+ import { dirname, join, relative, sep } from "node:path";
16
16
 
17
- const __dirname = dirname(fileURLToPath(import.meta.url));
18
- const nodeModules = join(__dirname, "..", "node_modules");
17
+ const resolveFromHere = createRequire(import.meta.url).resolve;
18
+
19
+ function findPackageRoot(entryFile, packageName) {
20
+ let directory = dirname(entryFile);
21
+ while (true) {
22
+ const manifestFile = join(directory, "package.json");
23
+ if (existsSync(manifestFile)) {
24
+ const manifest = JSON.parse(readFileSync(manifestFile, "utf8"));
25
+ if (manifest.name === packageName) return directory;
26
+ }
27
+
28
+ const parent = dirname(directory);
29
+ if (parent === directory) {
30
+ throw new Error(`could not find the ${packageName} package root from ${entryFile}`);
31
+ }
32
+ directory = parent;
33
+ }
34
+ }
19
35
 
20
36
  function patchTr46() {
21
- const file = join(nodeModules, "tr46", "index.js");
37
+ const file = resolveFromHere("tr46");
22
38
  if (!existsSync(file)) {
23
39
  console.debug("patch-jiti-compat: tr46/index.js not found, skipping");
24
40
  return;
@@ -45,13 +61,14 @@ module.exports[Symbol.iterator] = Set.prototype[Symbol.iterator].bind(module.exp
45
61
  `;
46
62
 
47
63
  function patchCssstyleSetExports() {
64
+ const packageRoot = findPackageRoot(resolveFromHere("cssstyle"), "cssstyle");
48
65
  const files = [
49
- join(nodeModules, "cssstyle", "lib", "allExtraProperties.js"),
50
- join(nodeModules, "cssstyle", "lib", "generated", "allProperties.js"),
51
- join(nodeModules, "cssstyle", "lib", "generated", "implementedProperties.js"),
66
+ join(packageRoot, "lib", "allExtraProperties.js"),
67
+ join(packageRoot, "lib", "generated", "allProperties.js"),
68
+ join(packageRoot, "lib", "generated", "implementedProperties.js"),
52
69
  ];
53
70
  for (const file of files) {
54
- const label = `cssstyle/${file.slice(nodeModules.length + 1)}`;
71
+ const label = `cssstyle/${relative(packageRoot, file).split(sep).join("/")}`;
55
72
  if (!existsSync(file)) {
56
73
  console.debug(`patch-jiti-compat: ${label} not found, skipping`);
57
74
  continue;
@@ -67,10 +84,15 @@ function patchCssstyleSetExports() {
67
84
  }
68
85
  }
69
86
 
70
- try {
71
- patchTr46();
72
- patchCssstyleSetExports();
73
- } catch (err) {
74
- // Never fail the install over a best-effort compat patch.
75
- console.warn("patch-jiti-compat: skipped, non-fatal error:", err.message);
87
+ function runBestEffort(label, patch) {
88
+ try {
89
+ patch();
90
+ } catch (err) {
91
+ // Never fail the install over a best-effort compat patch.
92
+ const message = err instanceof Error ? err.message : String(err);
93
+ console.warn(`patch-jiti-compat: ${label} skipped, non-fatal error: ${message}`);
94
+ }
76
95
  }
96
+
97
+ runBestEffort("tr46", patchTr46);
98
+ runBestEffort("cssstyle", patchCssstyleSetExports);