@zhushanwen/pi-permission 1.6.5 → 1.6.6
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhushanwen/pi-permission",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.6",
|
|
4
4
|
"description": "Pi permission extension — four permission modes (yolo/auto/approve/strict) with three-layer pipeline (AST + rules + AI classifier).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"tree-sitter-bash": "^0.25.1",
|
|
52
52
|
"web-tree-sitter": "^0.26.11",
|
|
53
|
+
"@zhushanwen/extension-protocol": "0.24.0",
|
|
53
54
|
"@zhushanwen/pi-ext-guards": "0.5.0",
|
|
54
55
|
"@zhushanwen/pi-extension-logger": "0.6.2",
|
|
55
56
|
"@zhushanwen/pi-llm-shared": "0.12.0"
|
|
@@ -11,6 +11,9 @@ import {
|
|
|
11
11
|
renderApprovalView,
|
|
12
12
|
requestUserApproval,
|
|
13
13
|
} from "../approval.js";
|
|
14
|
+
// 对拍符号:runtime event-adapter 判定键与本扩展 title 构造引用同一常量(值锁定在
|
|
15
|
+
// extension-protocol markers.test.ts),单源化后双端文案漂移在编译期即报错
|
|
16
|
+
import { PERMISSION_APPROVAL_TITLE } from "@zhushanwen/extension-protocol";
|
|
14
17
|
import type { ApprovalRequest } from "../pipeline.js";
|
|
15
18
|
import type { ClassifierResult, ToolInvocationContext, UserDecision } from "../types.js";
|
|
16
19
|
|
|
@@ -176,7 +179,7 @@ describe("requestUserApproval: rpc 模式", () => {
|
|
|
176
179
|
const lines = capturedTitle.split("\n");
|
|
177
180
|
// RPC title 5→6 行:补 ` reasoning: <AI 理由>` 行(与 TUI 字段集同源,M6 漂移修复)
|
|
178
181
|
expect(lines).toHaveLength(6);
|
|
179
|
-
expect(lines[0]).toBe(
|
|
182
|
+
expect(lines[0]).toBe(PERMISSION_APPROVAL_TITLE);
|
|
180
183
|
expect(lines[1]).toBe("Tool: bash");
|
|
181
184
|
expect(lines[2]).toBe("Command: rm -rf /tmp");
|
|
182
185
|
expect(lines[3]).toBe("Reason: no allow rule");
|
package/src/approval.ts
CHANGED
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
|
|
23
23
|
import { type Component, matchesKey, truncateToWidth } from "@earendil-works/pi-tui";
|
|
24
24
|
|
|
25
|
+
// 审批 select title 首行判定键单源:runtime event-adapter 按此串精确匹配落
|
|
26
|
+
// permission: true 键(侧栏等待可见性),双端 import 同一符号防文案漂移静默失联。
|
|
27
|
+
import { PERMISSION_APPROVAL_TITLE } from "@zhushanwen/extension-protocol";
|
|
28
|
+
|
|
25
29
|
import type { ApprovalRequest } from "./pipeline.js";
|
|
26
30
|
import type { ToolInvocationContext, UserDecision } from "./types.js";
|
|
27
31
|
|
|
@@ -223,7 +227,7 @@ interface ApprovalFieldSet {
|
|
|
223
227
|
/** 构造审批卡字段集(title/tool/command/reason + 可选 AI 四元组含 reasoning)。 */
|
|
224
228
|
function buildApprovalFieldSet(req: ApprovalRequest): ApprovalFieldSet {
|
|
225
229
|
return {
|
|
226
|
-
title:
|
|
230
|
+
title: PERMISSION_APPROVAL_TITLE,
|
|
227
231
|
tool: req.toolName,
|
|
228
232
|
// 空字符串与 undefined 同义(两外壳的 Command 行都只在非空时渲染)
|
|
229
233
|
command: req.command !== undefined && req.command.length > 0 ? req.command : undefined,
|