groove-dev 0.14.1 → 0.15.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/node_modules/@groove-dev/daemon/src/api.js +29 -2
- package/node_modules/@groove-dev/daemon/src/introducer.js +26 -0
- package/node_modules/@groove-dev/daemon/src/registry.js +2 -1
- package/node_modules/@groove-dev/daemon/src/skills.js +60 -14
- package/node_modules/@groove-dev/daemon/src/validate.js +10 -0
- package/node_modules/@groove-dev/gui/dist/assets/index-CNCSwHwH.js +74 -0
- package/node_modules/@groove-dev/gui/dist/index.html +1 -1
- package/node_modules/@groove-dev/gui/src/components/AgentActions.jsx +129 -0
- package/node_modules/@groove-dev/gui/src/components/SpawnPanel.jsx +84 -0
- package/node_modules/@groove-dev/gui/src/views/SkillsMarketplace.jsx +1 -1
- package/package.json +1 -1
- package/packages/daemon/src/api.js +29 -2
- package/packages/daemon/src/introducer.js +26 -0
- package/packages/daemon/src/registry.js +2 -1
- package/packages/daemon/src/skills.js +60 -14
- package/packages/daemon/src/validate.js +10 -0
- package/packages/gui/dist/assets/index-CNCSwHwH.js +74 -0
- package/packages/gui/dist/index.html +1 -1
- package/packages/gui/src/components/AgentActions.jsx +129 -0
- package/packages/gui/src/components/SpawnPanel.jsx +84 -0
- package/packages/gui/src/views/SkillsMarketplace.jsx +1 -1
- package/node_modules/@groove-dev/gui/dist/assets/index-TcP3URUY.js +0 -74
- package/packages/gui/dist/assets/index-TcP3URUY.js +0 -74
|
@@ -367,8 +367,8 @@ export function createApi(app, daemon) {
|
|
|
367
367
|
|
|
368
368
|
// --- Skills Marketplace ---
|
|
369
369
|
|
|
370
|
-
app.get('/api/skills/registry', (req, res) => {
|
|
371
|
-
const skills = daemon.skills.getRegistry({
|
|
370
|
+
app.get('/api/skills/registry', async (req, res) => {
|
|
371
|
+
const skills = await daemon.skills.getRegistry({
|
|
372
372
|
search: req.query.search || '',
|
|
373
373
|
category: req.query.category || 'all',
|
|
374
374
|
});
|
|
@@ -406,6 +406,33 @@ export function createApi(app, daemon) {
|
|
|
406
406
|
res.json({ id: req.params.id, content });
|
|
407
407
|
});
|
|
408
408
|
|
|
409
|
+
// --- Agent Skills (attach/detach) ---
|
|
410
|
+
|
|
411
|
+
app.post('/api/agents/:agentId/skills/:skillId', (req, res) => {
|
|
412
|
+
const agent = daemon.registry.get(req.params.agentId);
|
|
413
|
+
if (!agent) return res.status(404).json({ error: 'Agent not found' });
|
|
414
|
+
const skillId = req.params.skillId;
|
|
415
|
+
if (!daemon.skills.getContent(skillId)) {
|
|
416
|
+
return res.status(400).json({ error: 'Skill not installed. Install it first.' });
|
|
417
|
+
}
|
|
418
|
+
const skills = agent.skills || [];
|
|
419
|
+
if (skills.includes(skillId)) {
|
|
420
|
+
return res.json({ id: agent.id, skills });
|
|
421
|
+
}
|
|
422
|
+
daemon.registry.update(agent.id, { skills: [...skills, skillId] });
|
|
423
|
+
daemon.audit.log('skill.attach', { agentId: agent.id, skillId });
|
|
424
|
+
res.json({ id: agent.id, skills: [...skills, skillId] });
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
app.delete('/api/agents/:agentId/skills/:skillId', (req, res) => {
|
|
428
|
+
const agent = daemon.registry.get(req.params.agentId);
|
|
429
|
+
if (!agent) return res.status(404).json({ error: 'Agent not found' });
|
|
430
|
+
const skills = (agent.skills || []).filter((s) => s !== req.params.skillId);
|
|
431
|
+
daemon.registry.update(agent.id, { skills });
|
|
432
|
+
daemon.audit.log('skill.detach', { agentId: agent.id, skillId: req.params.skillId });
|
|
433
|
+
res.json({ id: agent.id, skills });
|
|
434
|
+
});
|
|
435
|
+
|
|
409
436
|
// --- Directory Browser ---
|
|
410
437
|
|
|
411
438
|
app.get('/api/browse', (req, res) => {
|
|
@@ -162,6 +162,32 @@ export class Introducer {
|
|
|
162
162
|
lines.push(archContent);
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
// Skills injection — load attached skill content and inject into context
|
|
166
|
+
if (newAgent.skills && newAgent.skills.length > 0 && this.daemon.skills) {
|
|
167
|
+
const skillSections = [];
|
|
168
|
+
for (const skillId of newAgent.skills) {
|
|
169
|
+
const content = this.daemon.skills.getContent(skillId);
|
|
170
|
+
if (content) {
|
|
171
|
+
// Strip YAML frontmatter, keep the instruction body
|
|
172
|
+
const body = content.replace(/^---[\s\S]*?---\n*/, '').trim();
|
|
173
|
+
if (body) {
|
|
174
|
+
// Find the skill name from registry or frontmatter
|
|
175
|
+
const regEntry = this.daemon.skills.registry.find((s) => s.id === skillId);
|
|
176
|
+
const name = regEntry?.name || skillId;
|
|
177
|
+
skillSections.push(`### ${name}\n\n${body}`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (skillSections.length > 0) {
|
|
182
|
+
lines.push('');
|
|
183
|
+
lines.push(`## Skills (${skillSections.length} attached)`);
|
|
184
|
+
lines.push('');
|
|
185
|
+
lines.push(`The following skills have been attached to this agent. Follow their instructions:`);
|
|
186
|
+
lines.push('');
|
|
187
|
+
lines.push(skillSections.join('\n\n---\n\n'));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
165
191
|
return lines.join('\n');
|
|
166
192
|
}
|
|
167
193
|
|
|
@@ -22,6 +22,7 @@ export class Registry extends EventEmitter {
|
|
|
22
22
|
prompt: config.prompt || '',
|
|
23
23
|
permission: config.permission || 'full',
|
|
24
24
|
workingDir: config.workingDir || process.cwd(),
|
|
25
|
+
skills: config.skills || [],
|
|
25
26
|
status: 'starting',
|
|
26
27
|
pid: null,
|
|
27
28
|
spawnedAt: new Date().toISOString(),
|
|
@@ -48,7 +49,7 @@ export class Registry extends EventEmitter {
|
|
|
48
49
|
if (!agent) return null;
|
|
49
50
|
|
|
50
51
|
// Only allow known fields to prevent prototype pollution
|
|
51
|
-
const SAFE_FIELDS = ['status', 'pid', 'tokensUsed', 'contextUsage', 'lastActivity', 'model', 'name', 'routingMode', 'routingReason', 'sessionId'];
|
|
52
|
+
const SAFE_FIELDS = ['status', 'pid', 'tokensUsed', 'contextUsage', 'lastActivity', 'model', 'name', 'routingMode', 'routingReason', 'sessionId', 'skills'];
|
|
52
53
|
for (const key of Object.keys(updates)) {
|
|
53
54
|
if (SAFE_FIELDS.includes(key)) {
|
|
54
55
|
agent[key] = updates[key];
|
|
@@ -7,7 +7,19 @@ import { fileURLToPath } from 'url';
|
|
|
7
7
|
|
|
8
8
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const SKILLS_API = 'https://docs.groovedev.ai/api/v1';
|
|
11
|
+
|
|
12
|
+
// Normalize snake_case API fields to camelCase used by GUI
|
|
13
|
+
function normalize(skill) {
|
|
14
|
+
return {
|
|
15
|
+
...skill,
|
|
16
|
+
ratingCount: skill.ratingCount ?? skill.rating_count ?? 0,
|
|
17
|
+
contentUrl: skill.contentUrl ?? skill.content_url ?? null,
|
|
18
|
+
authorId: skill.authorId ?? skill.author_id ?? null,
|
|
19
|
+
createdAt: skill.createdAt ?? skill.created_at ?? null,
|
|
20
|
+
updatedAt: skill.updatedAt ?? skill.updated_at ?? null,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
11
23
|
|
|
12
24
|
export class SkillStore {
|
|
13
25
|
constructor(daemon) {
|
|
@@ -22,39 +34,58 @@ export class SkillStore {
|
|
|
22
34
|
this.registry = JSON.parse(readFileSync(regPath, 'utf8'));
|
|
23
35
|
} catch { /* no registry file */ }
|
|
24
36
|
|
|
25
|
-
// Fetch
|
|
37
|
+
// Fetch full registry from live API in background
|
|
26
38
|
this._refreshRegistry();
|
|
27
39
|
}
|
|
28
40
|
|
|
29
41
|
async _refreshRegistry() {
|
|
30
42
|
try {
|
|
31
|
-
const res = await fetch(
|
|
43
|
+
const res = await fetch(`${SKILLS_API}/skills?limit=200`, { signal: AbortSignal.timeout(5000) });
|
|
32
44
|
if (res.ok) {
|
|
33
|
-
|
|
45
|
+
const data = await res.json();
|
|
46
|
+
this.registry = (data.skills || data).map(normalize);
|
|
34
47
|
}
|
|
35
48
|
} catch { /* offline — use bundled */ }
|
|
36
49
|
}
|
|
37
50
|
|
|
38
51
|
/**
|
|
39
|
-
* Get
|
|
52
|
+
* Get skills from the live API, with local fallback.
|
|
53
|
+
* Server handles search + category filtering when online.
|
|
40
54
|
*/
|
|
41
|
-
getRegistry(query) {
|
|
55
|
+
async getRegistry(query) {
|
|
56
|
+
// Try live API first — server handles search/filter/sort
|
|
57
|
+
try {
|
|
58
|
+
const params = new URLSearchParams();
|
|
59
|
+
if (query?.search) params.set('search', query.search);
|
|
60
|
+
if (query?.category && query.category !== 'all') params.set('category', query.category);
|
|
61
|
+
params.set('limit', '200');
|
|
62
|
+
|
|
63
|
+
const res = await fetch(`${SKILLS_API}/skills?${params}`, { signal: AbortSignal.timeout(5000) });
|
|
64
|
+
if (res.ok) {
|
|
65
|
+
const data = await res.json();
|
|
66
|
+
const skills = (data.skills || data).map((s) => ({
|
|
67
|
+
...normalize(s),
|
|
68
|
+
installed: this._isInstalled(s.id),
|
|
69
|
+
}));
|
|
70
|
+
return skills;
|
|
71
|
+
}
|
|
72
|
+
} catch { /* fall through to local */ }
|
|
73
|
+
|
|
74
|
+
// Offline fallback — filter locally from cached registry
|
|
42
75
|
let skills = this.registry.map((s) => ({
|
|
43
76
|
...s,
|
|
44
77
|
installed: this._isInstalled(s.id),
|
|
45
78
|
}));
|
|
46
79
|
|
|
47
|
-
// Search filter
|
|
48
80
|
if (query?.search) {
|
|
49
81
|
const q = query.search.toLowerCase();
|
|
50
82
|
skills = skills.filter((s) =>
|
|
51
83
|
s.name.toLowerCase().includes(q)
|
|
52
84
|
|| s.description.toLowerCase().includes(q)
|
|
53
|
-
|| s.tags.some((t) => t.includes(q))
|
|
85
|
+
|| (s.tags || []).some((t) => t.includes(q))
|
|
54
86
|
);
|
|
55
87
|
}
|
|
56
88
|
|
|
57
|
-
// Category filter
|
|
58
89
|
if (query?.category && query.category !== 'all') {
|
|
59
90
|
skills = skills.filter((s) => s.category === query.category);
|
|
60
91
|
}
|
|
@@ -97,8 +128,8 @@ export class SkillStore {
|
|
|
97
128
|
}
|
|
98
129
|
|
|
99
130
|
/**
|
|
100
|
-
* Install a skill
|
|
101
|
-
* Downloads
|
|
131
|
+
* Install a skill.
|
|
132
|
+
* Downloads content from live API, falls back to contentUrl, then local plugins.
|
|
102
133
|
*/
|
|
103
134
|
async install(skillId) {
|
|
104
135
|
const entry = this.registry.find((s) => s.id === skillId);
|
|
@@ -107,12 +138,21 @@ export class SkillStore {
|
|
|
107
138
|
|
|
108
139
|
let content = null;
|
|
109
140
|
|
|
110
|
-
// Try
|
|
111
|
-
|
|
141
|
+
// Try live API content endpoint first
|
|
142
|
+
try {
|
|
143
|
+
const res = await fetch(`${SKILLS_API}/skills/${skillId}/content`, { signal: AbortSignal.timeout(10000) });
|
|
144
|
+
if (res.ok) {
|
|
145
|
+
const data = await res.json();
|
|
146
|
+
content = data.content;
|
|
147
|
+
}
|
|
148
|
+
} catch { /* fall through */ }
|
|
149
|
+
|
|
150
|
+
// Fall back to contentUrl from registry entry
|
|
151
|
+
if (!content && entry.contentUrl) {
|
|
112
152
|
try {
|
|
113
153
|
const res = await fetch(entry.contentUrl, { signal: AbortSignal.timeout(10000) });
|
|
114
154
|
if (res.ok) content = await res.text();
|
|
115
|
-
} catch { /* fall through
|
|
155
|
+
} catch { /* fall through */ }
|
|
116
156
|
}
|
|
117
157
|
|
|
118
158
|
// Fall back to local Claude plugins
|
|
@@ -129,6 +169,12 @@ export class SkillStore {
|
|
|
129
169
|
mkdirSync(skillDir, { recursive: true });
|
|
130
170
|
writeFileSync(resolve(skillDir, 'SKILL.md'), content);
|
|
131
171
|
|
|
172
|
+
// Track install on server (fire-and-forget, no auth needed)
|
|
173
|
+
fetch(`${SKILLS_API}/skills/${skillId}/install`, {
|
|
174
|
+
method: 'POST',
|
|
175
|
+
signal: AbortSignal.timeout(5000),
|
|
176
|
+
}).catch(() => {});
|
|
177
|
+
|
|
132
178
|
this.daemon.audit.log('skill.install', { id: skillId, name: entry.name });
|
|
133
179
|
|
|
134
180
|
return { id: skillId, name: entry.name, installed: true };
|
|
@@ -57,6 +57,15 @@ export function validateAgentConfig(config) {
|
|
|
57
57
|
const validPermissions = ['auto', 'full'];
|
|
58
58
|
const permission = validPermissions.includes(config.permission) ? config.permission : 'full';
|
|
59
59
|
|
|
60
|
+
// Validate skills (array of skill IDs)
|
|
61
|
+
let skills = [];
|
|
62
|
+
if (config.skills !== undefined && config.skills !== null) {
|
|
63
|
+
if (!Array.isArray(config.skills)) {
|
|
64
|
+
throw new Error('Skills must be an array');
|
|
65
|
+
}
|
|
66
|
+
skills = config.skills.filter((s) => typeof s === 'string' && s.length > 0 && s.length <= 100);
|
|
67
|
+
}
|
|
68
|
+
|
|
60
69
|
// Return sanitized config (only known fields)
|
|
61
70
|
return {
|
|
62
71
|
role: config.role,
|
|
@@ -67,6 +76,7 @@ export function validateAgentConfig(config) {
|
|
|
67
76
|
model: typeof config.model === 'string' ? config.model : null,
|
|
68
77
|
workingDir: typeof config.workingDir === 'string' ? config.workingDir : undefined,
|
|
69
78
|
permission,
|
|
79
|
+
skills,
|
|
70
80
|
};
|
|
71
81
|
}
|
|
72
82
|
|