@trim21/personal-pi-extensions 0.0.353 → 0.0.355
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/aft/tools.ts +22 -1
- package/src/talk/index.ts +1 -1
package/package.json
CHANGED
package/src/aft/tools.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { readFileSync } from "node:fs";
|
|
9
9
|
import { stat } from "node:fs/promises";
|
|
10
10
|
import { homedir } from "node:os";
|
|
11
|
-
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
11
|
+
import { basename, isAbsolute, join, relative, resolve } from "node:path";
|
|
12
12
|
import { fileURLToPath } from "node:url";
|
|
13
13
|
|
|
14
14
|
import {
|
|
@@ -63,6 +63,16 @@ export function formatDisplayPath(cwd: string, filePath: string): string {
|
|
|
63
63
|
return filePath;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
/** subtitle 中路径的最大显示长度,超过时退化为仅文件名。 */
|
|
67
|
+
export const MAX_SUBTITLE_PATH_LENGTH = 20;
|
|
68
|
+
|
|
69
|
+
/** subtitle 用的显示路径:优先 `./…` / `~/…` / 绝对路径,结果过长时只显示文件名。 */
|
|
70
|
+
export function formatSubtitlePath(cwd: string, filePath: string): string {
|
|
71
|
+
const display = formatDisplayPath(cwd, filePath);
|
|
72
|
+
if (display.length <= MAX_SUBTITLE_PATH_LENGTH) return display;
|
|
73
|
+
return basename(filePath);
|
|
74
|
+
}
|
|
75
|
+
|
|
66
76
|
export interface AftToolContext {
|
|
67
77
|
cwd: string;
|
|
68
78
|
pool: AftTransportPool;
|
|
@@ -150,6 +160,8 @@ export function registerOutlineTool(pi: ExtensionAPI, ctx: AftToolContext): void
|
|
|
150
160
|
if (filesMode) rawArgs.files = true;
|
|
151
161
|
if (params.includeTests !== undefined) rawArgs.includeTests = params.includeTests;
|
|
152
162
|
|
|
163
|
+
const subtitle = buildOutlineSubtitle(extCtx.cwd, target);
|
|
164
|
+
|
|
153
165
|
const { text, response } = await callAftTool(bridgeFor(ctx), "outline", rawArgs, extCtx);
|
|
154
166
|
const truncated = response.truncated === true;
|
|
155
167
|
return {
|
|
@@ -157,12 +169,21 @@ export function registerOutlineTool(pi: ExtensionAPI, ctx: AftToolContext): void
|
|
|
157
169
|
details: {
|
|
158
170
|
truncated,
|
|
159
171
|
params,
|
|
172
|
+
pendant: {
|
|
173
|
+
title: "aft_outline",
|
|
174
|
+
subtitle,
|
|
175
|
+
} satisfies ToolPendant,
|
|
160
176
|
},
|
|
161
177
|
};
|
|
162
178
|
},
|
|
163
179
|
});
|
|
164
180
|
}
|
|
165
181
|
|
|
182
|
+
/** 构建 aft_outline pendant 的 subtitle:`target="…"`(路径过长时只显示文件名)。 */
|
|
183
|
+
export function buildOutlineSubtitle(cwd: string, target: string): string {
|
|
184
|
+
return `target="${formatSubtitlePath(cwd, resolvePathArg(cwd, target))}"`;
|
|
185
|
+
}
|
|
186
|
+
|
|
166
187
|
const ZoomParams = Type.Object(
|
|
167
188
|
{
|
|
168
189
|
path: Type.String({ description: "文件路径(绝对或相对项目根)" }),
|
package/src/talk/index.ts
CHANGED
|
@@ -226,7 +226,7 @@ export default function talk(pi: ExtensionAPI) {
|
|
|
226
226
|
"Ask another pi agent a question and block until it responds (or times out). Before asking, it checks whether that agent already sent you something; if so, you are told to read and respond first instead of asking.",
|
|
227
227
|
promptSnippet: "Ask another pi agent a question and wait for a response",
|
|
228
228
|
parameters: Type.Object({
|
|
229
|
-
to: Type.String({ description: "Target agent (
|
|
229
|
+
to: Type.String({ description: "Target agent id (from talk-list-agents)" }),
|
|
230
230
|
message: Type.String({ description: "The question" }),
|
|
231
231
|
timeoutMs: Type.Optional(
|
|
232
232
|
Type.Number({ description: `Wait cap in ms; default ${ASK_TIMEOUT_MS}` }),
|