@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.
- package/package.json +2 -2
- package/src/aft/config.ts +9 -3
- package/src/aft/index.ts +6 -2
- package/src/aft/logger.ts +9 -3
- package/src/aft/tools.ts +5 -3
- package/src/bwrap/approval-rules.ts +51 -18
- package/src/bwrap/approval-suggest.ts +12 -4
- package/src/bwrap/core.ts +39 -13
- package/src/bwrap/dcg-scan.ts +16 -6
- package/src/bwrap/holder.ts +3 -1
- package/src/bwrap/mihomo-config.ts +18 -6
- package/src/bwrap/network-stack.ts +30 -10
- package/src/bwrap/runtime.ts +36 -14
- package/src/claude-code/common.ts +6 -2
- package/src/claude-code/edit-utils.ts +3 -1
- package/src/claude-code/files.ts +40 -14
- package/src/claude-code/glob.ts +12 -4
- package/src/claude-code/grep.ts +41 -14
- package/src/claude-code/session-tools.ts +18 -6
- package/src/claude-code/shell.ts +9 -3
- package/src/gh/base.ts +72 -24
- package/src/gh/tools/download-release-assets.ts +12 -4
- package/src/gh/tools/list-releases.ts +3 -1
- package/src/gh/tools/list-workflow-runs.ts +9 -3
- package/src/gh/tools/read-ci-logs.ts +21 -7
- package/src/gh/tools/read-repo.ts +3 -1
- package/src/lib/cli-args.ts +6 -2
- package/src/lib/cli.ts +55 -22
- package/src/lib/file-reads.ts +24 -8
- package/src/lib/github.ts +35 -12
- package/src/lib/lsp/adapter.ts +6 -2
- package/src/lib/lsp/bin.ts +12 -4
- package/src/lib/lsp/client.ts +205 -69
- package/src/lib/lsp/diagnostic.ts +6 -2
- package/src/lib/lsp/inspect-tool.ts +25 -9
- package/src/lib/lsp/lsp.ts +154 -58
- package/src/lib/lsp/rename-tool.ts +11 -4
- package/src/lib/lsp/rename.ts +25 -8
- package/src/lib/lsp/server-config.ts +41 -14
- package/src/lib/lsp/watcher.ts +51 -17
- package/src/lib/path.ts +18 -6
- package/src/lib/proc.ts +3 -1
- package/src/lib/proxy.ts +9 -3
- package/src/lib/request-policy.ts +3 -1
- package/src/lib/seq-state.ts +3 -1
- package/src/lib/ui.ts +23 -8
- package/src/lib/write-guard.ts +21 -7
- package/src/openai-cost/config.ts +3 -1
- package/src/openai-cost/cost.ts +54 -18
- package/src/openai-cost/index.ts +3 -1
- package/src/openai-cost/provider.ts +6 -2
- package/src/opencode/bash.ts +9 -3
- package/src/opencode/edit-engine.ts +63 -41
- package/src/opencode/files.ts +30 -10
- package/src/opencode/glob.ts +3 -1
- package/src/opencode/grep.ts +12 -4
- package/src/opencode/question.ts +3 -1
- package/src/opencode/ripgrep.ts +23 -9
- package/src/opencode/todo.ts +3 -1
- package/src/session-name.ts +40 -16
- package/src/spawn-agent-agents.ts +18 -6
- package/src/spawn-agent.ts +58 -21
- package/src/system-prompt/index.ts +9 -3
- package/src/talk/core.ts +143 -48
- package/src/talk/format.ts +12 -4
- package/src/talk/group.ts +9 -3
- package/src/talk/index.ts +30 -10
- package/src/talk/mailbox.ts +30 -10
- package/src/talk/policy.ts +10 -5
- package/src/talk/registry.ts +35 -12
- package/src/talk/storage.ts +3 -1
- package/src/vision-agent.ts +41 -14
- package/src/web/config.ts +3 -1
- package/src/web/fetch.ts +75 -25
- 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))
|
|
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)
|
|
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)
|
|
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)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (
|
|
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)
|
|
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)
|
|
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))
|
|
253
|
+
if (seen.has(hit.url)) {
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
236
256
|
seen.add(hit.url);
|
|
237
257
|
hits.push(hit);
|
|
238
258
|
}
|