@trim21/personal-pi-extensions 0.1.471 → 0.1.473
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/search.md +0 -1
- package/src/aft/tools.ts +0 -6
- package/src/system-prompt/index.ts +10 -3
package/package.json
CHANGED
package/src/aft/search.md
CHANGED
package/src/aft/tools.ts
CHANGED
|
@@ -363,11 +363,6 @@ const SearchParams = Type.Object(
|
|
|
363
363
|
}),
|
|
364
364
|
),
|
|
365
365
|
includeTests: Type.Optional(Type.Boolean({ description: "包含测试文件。默认 false。" })),
|
|
366
|
-
path: Type.Optional(
|
|
367
|
-
Type.String({
|
|
368
|
-
description: "仅当要搜索不同的 Git 项目时设置(绝对或 ~ 路径)。默认搜索当前项目。",
|
|
369
|
-
}),
|
|
370
|
-
),
|
|
371
366
|
},
|
|
372
367
|
{ additionalProperties: false },
|
|
373
368
|
);
|
|
@@ -393,7 +388,6 @@ export function registerSearchTool(pi: ExtensionAPI, ctx: AftToolContext): void
|
|
|
393
388
|
query: params.query,
|
|
394
389
|
topK: params.topK,
|
|
395
390
|
includeTests: params.includeTests,
|
|
396
|
-
path: params.path ? resolvePathArg(extCtx.cwd, params.path) : undefined,
|
|
397
391
|
});
|
|
398
392
|
|
|
399
393
|
const { text, response } = await callAftTool(bridgeFor(ctx), "search", rawArgs, extCtx, {
|
|
@@ -61,8 +61,9 @@ export function formatTools(
|
|
|
61
61
|
selectedTools: string[] | undefined,
|
|
62
62
|
toolSnippets: Record<string, string> | undefined,
|
|
63
63
|
): string {
|
|
64
|
+
const names = (selectedTools ?? []).toSorted((a, b) => a.localeCompare(b));
|
|
64
65
|
const lines: string[] = [];
|
|
65
|
-
for (const name of
|
|
66
|
+
for (const name of names) {
|
|
66
67
|
const snippet = toolSnippets?.[name];
|
|
67
68
|
if (snippet) {
|
|
68
69
|
lines.push(`- ${name}: ${snippet}`);
|
|
@@ -73,7 +74,10 @@ export function formatTools(
|
|
|
73
74
|
|
|
74
75
|
/** 渲染工具特定 guideline 块;为空时整个块(含标题)省略。guide 本身是 md 文档,直接拼接。 */
|
|
75
76
|
export function formatGuidelines(promptGuidelines: string[] | undefined): string {
|
|
76
|
-
const items = (promptGuidelines ?? [])
|
|
77
|
+
const items = (promptGuidelines ?? [])
|
|
78
|
+
.map((g) => g.trim())
|
|
79
|
+
.filter((g) => g.length > 0)
|
|
80
|
+
.toSorted((a, b) => a.localeCompare(b));
|
|
77
81
|
if (items.length === 0) return "";
|
|
78
82
|
return `## Guidelines\n\n${items.join("\n\n")}`;
|
|
79
83
|
}
|
|
@@ -84,6 +88,7 @@ export function formatContextFiles(
|
|
|
84
88
|
): string {
|
|
85
89
|
if (!contextFiles || contextFiles.length === 0) return "";
|
|
86
90
|
const inner = contextFiles
|
|
91
|
+
.toSorted((a, b) => a.path.localeCompare(b.path))
|
|
87
92
|
.map(
|
|
88
93
|
({ path, content }) =>
|
|
89
94
|
`<project_instructions path="${path}">\n${content}\n</project_instructions>`,
|
|
@@ -97,7 +102,9 @@ export function formatContextFiles(
|
|
|
97
102
|
* 一致;disableModelInvocation 的 skill 不展示;为空时省略。
|
|
98
103
|
*/
|
|
99
104
|
export function formatSkills(skills: SkillLike[] | undefined): string {
|
|
100
|
-
const visible = (skills ?? [])
|
|
105
|
+
const visible = (skills ?? [])
|
|
106
|
+
.filter((skill) => !skill.disableModelInvocation)
|
|
107
|
+
.toSorted((a, b) => a.name.localeCompare(b.name) || a.filePath.localeCompare(b.filePath));
|
|
101
108
|
if (visible.length === 0) return "";
|
|
102
109
|
const lines = [
|
|
103
110
|
"\n\nThe following skills provide specialized instructions for specific tasks.",
|