@trim21/personal-pi-extensions 0.0.214 → 0.0.216
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 -2
- package/src/lib/pendant.ts +16 -0
- package/src/opencode-todo.ts +3 -1
- package/src/vision-agent.ts +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trim21/personal-pi-extensions",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.216",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Custom pi coding-agent extensions: bwrap sandbox, workspace guard, opencode edit, and more",
|
|
6
6
|
"keywords": [
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"eslint-plugin-erasable-syntax-only": "0.4.2",
|
|
41
41
|
"eslint-plugin-promise": "7.3.0",
|
|
42
42
|
"eslint-plugin-simple-import-sort": "14.0.0",
|
|
43
|
-
"eslint-plugin-tsdoc": "0.5.2",
|
|
44
43
|
"eslint-plugin-unicorn": "73.0.0",
|
|
45
44
|
"eslint-plugin-unused-imports": "4.4.1",
|
|
46
45
|
"husky": "^9.1.7",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 工具结果 details.pendant —— pi TUI 的 UI 扩展字段(本仓库约定,非 pi 官方 schema)。
|
|
3
|
+
*
|
|
4
|
+
* 工具 execute 返回的 details 里可携带一个可折叠的 markdown 面板,TUI 会把它
|
|
5
|
+
* 与本次工具调用的消息一起渲染:
|
|
6
|
+
* - `markdown`: 面板正文(完整 markdown),建议以 `## ` 标题开头、末尾 trim
|
|
7
|
+
* - `expanded`: 面板是否默认展开;识别/结果这类需要立即看到的内容用 true,
|
|
8
|
+
* 列表等常驻信息用 false
|
|
9
|
+
*/
|
|
10
|
+
export interface ToolPendant {
|
|
11
|
+
markdown: string;
|
|
12
|
+
/**
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
expanded?: boolean;
|
|
16
|
+
}
|
package/src/opencode-todo.ts
CHANGED
|
@@ -26,6 +26,8 @@ import { StringEnum } from "@earendil-works/pi-ai";
|
|
|
26
26
|
import { type ExtensionAPI, truncateToVisualLines } from "@earendil-works/pi-coding-agent";
|
|
27
27
|
import { Type } from "typebox";
|
|
28
28
|
|
|
29
|
+
import { type ToolPendant } from "./lib/pendant.js";
|
|
30
|
+
|
|
29
31
|
// ── constants ────────────────────────────────────────────────────────────────
|
|
30
32
|
|
|
31
33
|
export const TOOL_NAME = "todowrite";
|
|
@@ -82,7 +84,7 @@ export interface TodoInfo {
|
|
|
82
84
|
|
|
83
85
|
export interface TodoDetails {
|
|
84
86
|
todos: TodoInfo[];
|
|
85
|
-
pendant
|
|
87
|
+
pendant?: ToolPendant;
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
// ── schema(与 opencode 的 Parameters 一致)──────────────────────────────────
|
package/src/vision-agent.ts
CHANGED
|
@@ -34,6 +34,8 @@ import {
|
|
|
34
34
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
35
35
|
import { Type } from "typebox";
|
|
36
36
|
|
|
37
|
+
import { type ToolPendant } from "./lib/pendant.js";
|
|
38
|
+
|
|
37
39
|
// ── constants ────────────────────────────────────────────────────────────────
|
|
38
40
|
|
|
39
41
|
export const TOOL_NAME = "describe_image";
|
|
@@ -444,7 +446,7 @@ export default function visionAgent(pi: ExtensionAPI) {
|
|
|
444
446
|
pendant: {
|
|
445
447
|
markdown,
|
|
446
448
|
expanded: true,
|
|
447
|
-
},
|
|
449
|
+
} satisfies ToolPendant,
|
|
448
450
|
},
|
|
449
451
|
};
|
|
450
452
|
} catch (error) {
|
|
@@ -464,7 +466,7 @@ export default function visionAgent(pi: ExtensionAPI) {
|
|
|
464
466
|
pendant: {
|
|
465
467
|
markdown: `## 图片识别失败\n\n${message}`,
|
|
466
468
|
expanded: true,
|
|
467
|
-
},
|
|
469
|
+
} satisfies ToolPendant,
|
|
468
470
|
},
|
|
469
471
|
};
|
|
470
472
|
}
|