@caupulican/pi-adaptative 0.80.40 → 0.80.44
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/CHANGELOG.md +25 -0
- package/dist/bundled-resources/prompts/extensionify.md +20 -0
- package/dist/bundled-resources/prompts/learn.md +27 -0
- package/dist/bundled-resources/prompts/skillify.md +21 -0
- package/dist/bundled-resources/skills/pi-harness-learning/SKILL.md +217 -0
- package/dist/bundled-resources/skills/skill-architect/SKILL.md +162 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +30 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +37 -2
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +217 -11
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +4 -2
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/context-gc.d.ts.map +1 -1
- package/dist/core/context-gc.js +27 -5
- package/dist/core/context-gc.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +10 -3
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +38 -7
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +6 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +53 -6
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +16 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/profile-registry.d.ts +39 -0
- package/dist/core/profile-registry.d.ts.map +1 -0
- package/dist/core/profile-registry.js +230 -0
- package/dist/core/profile-registry.js.map +1 -0
- package/dist/core/profile-resource-selection.d.ts +19 -0
- package/dist/core/profile-resource-selection.d.ts.map +1 -0
- package/dist/core/profile-resource-selection.js +84 -0
- package/dist/core/profile-resource-selection.js.map +1 -0
- package/dist/core/resource-loader.d.ts +33 -3
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +68 -11
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/settings-manager.d.ts +44 -2
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +557 -27
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +5 -0
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +2 -2
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +5 -17
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/extensionify.d.ts +33 -0
- package/dist/core/tools/extensionify.d.ts.map +1 -0
- package/dist/core/tools/extensionify.js +146 -0
- package/dist/core/tools/extensionify.js.map +1 -0
- package/dist/core/tools/index.d.ts +10 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +36 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/skill-audit.d.ts +63 -0
- package/dist/core/tools/skill-audit.d.ts.map +1 -0
- package/dist/core/tools/skill-audit.js +175 -0
- package/dist/core/tools/skill-audit.js.map +1 -0
- package/dist/core/tools/skillify.d.ts +30 -0
- package/dist/core/tools/skillify.d.ts.map +1 -0
- package/dist/core/tools/skillify.js +91 -0
- package/dist/core/tools/skillify.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/profile-resource-editor.d.ts +50 -0
- package/dist/modes/interactive/components/profile-resource-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/profile-resource-editor.js +232 -0
- package/dist/modes/interactive/components/profile-resource-editor.js.map +1 -0
- package/dist/modes/interactive/components/profile-selector.d.ts +8 -0
- package/dist/modes/interactive/components/profile-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/profile-selector.js +77 -0
- package/dist/modes/interactive/components/profile-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +7 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +62 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +12 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +362 -24
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/settings.md +20 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/sdk/12-full-control.ts +4 -0
- package/npm-shrinkwrap.json +12 -12
- package/package.json +6 -6
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
import { getAgentDir } from "../../config.js";
|
|
3
|
+
import { loadSkills } from "../skills.js";
|
|
4
|
+
import { wrapToolDefinition } from "./tool-definition-wrapper.js";
|
|
5
|
+
const DUPLICATE_THRESHOLD = 0.55;
|
|
6
|
+
const STOPWORDS = new Set("the a an and or of for to with when use using from into this that skill task work working project agent agents code files file in on by as is are be do not should about".split(" "));
|
|
7
|
+
/**
|
|
8
|
+
* Tokenize text by lowercasing, removing non-alphanumeric chars (except hyphens and colons),
|
|
9
|
+
* splitting on whitespace, and filtering out short tokens and stopwords.
|
|
10
|
+
*/
|
|
11
|
+
export function tokenize(text) {
|
|
12
|
+
return [
|
|
13
|
+
...new Set(text
|
|
14
|
+
.toLowerCase()
|
|
15
|
+
.replace(/[^a-z0-9:-]+/g, " ")
|
|
16
|
+
.split(/\s+/)
|
|
17
|
+
.filter((token) => token.length >= 3 && !STOPWORDS.has(token))),
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Calculate Jaccard similarity between two token sets.
|
|
22
|
+
* Jaccard(A, B) = |A ∩ B| / |A ∪ B|
|
|
23
|
+
*/
|
|
24
|
+
export function jaccard(a, b) {
|
|
25
|
+
if (a.length === 0 || b.length === 0)
|
|
26
|
+
return 0;
|
|
27
|
+
const setA = new Set(a);
|
|
28
|
+
const setB = new Set(b);
|
|
29
|
+
let intersection = 0;
|
|
30
|
+
for (const item of setA)
|
|
31
|
+
if (setB.has(item))
|
|
32
|
+
intersection++;
|
|
33
|
+
const union = new Set([...a, ...b]).size;
|
|
34
|
+
return union === 0 ? 0 : intersection / union;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Audit existing skills for overlap and compare against a draft skill.
|
|
38
|
+
*/
|
|
39
|
+
export function runSkillAudit(cwd, draftSkill) {
|
|
40
|
+
// Load existing skills
|
|
41
|
+
const result = loadSkills({
|
|
42
|
+
cwd,
|
|
43
|
+
agentDir: getAgentDir(),
|
|
44
|
+
skillPaths: [],
|
|
45
|
+
includeDefaults: true,
|
|
46
|
+
});
|
|
47
|
+
const skills = result.skills.map((skill) => ({
|
|
48
|
+
name: skill.name,
|
|
49
|
+
description: skill.description,
|
|
50
|
+
path: skill.filePath,
|
|
51
|
+
scope: skill.sourceInfo.scope ?? "unknown",
|
|
52
|
+
keywords: tokenize(`${skill.name} ${skill.description}`),
|
|
53
|
+
}));
|
|
54
|
+
// If a draft skill is provided, add it to the set for comparison
|
|
55
|
+
if (draftSkill) {
|
|
56
|
+
const draftName = draftSkill.name || "draft-skill";
|
|
57
|
+
const draftDesc = draftSkill.description || "";
|
|
58
|
+
skills.push({
|
|
59
|
+
name: draftName,
|
|
60
|
+
description: draftDesc,
|
|
61
|
+
path: "[draft]",
|
|
62
|
+
scope: "draft",
|
|
63
|
+
keywords: tokenize(`${draftName} ${draftDesc} ${draftSkill.body || ""}`),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
// Find near-duplicates based on Jaccard similarity
|
|
67
|
+
const nearDuplicates = [];
|
|
68
|
+
for (let i = 0; i < skills.length; i++) {
|
|
69
|
+
for (let j = i + 1; j < skills.length; j++) {
|
|
70
|
+
const similarity = jaccard(skills[i].keywords, skills[j].keywords);
|
|
71
|
+
if (similarity >= DUPLICATE_THRESHOLD) {
|
|
72
|
+
const reason = similarity >= 0.9
|
|
73
|
+
? "90%+ keyword overlap; merge/refine before adding another skill"
|
|
74
|
+
: "high trigger/workflow overlap; review for dedup or compartmentalization";
|
|
75
|
+
nearDuplicates.push({
|
|
76
|
+
a: skills[i].path,
|
|
77
|
+
b: skills[j].path,
|
|
78
|
+
similarity: Number(similarity.toFixed(3)),
|
|
79
|
+
reason,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
nearDuplicates.sort((a, b) => b.similarity - a.similarity);
|
|
85
|
+
// Check for name collisions
|
|
86
|
+
const byName = new Map();
|
|
87
|
+
for (const skill of skills) {
|
|
88
|
+
const existing = byName.get(skill.name) ?? [];
|
|
89
|
+
byName.set(skill.name, [...existing, skill.path]);
|
|
90
|
+
}
|
|
91
|
+
const nameCollisions = [...byName.entries()]
|
|
92
|
+
.filter(([, paths]) => paths.length > 1)
|
|
93
|
+
.map(([name, paths]) => ({ name, paths }));
|
|
94
|
+
// Build recommendations
|
|
95
|
+
const recommendations = [];
|
|
96
|
+
if (draftSkill && nearDuplicates.length > 0) {
|
|
97
|
+
const draftNearDupes = nearDuplicates.filter((d) => d.a === "[draft]" || d.b === "[draft]");
|
|
98
|
+
if (draftNearDupes.length > 0) {
|
|
99
|
+
recommendations.push(`Draft skill has ${draftNearDupes.length} similar existing skill(s). Consider merging or refining the trigger/scope.`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (nameCollisions.length > 0) {
|
|
103
|
+
recommendations.push(`Found ${nameCollisions.length} skill name collision(s). Resolve naming conflicts before deployment.`);
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
generatedAt: new Date().toISOString(),
|
|
107
|
+
skills: skills.filter((s) => s.path !== "[draft]"), // Don't include draft in final skill list
|
|
108
|
+
nearDuplicates,
|
|
109
|
+
compartmentWarnings: [],
|
|
110
|
+
nameCollisions,
|
|
111
|
+
recommendations,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const skillAuditSchema = Type.Object({
|
|
115
|
+
draftName: Type.Optional(Type.String({ description: "Name of the draft skill to audit" })),
|
|
116
|
+
draftDescription: Type.Optional(Type.String({ description: "Description of the draft skill" })),
|
|
117
|
+
draftBody: Type.Optional(Type.String({ description: "Body/content of the draft skill" })),
|
|
118
|
+
});
|
|
119
|
+
export function createSkillAuditToolDefinition(cwd, _options) {
|
|
120
|
+
return {
|
|
121
|
+
name: "skill_audit",
|
|
122
|
+
label: "skill audit",
|
|
123
|
+
description: "Check a draft/new skill for overlap with existing skills before creating it; flags near-duplicate triggers/descriptions via local Jaccard similarity. Read-only: does not write files.",
|
|
124
|
+
promptSnippet: "Audit skill for overlaps",
|
|
125
|
+
promptGuidelines: [
|
|
126
|
+
"Use skill_audit to check draft skills for conflicts before creating them.",
|
|
127
|
+
"Similarity >= 55% indicates potential dedup or compartmentalization work.",
|
|
128
|
+
],
|
|
129
|
+
parameters: skillAuditSchema,
|
|
130
|
+
async execute(_toolCallId, { draftName, draftDescription, draftBody }, _signal, _onUpdate, _ctx) {
|
|
131
|
+
const draftSkill = draftName || draftDescription
|
|
132
|
+
? {
|
|
133
|
+
name: draftName,
|
|
134
|
+
description: draftDescription,
|
|
135
|
+
body: draftBody,
|
|
136
|
+
}
|
|
137
|
+
: undefined;
|
|
138
|
+
const report = runSkillAudit(cwd, draftSkill);
|
|
139
|
+
// Format the report as readable text
|
|
140
|
+
const lines = [];
|
|
141
|
+
lines.push(`Skill audit: ${report.skills.length} skill(s), ${report.nearDuplicates.length} overlap warning(s).`);
|
|
142
|
+
if (report.nearDuplicates.length > 0) {
|
|
143
|
+
lines.push("\nTop overlap warnings:");
|
|
144
|
+
for (const item of report.nearDuplicates.slice(0, 8)) {
|
|
145
|
+
const aName = item.a.split("/").pop() || item.a;
|
|
146
|
+
const bName = item.b.split("/").pop() || item.b;
|
|
147
|
+
lines.push(`- ${(item.similarity * 100).toFixed(1)}%: ${aName} ↔ ${bName} — ${item.reason}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (report.nameCollisions.length > 0) {
|
|
151
|
+
lines.push("\nName collisions:");
|
|
152
|
+
for (const item of report.nameCollisions.slice(0, 8)) {
|
|
153
|
+
lines.push(`- ${item.name}: ${item.paths.length} paths`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (report.recommendations && report.recommendations.length > 0) {
|
|
157
|
+
lines.push("\nRecommendations:");
|
|
158
|
+
for (const rec of report.recommendations) {
|
|
159
|
+
lines.push(`- ${rec}`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (report.nearDuplicates.length === 0 && report.nameCollisions.length === 0) {
|
|
163
|
+
lines.push("\nNo overlaps detected. This skill appears to be unique.");
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
167
|
+
details: report,
|
|
168
|
+
};
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
export function createSkillAuditTool(cwd, options) {
|
|
173
|
+
return wrapToolDefinition(createSkillAuditToolDefinition(cwd, options));
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=skill-audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-audit.js","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AC,cAAc,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC9E,KAAK,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;YACxE,CAAC;YAED,OAAO;gBACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnD,OAAO,EAAE,MAAM;aACf,CAAC;QAAA,CACF;KACD,CAAC;AAAA,CACF;AAED,MAAM,UAAU,oBAAoB,CAAC,GAAW,EAAE,OAA+B,EAAsC;IACtH,OAAO,kBAAkB,CAAC,8BAA8B,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AAAA,CACxE","sourcesContent":["import type { AgentTool } from \"@caupulican/pi-agent-core\";\nimport { type Static, Type } from \"typebox\";\nimport { getAgentDir } from \"../../config.ts\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport { loadSkills, type Skill } from \"../skills.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\n\nconst DUPLICATE_THRESHOLD = 0.55;\n\nconst STOPWORDS = new Set(\n\t\"the a an and or of for to with when use using from into this that skill task work working project agent agents code files file in on by as is are be do not should about\".split(\n\t\t\" \",\n\t),\n);\n\n/**\n * Tokenize text by lowercasing, removing non-alphanumeric chars (except hyphens and colons),\n * splitting on whitespace, and filtering out short tokens and stopwords.\n */\nexport function tokenize(text: string): string[] {\n\treturn [\n\t\t...new Set(\n\t\t\ttext\n\t\t\t\t.toLowerCase()\n\t\t\t\t.replace(/[^a-z0-9:-]+/g, \" \")\n\t\t\t\t.split(/\\s+/)\n\t\t\t\t.filter((token) => token.length >= 3 && !STOPWORDS.has(token)),\n\t\t),\n\t];\n}\n\n/**\n * Calculate Jaccard similarity between two token sets.\n * Jaccard(A, B) = |A ∩ B| / |A ∪ B|\n */\nexport function jaccard(a: string[], b: string[]): number {\n\tif (a.length === 0 || b.length === 0) return 0;\n\tconst setA = new Set(a);\n\tconst setB = new Set(b);\n\tlet intersection = 0;\n\tfor (const item of setA) if (setB.has(item)) intersection++;\n\tconst union = new Set([...a, ...b]).size;\n\treturn union === 0 ? 0 : intersection / union;\n}\n\nexport interface SkillSummary {\n\tname: string;\n\tdescription: string;\n\tpath: string;\n\tscope: string;\n\tkeywords: string[];\n}\n\nexport interface SkillAuditReport {\n\tgeneratedAt: string;\n\tskills: SkillSummary[];\n\tnearDuplicates: Array<{\n\t\ta: string;\n\t\tb: string;\n\t\tsimilarity: number;\n\t\treason: string;\n\t}>;\n\tcompartmentWarnings: Array<{\n\t\tskill: string;\n\t\tpath: string;\n\t\treason: string;\n\t}>;\n\tnameCollisions: Array<{\n\t\tname: string;\n\t\tpaths: string[];\n\t}>;\n\trecommendations?: string[];\n}\n\n/**\n * Audit existing skills for overlap and compare against a draft skill.\n */\nexport function runSkillAudit(\n\tcwd: string,\n\tdraftSkill?: { name?: string; description?: string; body?: string },\n): SkillAuditReport {\n\t// Load existing skills\n\tconst result = loadSkills({\n\t\tcwd,\n\t\tagentDir: getAgentDir(),\n\t\tskillPaths: [],\n\t\tincludeDefaults: true,\n\t});\n\n\tconst skills: SkillSummary[] = result.skills.map((skill: Skill) => ({\n\t\tname: skill.name,\n\t\tdescription: skill.description,\n\t\tpath: skill.filePath,\n\t\tscope: skill.sourceInfo.scope ?? \"unknown\",\n\t\tkeywords: tokenize(`${skill.name} ${skill.description}`),\n\t}));\n\n\t// If a draft skill is provided, add it to the set for comparison\n\tif (draftSkill) {\n\t\tconst draftName = draftSkill.name || \"draft-skill\";\n\t\tconst draftDesc = draftSkill.description || \"\";\n\t\tskills.push({\n\t\t\tname: draftName,\n\t\t\tdescription: draftDesc,\n\t\t\tpath: \"[draft]\",\n\t\t\tscope: \"draft\",\n\t\t\tkeywords: tokenize(`${draftName} ${draftDesc} ${draftSkill.body || \"\"}`),\n\t\t});\n\t}\n\n\t// Find near-duplicates based on Jaccard similarity\n\tconst nearDuplicates: SkillAuditReport[\"nearDuplicates\"] = [];\n\tfor (let i = 0; i < skills.length; i++) {\n\t\tfor (let j = i + 1; j < skills.length; j++) {\n\t\t\tconst similarity = jaccard(skills[i].keywords, skills[j].keywords);\n\t\t\tif (similarity >= DUPLICATE_THRESHOLD) {\n\t\t\t\tconst reason =\n\t\t\t\t\tsimilarity >= 0.9\n\t\t\t\t\t\t? \"90%+ keyword overlap; merge/refine before adding another skill\"\n\t\t\t\t\t\t: \"high trigger/workflow overlap; review for dedup or compartmentalization\";\n\t\t\t\tnearDuplicates.push({\n\t\t\t\t\ta: skills[i].path,\n\t\t\t\t\tb: skills[j].path,\n\t\t\t\t\tsimilarity: Number(similarity.toFixed(3)),\n\t\t\t\t\treason,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\tnearDuplicates.sort((a, b) => b.similarity - a.similarity);\n\n\t// Check for name collisions\n\tconst byName = new Map<string, string[]>();\n\tfor (const skill of skills) {\n\t\tconst existing = byName.get(skill.name) ?? [];\n\t\tbyName.set(skill.name, [...existing, skill.path]);\n\t}\n\tconst nameCollisions = [...byName.entries()]\n\t\t.filter(([, paths]) => paths.length > 1)\n\t\t.map(([name, paths]) => ({ name, paths }));\n\n\t// Build recommendations\n\tconst recommendations: string[] = [];\n\tif (draftSkill && nearDuplicates.length > 0) {\n\t\tconst draftNearDupes = nearDuplicates.filter((d) => d.a === \"[draft]\" || d.b === \"[draft]\");\n\t\tif (draftNearDupes.length > 0) {\n\t\t\trecommendations.push(\n\t\t\t\t`Draft skill has ${draftNearDupes.length} similar existing skill(s). Consider merging or refining the trigger/scope.`,\n\t\t\t);\n\t\t}\n\t}\n\tif (nameCollisions.length > 0) {\n\t\trecommendations.push(\n\t\t\t`Found ${nameCollisions.length} skill name collision(s). Resolve naming conflicts before deployment.`,\n\t\t);\n\t}\n\n\treturn {\n\t\tgeneratedAt: new Date().toISOString(),\n\t\tskills: skills.filter((s) => s.path !== \"[draft]\"), // Don't include draft in final skill list\n\t\tnearDuplicates,\n\t\tcompartmentWarnings: [],\n\t\tnameCollisions,\n\t\trecommendations,\n\t};\n}\n\nconst skillAuditSchema = Type.Object({\n\tdraftName: Type.Optional(Type.String({ description: \"Name of the draft skill to audit\" })),\n\tdraftDescription: Type.Optional(Type.String({ description: \"Description of the draft skill\" })),\n\tdraftBody: Type.Optional(Type.String({ description: \"Body/content of the draft skill\" })),\n});\n\nexport type SkillAuditInput = Static<typeof skillAuditSchema>;\n\nexport interface SkillAuditToolDetails {\n\treportPath?: string;\n}\n\nexport interface SkillAuditToolOptions {}\n\nexport function createSkillAuditToolDefinition(\n\tcwd: string,\n\t_options?: SkillAuditToolOptions,\n): ToolDefinition<typeof skillAuditSchema, SkillAuditReport> {\n\treturn {\n\t\tname: \"skill_audit\",\n\t\tlabel: \"skill audit\",\n\t\tdescription:\n\t\t\t\"Check a draft/new skill for overlap with existing skills before creating it; flags near-duplicate triggers/descriptions via local Jaccard similarity. Read-only: does not write files.\",\n\t\tpromptSnippet: \"Audit skill for overlaps\",\n\t\tpromptGuidelines: [\n\t\t\t\"Use skill_audit to check draft skills for conflicts before creating them.\",\n\t\t\t\"Similarity >= 55% indicates potential dedup or compartmentalization work.\",\n\t\t],\n\t\tparameters: skillAuditSchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ draftName, draftDescription, draftBody }: SkillAuditInput,\n\t\t\t_signal?: AbortSignal,\n\t\t\t_onUpdate?,\n\t\t\t_ctx?,\n\t\t): Promise<{\n\t\t\tcontent: Array<{ type: \"text\"; text: string }>;\n\t\t\tdetails: SkillAuditReport;\n\t\t}> {\n\t\t\tconst draftSkill =\n\t\t\t\tdraftName || draftDescription\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tname: draftName,\n\t\t\t\t\t\t\tdescription: draftDescription,\n\t\t\t\t\t\t\tbody: draftBody,\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined;\n\n\t\t\tconst report = runSkillAudit(cwd, draftSkill);\n\n\t\t\t// Format the report as readable text\n\t\t\tconst lines: string[] = [];\n\t\t\tlines.push(\n\t\t\t\t`Skill audit: ${report.skills.length} skill(s), ${report.nearDuplicates.length} overlap warning(s).`,\n\t\t\t);\n\n\t\t\tif (report.nearDuplicates.length > 0) {\n\t\t\t\tlines.push(\"\\nTop overlap warnings:\");\n\t\t\t\tfor (const item of report.nearDuplicates.slice(0, 8)) {\n\t\t\t\t\tconst aName = item.a.split(\"/\").pop() || item.a;\n\t\t\t\t\tconst bName = item.b.split(\"/\").pop() || item.b;\n\t\t\t\t\tlines.push(`- ${(item.similarity * 100).toFixed(1)}%: ${aName} ↔ ${bName} — ${item.reason}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (report.nameCollisions.length > 0) {\n\t\t\t\tlines.push(\"\\nName collisions:\");\n\t\t\t\tfor (const item of report.nameCollisions.slice(0, 8)) {\n\t\t\t\t\tlines.push(`- ${item.name}: ${item.paths.length} paths`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (report.recommendations && report.recommendations.length > 0) {\n\t\t\t\tlines.push(\"\\nRecommendations:\");\n\t\t\t\tfor (const rec of report.recommendations) {\n\t\t\t\t\tlines.push(`- ${rec}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (report.nearDuplicates.length === 0 && report.nameCollisions.length === 0) {\n\t\t\t\tlines.push(\"\\nNo overlaps detected. This skill appears to be unique.\");\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: lines.join(\"\\n\") }],\n\t\t\t\tdetails: report,\n\t\t\t};\n\t\t},\n\t};\n}\n\nexport function createSkillAuditTool(cwd: string, options?: SkillAuditToolOptions): AgentTool<typeof skillAuditSchema> {\n\treturn wrapToolDefinition(createSkillAuditToolDefinition(cwd, options));\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AgentTool } from "@caupulican/pi-agent-core";
|
|
2
|
+
import { type Static, Type } from "typebox";
|
|
3
|
+
import type { ToolDefinition } from "../extensions/types.ts";
|
|
4
|
+
import { type SkillAuditReport } from "./skill-audit.ts";
|
|
5
|
+
declare const skillifySchema: Type.TObject<{
|
|
6
|
+
name: Type.TString;
|
|
7
|
+
description: Type.TString;
|
|
8
|
+
body: Type.TString;
|
|
9
|
+
}>;
|
|
10
|
+
export type SkillifyInput = Static<typeof skillifySchema>;
|
|
11
|
+
export interface SkillifyReport {
|
|
12
|
+
valid: boolean;
|
|
13
|
+
errors: string[];
|
|
14
|
+
audit: SkillAuditReport;
|
|
15
|
+
proposedPath: string;
|
|
16
|
+
draft: {
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
body: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface SkillifyToolDetails {
|
|
23
|
+
report?: SkillifyReport;
|
|
24
|
+
}
|
|
25
|
+
export interface SkillifyToolOptions {
|
|
26
|
+
}
|
|
27
|
+
export declare function createSkillifyToolDefinition(cwd: string, _options?: SkillifyToolOptions): ToolDefinition<typeof skillifySchema, SkillifyReport>;
|
|
28
|
+
export declare function createSkillifyTool(cwd: string, options?: SkillifyToolOptions): AgentTool<typeof skillifySchema>;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=skillify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skillify.d.ts","sourceRoot":"","sources":["../../../src/core/tools/skillify.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGxE,QAAA,MAAM,cAAc;;;;EAIlB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC;AAE1D,MAAM,WAAW,cAAc;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,gBAAgB,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;KACb,CAAC;CACF;AAED,MAAM,WAAW,mBAAmB;IACnC,MAAM,CAAC,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;CAAG;AAEvC,wBAAgB,4BAA4B,CAC3C,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,mBAAmB,GAC5B,cAAc,CAAC,OAAO,cAAc,EAAE,cAAc,CAAC,CAoGvD;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC,OAAO,cAAc,CAAC,CAE/G","sourcesContent":["import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport type { AgentTool } from \"@caupulican/pi-agent-core\";\nimport { type Static, Type } from \"typebox\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport { validateSkillName } from \"../skills.ts\";\nimport { runSkillAudit, type SkillAuditReport } from \"./skill-audit.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\n\nconst skillifySchema = Type.Object({\n\tname: Type.String({ description: \"Skill name (lowercase, a-z 0-9 hyphens only, max 64 chars)\" }),\n\tdescription: Type.String({ description: \"Skill description (max 1024 chars)\" }),\n\tbody: Type.String({ description: \"Skill body/implementation code\" }),\n});\n\nexport type SkillifyInput = Static<typeof skillifySchema>;\n\nexport interface SkillifyReport {\n\tvalid: boolean;\n\terrors: string[];\n\taudit: SkillAuditReport;\n\tproposedPath: string;\n\tdraft: {\n\t\tname: string;\n\t\tdescription: string;\n\t\tbody: string;\n\t};\n}\n\nexport interface SkillifyToolDetails {\n\treport?: SkillifyReport;\n}\n\nexport interface SkillifyToolOptions {}\n\nexport function createSkillifyToolDefinition(\n\tcwd: string,\n\t_options?: SkillifyToolOptions,\n): ToolDefinition<typeof skillifySchema, SkillifyReport> {\n\treturn {\n\t\tname: \"skillify\",\n\t\tlabel: \"skillify\",\n\t\tdescription:\n\t\t\t\"Validate a draft skill and audit for overlaps with existing skills. Pure analysis tool: generates a proposal with validation and audit report, but does NOT write files or activate the skill. Returns structured report with proposed install path.\",\n\t\tpromptSnippet: \"Validate and audit a draft skill\",\n\t\tpromptGuidelines: [\n\t\t\t\"Use skillify to validate and audit draft skills before creating them.\",\n\t\t\t\"Fix validation errors (name format, description length) and review audit findings before proceeding.\",\n\t\t\t\"The tool returns a proposal only; persistent write and activation happen later.\",\n\t\t],\n\t\tparameters: skillifySchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ name, description, body }: SkillifyInput,\n\t\t\t_signal?: AbortSignal,\n\t\t\t_onUpdate?,\n\t\t\t_ctx?,\n\t\t): Promise<{\n\t\t\tcontent: Array<{ type: \"text\"; text: string }>;\n\t\t\tdetails: SkillifyReport;\n\t\t}> {\n\t\t\tconst errors: string[] = [];\n\n\t\t\t// Validate name\n\t\t\tconst nameErrors = validateSkillName(name);\n\t\t\terrors.push(...nameErrors);\n\n\t\t\t// Validate description\n\t\t\tif (!description || description.trim() === \"\") {\n\t\t\t\terrors.push(\"description is required\");\n\t\t\t} else if (description.length > 1024) {\n\t\t\t\terrors.push(`description exceeds 1024 characters (${description.length})`);\n\t\t\t}\n\n\t\t\t// Run audit on the draft\n\t\t\tconst audit = runSkillAudit(cwd, { name, description, body });\n\n\t\t\tconst valid = errors.length === 0;\n\t\t\tconst proposedPath = join(homedir(), \".pi\", \"agent\", \"skills\", name, \"SKILL.md\");\n\n\t\t\tconst report: SkillifyReport = {\n\t\t\t\tvalid,\n\t\t\t\terrors,\n\t\t\t\taudit,\n\t\t\t\tproposedPath,\n\t\t\t\tdraft: { name, description, body },\n\t\t\t};\n\n\t\t\t// Format the report as readable text\n\t\t\tconst lines: string[] = [];\n\t\t\tlines.push(`Skillify validation: ${valid ? \"✓ valid\" : \"✗ invalid\"}`);\n\n\t\t\tif (errors.length > 0) {\n\t\t\t\tlines.push(\"\\nValidation errors:\");\n\t\t\t\tfor (const err of errors) {\n\t\t\t\t\tlines.push(`- ${err}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlines.push(\n\t\t\t\t`\\nAudit: ${audit.skills.length} existing skill(s), ${audit.nearDuplicates.length} overlap warning(s).`,\n\t\t\t);\n\n\t\t\tif (audit.nearDuplicates.length > 0) {\n\t\t\t\tlines.push(\"\\nTop overlaps with existing skills:\");\n\t\t\t\tfor (const item of audit.nearDuplicates.slice(0, 5)) {\n\t\t\t\t\tconst otherPath = item.a === \"[draft]\" ? item.b : item.a;\n\t\t\t\t\tconst otherName = otherPath.split(\"/\").pop() || otherPath;\n\t\t\t\t\tlines.push(`- ${(item.similarity * 100).toFixed(1)}%: ${otherName} — ${item.reason}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (audit.nameCollisions.length > 0) {\n\t\t\t\tlines.push(\"\\nName collisions:\");\n\t\t\t\tfor (const item of audit.nameCollisions) {\n\t\t\t\t\tlines.push(`- ${item.name}: ${item.paths.length} existing path(s)`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (audit.recommendations && audit.recommendations.length > 0) {\n\t\t\t\tlines.push(\"\\nRecommendations:\");\n\t\t\t\tfor (const rec of audit.recommendations) {\n\t\t\t\t\tlines.push(`- ${rec}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (valid && audit.nearDuplicates.length === 0 && audit.nameCollisions.length === 0) {\n\t\t\t\tlines.push(\"\\n✓ Skill appears ready for creation.\");\n\t\t\t}\n\n\t\t\tlines.push(`\\nProposed install path: ${proposedPath}`);\n\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: lines.join(\"\\n\") }],\n\t\t\t\tdetails: report,\n\t\t\t};\n\t\t},\n\t};\n}\n\nexport function createSkillifyTool(cwd: string, options?: SkillifyToolOptions): AgentTool<typeof skillifySchema> {\n\treturn wrapToolDefinition(createSkillifyToolDefinition(cwd, options));\n}\n"]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { Type } from "typebox";
|
|
4
|
+
import { validateSkillName } from "../skills.js";
|
|
5
|
+
import { runSkillAudit } from "./skill-audit.js";
|
|
6
|
+
import { wrapToolDefinition } from "./tool-definition-wrapper.js";
|
|
7
|
+
const skillifySchema = Type.Object({
|
|
8
|
+
name: Type.String({ description: "Skill name (lowercase, a-z 0-9 hyphens only, max 64 chars)" }),
|
|
9
|
+
description: Type.String({ description: "Skill description (max 1024 chars)" }),
|
|
10
|
+
body: Type.String({ description: "Skill body/implementation code" }),
|
|
11
|
+
});
|
|
12
|
+
export function createSkillifyToolDefinition(cwd, _options) {
|
|
13
|
+
return {
|
|
14
|
+
name: "skillify",
|
|
15
|
+
label: "skillify",
|
|
16
|
+
description: "Validate a draft skill and audit for overlaps with existing skills. Pure analysis tool: generates a proposal with validation and audit report, but does NOT write files or activate the skill. Returns structured report with proposed install path.",
|
|
17
|
+
promptSnippet: "Validate and audit a draft skill",
|
|
18
|
+
promptGuidelines: [
|
|
19
|
+
"Use skillify to validate and audit draft skills before creating them.",
|
|
20
|
+
"Fix validation errors (name format, description length) and review audit findings before proceeding.",
|
|
21
|
+
"The tool returns a proposal only; persistent write and activation happen later.",
|
|
22
|
+
],
|
|
23
|
+
parameters: skillifySchema,
|
|
24
|
+
async execute(_toolCallId, { name, description, body }, _signal, _onUpdate, _ctx) {
|
|
25
|
+
const errors = [];
|
|
26
|
+
// Validate name
|
|
27
|
+
const nameErrors = validateSkillName(name);
|
|
28
|
+
errors.push(...nameErrors);
|
|
29
|
+
// Validate description
|
|
30
|
+
if (!description || description.trim() === "") {
|
|
31
|
+
errors.push("description is required");
|
|
32
|
+
}
|
|
33
|
+
else if (description.length > 1024) {
|
|
34
|
+
errors.push(`description exceeds 1024 characters (${description.length})`);
|
|
35
|
+
}
|
|
36
|
+
// Run audit on the draft
|
|
37
|
+
const audit = runSkillAudit(cwd, { name, description, body });
|
|
38
|
+
const valid = errors.length === 0;
|
|
39
|
+
const proposedPath = join(homedir(), ".pi", "agent", "skills", name, "SKILL.md");
|
|
40
|
+
const report = {
|
|
41
|
+
valid,
|
|
42
|
+
errors,
|
|
43
|
+
audit,
|
|
44
|
+
proposedPath,
|
|
45
|
+
draft: { name, description, body },
|
|
46
|
+
};
|
|
47
|
+
// Format the report as readable text
|
|
48
|
+
const lines = [];
|
|
49
|
+
lines.push(`Skillify validation: ${valid ? "✓ valid" : "✗ invalid"}`);
|
|
50
|
+
if (errors.length > 0) {
|
|
51
|
+
lines.push("\nValidation errors:");
|
|
52
|
+
for (const err of errors) {
|
|
53
|
+
lines.push(`- ${err}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
lines.push(`\nAudit: ${audit.skills.length} existing skill(s), ${audit.nearDuplicates.length} overlap warning(s).`);
|
|
57
|
+
if (audit.nearDuplicates.length > 0) {
|
|
58
|
+
lines.push("\nTop overlaps with existing skills:");
|
|
59
|
+
for (const item of audit.nearDuplicates.slice(0, 5)) {
|
|
60
|
+
const otherPath = item.a === "[draft]" ? item.b : item.a;
|
|
61
|
+
const otherName = otherPath.split("/").pop() || otherPath;
|
|
62
|
+
lines.push(`- ${(item.similarity * 100).toFixed(1)}%: ${otherName} — ${item.reason}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (audit.nameCollisions.length > 0) {
|
|
66
|
+
lines.push("\nName collisions:");
|
|
67
|
+
for (const item of audit.nameCollisions) {
|
|
68
|
+
lines.push(`- ${item.name}: ${item.paths.length} existing path(s)`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (audit.recommendations && audit.recommendations.length > 0) {
|
|
72
|
+
lines.push("\nRecommendations:");
|
|
73
|
+
for (const rec of audit.recommendations) {
|
|
74
|
+
lines.push(`- ${rec}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (valid && audit.nearDuplicates.length === 0 && audit.nameCollisions.length === 0) {
|
|
78
|
+
lines.push("\n✓ Skill appears ready for creation.");
|
|
79
|
+
}
|
|
80
|
+
lines.push(`\nProposed install path: ${proposedPath}`);
|
|
81
|
+
return {
|
|
82
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
83
|
+
details: report,
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export function createSkillifyTool(cwd, options) {
|
|
89
|
+
return wrapToolDefinition(createSkillifyToolDefinition(cwd, options));
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=skillify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skillify.js","sourceRoot":"","sources":["../../../src/core/tools/skillify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,aAAa,EAAyB,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC;IAClC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,4DAA4D,EAAE,CAAC;IAChG,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,oCAAoC,EAAE,CAAC;IAC/E,IAAI,EAAE,IAAI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AC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AAAA,CACtE","sourcesContent":["import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport type { AgentTool } from \"@caupulican/pi-agent-core\";\nimport { type Static, Type } from \"typebox\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport { validateSkillName } from \"../skills.ts\";\nimport { runSkillAudit, type SkillAuditReport } from \"./skill-audit.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\n\nconst skillifySchema = Type.Object({\n\tname: Type.String({ description: \"Skill name (lowercase, a-z 0-9 hyphens only, max 64 chars)\" }),\n\tdescription: Type.String({ description: \"Skill description (max 1024 chars)\" }),\n\tbody: Type.String({ description: \"Skill body/implementation code\" }),\n});\n\nexport type SkillifyInput = Static<typeof skillifySchema>;\n\nexport interface SkillifyReport {\n\tvalid: boolean;\n\terrors: string[];\n\taudit: SkillAuditReport;\n\tproposedPath: string;\n\tdraft: {\n\t\tname: string;\n\t\tdescription: string;\n\t\tbody: string;\n\t};\n}\n\nexport interface SkillifyToolDetails {\n\treport?: SkillifyReport;\n}\n\nexport interface SkillifyToolOptions {}\n\nexport function createSkillifyToolDefinition(\n\tcwd: string,\n\t_options?: SkillifyToolOptions,\n): ToolDefinition<typeof skillifySchema, SkillifyReport> {\n\treturn {\n\t\tname: \"skillify\",\n\t\tlabel: \"skillify\",\n\t\tdescription:\n\t\t\t\"Validate a draft skill and audit for overlaps with existing skills. Pure analysis tool: generates a proposal with validation and audit report, but does NOT write files or activate the skill. Returns structured report with proposed install path.\",\n\t\tpromptSnippet: \"Validate and audit a draft skill\",\n\t\tpromptGuidelines: [\n\t\t\t\"Use skillify to validate and audit draft skills before creating them.\",\n\t\t\t\"Fix validation errors (name format, description length) and review audit findings before proceeding.\",\n\t\t\t\"The tool returns a proposal only; persistent write and activation happen later.\",\n\t\t],\n\t\tparameters: skillifySchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ name, description, body }: SkillifyInput,\n\t\t\t_signal?: AbortSignal,\n\t\t\t_onUpdate?,\n\t\t\t_ctx?,\n\t\t): Promise<{\n\t\t\tcontent: Array<{ type: \"text\"; text: string }>;\n\t\t\tdetails: SkillifyReport;\n\t\t}> {\n\t\t\tconst errors: string[] = [];\n\n\t\t\t// Validate name\n\t\t\tconst nameErrors = validateSkillName(name);\n\t\t\terrors.push(...nameErrors);\n\n\t\t\t// Validate description\n\t\t\tif (!description || description.trim() === \"\") {\n\t\t\t\terrors.push(\"description is required\");\n\t\t\t} else if (description.length > 1024) {\n\t\t\t\terrors.push(`description exceeds 1024 characters (${description.length})`);\n\t\t\t}\n\n\t\t\t// Run audit on the draft\n\t\t\tconst audit = runSkillAudit(cwd, { name, description, body });\n\n\t\t\tconst valid = errors.length === 0;\n\t\t\tconst proposedPath = join(homedir(), \".pi\", \"agent\", \"skills\", name, \"SKILL.md\");\n\n\t\t\tconst report: SkillifyReport = {\n\t\t\t\tvalid,\n\t\t\t\terrors,\n\t\t\t\taudit,\n\t\t\t\tproposedPath,\n\t\t\t\tdraft: { name, description, body },\n\t\t\t};\n\n\t\t\t// Format the report as readable text\n\t\t\tconst lines: string[] = [];\n\t\t\tlines.push(`Skillify validation: ${valid ? \"✓ valid\" : \"✗ invalid\"}`);\n\n\t\t\tif (errors.length > 0) {\n\t\t\t\tlines.push(\"\\nValidation errors:\");\n\t\t\t\tfor (const err of errors) {\n\t\t\t\t\tlines.push(`- ${err}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlines.push(\n\t\t\t\t`\\nAudit: ${audit.skills.length} existing skill(s), ${audit.nearDuplicates.length} overlap warning(s).`,\n\t\t\t);\n\n\t\t\tif (audit.nearDuplicates.length > 0) {\n\t\t\t\tlines.push(\"\\nTop overlaps with existing skills:\");\n\t\t\t\tfor (const item of audit.nearDuplicates.slice(0, 5)) {\n\t\t\t\t\tconst otherPath = item.a === \"[draft]\" ? item.b : item.a;\n\t\t\t\t\tconst otherName = otherPath.split(\"/\").pop() || otherPath;\n\t\t\t\t\tlines.push(`- ${(item.similarity * 100).toFixed(1)}%: ${otherName} — ${item.reason}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (audit.nameCollisions.length > 0) {\n\t\t\t\tlines.push(\"\\nName collisions:\");\n\t\t\t\tfor (const item of audit.nameCollisions) {\n\t\t\t\t\tlines.push(`- ${item.name}: ${item.paths.length} existing path(s)`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (audit.recommendations && audit.recommendations.length > 0) {\n\t\t\t\tlines.push(\"\\nRecommendations:\");\n\t\t\t\tfor (const rec of audit.recommendations) {\n\t\t\t\t\tlines.push(`- ${rec}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (valid && audit.nearDuplicates.length === 0 && audit.nameCollisions.length === 0) {\n\t\t\t\tlines.push(\"\\n✓ Skill appears ready for creation.\");\n\t\t\t}\n\n\t\t\tlines.push(`\\nProposed install path: ${proposedPath}`);\n\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: lines.join(\"\\n\") }],\n\t\t\t\tdetails: report,\n\t\t\t};\n\t\t},\n\t};\n}\n\nexport function createSkillifyTool(cwd: string, options?: SkillifyToolOptions): AgentTool<typeof skillifySchema> {\n\treturn wrapToolDefinition(createSkillifyToolDefinition(cwd, options));\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export { type CompactionSettings, type DirectoryResourceProfileInfo, getDirector
|
|
|
22
22
|
export { formatSkillsForPrompt, type LoadSkillsFromDirOptions, type LoadSkillsResult, loadSkills, loadSkillsFromDir, type Skill, type SkillFrontmatter, } from "./core/skills.ts";
|
|
23
23
|
export { createSyntheticSourceInfo } from "./core/source-info.ts";
|
|
24
24
|
export { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, createBashToolDefinition, createEditToolDefinition, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLsToolDefinition, createReadToolDefinition, createWriteToolDefinition, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, type EditOperations, type EditToolDetails, type EditToolInput, type EditToolOptions, type FindOperations, type FindToolDetails, type FindToolInput, type FindToolOptions, formatSize, type GrepOperations, type GrepToolDetails, type GrepToolInput, type GrepToolOptions, type LsOperations, type LsToolDetails, type LsToolInput, type LsToolOptions, type ReadOperations, type ReadToolDetails, type ReadToolInput, type ReadToolOptions, type ToolsOptions, type TruncationOptions, type TruncationResult, truncateHead, truncateLine, truncateTail, type WriteOperations, type WriteToolInput, type WriteToolOptions, withFileMutationQueue, } from "./core/tools/index.ts";
|
|
25
|
+
export { jaccard, runSkillAudit, type SkillAuditReport, type SkillSummary, tokenize, } from "./core/tools/skill-audit.ts";
|
|
25
26
|
export { hasProjectTrustInputs, type ProjectTrustDecision, ProjectTrustStore } from "./core/trust-manager.ts";
|
|
26
27
|
export { type MainOptions, main } from "./main.ts";
|
|
27
28
|
export { InteractiveMode, type InteractiveModeOptions, type ModelInfo, type PrintModeOptions, RpcClient, type RpcClientOptions, type RpcCommand, type RpcEventListener, type RpcResponse, type RpcSessionState, runPrintMode, runRpcMode, } from "./modes/index.ts";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,IAAI,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACN,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,eAAe,EACf,KAAK,YAAY,GACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK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AY,EACZ,sBAAsB,EACtB,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,eAAe,EACf,OAAO,EACP,OAAO,EACP,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,iBAAiB,EACtB,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,qBAAqB,EACrB,UAAU,EACV,SAAS,EACT,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,KAAK,oBAAoB,GACzB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,EACL,KAAK,UAAU,GACf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9F,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\nexport { type Args, parseArgs } from \"./cli/args.ts\";\n\n// Config paths\nexport { getAgentDir, VERSION } from \"./config.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\ttype AuthStatus,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.ts\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionMode,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tcreateExtensionRuntime,\n\tdefineTool,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport {\n\tappendRunRecord,\n\ttype ConfidenceMode,\n\ttype ConfidenceResult,\n\tcleanupImprovementSandbox,\n\tcompareMetric,\n\tcomputeMadConfidence,\n\tcreateImprovementDecisionTool,\n\tcreateImprovementLoopTool,\n\tcreateImprovementSandbox,\n\tdecideImprovement,\n\texportImprovementSandboxPatch,\n\ttype GitStatusEntry,\n\ttype ImprovementDecision,\n\ttype ImprovementDecisionInput,\n\ttype ImprovementDecisionReason,\n\ttype ImprovementDecisionResult,\n\ttype ImprovementLoopConfig,\n\ttype ImprovementLoopExec,\n\ttype ImprovementLoopInitInput,\n\ttype ImprovementLoopPaths,\n\ttype ImprovementLoopRecordInput,\n\ttype ImprovementLoopState,\n\ttype ImprovementLoopStatusInput,\n\ttype ImprovementLoopToolAction,\n\ttype ImprovementLoopToolDetails,\n\ttype ImprovementMeasurementCommandResult,\n\ttype ImprovementMeasurementResult,\n\ttype ImprovementRunRecord,\n\ttype ImprovementSandboxCleanupInput,\n\ttype ImprovementSandboxCreateInput,\n\ttype ImprovementSandboxExportInput,\n\ttype ImprovementSandboxRecord,\n\timprovementLoopPaths,\n\tinitImprovementLoop,\n\ttype LowConfidenceAction,\n\ttype MetricComparison,\n\ttype MetricDirection,\n\tmedian,\n\tmedianAbsoluteDeviation,\n\tmetricMapFromOutput,\n\ttype OwnedDiscardPlan,\n\ttype OwnedDiscardPlanInput,\n\tparseGitPorcelainStatus,\n\tparseMetricLines,\n\tplanOwnedDiscard,\n\treadImprovementLoopState,\n\treadRunRecords,\n\trecordImprovementRun,\n\trunImprovementMeasurement,\n\tselectPrimaryMetric,\n\tserializeRunRecord,\n} from \"./core/improvement-loop.ts\";\nexport { convertToLlm } from \"./core/messages.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport {\n\tACTIVE_TURN_TTL_MS,\n\tAUTO_RELOAD_COORDINATOR_TTL_MS,\n\tdescribeReloadSession,\n\tgetPendingReloadBlockers,\n\tisReloadSessionProcessAlive,\n\ttype PendingReloadBlockers,\n\ttype ReloadBlockerOptions,\n\ttype ReloadSessionRecord,\n} from \"./core/reload-blockers.ts\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\nexport {\n\tmergeResourceProfileMap,\n\tmergeResourceProfileSettings,\n\tparseResourceProfileBlocks,\n\tparseResourceProfileInput,\n\tparseResourceProfileJson,\n\tstripResourceProfileBlocks,\n} from \"./core/resource-profile-blocks.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionServices,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n} from \"./core/sdk.ts\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.ts\";\nexport {\n\ttype CompactionSettings,\n\ttype DirectoryResourceProfileInfo,\n\tgetDirectoryResourceProfileInfo,\n\ttype ImageSettings,\n\tmatchesResourceProfilePattern,\n\ttype PackageSource,\n\ttype ResourceProfileFilterSettings,\n\ttype ResourceProfileKind,\n\ttype ResourceProfileSettings,\n\ttype RetrySettings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\nexport { hasProjectTrustInputs, type ProjectTrustDecision, ProjectTrustStore } from \"./core/trust-manager.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEventListener,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\trenderTitleBadge,\n\trenderToolTitle,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tTitleBadgeComponent,\n\ttype TitleBadgeOptions,\n\ttype TitleBadgeSegment,\n\ttype TitleBadgeStatus,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tToolTitleComponent,\n\ttype ToolTitleOptions,\n\ttype ToolTitleSegment,\n\ttype ToolTitleStatus,\n\tTreeSelectorComponent,\n\ttitleBadge,\n\ttoolTitle,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,IAAI,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACN,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,eAAe,EACf,KAAK,YAAY,GACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,WAAW,EACX,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,KAAK,eAAe,GACpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB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OAAO,EACP,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,iBAAiB,EACtB,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,qBAAqB,EACrB,UAAU,EACV,SAAS,EACT,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,KAAK,oBAAoB,GACzB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,EACL,KAAK,UAAU,GACf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9F,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\nexport { type Args, parseArgs } from \"./cli/args.ts\";\n\n// Config paths\nexport { getAgentDir, VERSION } from \"./config.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\ttype AuthStatus,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.ts\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionMode,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tcreateExtensionRuntime,\n\tdefineTool,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport {\n\tappendRunRecord,\n\ttype ConfidenceMode,\n\ttype ConfidenceResult,\n\tcleanupImprovementSandbox,\n\tcompareMetric,\n\tcomputeMadConfidence,\n\tcreateImprovementDecisionTool,\n\tcreateImprovementLoopTool,\n\tcreateImprovementSandbox,\n\tdecideImprovement,\n\texportImprovementSandboxPatch,\n\ttype GitStatusEntry,\n\ttype ImprovementDecision,\n\ttype ImprovementDecisionInput,\n\ttype ImprovementDecisionReason,\n\ttype ImprovementDecisionResult,\n\ttype ImprovementLoopConfig,\n\ttype ImprovementLoopExec,\n\ttype ImprovementLoopInitInput,\n\ttype ImprovementLoopPaths,\n\ttype ImprovementLoopRecordInput,\n\ttype ImprovementLoopState,\n\ttype ImprovementLoopStatusInput,\n\ttype ImprovementLoopToolAction,\n\ttype ImprovementLoopToolDetails,\n\ttype ImprovementMeasurementCommandResult,\n\ttype ImprovementMeasurementResult,\n\ttype ImprovementRunRecord,\n\ttype ImprovementSandboxCleanupInput,\n\ttype ImprovementSandboxCreateInput,\n\ttype ImprovementSandboxExportInput,\n\ttype ImprovementSandboxRecord,\n\timprovementLoopPaths,\n\tinitImprovementLoop,\n\ttype LowConfidenceAction,\n\ttype MetricComparison,\n\ttype MetricDirection,\n\tmedian,\n\tmedianAbsoluteDeviation,\n\tmetricMapFromOutput,\n\ttype OwnedDiscardPlan,\n\ttype OwnedDiscardPlanInput,\n\tparseGitPorcelainStatus,\n\tparseMetricLines,\n\tplanOwnedDiscard,\n\treadImprovementLoopState,\n\treadRunRecords,\n\trecordImprovementRun,\n\trunImprovementMeasurement,\n\tselectPrimaryMetric,\n\tserializeRunRecord,\n} from \"./core/improvement-loop.ts\";\nexport { convertToLlm } from \"./core/messages.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport {\n\tACTIVE_TURN_TTL_MS,\n\tAUTO_RELOAD_COORDINATOR_TTL_MS,\n\tdescribeReloadSession,\n\tgetPendingReloadBlockers,\n\tisReloadSessionProcessAlive,\n\ttype PendingReloadBlockers,\n\ttype ReloadBlockerOptions,\n\ttype ReloadSessionRecord,\n} from \"./core/reload-blockers.ts\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\nexport {\n\tmergeResourceProfileMap,\n\tmergeResourceProfileSettings,\n\tparseResourceProfileBlocks,\n\tparseResourceProfileInput,\n\tparseResourceProfileJson,\n\tstripResourceProfileBlocks,\n} from \"./core/resource-profile-blocks.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionServices,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n} from \"./core/sdk.ts\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.ts\";\nexport {\n\ttype CompactionSettings,\n\ttype DirectoryResourceProfileInfo,\n\tgetDirectoryResourceProfileInfo,\n\ttype ImageSettings,\n\tmatchesResourceProfilePattern,\n\ttype PackageSource,\n\ttype ResourceProfileFilterSettings,\n\ttype ResourceProfileKind,\n\ttype ResourceProfileSettings,\n\ttype RetrySettings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\n// Skill-audit primitives — exported so extensions (e.g. continuous-learning) can reuse the native\n// Jaccard overlap audit via `import { runSkillAudit } from \"@caupulican/pi-adaptative\"` instead of\n// carrying a duplicate copy.\nexport {\n\tjaccard,\n\trunSkillAudit,\n\ttype SkillAuditReport,\n\ttype SkillSummary,\n\ttokenize,\n} from \"./core/tools/skill-audit.ts\";\nexport { hasProjectTrustInputs, type ProjectTrustDecision, ProjectTrustStore } from \"./core/trust-manager.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEventListener,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\trenderTitleBadge,\n\trenderToolTitle,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tTitleBadgeComponent,\n\ttype TitleBadgeOptions,\n\ttype TitleBadgeSegment,\n\ttype TitleBadgeStatus,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tToolTitleComponent,\n\ttype ToolTitleOptions,\n\ttype ToolTitleSegment,\n\ttype ToolTitleStatus,\n\tTreeSelectorComponent,\n\ttitleBadge,\n\ttoolTitle,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.ts\";\n"]}
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,10 @@ export { formatSkillsForPrompt, loadSkills, loadSkillsFromDir, } from "./core/sk
|
|
|
29
29
|
export { createSyntheticSourceInfo } from "./core/source-info.js";
|
|
30
30
|
// Tools
|
|
31
31
|
export { createBashToolDefinition, createEditToolDefinition, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLsToolDefinition, createReadToolDefinition, createWriteToolDefinition, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateHead, truncateLine, truncateTail, withFileMutationQueue, } from "./core/tools/index.js";
|
|
32
|
+
// Skill-audit primitives — exported so extensions (e.g. continuous-learning) can reuse the native
|
|
33
|
+
// Jaccard overlap audit via `import { runSkillAudit } from "@caupulican/pi-adaptative"` instead of
|
|
34
|
+
// carrying a duplicate copy.
|
|
35
|
+
export { jaccard, runSkillAudit, tokenize, } from "./core/tools/skill-audit.js";
|
|
32
36
|
export { hasProjectTrustInputs, ProjectTrustStore } from "./core/trust-manager.js";
|
|
33
37
|
// Main entry point
|
|
34
38
|
export { main } from "./main.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,OAAO,EAAa,SAAS,EAAE,MAAM,eAAe,CAAC;AAErD,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACN,YAAY,EAOZ,eAAe,GAEf,MAAM,yBAAyB,CAAC;AACjC,0BAA0B;AAC1B,OAAO,EAIN,WAAW,EAEX,sBAAsB,EACtB,0BAA0B,GAE1B,MAAM,wBAAwB,CAAC;AAChC,aAAa;AACb,OAAO,EAMN,sBAAsB,EACtB,8BAA8B,EAC9B,OAAO,EACP,2BAA2B,EAC3B,cAAc,EAEd,YAAY,EACZ,kBAAkB,EAElB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAA0C,MAAM,qBAAqB,CAAC;AAkF7F,OAAO,EACN,sBAAsB,EACtB,UAAU,EACV,yBAAyB,EACzB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,GACnB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACN,eAAe,EAGf,yBAAyB,EACzB,aAAa,EACb,oBAAoB,EACpB,6BAA6B,EAC7B,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,EACjB,6BAA6B,EAsB7B,oBAAoB,EACpB,mBAAmB,EAInB,MAAM,EACN,uBAAuB,EACvB,m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Ae,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAqB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC9F,kBAAkB;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\nexport { type Args, parseArgs } from \"./cli/args.ts\";\n\n// Config paths\nexport { getAgentDir, VERSION } from \"./config.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\ttype AuthStatus,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.ts\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionMode,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tcreateExtensionRuntime,\n\tdefineTool,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport {\n\tappendRunRecord,\n\ttype ConfidenceMode,\n\ttype ConfidenceResult,\n\tcleanupImprovementSandbox,\n\tcompareMetric,\n\tcomputeMadConfidence,\n\tcreateImprovementDecisionTool,\n\tcreateImprovementLoopTool,\n\tcreateImprovementSandbox,\n\tdecideImprovement,\n\texportImprovementSandboxPatch,\n\ttype GitStatusEntry,\n\ttype ImprovementDecision,\n\ttype ImprovementDecisionInput,\n\ttype ImprovementDecisionReason,\n\ttype ImprovementDecisionResult,\n\ttype ImprovementLoopConfig,\n\ttype ImprovementLoopExec,\n\ttype ImprovementLoopInitInput,\n\ttype ImprovementLoopPaths,\n\ttype ImprovementLoopRecordInput,\n\ttype ImprovementLoopState,\n\ttype ImprovementLoopStatusInput,\n\ttype ImprovementLoopToolAction,\n\ttype ImprovementLoopToolDetails,\n\ttype ImprovementMeasurementCommandResult,\n\ttype ImprovementMeasurementResult,\n\ttype ImprovementRunRecord,\n\ttype ImprovementSandboxCleanupInput,\n\ttype ImprovementSandboxCreateInput,\n\ttype ImprovementSandboxExportInput,\n\ttype ImprovementSandboxRecord,\n\timprovementLoopPaths,\n\tinitImprovementLoop,\n\ttype LowConfidenceAction,\n\ttype MetricComparison,\n\ttype MetricDirection,\n\tmedian,\n\tmedianAbsoluteDeviation,\n\tmetricMapFromOutput,\n\ttype OwnedDiscardPlan,\n\ttype OwnedDiscardPlanInput,\n\tparseGitPorcelainStatus,\n\tparseMetricLines,\n\tplanOwnedDiscard,\n\treadImprovementLoopState,\n\treadRunRecords,\n\trecordImprovementRun,\n\trunImprovementMeasurement,\n\tselectPrimaryMetric,\n\tserializeRunRecord,\n} from \"./core/improvement-loop.ts\";\nexport { convertToLlm } from \"./core/messages.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport {\n\tACTIVE_TURN_TTL_MS,\n\tAUTO_RELOAD_COORDINATOR_TTL_MS,\n\tdescribeReloadSession,\n\tgetPendingReloadBlockers,\n\tisReloadSessionProcessAlive,\n\ttype PendingReloadBlockers,\n\ttype ReloadBlockerOptions,\n\ttype ReloadSessionRecord,\n} from \"./core/reload-blockers.ts\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\nexport {\n\tmergeResourceProfileMap,\n\tmergeResourceProfileSettings,\n\tparseResourceProfileBlocks,\n\tparseResourceProfileInput,\n\tparseResourceProfileJson,\n\tstripResourceProfileBlocks,\n} from \"./core/resource-profile-blocks.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionServices,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n} from \"./core/sdk.ts\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.ts\";\nexport {\n\ttype CompactionSettings,\n\ttype DirectoryResourceProfileInfo,\n\tgetDirectoryResourceProfileInfo,\n\ttype ImageSettings,\n\tmatchesResourceProfilePattern,\n\ttype PackageSource,\n\ttype ResourceProfileFilterSettings,\n\ttype ResourceProfileKind,\n\ttype ResourceProfileSettings,\n\ttype RetrySettings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\nexport { hasProjectTrustInputs, type ProjectTrustDecision, ProjectTrustStore } from \"./core/trust-manager.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEventListener,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\trenderTitleBadge,\n\trenderToolTitle,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tTitleBadgeComponent,\n\ttype TitleBadgeOptions,\n\ttype TitleBadgeSegment,\n\ttype TitleBadgeStatus,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tToolTitleComponent,\n\ttype ToolTitleOptions,\n\ttype ToolTitleSegment,\n\ttype ToolTitleStatus,\n\tTreeSelectorComponent,\n\ttitleBadge,\n\ttoolTitle,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,OAAO,EAAa,SAAS,EAAE,MAAM,eAAe,CAAC;AAErD,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACN,YAAY,EAOZ,eAAe,GAEf,MAAM,yBAAyB,CAAC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parseArgs } from \"./cli/args.ts\";\n\n// Config paths\nexport { getAgentDir, VERSION } from \"./config.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\ttype AuthStatus,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.ts\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionMode,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tcreateExtensionRuntime,\n\tdefineTool,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport {\n\tappendRunRecord,\n\ttype ConfidenceMode,\n\ttype ConfidenceResult,\n\tcleanupImprovementSandbox,\n\tcompareMetric,\n\tcomputeMadConfidence,\n\tcreateImprovementDecisionTool,\n\tcreateImprovementLoopTool,\n\tcreateImprovementSandbox,\n\tdecideImprovement,\n\texportImprovementSandboxPatch,\n\ttype GitStatusEntry,\n\ttype ImprovementDecision,\n\ttype ImprovementDecisionInput,\n\ttype ImprovementDecisionReason,\n\ttype ImprovementDecisionResult,\n\ttype ImprovementLoopConfig,\n\ttype ImprovementLoopExec,\n\ttype ImprovementLoopInitInput,\n\ttype ImprovementLoopPaths,\n\ttype ImprovementLoopRecordInput,\n\ttype ImprovementLoopState,\n\ttype ImprovementLoopStatusInput,\n\ttype ImprovementLoopToolAction,\n\ttype ImprovementLoopToolDetails,\n\ttype ImprovementMeasurementCommandResult,\n\ttype ImprovementMeasurementResult,\n\ttype ImprovementRunRecord,\n\ttype ImprovementSandboxCleanupInput,\n\ttype ImprovementSandboxCreateInput,\n\ttype ImprovementSandboxExportInput,\n\ttype ImprovementSandboxRecord,\n\timprovementLoopPaths,\n\tinitImprovementLoop,\n\ttype LowConfidenceAction,\n\ttype MetricComparison,\n\ttype MetricDirection,\n\tmedian,\n\tmedianAbsoluteDeviation,\n\tmetricMapFromOutput,\n\ttype OwnedDiscardPlan,\n\ttype OwnedDiscardPlanInput,\n\tparseGitPorcelainStatus,\n\tparseMetricLines,\n\tplanOwnedDiscard,\n\treadImprovementLoopState,\n\treadRunRecords,\n\trecordImprovementRun,\n\trunImprovementMeasurement,\n\tselectPrimaryMetric,\n\tserializeRunRecord,\n} from \"./core/improvement-loop.ts\";\nexport { convertToLlm } from \"./core/messages.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport {\n\tACTIVE_TURN_TTL_MS,\n\tAUTO_RELOAD_COORDINATOR_TTL_MS,\n\tdescribeReloadSession,\n\tgetPendingReloadBlockers,\n\tisReloadSessionProcessAlive,\n\ttype PendingReloadBlockers,\n\ttype ReloadBlockerOptions,\n\ttype ReloadSessionRecord,\n} from \"./core/reload-blockers.ts\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\nexport {\n\tmergeResourceProfileMap,\n\tmergeResourceProfileSettings,\n\tparseResourceProfileBlocks,\n\tparseResourceProfileInput,\n\tparseResourceProfileJson,\n\tstripResourceProfileBlocks,\n} from \"./core/resource-profile-blocks.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionServices,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n} from \"./core/sdk.ts\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.ts\";\nexport {\n\ttype CompactionSettings,\n\ttype DirectoryResourceProfileInfo,\n\tgetDirectoryResourceProfileInfo,\n\ttype ImageSettings,\n\tmatchesResourceProfilePattern,\n\ttype PackageSource,\n\ttype ResourceProfileFilterSettings,\n\ttype ResourceProfileKind,\n\ttype ResourceProfileSettings,\n\ttype RetrySettings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\n// Skill-audit primitives — exported so extensions (e.g. continuous-learning) can reuse the native\n// Jaccard overlap audit via `import { runSkillAudit } from \"@caupulican/pi-adaptative\"` instead of\n// carrying a duplicate copy.\nexport {\n\tjaccard,\n\trunSkillAudit,\n\ttype SkillAuditReport,\n\ttype SkillSummary,\n\ttokenize,\n} from \"./core/tools/skill-audit.ts\";\nexport { hasProjectTrustInputs, type ProjectTrustDecision, ProjectTrustStore } from \"./core/trust-manager.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEventListener,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\trenderTitleBadge,\n\trenderToolTitle,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tTitleBadgeComponent,\n\ttype TitleBadgeOptions,\n\ttype TitleBadgeSegment,\n\ttype TitleBadgeStatus,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tToolTitleComponent,\n\ttype ToolTitleOptions,\n\ttype ToolTitleSegment,\n\ttype ToolTitleStatus,\n\tTreeSelectorComponent,\n\ttitleBadge,\n\ttoolTitle,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.ts\";\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Container, type Focusable, Input } from "@caupulican/pi-tui";
|
|
2
|
+
import type { ResourceProfileKind, ResourceProfileSettings } from "../../../core/settings-manager.ts";
|
|
3
|
+
export interface ProfileResourceEditorKind {
|
|
4
|
+
kind: ResourceProfileKind;
|
|
5
|
+
label: string;
|
|
6
|
+
allIds: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface ProfileResourceEditorOptions {
|
|
9
|
+
profileName: string;
|
|
10
|
+
initialResources: ResourceProfileSettings;
|
|
11
|
+
kinds: ProfileResourceEditorKind[];
|
|
12
|
+
onSave: (resources: ResourceProfileSettings) => void;
|
|
13
|
+
onCancel: () => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* TUI component for editing per-kind resource toggles in a profile.
|
|
17
|
+
* Shows a selectable list of resources for each kind (tools, skills, etc.),
|
|
18
|
+
* with space-to-toggle, search filtering, and save/cancel callbacks.
|
|
19
|
+
*/
|
|
20
|
+
export declare class ProfileResourceEditorComponent extends Container implements Focusable {
|
|
21
|
+
private profileName;
|
|
22
|
+
private kinds;
|
|
23
|
+
private enabledByKind;
|
|
24
|
+
private currentKindIndex;
|
|
25
|
+
private filteredItems;
|
|
26
|
+
private selectedIndex;
|
|
27
|
+
private searchInput;
|
|
28
|
+
private kindHeaderText;
|
|
29
|
+
private listContainer;
|
|
30
|
+
private footerText;
|
|
31
|
+
private isDirty;
|
|
32
|
+
private maxVisible;
|
|
33
|
+
private _focused;
|
|
34
|
+
get focused(): boolean;
|
|
35
|
+
set focused(value: boolean);
|
|
36
|
+
private onSave;
|
|
37
|
+
private onCancel;
|
|
38
|
+
constructor(options: ProfileResourceEditorOptions);
|
|
39
|
+
private getKindHeaderText;
|
|
40
|
+
private getCurrentKind;
|
|
41
|
+
private getCurrentEnabledSet;
|
|
42
|
+
private buildItems;
|
|
43
|
+
private getFooterText;
|
|
44
|
+
private refresh;
|
|
45
|
+
private updateList;
|
|
46
|
+
handleInput(data: string): void;
|
|
47
|
+
private persistChanges;
|
|
48
|
+
getSearchInput(): Input;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=profile-resource-editor.d.ts.map
|