@trim21/personal-pi-extensions 0.0.320 → 0.0.323
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 +1 -1
- package/src/bwrap/runtime.ts +13 -1
- package/src/claude-code/bash.md +1 -0
- package/src/claude-code/shell.ts +1 -0
- package/src/opencode/bash.ts +2 -1
package/package.json
CHANGED
package/src/bwrap/runtime.ts
CHANGED
|
@@ -69,6 +69,8 @@ export interface BwrapExecutionRequest {
|
|
|
69
69
|
timeout?: number;
|
|
70
70
|
requestFullAccess?: boolean;
|
|
71
71
|
requestFullAccessReason?: string;
|
|
72
|
+
/** bash 工具显式传入的 workdir 参数;存在时审批对话框显示实际执行目录。 */
|
|
73
|
+
workdir?: string;
|
|
72
74
|
signal?: AbortSignal;
|
|
73
75
|
onUpdate?: AgentToolUpdateCallback;
|
|
74
76
|
ctx: ExtensionContext;
|
|
@@ -324,7 +326,12 @@ export class BwrapRuntime {
|
|
|
324
326
|
throw new Error(`Command denied by bwrap approval rule: ${request.command}`);
|
|
325
327
|
}
|
|
326
328
|
if (decision === undefined) {
|
|
327
|
-
await this.approveFullAccess(
|
|
329
|
+
await this.approveFullAccess(
|
|
330
|
+
request.ctx,
|
|
331
|
+
request.command,
|
|
332
|
+
request.requestFullAccessReason,
|
|
333
|
+
request.workdir,
|
|
334
|
+
);
|
|
328
335
|
}
|
|
329
336
|
}
|
|
330
337
|
const operations =
|
|
@@ -414,6 +421,7 @@ export class BwrapRuntime {
|
|
|
414
421
|
ctx: ExtensionContext,
|
|
415
422
|
command: string,
|
|
416
423
|
reason: string | undefined,
|
|
424
|
+
workdir?: string,
|
|
417
425
|
): Promise<void> {
|
|
418
426
|
const policy = resolveEscalation({ hasUI: ctx.hasUI });
|
|
419
427
|
if (policy.kind === "deny") throw new Error(policy.reason);
|
|
@@ -443,6 +451,10 @@ export class BwrapRuntime {
|
|
|
443
451
|
lines.push("", "勾选规则将永久允许(allow forever),未勾选规则仅本次放行:", "---");
|
|
444
452
|
}
|
|
445
453
|
lines.push(fenceCodeBlock(command));
|
|
454
|
+
// workdir 存在时展示实际执行目录(ctx.cwd 已被 bash 工具解析为绝对路径)
|
|
455
|
+
if (workdir) {
|
|
456
|
+
lines.push(`Workdir: ${escapeHtml(ctx.cwd)}`);
|
|
457
|
+
}
|
|
446
458
|
const description = lines.join("\n");
|
|
447
459
|
|
|
448
460
|
// 解析失败(无 pattern 可勾选):保持单选对话框(Allow forever 是空操作)
|
package/src/claude-code/bash.md
CHANGED
|
@@ -17,6 +17,7 @@ IMPORTANT: Avoid using this tool to run `find`, `grep`, `cat`, `head`, `tail`, `
|
|
|
17
17
|
While the Bash tool can do similar things, it's better to use the built-in tools as they provide a better user experience and make it easier to review tool calls and give permission.
|
|
18
18
|
|
|
19
19
|
- You may specify an optional timeout in milliseconds (up to 600000ms / 10 minutes). By default, your command will timeout after 120000ms (2 minutes).
|
|
20
|
+
- Prever to use workdir argument over `cd ...`
|
|
20
21
|
- When issuing multiple commands:
|
|
21
22
|
- If the commands are independent and can run in parallel, make multiple Bash tool calls in a single message. Example: if you need to run "git status" and "git diff", send a single message with two Bash tool calls in parallel.
|
|
22
23
|
- If the commands depend on each other and must run sequentially, use a single Bash call with '&&' to chain them together.
|
package/src/claude-code/shell.ts
CHANGED
package/src/opencode/bash.ts
CHANGED
|
@@ -38,7 +38,7 @@ export default function opencodeBash(
|
|
|
38
38
|
workdir: Type.Optional(
|
|
39
39
|
Type.String({
|
|
40
40
|
description:
|
|
41
|
-
"Working directory to execute the command in. Defaults to the current directory; relative paths resolve from there.",
|
|
41
|
+
"Working directory to execute the command in. Defaults to the current directory; relative paths resolve from there. prefer use this argument over `cd ...`",
|
|
42
42
|
}),
|
|
43
43
|
),
|
|
44
44
|
timeout: Type.Optional(
|
|
@@ -72,6 +72,7 @@ export default function opencodeBash(
|
|
|
72
72
|
command: params.command,
|
|
73
73
|
timeout: timeout / 1000,
|
|
74
74
|
requestFullAccess: params.dangerouslyDisableSandbox,
|
|
75
|
+
workdir: params.workdir,
|
|
75
76
|
signal,
|
|
76
77
|
onUpdate,
|
|
77
78
|
});
|