@trim21/personal-pi-extensions 0.1.611 → 0.1.613

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.
Files changed (75) hide show
  1. package/package.json +2 -2
  2. package/src/aft/config.ts +9 -3
  3. package/src/aft/index.ts +6 -2
  4. package/src/aft/logger.ts +9 -3
  5. package/src/aft/tools.ts +5 -3
  6. package/src/bwrap/approval-rules.ts +51 -18
  7. package/src/bwrap/approval-suggest.ts +12 -4
  8. package/src/bwrap/core.ts +39 -13
  9. package/src/bwrap/dcg-scan.ts +16 -6
  10. package/src/bwrap/holder.ts +3 -1
  11. package/src/bwrap/mihomo-config.ts +18 -6
  12. package/src/bwrap/network-stack.ts +30 -10
  13. package/src/bwrap/runtime.ts +36 -14
  14. package/src/claude-code/common.ts +6 -2
  15. package/src/claude-code/edit-utils.ts +3 -1
  16. package/src/claude-code/files.ts +40 -14
  17. package/src/claude-code/glob.ts +12 -4
  18. package/src/claude-code/grep.ts +41 -14
  19. package/src/claude-code/session-tools.ts +18 -6
  20. package/src/claude-code/shell.ts +9 -3
  21. package/src/gh/base.ts +72 -24
  22. package/src/gh/tools/download-release-assets.ts +12 -4
  23. package/src/gh/tools/list-releases.ts +3 -1
  24. package/src/gh/tools/list-workflow-runs.ts +9 -3
  25. package/src/gh/tools/read-ci-logs.ts +21 -7
  26. package/src/gh/tools/read-repo.ts +3 -1
  27. package/src/lib/cli-args.ts +6 -2
  28. package/src/lib/cli.ts +55 -22
  29. package/src/lib/file-reads.ts +24 -8
  30. package/src/lib/github.ts +35 -12
  31. package/src/lib/lsp/adapter.ts +6 -2
  32. package/src/lib/lsp/bin.ts +12 -4
  33. package/src/lib/lsp/client.ts +205 -69
  34. package/src/lib/lsp/diagnostic.ts +6 -2
  35. package/src/lib/lsp/inspect-tool.ts +25 -9
  36. package/src/lib/lsp/lsp.ts +154 -58
  37. package/src/lib/lsp/rename-tool.ts +11 -4
  38. package/src/lib/lsp/rename.ts +25 -8
  39. package/src/lib/lsp/server-config.ts +41 -14
  40. package/src/lib/lsp/watcher.ts +51 -17
  41. package/src/lib/path.ts +18 -6
  42. package/src/lib/proc.ts +3 -1
  43. package/src/lib/proxy.ts +9 -3
  44. package/src/lib/request-policy.ts +3 -1
  45. package/src/lib/seq-state.ts +3 -1
  46. package/src/lib/ui.ts +23 -8
  47. package/src/lib/write-guard.ts +21 -7
  48. package/src/openai-cost/config.ts +3 -1
  49. package/src/openai-cost/cost.ts +54 -18
  50. package/src/openai-cost/index.ts +3 -1
  51. package/src/openai-cost/provider.ts +6 -2
  52. package/src/opencode/bash.ts +9 -3
  53. package/src/opencode/edit-engine.ts +63 -41
  54. package/src/opencode/files.ts +30 -10
  55. package/src/opencode/glob.ts +3 -1
  56. package/src/opencode/grep.ts +12 -4
  57. package/src/opencode/question.ts +3 -1
  58. package/src/opencode/ripgrep.ts +23 -9
  59. package/src/opencode/todo.ts +3 -1
  60. package/src/session-name.ts +40 -16
  61. package/src/spawn-agent-agents.ts +18 -6
  62. package/src/spawn-agent.ts +58 -21
  63. package/src/system-prompt/index.ts +9 -3
  64. package/src/talk/core.ts +143 -48
  65. package/src/talk/format.ts +12 -4
  66. package/src/talk/group.ts +9 -3
  67. package/src/talk/index.ts +30 -10
  68. package/src/talk/mailbox.ts +30 -10
  69. package/src/talk/policy.ts +10 -5
  70. package/src/talk/registry.ts +35 -12
  71. package/src/talk/storage.ts +3 -1
  72. package/src/vision-agent.ts +41 -14
  73. package/src/web/config.ts +3 -1
  74. package/src/web/fetch.ts +75 -25
  75. package/src/web/search.ts +30 -10
package/src/web/search.ts CHANGED
@@ -51,13 +51,17 @@ export interface SearchOptions {
51
51
  }
52
52
 
53
53
  function clampNumResults(value: number | undefined): number {
54
- if (typeof value !== "number" || !Number.isFinite(value)) return 5;
54
+ if (typeof value !== "number" || !Number.isFinite(value)) {
55
+ return 5;
56
+ }
55
57
  return Math.max(1, Math.min(Math.floor(value), 50));
56
58
  }
57
59
 
58
60
  function normalizeDomain(raw: string): string | undefined {
59
61
  const input = raw.trim().toLowerCase().replace(/^-/, "").trim();
60
- if (!input) return undefined;
62
+ if (!input) {
63
+ return undefined;
64
+ }
61
65
  try {
62
66
  const host = input.includes("://")
63
67
  ? new URL(input).hostname
@@ -76,7 +80,9 @@ function splitDomainFilter(domainFilter: string[] | undefined): {
76
80
  const excludeSites: string[] = [];
77
81
  for (const raw of domainFilter ?? []) {
78
82
  const domain = normalizeDomain(raw);
79
- if (!domain) continue;
83
+ if (!domain) {
84
+ continue;
85
+ }
80
86
  (raw.trimStart().startsWith("-") ? excludeSites : includeSites).push(domain);
81
87
  }
82
88
  return { includeSites, excludeSites };
@@ -90,10 +96,18 @@ export function buildSearchBody(query: string, options: SearchOptions): Record<s
90
96
  max_results: numResults,
91
97
  crawl_results: options.includeContent ? Math.min(numResults, 5) : 0,
92
98
  };
93
- if (options.recencyFilter) body.time_range = options.recencyFilter;
94
- if (options.searchService) body.search_service = options.searchService;
95
- if (includeSites.length > 0) body.include_sites = includeSites;
96
- if (excludeSites.length > 0) body.exclude_sites = excludeSites;
99
+ if (options.recencyFilter) {
100
+ body.time_range = options.recencyFilter;
101
+ }
102
+ if (options.searchService) {
103
+ body.search_service = options.searchService;
104
+ }
105
+ if (includeSites.length > 0) {
106
+ body.include_sites = includeSites;
107
+ }
108
+ if (excludeSites.length > 0) {
109
+ body.exclude_sites = excludeSites;
110
+ }
97
111
  return body;
98
112
  }
99
113
 
@@ -108,14 +122,18 @@ function mapHits(
108
122
  const hits: SearchHit[] = [];
109
123
  for (const item of results) {
110
124
  const url = item.link?.trim();
111
- if (!url) continue;
125
+ if (!url) {
126
+ continue;
127
+ }
112
128
  const hit: SearchHit = {
113
129
  title: item.title?.trim() || url,
114
130
  url,
115
131
  snippet: item.snippet?.replaceAll(/\s+/g, " ").trim() || "",
116
132
  };
117
133
  const content = item.content?.trim();
118
- if (content) hit.content = content;
134
+ if (content) {
135
+ hit.content = content;
136
+ }
119
137
  hits.push(hit);
120
138
  }
121
139
  return hits;
@@ -232,7 +250,9 @@ export default function webSearchTool(pi: ExtensionAPI): void {
232
250
  const hits: SearchHit[] = [];
233
251
  for (const result of results) {
234
252
  for (const hit of result.hits) {
235
- if (seen.has(hit.url)) continue;
253
+ if (seen.has(hit.url)) {
254
+ continue;
255
+ }
236
256
  seen.add(hit.url);
237
257
  hits.push(hit);
238
258
  }