@kernel.chat/kbot 3.52.0 → 3.54.0
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/dist/agents/replit.js +1 -1
- package/dist/behaviour.d.ts +30 -0
- package/dist/behaviour.d.ts.map +1 -0
- package/dist/behaviour.js +191 -0
- package/dist/behaviour.js.map +1 -0
- package/dist/bootstrap.js +1 -1
- package/dist/bootstrap.js.map +1 -1
- package/dist/integrations/ableton-m4l.d.ts +124 -0
- package/dist/integrations/ableton-m4l.d.ts.map +1 -0
- package/dist/integrations/ableton-m4l.js +338 -0
- package/dist/integrations/ableton-m4l.js.map +1 -0
- package/dist/integrations/ableton-osc.d.ts.map +1 -1
- package/dist/integrations/ableton-osc.js +6 -2
- package/dist/integrations/ableton-osc.js.map +1 -1
- package/dist/music-learning.d.ts +181 -0
- package/dist/music-learning.d.ts.map +1 -0
- package/dist/music-learning.js +340 -0
- package/dist/music-learning.js.map +1 -0
- package/dist/skill-system.d.ts +68 -0
- package/dist/skill-system.d.ts.map +1 -0
- package/dist/skill-system.js +386 -0
- package/dist/skill-system.js.map +1 -0
- package/dist/tools/ableton.d.ts.map +1 -1
- package/dist/tools/ableton.js +24 -8
- package/dist/tools/ableton.js.map +1 -1
- package/dist/tools/arrangement-engine.d.ts +2 -0
- package/dist/tools/arrangement-engine.d.ts.map +1 -0
- package/dist/tools/arrangement-engine.js +644 -0
- package/dist/tools/arrangement-engine.js.map +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +5 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/producer-engine.d.ts +71 -0
- package/dist/tools/producer-engine.d.ts.map +1 -0
- package/dist/tools/producer-engine.js +1859 -0
- package/dist/tools/producer-engine.js.map +1 -0
- package/dist/tools/sound-designer.d.ts +2 -0
- package/dist/tools/sound-designer.d.ts.map +1 -0
- package/dist/tools/sound-designer.js +896 -0
- package/dist/tools/sound-designer.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
// kbot Music Learning Engine — Self-Improving Production Intelligence
|
|
2
|
+
//
|
|
3
|
+
// Inspired by Agent Zero's adaptive memory + kbot's existing learning.ts
|
|
4
|
+
//
|
|
5
|
+
// Three feedback loops:
|
|
6
|
+
// 1. SOUND MEMORY — Remember which synth settings, presets, and samples sounded good
|
|
7
|
+
// 2. PATTERN MEMORY — Remember which drum patterns, melodies, and progressions the user kept
|
|
8
|
+
// 3. MIX MEMORY — Remember mix decisions that worked (volumes, EQ, sends)
|
|
9
|
+
//
|
|
10
|
+
// The engine learns from:
|
|
11
|
+
// - User keeps a beat playing (positive signal)
|
|
12
|
+
// - User changes something (negative signal for what was changed, positive for what wasn't)
|
|
13
|
+
// - User says "I like this" or "this sounds good" (explicit positive)
|
|
14
|
+
// - User says "change the drums" or "make it darker" (explicit correction)
|
|
15
|
+
// - User exports/saves (strongest positive signal)
|
|
16
|
+
//
|
|
17
|
+
// Everything persists to ~/.kbot/music-memory/
|
|
18
|
+
import { homedir } from 'node:os';
|
|
19
|
+
import { join } from 'node:path';
|
|
20
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
21
|
+
const MUSIC_DIR = join(homedir(), '.kbot', 'music-memory');
|
|
22
|
+
const SOUNDS_FILE = join(MUSIC_DIR, 'sounds.json');
|
|
23
|
+
const PATTERNS_FILE = join(MUSIC_DIR, 'patterns.json');
|
|
24
|
+
const MIXES_FILE = join(MUSIC_DIR, 'mixes.json');
|
|
25
|
+
const PREFERENCES_FILE = join(MUSIC_DIR, 'preferences.json');
|
|
26
|
+
const HISTORY_FILE = join(MUSIC_DIR, 'history.json');
|
|
27
|
+
function ensureDir() {
|
|
28
|
+
if (!existsSync(MUSIC_DIR))
|
|
29
|
+
mkdirSync(MUSIC_DIR, { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
function loadJSON(path, fallback) {
|
|
32
|
+
ensureDir();
|
|
33
|
+
if (!existsSync(path))
|
|
34
|
+
return fallback;
|
|
35
|
+
try {
|
|
36
|
+
return JSON.parse(readFileSync(path, 'utf-8'));
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return fallback;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function saveJSON(path, data) {
|
|
43
|
+
ensureDir();
|
|
44
|
+
writeFileSync(path, JSON.stringify(data, null, 2));
|
|
45
|
+
}
|
|
46
|
+
let sounds = loadJSON(SOUNDS_FILE, []);
|
|
47
|
+
/** Record a sound that was used in a production */
|
|
48
|
+
export function recordSound(sound) {
|
|
49
|
+
const existing = sounds.find(s => s.role === sound.role && s.plugin === sound.plugin && s.genre === sound.genre);
|
|
50
|
+
if (existing) {
|
|
51
|
+
existing.uses++;
|
|
52
|
+
existing.lastUsed = new Date().toISOString();
|
|
53
|
+
// Merge params (keep the latest)
|
|
54
|
+
existing.params = { ...existing.params, ...sound.params };
|
|
55
|
+
if (sound.preset)
|
|
56
|
+
existing.preset = sound.preset;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
sounds.push({
|
|
60
|
+
...sound,
|
|
61
|
+
score: 0.5, // neutral starting score
|
|
62
|
+
uses: 1,
|
|
63
|
+
lastUsed: new Date().toISOString(),
|
|
64
|
+
tags: [],
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
saveJSON(SOUNDS_FILE, sounds);
|
|
68
|
+
}
|
|
69
|
+
/** Boost a sound's score (user liked it) */
|
|
70
|
+
export function boostSound(role, genre, amount = 0.1) {
|
|
71
|
+
const sound = sounds.find(s => s.role === role && s.genre === genre);
|
|
72
|
+
if (sound) {
|
|
73
|
+
sound.score = Math.min(1, sound.score + amount);
|
|
74
|
+
saveJSON(SOUNDS_FILE, sounds);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/** Penalize a sound's score (user changed it) */
|
|
78
|
+
export function penalizeSound(role, genre, amount = 0.15) {
|
|
79
|
+
const sound = sounds.find(s => s.role === role && s.genre === genre);
|
|
80
|
+
if (sound) {
|
|
81
|
+
sound.score = Math.max(0, sound.score - amount);
|
|
82
|
+
saveJSON(SOUNDS_FILE, sounds);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/** Get the best-scoring sound for a role + genre */
|
|
86
|
+
export function getBestSound(role, genre) {
|
|
87
|
+
const candidates = sounds
|
|
88
|
+
.filter(s => s.role === role && s.genre === genre && s.score > 0.4)
|
|
89
|
+
.sort((a, b) => b.score - a.score);
|
|
90
|
+
return candidates[0] || null;
|
|
91
|
+
}
|
|
92
|
+
/** Get all sounds for a genre, sorted by score */
|
|
93
|
+
export function getSoundsForGenre(genre) {
|
|
94
|
+
return sounds
|
|
95
|
+
.filter(s => s.genre === genre)
|
|
96
|
+
.sort((a, b) => b.score - a.score);
|
|
97
|
+
}
|
|
98
|
+
let patterns = loadJSON(PATTERNS_FILE, []);
|
|
99
|
+
/** Record a pattern that was used */
|
|
100
|
+
export function recordPattern(pattern) {
|
|
101
|
+
patterns.push({
|
|
102
|
+
...pattern,
|
|
103
|
+
score: 0.5,
|
|
104
|
+
uses: 1,
|
|
105
|
+
tags: [],
|
|
106
|
+
created: new Date().toISOString(),
|
|
107
|
+
});
|
|
108
|
+
// Keep max 200 patterns (trim lowest-scored)
|
|
109
|
+
if (patterns.length > 200) {
|
|
110
|
+
patterns.sort((a, b) => b.score - a.score);
|
|
111
|
+
patterns = patterns.slice(0, 200);
|
|
112
|
+
}
|
|
113
|
+
saveJSON(PATTERNS_FILE, patterns);
|
|
114
|
+
}
|
|
115
|
+
/** Get the best pattern for a type + genre */
|
|
116
|
+
export function getBestPattern(type, genre) {
|
|
117
|
+
const candidates = patterns
|
|
118
|
+
.filter(p => p.type === type && p.genre === genre && p.score > 0.4)
|
|
119
|
+
.sort((a, b) => b.score - a.score);
|
|
120
|
+
return candidates[0] || null;
|
|
121
|
+
}
|
|
122
|
+
/** Boost a pattern (user kept it) */
|
|
123
|
+
export function boostPattern(type, genre, amount = 0.1) {
|
|
124
|
+
const recent = patterns
|
|
125
|
+
.filter(p => p.type === type && p.genre === genre)
|
|
126
|
+
.sort((a, b) => new Date(b.created).getTime() - new Date(a.created).getTime());
|
|
127
|
+
if (recent[0]) {
|
|
128
|
+
recent[0].score = Math.min(1, recent[0].score + amount);
|
|
129
|
+
recent[0].uses++;
|
|
130
|
+
saveJSON(PATTERNS_FILE, patterns);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
let mixes = loadJSON(MIXES_FILE, []);
|
|
134
|
+
/** Record a mix configuration */
|
|
135
|
+
export function recordMix(mix) {
|
|
136
|
+
mixes.push({
|
|
137
|
+
...mix,
|
|
138
|
+
score: 0.5,
|
|
139
|
+
uses: 1,
|
|
140
|
+
created: new Date().toISOString(),
|
|
141
|
+
});
|
|
142
|
+
if (mixes.length > 50) {
|
|
143
|
+
mixes.sort((a, b) => b.score - a.score);
|
|
144
|
+
mixes = mixes.slice(0, 50);
|
|
145
|
+
}
|
|
146
|
+
saveJSON(MIXES_FILE, mixes);
|
|
147
|
+
}
|
|
148
|
+
/** Get the best mix for a genre */
|
|
149
|
+
export function getBestMix(genre) {
|
|
150
|
+
const candidates = mixes
|
|
151
|
+
.filter(m => m.genre === genre && m.score > 0.4)
|
|
152
|
+
.sort((a, b) => b.score - a.score);
|
|
153
|
+
return candidates[0] || null;
|
|
154
|
+
}
|
|
155
|
+
/** Boost the most recent mix for a genre */
|
|
156
|
+
export function boostMix(genre, amount = 0.1) {
|
|
157
|
+
const recent = mixes
|
|
158
|
+
.filter(m => m.genre === genre)
|
|
159
|
+
.sort((a, b) => new Date(b.created).getTime() - new Date(a.created).getTime());
|
|
160
|
+
if (recent[0]) {
|
|
161
|
+
recent[0].score = Math.min(1, recent[0].score + amount);
|
|
162
|
+
recent[0].uses++;
|
|
163
|
+
saveJSON(MIXES_FILE, mixes);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
let preferences = loadJSON(PREFERENCES_FILE, {
|
|
167
|
+
genres: {},
|
|
168
|
+
keys: {},
|
|
169
|
+
bpmRanges: {},
|
|
170
|
+
instruments: {},
|
|
171
|
+
rolandPreferred: true,
|
|
172
|
+
reverbAmount: 0.35,
|
|
173
|
+
melodyDensity: 'normal',
|
|
174
|
+
totalBeats: 0,
|
|
175
|
+
totalSessions: 0,
|
|
176
|
+
progressions: {},
|
|
177
|
+
});
|
|
178
|
+
/** Record that a genre was used */
|
|
179
|
+
export function recordGenreUse(genre) {
|
|
180
|
+
preferences.genres[genre] = (preferences.genres[genre] || 0) + 1;
|
|
181
|
+
preferences.totalBeats++;
|
|
182
|
+
saveJSON(PREFERENCES_FILE, preferences);
|
|
183
|
+
}
|
|
184
|
+
/** Record that a key was used */
|
|
185
|
+
export function recordKeyUse(key) {
|
|
186
|
+
preferences.keys[key] = (preferences.keys[key] || 0) + 1;
|
|
187
|
+
saveJSON(PREFERENCES_FILE, preferences);
|
|
188
|
+
}
|
|
189
|
+
/** Record a progression was used */
|
|
190
|
+
export function recordProgressionUse(progression) {
|
|
191
|
+
preferences.progressions[progression] = (preferences.progressions[progression] || 0) + 1;
|
|
192
|
+
saveJSON(PREFERENCES_FILE, preferences);
|
|
193
|
+
}
|
|
194
|
+
/** Get the user's most-used genre */
|
|
195
|
+
export function getPreferredGenre() {
|
|
196
|
+
const entries = Object.entries(preferences.genres).sort((a, b) => b[1] - a[1]);
|
|
197
|
+
return entries[0]?.[0] || null;
|
|
198
|
+
}
|
|
199
|
+
/** Get the user's preferred key for a genre */
|
|
200
|
+
export function getPreferredKey(genre) {
|
|
201
|
+
// Check genre-specific key preferences from sounds
|
|
202
|
+
const genreSounds = sounds.filter(s => s.genre === genre && s.score > 0.6);
|
|
203
|
+
// For now use global key preferences
|
|
204
|
+
const entries = Object.entries(preferences.keys).sort((a, b) => b[1] - a[1]);
|
|
205
|
+
return entries[0]?.[0] || null;
|
|
206
|
+
}
|
|
207
|
+
/** Get all preferences */
|
|
208
|
+
export function getPreferences() {
|
|
209
|
+
return { ...preferences };
|
|
210
|
+
}
|
|
211
|
+
let history = loadJSON(HISTORY_FILE, []);
|
|
212
|
+
/** Record a production event */
|
|
213
|
+
export function recordEvent(event) {
|
|
214
|
+
history.push({
|
|
215
|
+
...event,
|
|
216
|
+
timestamp: new Date().toISOString(),
|
|
217
|
+
});
|
|
218
|
+
// Keep last 500 events
|
|
219
|
+
if (history.length > 500) {
|
|
220
|
+
history = history.slice(-500);
|
|
221
|
+
}
|
|
222
|
+
saveJSON(HISTORY_FILE, history);
|
|
223
|
+
}
|
|
224
|
+
/** Get recent history */
|
|
225
|
+
export function getRecentHistory(count = 20) {
|
|
226
|
+
return history.slice(-count);
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Process user feedback and update all memory systems.
|
|
230
|
+
* This is the self-improvement loop — every feedback signal
|
|
231
|
+
* adjusts future behavior.
|
|
232
|
+
*/
|
|
233
|
+
export function processFeedback(signal) {
|
|
234
|
+
const { genre, action, sentiment, target, detail } = signal;
|
|
235
|
+
const isPositive = sentiment === 'positive';
|
|
236
|
+
const amount = isPositive ? 0.1 : 0.15; // penalize harder than reward (asymmetric trust)
|
|
237
|
+
const updates = [];
|
|
238
|
+
if (target === 'overall' || target === 'all') {
|
|
239
|
+
// Boost/penalize everything for this genre
|
|
240
|
+
if (isPositive) {
|
|
241
|
+
boostMix(genre, amount);
|
|
242
|
+
updates.push('mix boosted');
|
|
243
|
+
}
|
|
244
|
+
for (const type of ['drums', 'bass', 'melody', 'chords', 'perc']) {
|
|
245
|
+
if (isPositive)
|
|
246
|
+
boostPattern(type, genre, amount);
|
|
247
|
+
}
|
|
248
|
+
for (const role of ['drums', 'bass', 'melody', 'pad', 'perc']) {
|
|
249
|
+
if (isPositive)
|
|
250
|
+
boostSound(role, genre, amount);
|
|
251
|
+
else
|
|
252
|
+
penalizeSound(role, genre, amount);
|
|
253
|
+
}
|
|
254
|
+
updates.push(`all ${isPositive ? 'boosted' : 'penalized'} for ${genre}`);
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
// Target specific element
|
|
258
|
+
if (isPositive) {
|
|
259
|
+
boostSound(target, genre, amount);
|
|
260
|
+
boostPattern(target, genre, amount);
|
|
261
|
+
updates.push(`${target} boosted`);
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
penalizeSound(target, genre, amount);
|
|
265
|
+
updates.push(`${target} penalized — will try different approach next time`);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
// Record the event
|
|
269
|
+
recordEvent({
|
|
270
|
+
action: 'feedback',
|
|
271
|
+
genre,
|
|
272
|
+
key: '',
|
|
273
|
+
bpm: 0,
|
|
274
|
+
detail: `${sentiment} feedback on ${target}: ${detail || 'no detail'}`,
|
|
275
|
+
feedback: sentiment === 'positive' ? 'positive' : 'negative',
|
|
276
|
+
});
|
|
277
|
+
return `Learned: ${updates.join(', ')}. Score adjustments saved.`;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Get a learning summary — what kbot has learned about the user's taste.
|
|
281
|
+
*/
|
|
282
|
+
export function getLearningReport() {
|
|
283
|
+
const lines = ['## kbot Music Learning Report', ''];
|
|
284
|
+
// Genre preferences
|
|
285
|
+
const genreEntries = Object.entries(preferences.genres).sort((a, b) => b[1] - a[1]);
|
|
286
|
+
if (genreEntries.length > 0) {
|
|
287
|
+
lines.push('**Preferred genres:**');
|
|
288
|
+
for (const [genre, count] of genreEntries.slice(0, 5)) {
|
|
289
|
+
lines.push(` ${genre}: ${count} beats`);
|
|
290
|
+
}
|
|
291
|
+
lines.push('');
|
|
292
|
+
}
|
|
293
|
+
// Key preferences
|
|
294
|
+
const keyEntries = Object.entries(preferences.keys).sort((a, b) => b[1] - a[1]);
|
|
295
|
+
if (keyEntries.length > 0) {
|
|
296
|
+
lines.push('**Preferred keys:** ' + keyEntries.slice(0, 5).map(([k, c]) => `${k}(${c})`).join(', '));
|
|
297
|
+
lines.push('');
|
|
298
|
+
}
|
|
299
|
+
// Best sounds
|
|
300
|
+
const topSounds = sounds.filter(s => s.score > 0.6).sort((a, b) => b.score - a.score).slice(0, 10);
|
|
301
|
+
if (topSounds.length > 0) {
|
|
302
|
+
lines.push('**Top-rated sounds:**');
|
|
303
|
+
for (const s of topSounds) {
|
|
304
|
+
lines.push(` ${s.role} (${s.genre}): ${s.plugin} — score ${s.score.toFixed(2)} (${s.uses} uses)`);
|
|
305
|
+
}
|
|
306
|
+
lines.push('');
|
|
307
|
+
}
|
|
308
|
+
// Stats
|
|
309
|
+
lines.push(`**Total:** ${preferences.totalBeats} beats, ${history.length} events, ${sounds.length} sounds, ${patterns.length} patterns`);
|
|
310
|
+
return lines.join('\n');
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Apply learned preferences to a genre preset.
|
|
314
|
+
* Returns overrides that should be applied on top of the default preset.
|
|
315
|
+
*/
|
|
316
|
+
export function getLearnedOverrides(genre) {
|
|
317
|
+
const overrides = { soundOverrides: {} };
|
|
318
|
+
// Check if we have a preferred key for this genre
|
|
319
|
+
const prefKey = getPreferredKey(genre);
|
|
320
|
+
if (prefKey)
|
|
321
|
+
overrides.preferredKey = prefKey;
|
|
322
|
+
// Check for high-scoring sounds
|
|
323
|
+
for (const role of ['drums', 'bass', 'melody', 'pad', 'perc']) {
|
|
324
|
+
const best = getBestSound(role, genre);
|
|
325
|
+
if (best && best.score > 0.7) {
|
|
326
|
+
overrides.soundOverrides[role] = {
|
|
327
|
+
plugin: best.plugin,
|
|
328
|
+
manufacturer: best.manufacturer,
|
|
329
|
+
preset: best.preset,
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
// Check for learned mix
|
|
334
|
+
const bestMix = getBestMix(genre);
|
|
335
|
+
if (bestMix && bestMix.score > 0.7) {
|
|
336
|
+
overrides.mixOverrides = { volumes: bestMix.volumes };
|
|
337
|
+
}
|
|
338
|
+
return overrides;
|
|
339
|
+
}
|
|
340
|
+
//# sourceMappingURL=music-learning.js.map
|
|
@@ -0,0 +1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AI,EAAE,KAAK,CAAC,CAAA;QACtC,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,GAAG,GAAG,EAAE,CAAC;YAC7B,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG;gBAC/B,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB,CAAA;QACH,CAAC;IACH,CAAC;IAED,wBAAwB;IACxB,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;IACjC,IAAI,OAAO,IAAI,OAAO,CAAC,KAAK,GAAG,GAAG,EAAE,CAAC;QACnC,SAAS,CAAC,YAAY,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAA;IACvD,CAAC;IAED,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export interface Skill {
|
|
2
|
+
/** Unique slug (filename without .md) */
|
|
3
|
+
id: string;
|
|
4
|
+
/** Human-readable title */
|
|
5
|
+
title: string;
|
|
6
|
+
/** Short description for search matching */
|
|
7
|
+
description: string;
|
|
8
|
+
/** Keywords for search */
|
|
9
|
+
keywords: string[];
|
|
10
|
+
/** Domain: general, music, code, research, devops, security */
|
|
11
|
+
domain: string;
|
|
12
|
+
/** The step-by-step procedure */
|
|
13
|
+
steps: string[];
|
|
14
|
+
/** Common issues and fixes */
|
|
15
|
+
issues: string[];
|
|
16
|
+
/** Tools used */
|
|
17
|
+
tools: string[];
|
|
18
|
+
/** Success rate (0-1) */
|
|
19
|
+
successRate: number;
|
|
20
|
+
/** Times executed */
|
|
21
|
+
executions: number;
|
|
22
|
+
/** Version (incremented on patches) */
|
|
23
|
+
version: number;
|
|
24
|
+
/** Created timestamp */
|
|
25
|
+
created: string;
|
|
26
|
+
/** Last used timestamp */
|
|
27
|
+
lastUsed: string;
|
|
28
|
+
/** Last patched timestamp */
|
|
29
|
+
lastPatched: string;
|
|
30
|
+
}
|
|
31
|
+
/** List all skills */
|
|
32
|
+
export declare function listSkills(domain?: string): Skill[];
|
|
33
|
+
/** Find skills matching a query */
|
|
34
|
+
export declare function findSkills(query: string, domain?: string): Skill[];
|
|
35
|
+
/** Get a specific skill by ID */
|
|
36
|
+
export declare function getSkill(id: string): Skill | null;
|
|
37
|
+
/** Create a new skill from a completed task */
|
|
38
|
+
export declare function createSkill(input: {
|
|
39
|
+
title: string;
|
|
40
|
+
description: string;
|
|
41
|
+
keywords: string[];
|
|
42
|
+
domain: string;
|
|
43
|
+
steps: string[];
|
|
44
|
+
issues?: string[];
|
|
45
|
+
tools: string[];
|
|
46
|
+
}): Skill;
|
|
47
|
+
/** Record a skill execution (success or failure) */
|
|
48
|
+
export declare function recordSkillExecution(id: string, success: boolean): void;
|
|
49
|
+
/** Patch a skill (update steps, add issues) */
|
|
50
|
+
export declare function patchSkill(id: string, patches: {
|
|
51
|
+
addSteps?: string[];
|
|
52
|
+
removeSteps?: string[];
|
|
53
|
+
addIssues?: string[];
|
|
54
|
+
replaceSteps?: string[];
|
|
55
|
+
}): void;
|
|
56
|
+
/** Delete a skill */
|
|
57
|
+
export declare function deleteSkill(id: string): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Analyze a tool call sequence and create a skill if it's complex enough.
|
|
60
|
+
* Call this at the end of a conversation with the tool history.
|
|
61
|
+
*/
|
|
62
|
+
export declare function maybeCreateSkill(toolCalls: Array<{
|
|
63
|
+
name: string;
|
|
64
|
+
args: Record<string, unknown>;
|
|
65
|
+
result: string;
|
|
66
|
+
}>, userMessage: string, domain?: string): Skill | null;
|
|
67
|
+
export declare function registerSkillTools(): void;
|
|
68
|
+
//# sourceMappingURL=skill-system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-system.d.ts","sourceRoot":"","sources":["../src/skill-system.ts"],"names":[],"mappings":"AAiCA,MAAM,WAAW,KAAK;IACpB,yCAAy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