@trim21/personal-pi-extensions 0.1.622 → 0.1.626
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 +3 -3
- package/src/aft/config.ts +1 -1
- package/src/aft/tools.ts +4 -4
- package/src/bwrap/core.ts +1 -1
- package/src/bwrap/holder.js +3 -1
- package/src/bwrap/network-stack.ts +1 -1
- package/src/bwrap/runtime.ts +1 -1
- package/src/claude-code/files.ts +1 -1
- package/src/claude-code/search.ts +2 -3
- package/src/claude-code/session-tools.ts +1 -1
- package/src/claude-code/shell.ts +1 -1
- package/src/lib/cli.ts +1 -1
- package/src/lib/file-reads.ts +1 -1
- package/src/lib/github.ts +4 -4
- package/src/lib/lsp/client.ts +169 -176
- package/src/lib/lsp/lsp.ts +7 -7
- package/src/lib/lsp/rename.ts +1 -1
- package/src/lib/lsp/watcher.ts +1 -1
- package/src/lib/path.ts +1 -1
- package/src/lib/proxy.ts +2 -2
- package/src/lib/request-policy.ts +1 -1
- package/src/openai-cost/config.ts +4 -4
- package/src/openai-cost/cost.ts +2 -2
- package/src/opencode/files.ts +2 -2
- package/src/opencode/grep.ts +1 -1
- package/src/opencode/index.ts +1 -25
- package/src/opencode/question.ts +1 -3
- package/src/opencode/todo.ts +4 -5
- package/src/talk/format.ts +1 -1
- package/src/talk/group.ts +3 -3
- package/src/talk/mailbox.ts +6 -6
- package/src/talk/policy.ts +3 -3
- package/src/talk/registry.ts +4 -4
- package/src/web/config.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trim21/personal-pi-extensions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.626",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Custom pi coding-agent extensions: bwrap sandbox, workspace guard, opencode edit, and more",
|
|
6
6
|
"keywords": [
|
|
@@ -106,8 +106,8 @@
|
|
|
106
106
|
"octokit": "^5.0.5",
|
|
107
107
|
"turndown": "^7.2.0",
|
|
108
108
|
"undici": "^8.0.0",
|
|
109
|
-
"vscode-
|
|
110
|
-
"vscode-languageserver-types": "^3.18.
|
|
109
|
+
"vscode-languageserver-protocol": "^3.18.4",
|
|
110
|
+
"vscode-languageserver-types": "^3.18.4",
|
|
111
111
|
"web-tree-sitter": "^0.27.0"
|
|
112
112
|
},
|
|
113
113
|
"optionalDependencies": {
|
package/src/aft/config.ts
CHANGED
|
@@ -24,7 +24,7 @@ import { parseWithSchema } from "../lib/parse-with-schema.js";
|
|
|
24
24
|
/** aft 侧走 HTTP embeddings 端点的后端;fastembed(本地 ONNX)有意排除在外。 */
|
|
25
25
|
const REMOTE_SEMANTIC_BACKENDS = ["openai_compatible", "ollama"] as const;
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
type RemoteSemanticBackend = (typeof REMOTE_SEMANTIC_BACKENDS)[number];
|
|
28
28
|
|
|
29
29
|
/** 就绪的外部 embedding 后端:类型受支持且配了 base_url。 */
|
|
30
30
|
export interface SemanticRemote {
|
package/src/aft/tools.ts
CHANGED
|
@@ -61,7 +61,7 @@ export interface AftToolContext {
|
|
|
61
61
|
getState(): AftState;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
function bridgeFor(ctx: AftToolContext): AftProjectTransport {
|
|
65
65
|
return ctx.getState().pool.pool.getBridge(ctx.cwd);
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -79,7 +79,7 @@ export function compactArgs(args: Record<string, unknown>): Record<string, unkno
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
/** 人类视角的调用记录:input params + 与 LLM 相同的输出结果。 */
|
|
82
|
-
|
|
82
|
+
function buildPendantMarkdown(params: {
|
|
83
83
|
title: string;
|
|
84
84
|
input: unknown;
|
|
85
85
|
output: string;
|
|
@@ -327,7 +327,7 @@ const CALLGRAPH_SOFT_CODES = new Set(["symbol_not_found", "callgraph_building"])
|
|
|
327
327
|
* 以及冷构建本身超过内联窗口。这里在扩展侧重试,预算耗尽才把 building
|
|
328
328
|
* 文本交给模型。
|
|
329
329
|
*/
|
|
330
|
-
|
|
330
|
+
const CALLGRAPH_BUILD_RETRY_BUDGET_MS = 90_000;
|
|
331
331
|
const CALLGRAPH_BUILD_RETRY_INTERVAL_MS = 3_000;
|
|
332
332
|
|
|
333
333
|
export async function callCallgraphWithBuildRetry(
|
|
@@ -434,7 +434,7 @@ interface StatusSubscribableBridge {
|
|
|
434
434
|
* 运行时能力探测:`AftProjectTransport` 接口没声明 subscribeStatus,但实际实现
|
|
435
435
|
* (BinaryBridge)有。用 in 收窄做真检查,而不是断言成「一定支持」。
|
|
436
436
|
*/
|
|
437
|
-
|
|
437
|
+
function isStatusSubscribable(
|
|
438
438
|
bridge: AftProjectTransport,
|
|
439
439
|
): bridge is AftProjectTransport & StatusSubscribableBridge {
|
|
440
440
|
return "subscribeStatus" in bridge && typeof bridge.subscribeStatus === "function";
|
package/src/bwrap/core.ts
CHANGED
|
@@ -85,7 +85,7 @@ const bwrapConfigProperties = {
|
|
|
85
85
|
|
|
86
86
|
// 配置文件容忍未知字段:schema 之外的字段(如新版本扩展新增的配置)会被忽略,
|
|
87
87
|
// 避免整个 bwrap 配置因单个未知字段失效;已声明字段仍做类型/取值校验。
|
|
88
|
-
|
|
88
|
+
const bwrapConfigSchema = Type.Object(bwrapConfigProperties, {
|
|
89
89
|
additionalProperties: true,
|
|
90
90
|
});
|
|
91
91
|
|
package/src/bwrap/holder.js
CHANGED
|
@@ -18,7 +18,9 @@ function tap0Exists() {
|
|
|
18
18
|
}
|
|
19
19
|
async function waitFor(attempts, delayMs, predicate) {
|
|
20
20
|
for (let i = 0; i < attempts; i++) {
|
|
21
|
-
if (await predicate())
|
|
21
|
+
if (await predicate()) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
22
24
|
await sleep(delayMs);
|
|
23
25
|
}
|
|
24
26
|
return false;
|
|
@@ -31,7 +31,7 @@ export interface NetworkStackOptions {
|
|
|
31
31
|
readonly onHolderOutput?: (chunk: string) => void;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
interface NetworkStackExecOptions {
|
|
35
35
|
readonly command: string;
|
|
36
36
|
readonly cwd: string;
|
|
37
37
|
readonly bwrapPath: string;
|
package/src/bwrap/runtime.ts
CHANGED
|
@@ -368,7 +368,7 @@ export function describeSandbox(
|
|
|
368
368
|
* 状态块不再附——提权请求刚被用户拒绝,再提示 dangerouslyDisableSandbox 只会
|
|
369
369
|
* 诱导重复请求,作用域描述由本提醒承担。
|
|
370
370
|
*/
|
|
371
|
-
|
|
371
|
+
function describeSandboxChoice(resolved: ResolvedBwrap): string {
|
|
372
372
|
return [
|
|
373
373
|
"<system-reminder>",
|
|
374
374
|
`The user ran this command in the sandbox instead of approving unsandboxed execution: ${describeLimits(resolved)}.`,
|
package/src/claude-code/files.ts
CHANGED
|
@@ -16,7 +16,6 @@ export function registerSearchTools(pi: ExtensionAPI): void {
|
|
|
16
16
|
registerGrepTool(pi);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
// Re-exported for tests
|
|
20
|
-
//
|
|
21
|
-
export { globFiles } from "./glob.js";
|
|
19
|
+
// Re-exported for tests that import pure functions from "./search.js"; the
|
|
20
|
+
// implementations live in the split files above.
|
|
22
21
|
export { buildGrepArguments, pageGrepOutput } from "./grep.js";
|
package/src/claude-code/shell.ts
CHANGED
|
@@ -72,7 +72,7 @@ function appendTruncationNotice(
|
|
|
72
72
|
* 截断时追加 `[Showing lines X-Y of N. Full output: path]` 提示。
|
|
73
73
|
* opencode 套件的 bash 工具复用同一逻辑。
|
|
74
74
|
*/
|
|
75
|
-
|
|
75
|
+
function formatBashSuccess(result: Awaited<ReturnType<BwrapRuntime["execute"]>>): {
|
|
76
76
|
content: { type: "text"; text: string }[];
|
|
77
77
|
details: BashToolDetails | undefined;
|
|
78
78
|
} {
|
package/src/lib/cli.ts
CHANGED
|
@@ -39,7 +39,7 @@ import { shlexSplit } from "./cli-args.js";
|
|
|
39
39
|
import { isRecord, isUnknownArray } from "./narrow.js";
|
|
40
40
|
|
|
41
41
|
/** Per-flag CLI metadata on top of the typebox schema. */
|
|
42
|
-
|
|
42
|
+
interface FlagMeta {
|
|
43
43
|
/** Optional short alias (single character), e.g. "n" for `-n`. */
|
|
44
44
|
short?: string;
|
|
45
45
|
/** Help line for this flag; defaults to the schema `description`. */
|
package/src/lib/file-reads.ts
CHANGED
|
@@ -86,7 +86,7 @@ export async function readStateKey(filePath: string): Promise<string> {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
function snapshotsEqual(left: FileSnapshot, right: FileSnapshot): boolean {
|
|
90
90
|
return left.digest === right.digest;
|
|
91
91
|
}
|
|
92
92
|
|
package/src/lib/github.ts
CHANGED
|
@@ -254,7 +254,7 @@ function ghAuthToken(): Promise<string> {
|
|
|
254
254
|
* Error thrown when the GitHub search API rejects the request. Carries the
|
|
255
255
|
* original toolcall params so the model can see the exact input.
|
|
256
256
|
*/
|
|
257
|
-
|
|
257
|
+
class GithubSearchError extends Error {
|
|
258
258
|
readonly params: SearchParams;
|
|
259
259
|
readonly status: number | undefined;
|
|
260
260
|
|
|
@@ -279,7 +279,7 @@ function describeHttpError(status: number | undefined): string {
|
|
|
279
279
|
return `GitHub API error${status === undefined ? "" : ` (HTTP ${status})`}`;
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
|
|
282
|
+
interface GithubApi {
|
|
283
283
|
/** Run an octokit request; retries once with a fresh token on 401. */
|
|
284
284
|
call<T>(fn: (octokit: Octokit) => Promise<T>): Promise<T>;
|
|
285
285
|
}
|
|
@@ -299,7 +299,7 @@ export interface GithubClientOptions {
|
|
|
299
299
|
* module-level state. A stale cached token can produce 401s; the cache is
|
|
300
300
|
* dropped and the request retried once in that case.
|
|
301
301
|
*/
|
|
302
|
-
|
|
302
|
+
function createGithubApi(options: GithubClientOptions = {}): GithubApi {
|
|
303
303
|
let client: Octokit | undefined;
|
|
304
304
|
|
|
305
305
|
async function getClient(): Promise<Octokit> {
|
|
@@ -400,7 +400,7 @@ export interface ActionJob {
|
|
|
400
400
|
}
|
|
401
401
|
|
|
402
402
|
/** One step of a workflow run job, as the REST API reports it. */
|
|
403
|
-
|
|
403
|
+
interface RunJobStep {
|
|
404
404
|
readonly name: string;
|
|
405
405
|
readonly number: number;
|
|
406
406
|
readonly status: string;
|