@trim21/personal-pi-extensions 0.1.472 → 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/system-prompt/index.ts +10 -3
package/package.json
CHANGED
|
@@ -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.",
|