@zeldrisho/pi-web-search 0.12.0 → 0.12.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
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.12.1] - 2026-10-23
11
+
12
+ ### Security
13
+
14
+ - Use static regular expressions when parsing supported API key names from `.env` files.
15
+
10
16
  ## [0.12.0] - 2026-10-20
11
17
 
12
18
  ### Changed
@@ -146,7 +152,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
146
152
 
147
153
  - Add bounded Brave web search ([cbc9491](https://github.com/zeldrisho/pi-packages/commit/cbc9491dce36555ab91b6bef203ec8b380596a89))
148
154
 
149
- [Unreleased]: https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.12.0...HEAD
155
+ [Unreleased]: https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.12.1...HEAD
156
+ [0.12.1]: https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.12.0...pi-web-search-v0.12.1
150
157
  [0.12.0]: https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.11.0...pi-web-search-v0.12.0
151
158
  [0.11.0]: https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.10.0...pi-web-search-v0.11.0
152
159
  [0.10.0]: https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.9.0...pi-web-search-v0.10.0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zeldrisho/pi-web-search",
3
- "version": "0.12.0",
4
- "description": "Pi extension for bounded Brave web search and LLM context retrieval",
3
+ "version": "0.12.1",
4
+ "description": "Pi extension for bounded Brave web search with generated-answer fallback",
5
5
  "keywords": [
6
6
  "brave-search",
7
7
  "pi",
@@ -30,7 +30,6 @@
30
30
  "access": "public"
31
31
  },
32
32
  "devDependencies": {
33
- "@earendil-works/pi-ai": "^1.3.0",
34
33
  "@earendil-works/pi-coding-agent": "^1.3.0",
35
34
  "@earendil-works/pi-tui": "^1.3.0",
36
35
  "typebox": "^1.4.2",
@@ -39,7 +38,6 @@
39
38
  "vite-plus": "1.3.0"
40
39
  },
41
40
  "peerDependencies": {
42
- "@earendil-works/pi-ai": "*",
43
41
  "@earendil-works/pi-coding-agent": "*",
44
42
  "@earendil-works/pi-tui": "*",
45
43
  "typebox": "*"
@@ -19,13 +19,22 @@ const MAX_DOT_ENV_BYTES = 64 * 1024;
19
19
  *
20
20
  * Only the extracted value is used; file contents are never echoed into
21
21
  * errors or tool output.
22
+ * Reads the first matching assignment, trimming surrounding whitespace and
23
+ * removing paired single or double quotes. Does not interpret `export`,
24
+ * inline comments, escapes, or variable expansion.
25
+ *
26
+ * @param keyName - Selects the Search or Answers key; defaults to the Search key
27
+ * @returns The value, or `undefined` when the first assignment is empty or no assignment matches
22
28
  */
23
29
  export function extractKeyValue(
24
30
  text: string,
25
31
  keyName: ApiKeyName = "BRAVE_SEARCH_API_KEY",
26
32
  ): string | undefined {
27
33
  for (const line of text.split(/\r?\n/)) {
28
- const match = line.match(new RegExp(`^\\s*${keyName}\\s*=\\s*(.*)$`));
34
+ const match =
35
+ keyName === "BRAVE_SEARCH_API_KEY"
36
+ ? line.match(/^\s*BRAVE_SEARCH_API_KEY\s*=\s*(.*)$/)
37
+ : line.match(/^\s*BRAVE_ANSWERS_API_KEY\s*=\s*(.*)$/);
29
38
 
30
39
  if (!match) continue;
31
40
  let value = match[1].trim();