wyrm-mcp 7.2.1 โ†’ 7.2.2

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.
Files changed (150) hide show
  1. package/LICENSE +26 -667
  2. package/NOTICE +14 -33
  3. package/dist/activation.js +1 -60
  4. package/dist/agent-daemon.js +4 -281
  5. package/dist/agent-loop.js +7 -332
  6. package/dist/analytics.js +13 -236
  7. package/dist/attribution.js +1 -49
  8. package/dist/audit.js +2 -457
  9. package/dist/auto-capture.js +3 -138
  10. package/dist/auto-orchestrator.js +1 -325
  11. package/dist/autoconfig.js +39 -840
  12. package/dist/buddy-runner.js +1 -109
  13. package/dist/buddy.js +14 -564
  14. package/dist/build-flags.js +1 -17
  15. package/dist/capabilities.js +3 -183
  16. package/dist/capture.js +1 -56
  17. package/dist/causality.js +6 -107
  18. package/dist/cli.js +20 -281
  19. package/dist/cloud/cli.js +5 -541
  20. package/dist/cloud/client.js +1 -221
  21. package/dist/cloud/crypto.js +1 -85
  22. package/dist/cloud/machine-id.js +2 -113
  23. package/dist/cloud/recovery.js +1 -60
  24. package/dist/cloud/sync-engine.js +7 -543
  25. package/dist/cloud-backup.js +5 -579
  26. package/dist/cloud-profile.js +1 -138
  27. package/dist/cloud-sync-entrypoint.js +1 -47
  28. package/dist/cloud-sync.js +2 -309
  29. package/dist/constellation.js +12 -168
  30. package/dist/context-build-budgeted.js +4 -144
  31. package/dist/context-ranking.js +1 -69
  32. package/dist/crypto.js +1 -179
  33. package/dist/daemon-write-endpoint.js +1 -290
  34. package/dist/daemon-writer.js +2 -406
  35. package/dist/database.js +43 -1110
  36. package/dist/deprecations.js +2 -162
  37. package/dist/design.js +13 -141
  38. package/dist/event-replication.js +1 -112
  39. package/dist/events-sse.js +7 -43
  40. package/dist/events.js +6 -238
  41. package/dist/failure-patterns.js +42 -659
  42. package/dist/federation.js +12 -236
  43. package/dist/goals.js +13 -101
  44. package/dist/golden.js +3 -355
  45. package/dist/handlers/agent.js +4 -165
  46. package/dist/handlers/alias-adapters.js +1 -129
  47. package/dist/handlers/aliases.js +1 -171
  48. package/dist/handlers/audit.js +1 -87
  49. package/dist/handlers/boundary.js +1 -221
  50. package/dist/handlers/capture.js +73 -1109
  51. package/dist/handlers/causality.js +7 -114
  52. package/dist/handlers/cloud.js +85 -382
  53. package/dist/handlers/companion.js +28 -459
  54. package/dist/handlers/datalake.js +7 -187
  55. package/dist/handlers/dispatch-context.js +0 -22
  56. package/dist/handlers/entity.js +25 -256
  57. package/dist/handlers/events.js +16 -335
  58. package/dist/handlers/failure.js +13 -340
  59. package/dist/handlers/goals.js +4 -296
  60. package/dist/handlers/intelligence.js +126 -674
  61. package/dist/handlers/invoicing.js +1 -70
  62. package/dist/handlers/mcpclient.js +6 -137
  63. package/dist/handlers/orchestration.js +40 -125
  64. package/dist/handlers/output-schemas.js +1 -24
  65. package/dist/handlers/presence.js +3 -99
  66. package/dist/handlers/project.js +28 -182
  67. package/dist/handlers/prompts.js +6 -157
  68. package/dist/handlers/quest.js +4 -224
  69. package/dist/handlers/recall.js +11 -218
  70. package/dist/handlers/registry.js +1 -167
  71. package/dist/handlers/resources.js +1 -288
  72. package/dist/handlers/review.js +11 -74
  73. package/dist/handlers/run.js +17 -487
  74. package/dist/handlers/search.js +15 -326
  75. package/dist/handlers/session.js +28 -615
  76. package/dist/handlers/share.js +8 -184
  77. package/dist/handlers/shims.js +1 -464
  78. package/dist/handlers/skill.js +67 -449
  79. package/dist/handlers/survivors.js +1 -120
  80. package/dist/handlers/symbols.js +8 -109
  81. package/dist/handlers/syncops.js +4 -302
  82. package/dist/handlers/types.js +1 -27
  83. package/dist/harvest.js +5 -191
  84. package/dist/hours.js +7 -156
  85. package/dist/http-auth.js +3 -321
  86. package/dist/http-fast.js +21 -1137
  87. package/dist/icons.js +1 -47
  88. package/dist/index.js +2 -924
  89. package/dist/indexer.js +4 -145
  90. package/dist/intelligence.js +31 -261
  91. package/dist/internal-dispatch.js +3 -212
  92. package/dist/keyset.js +1 -110
  93. package/dist/knowledge-graph.js +12 -176
  94. package/dist/license.js +2 -441
  95. package/dist/logger.js +2 -199
  96. package/dist/maintenance.js +2 -148
  97. package/dist/mcp-client.js +6 -262
  98. package/dist/memory-artifacts.js +30 -449
  99. package/dist/migrate-prompt.js +2 -124
  100. package/dist/migrations.js +40 -655
  101. package/dist/performance.js +1 -228
  102. package/dist/presence.js +11 -140
  103. package/dist/priority-embed.js +5 -164
  104. package/dist/providers/embedding-provider.js +1 -196
  105. package/dist/readonly-gate.js +1 -29
  106. package/dist/rehydration.js +9 -157
  107. package/dist/reindex.js +1 -88
  108. package/dist/render-target.js +21 -514
  109. package/dist/render.js +4 -280
  110. package/dist/repl-guard.js +1 -173
  111. package/dist/replication-daemon-entrypoint.js +1 -31
  112. package/dist/replication-daemon.js +2 -262
  113. package/dist/resilience.js +1 -591
  114. package/dist/reverse-bridge.js +5 -360
  115. package/dist/security.js +1 -244
  116. package/dist/session-seen.js +3 -51
  117. package/dist/setup.js +1 -260
  118. package/dist/skill-author.js +5 -168
  119. package/dist/spec-kit.js +1 -191
  120. package/dist/sqlite-busy.js +1 -154
  121. package/dist/statusline.js +11 -315
  122. package/dist/sub-agent.js +13 -262
  123. package/dist/summarizer.js +13 -139
  124. package/dist/symbols.js +7 -283
  125. package/dist/sync.js +5 -359
  126. package/dist/tasks-dispatch.js +1 -84
  127. package/dist/tasks.js +1 -282
  128. package/dist/token-budget.js +1 -143
  129. package/dist/tool-analytics.js +7 -129
  130. package/dist/tool-annotations.js +1 -365
  131. package/dist/tool-manifest-v2.json +1 -1
  132. package/dist/tool-manifest.json +1 -1
  133. package/dist/tool-profiles.js +1 -75
  134. package/dist/trace-harvest.js +6 -244
  135. package/dist/types.js +1 -30
  136. package/dist/ui-dashboard.js +41 -50
  137. package/dist/ulid.js +1 -81
  138. package/dist/validate.js +1 -129
  139. package/dist/vault.js +1 -534
  140. package/dist/vectors.js +3 -184
  141. package/dist/version-check.js +4 -136
  142. package/dist/visibility.js +19 -155
  143. package/dist/wyrm-cli.js +98 -2464
  144. package/dist/wyrm-guard.js +14 -424
  145. package/dist/wyrm-loop.js +3 -150
  146. package/dist/wyrm-manifest.json +1 -1
  147. package/dist/wyrm-statusline-daemon.js +1 -11
  148. package/dist/wyrm-statusline.js +4 -56
  149. package/dist/wyrm-ui.js +9 -77
  150. package/package.json +4 -2
@@ -1,449 +1,67 @@
1
- /**
2
- * @copyright 2026 Ghost Protocol (Pvt) Ltd.
3
- * @license AGPL-3.0-or-later
4
- */
5
- import { TOOL_ANNOTATIONS } from "../tool-annotations.js";
6
- import { currentReadCacheKey } from "./boundary.js";
7
- import { cache } from "../performance.js";
8
- import { sanitizeFtsQuery } from "../security.js";
9
- import { deploySkill, validateAtomicSkill } from "../skill-author.js";
10
- export const skillToolSpecs = [
11
- {
12
- name: "wyrm_skill_create",
13
- description: "Author + deploy + register an ATOMIC skill in one clean step. Validates atomicity (one focused capability, discoverable 12โ€“280 char description, proper frontmatter), writes <skillsDir>/<slug>/SKILL.md, and registers it so it's instantly findable via wyrm_skill_search. Refuses to clobber an existing skill unless force=true. Use this to create skills as they're needed instead of leaving them un-deployed.",
14
- inputSchema: {
15
- type: "object",
16
- properties: {
17
- name: { type: "string", description: "Skill name (slugified to kebab-case)" },
18
- description: { type: "string", description: "One-line description, 12โ€“280 chars โ€” used for discovery/recall ranking" },
19
- body: { type: "string", description: "The SKILL.md markdown body (the actual skill content; should be ONE focused capability)" },
20
- argumentHint: { type: "string", description: "Optional argument-hint frontmatter (for user-invocable skills)" },
21
- userInvocable: { type: "boolean", description: "Whether it's a user-invocable slash command" },
22
- category: { type: "string", description: "Optional category" },
23
- tags: { type: "array", items: { type: "string" }, description: "Optional tags" },
24
- force: { type: "boolean", description: "Overwrite an existing skill of the same slug (default false)" },
25
- register: { type: "boolean", description: "Register in the skill registry for discovery (default true)" },
26
- },
27
- required: ["name", "description", "body"],
28
- },
29
- annotations: TOOL_ANNOTATIONS["wyrm_skill_create"],
30
- aliases: [],
31
- handler: async (args, ctx) => {
32
- const { db } = ctx;
33
- const a = args || {};
34
- const requireArgs = (fields) => {
35
- const missing = fields.filter(f => !a[f] && a[f] !== 0 && a[f] !== false);
36
- if (missing.length > 0) {
37
- return { content: [{ type: "text", text: `Missing required arguments: ${missing.join(', ')}` }], isError: true };
38
- }
39
- return null;
40
- };
41
- const argErr = requireArgs(['name', 'description', 'body']);
42
- if (argErr)
43
- return argErr;
44
- const { name, description, body, argumentHint, userInvocable, category, tags, force, register } = args;
45
- const spec = { name, description, body, argumentHint, userInvocable, category, tags };
46
- const v = validateAtomicSkill(spec);
47
- if (!v.ok) {
48
- return { content: [{ type: "text", text: `โŒ Skill rejected (not clean/atomic):\n- ${v.errors.join('\n- ')}` }] };
49
- }
50
- let deploy;
51
- try {
52
- deploy = deploySkill(spec, { force });
53
- }
54
- catch (e) {
55
- return { content: [{ type: "text", text: `โŒ Deploy failed: ${e instanceof Error ? e.message : String(e)}` }] };
56
- }
57
- let registered = false;
58
- if (register !== false) {
59
- try {
60
- db.registerSkill(v.slug, description, deploy.path, category, 'Ghost Protocol', '1.0.0', (tags || []).join(','));
61
- registered = true;
62
- }
63
- catch { /* registry optional; file is deployed regardless */ }
64
- }
65
- const warn = v.warnings.length ? `\n\nโš ๏ธ ${v.warnings.join('\nโš ๏ธ ')}` : '';
66
- return { content: [{ type: "text", text: `๓ฑ… Skill "${v.slug}" ${deploy.action}${registered ? ' + registered (discoverable via wyrm_skill_search)' : ''}\n ${deploy.path}${warn}` }] };
67
- },
68
- },
69
- {
70
- name: "wyrm_skill_register",
71
- description: "Register or update a skill and store metadata in Wyrm. Supports GOD-SKILL SPEC v2 apex tiers (god > mega > atomic) with governs/composes routing.",
72
- inputSchema: {
73
- type: "object",
74
- properties: {
75
- name: { type: "string", description: "Skill name (e.g., 'professional-lead-scraping')" },
76
- description: { type: "string", description: "Skill description" },
77
- skillPath: { type: "string", description: "File path to skill (e.g., ~/.copilot/skills/name or project relative path)" },
78
- category: { type: "string", description: "Skill category (e.g., 'data-extraction', 'testing', 'documentation')" },
79
- author: { type: "string", description: "Skill author or creator" },
80
- version: { type: "string", description: "Skill version" },
81
- tags: { type: "string", description: "Comma-separated tags (e.g., 'scraping,leads,email-validation')" },
82
- tier: { type: "string", enum: ["atomic", "mega", "god"], description: "GOD-SKILL SPEC v2 apex tier. Default 'atomic'. 'mega' composes atomics; 'god' governs megas." },
83
- governs: { type: "array", items: { type: "string" }, description: "Skill names this node routes DOWN to (godโ†’megas, megaโ†’atomics). Default []." },
84
- composes: { type: "array", items: { type: "string" }, description: "Skill names this node pulls in laterally. Default []." },
85
- },
86
- required: ["name", "description", "skillPath"],
87
- },
88
- annotations: TOOL_ANNOTATIONS["wyrm_skill_register"],
89
- aliases: [],
90
- handler: async (args, ctx) => {
91
- const { db } = ctx;
92
- const { name, description, skillPath, category, author, version, tags, tier, governs, composes } = args;
93
- const governance = (tier || governs || composes)
94
- ? { tier, governs, composes }
95
- : undefined;
96
- const skill = db.registerSkill(name, description, skillPath, category, author, version, tags, governance);
97
- cache.invalidate('wyrm_skill_list');
98
- cache.invalidate('wyrm_skill_stats');
99
- const governsList = skill.governs ? JSON.parse(skill.governs) : [];
100
- const composesList = skill.composes ? JSON.parse(skill.composes) : [];
101
- let text = `๓ฑ… **Skill Registered**\n\nName: ${skill.name}\nPath: ${skill.skill_path}\nCategory: ${skill.category || 'uncategorized'}\nVersion: ${skill.version || '1.0.0'}\nTier: ${skill.tier}\nStatus: ${skill.is_active ? 'Active' : 'Inactive'}`;
102
- if (governsList.length)
103
- text += `\nGoverns: ${governsList.join(', ')}`;
104
- if (composesList.length)
105
- text += `\nComposes: ${composesList.join(', ')}`;
106
- return { content: [{ type: "text", text }] };
107
- },
108
- },
109
- {
110
- name: "wyrm_skill_list",
111
- description: "List registered skills with filtering options",
112
- inputSchema: {
113
- type: "object",
114
- properties: {
115
- active: { type: "boolean", description: "Filter by active status" },
116
- category: { type: "string", description: "Filter by category" },
117
- search: { type: "string", description: "Full-text search by name, description, or tags" },
118
- tier: { type: "string", enum: ["atomic", "mega", "god"], description: "Filter by GOD-SKILL SPEC v2 tier (atomic|mega|god)" },
119
- },
120
- },
121
- annotations: TOOL_ANNOTATIONS["wyrm_skill_list"],
122
- aliases: [],
123
- handler: async (args, ctx) => {
124
- const { cachedResponse, db } = ctx;
125
- const cacheKey = currentReadCacheKey();
126
- const { active, category, search, tier } = args;
127
- const skills = db.listSkills(active, category, search, tier);
128
- if (skills.length === 0) {
129
- return {
130
- content: [{
131
- type: "text",
132
- text: `๓ฑ… **Skills**\n\nNo skills found matching your criteria.`
133
- }]
134
- };
135
- }
136
- let text = `๓ฑ… **Skills Registry** (${skills.length} total)\n\n`;
137
- for (const skill of skills) {
138
- const tierBadge = skill.tier && skill.tier !== 'atomic' ? ` [${skill.tier.toUpperCase()}]` : '';
139
- text += `### ${skill.name}${tierBadge} ${skill.is_active ? 'โœ…' : 'โŒ'}\n`;
140
- text += `Category: ${skill.category || 'uncategorized'}\n`;
141
- text += `Description: ${skill.description}\n`;
142
- if (skill.version)
143
- text += `Version: ${skill.version}\n`;
144
- if (skill.author)
145
- text += `Author: ${skill.author}\n`;
146
- if (skill.tags)
147
- text += `Tags: ${skill.tags}\n`;
148
- text += `Path: \`${skill.skill_path}\`\n`;
149
- text += `Used: ${skill.usage_count} times`;
150
- if (skill.last_used)
151
- text += ` (last: ${skill.last_used})`;
152
- text += '\n\n';
153
- }
154
- const response = cachedResponse(text);
155
- if (cacheKey)
156
- cache.set(cacheKey, response, 30000);
157
- return response;
158
- },
159
- },
160
- {
161
- name: "wyrm_skill_get",
162
- description: "Get detailed information about a specific skill",
163
- inputSchema: {
164
- type: "object",
165
- properties: {
166
- name: { type: "string", description: "Skill name" },
167
- },
168
- required: ["name"],
169
- },
170
- annotations: TOOL_ANNOTATIONS["wyrm_skill_get"],
171
- aliases: [],
172
- handler: async (args, ctx) => {
173
- const { cachedResponse, db } = ctx;
174
- const cacheKey = currentReadCacheKey();
175
- const { name } = args;
176
- const skill = db.getSkill(name);
177
- if (!skill) {
178
- return {
179
- content: [{
180
- type: "text",
181
- text: `๓ฑ… **Skill Not Found**: ${name}`
182
- }]
183
- };
184
- }
185
- let text = `๓ฑ… **Skill: ${skill.name}** ${skill.is_active ? 'โœ… Active' : 'โŒ Inactive'}\n\n`;
186
- text += `**Description:** ${skill.description}\n`;
187
- text += `**Path:** \`${skill.skill_path}\`\n`;
188
- text += `**Category:** ${skill.category || 'uncategorized'}\n`;
189
- if (skill.author)
190
- text += `**Author:** ${skill.author}\n`;
191
- if (skill.version)
192
- text += `**Version:** ${skill.version}\n`;
193
- if (skill.tags)
194
- text += `**Tags:** ${skill.tags}\n`;
195
- text += `**Usage Count:** ${skill.usage_count}\n`;
196
- if (skill.last_used)
197
- text += `**Last Used:** ${skill.last_used}\n`;
198
- text += `**Created:** ${skill.created_at}\n`;
199
- text += `**Updated:** ${skill.updated_at}\n`;
200
- const response = cachedResponse(text);
201
- if (cacheKey)
202
- cache.set(cacheKey, response, 30000);
203
- return response;
204
- },
205
- },
206
- {
207
- name: "wyrm_skill_delete",
208
- description: "Delete a skill from Wyrm registry",
209
- inputSchema: {
210
- type: "object",
211
- properties: {
212
- name: { type: "string", description: "Skill name" },
213
- },
214
- required: ["name"],
215
- },
216
- annotations: TOOL_ANNOTATIONS["wyrm_skill_delete"],
217
- aliases: [],
218
- handler: async (args, ctx) => {
219
- const { db } = ctx;
220
- const { name } = args;
221
- const success = db.deleteSkill(name);
222
- cache.invalidate('wyrm_skill_list');
223
- cache.invalidate('wyrm_skill_stats');
224
- if (success) {
225
- return {
226
- content: [{
227
- type: "text",
228
- text: `๓ฑ… **Skill Deleted**: ${name}`
229
- }]
230
- };
231
- }
232
- else {
233
- return {
234
- content: [{
235
- type: "text",
236
- text: `๓ฑ… **Skill Not Found**: ${name}`
237
- }]
238
- };
239
- }
240
- },
241
- },
242
- {
243
- name: "wyrm_skill_activate",
244
- description: "Activate a skill (mark as active)",
245
- inputSchema: {
246
- type: "object",
247
- properties: {
248
- name: { type: "string", description: "Skill name" },
249
- },
250
- required: ["name"],
251
- },
252
- annotations: TOOL_ANNOTATIONS["wyrm_skill_activate"],
253
- aliases: [],
254
- handler: async (args, ctx) => {
255
- const { db } = ctx;
256
- const { name } = args;
257
- const skill = db.activateSkill(name);
258
- cache.invalidate('wyrm_skill_list');
259
- cache.invalidate('wyrm_skill_stats');
260
- if (skill) {
261
- return {
262
- content: [{
263
- type: "text",
264
- text: `๓ฑ… **Skill Activated**: ${name}`
265
- }]
266
- };
267
- }
268
- else {
269
- return {
270
- content: [{
271
- type: "text",
272
- text: `๓ฑ… **Skill Not Found**: ${name}`
273
- }]
274
- };
275
- }
276
- },
277
- },
278
- {
279
- name: "wyrm_skill_deactivate",
280
- description: "Deactivate a skill (mark as inactive)",
281
- inputSchema: {
282
- type: "object",
283
- properties: {
284
- name: { type: "string", description: "Skill name" },
285
- },
286
- required: ["name"],
287
- },
288
- annotations: TOOL_ANNOTATIONS["wyrm_skill_deactivate"],
289
- aliases: [],
290
- handler: async (args, ctx) => {
291
- const { db } = ctx;
292
- const { name } = args;
293
- const skill = db.deactivateSkill(name);
294
- cache.invalidate('wyrm_skill_list');
295
- cache.invalidate('wyrm_skill_stats');
296
- if (skill) {
297
- return {
298
- content: [{
299
- type: "text",
300
- text: `๓ฑ… **Skill Deactivated**: ${name}`
301
- }]
302
- };
303
- }
304
- else {
305
- return {
306
- content: [{
307
- type: "text",
308
- text: `๓ฑ… **Skill Not Found**: ${name}`
309
- }]
310
- };
311
- }
312
- },
313
- },
314
- {
315
- name: "wyrm_skill_search",
316
- description: "Search for skills by name, description, or tags. Optionally filter by GOD-SKILL SPEC v2 tier.",
317
- inputSchema: {
318
- type: "object",
319
- properties: {
320
- query: { type: "string", description: "Search query" },
321
- limit: { type: "number", description: "Max results (default: 20)" },
322
- tier: { type: "string", enum: ["atomic", "mega", "god"], description: "Restrict results to a GOD-SKILL SPEC v2 tier (atomic|mega|god)" },
323
- },
324
- required: ["query"],
325
- },
326
- annotations: TOOL_ANNOTATIONS["wyrm_skill_search"],
327
- aliases: [],
328
- handler: async (args, ctx) => {
329
- const { cachedResponse, db } = ctx;
330
- const cacheKey = currentReadCacheKey();
331
- const { query, limit, tier } = args;
332
- const sanitizedQuery = sanitizeFtsQuery(query);
333
- const skills = db.searchSkills(sanitizedQuery, limit || 20, tier);
334
- if (skills.length === 0) {
335
- return {
336
- content: [{
337
- type: "text",
338
- text: `๓ฑ… **Search Skills**: No results found for "${query}"${tier ? ` (tier=${tier})` : ''}`
339
- }]
340
- };
341
- }
342
- let text = `๓ฑ… **Skill Search Results for "${query}"** (${skills.length} found)\n\n`;
343
- for (const skill of skills) {
344
- const tierBadge = skill.tier && skill.tier !== 'atomic' ? ` [${skill.tier.toUpperCase()}]` : '';
345
- text += `- **${skill.name}**${tierBadge} (${skill.category || 'uncategorized'}) ${skill.is_active ? 'โœ…' : 'โŒ'}\n`;
346
- text += ` ${skill.description}\n\n`;
347
- }
348
- const response = cachedResponse(text);
349
- if (cacheKey)
350
- cache.set(cacheKey, response, 30000);
351
- return response;
352
- },
353
- },
354
- {
355
- name: "wyrm_skill_stats",
356
- description: "Get statistics on registered skills",
357
- inputSchema: {
358
- type: "object",
359
- properties: {},
360
- },
361
- annotations: TOOL_ANNOTATIONS["wyrm_skill_stats"],
362
- aliases: [],
363
- handler: async (args, ctx) => {
364
- const { cachedResponse, db } = ctx;
365
- const cacheKey = currentReadCacheKey();
366
- const stats = db.getSkillStats();
367
- let text = `๓ฑ… **Skill Statistics**\n\n`;
368
- text += `**Total Skills:** ${stats.total}\n`;
369
- text += `**Active Skills:** ${stats.active}\n`;
370
- text += `**Inactive Skills:** ${stats.total - stats.active}\n\n`;
371
- if (Object.keys(stats.byCategory).length > 0) {
372
- text += `**By Category:**\n`;
373
- for (const [category, count] of Object.entries(stats.byCategory)) {
374
- text += `- ${category}: ${count}\n`;
375
- }
376
- }
377
- const response = cachedResponse(text);
378
- if (cacheKey)
379
- cache.set(cacheKey, response, 30000);
380
- return response;
381
- },
382
- },
383
- {
384
- name: "wyrm_skill_graph",
385
- description: "Return the GOD-SKILL SPEC v2 governance graph: walks god โ†’ governs(mega) โ†’ governs(atomic) plus each node's composes, as a tree + edge-list the caller can render. Pass a root skill to scope to one apex; omit it to get the forest of every 'god' tier skill.",
386
- inputSchema: {
387
- type: "object",
388
- properties: {
389
- root: { type: "string", description: "Optional root skill name to scope the graph (e.g. 'ghost-godhead'). Omit for all god-tier apexes." },
390
- format: { type: "string", enum: ["tree", "edges", "both"], description: "Output shape: 'tree' (nested), 'edges' (flat edge-list), or 'both' (default)." },
391
- },
392
- },
393
- annotations: TOOL_ANNOTATIONS["wyrm_skill_graph"],
394
- aliases: [],
395
- handler: async (args, ctx) => {
396
- const { db, graph } = ctx;
397
- const { root, format } = args;
398
- const fmt = format || 'both';
399
- const forest = db.getSkillGraph(root);
400
- if (forest.length === 0) {
401
- const reason = root
402
- ? `Skill "${root}" is not registered (or has no graph).`
403
- : `No god-tier skills registered. Register one with wyrm_skill_register tier='god' + governs=[...].`;
404
- return { content: [{ type: "text", text: `๓ฑ… **Skill Graph**\n\n${reason}` }] };
405
- }
406
- const edges = [];
407
- const walk = (n) => {
408
- for (const g of n.governs) {
409
- edges.push({ from: n.name, to: g, kind: 'governs', resolved: n.children.some((c) => c.name === g) });
410
- }
411
- for (const c of n.composes) {
412
- edges.push({ from: n.name, to: c, kind: 'composes', resolved: false });
413
- }
414
- for (const child of n.children)
415
- walk(child);
416
- };
417
- for (const r of forest)
418
- walk(r);
419
- // Human-readable tree render.
420
- const tierIcon = (t) => (t === 'god' ? '๐Ÿ‘‘' : t === 'mega' ? 'โ—†' : 'ยท');
421
- const renderTree = (n, depth) => {
422
- const indent = ' '.repeat(depth);
423
- let out = `${indent}${tierIcon(n.tier)} ${n.name} (${n.tier})\n`;
424
- if (n.composes.length)
425
- out += `${indent} ~composes: ${n.composes.join(', ')}\n`;
426
- if (n.missing && n.missing.length)
427
- out += `${indent} โš  missing: ${n.missing.join(', ')}\n`;
428
- for (const child of n.children)
429
- out += renderTree(child, depth + 1);
430
- return out;
431
- };
432
- let text = `๓ฑ… **Skill Governance Graph**${root ? ` (root: ${root})` : ' (all god apexes)'}\n\n`;
433
- if (fmt === 'tree' || fmt === 'both') {
434
- for (const r of forest)
435
- text += renderTree(r, 0);
436
- }
437
- if (fmt === 'edges' || fmt === 'both') {
438
- text += `\n**Edges (${edges.length}):**\n`;
439
- for (const e of edges) {
440
- text += `- ${e.from} โ€”${e.kind}โ†’ ${e.to}${e.kind === 'governs' && !e.resolved ? ' (unresolved)' : ''}\n`;
441
- }
442
- }
443
- // Machine-readable payload appended for programmatic callers.
444
- text += `\n\`\`\`json\n${JSON.stringify({ tree: forest, edges }, null, 2)}\n\`\`\``;
445
- return { content: [{ type: "text", text }] };
446
- },
447
- },
448
- ];
449
- //# sourceMappingURL=skill.js.map
1
+ import{TOOL_ANNOTATIONS as v}from"../tool-annotations.js";import{currentReadCacheKey as $}from"./boundary.js";import{cache as h}from"../performance.js";import{sanitizeFtsQuery as O}from"../security.js";import{deploySkill as j,validateAtomicSkill as L}from"../skill-author.js";const A=[{name:"wyrm_skill_create",description:"Author + deploy + register an ATOMIC skill in one clean step. Validates atomicity (one focused capability, discoverable 12\u2013280 char description, proper frontmatter), writes <skillsDir>/<slug>/SKILL.md, and registers it so it's instantly findable via wyrm_skill_search. Refuses to clobber an existing skill unless force=true. Use this to create skills as they're needed instead of leaving them un-deployed.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Skill name (slugified to kebab-case)"},description:{type:"string",description:"One-line description, 12\u2013280 chars \u2014 used for discovery/recall ranking"},body:{type:"string",description:"The SKILL.md markdown body (the actual skill content; should be ONE focused capability)"},argumentHint:{type:"string",description:"Optional argument-hint frontmatter (for user-invocable skills)"},userInvocable:{type:"boolean",description:"Whether it's a user-invocable slash command"},category:{type:"string",description:"Optional category"},tags:{type:"array",items:{type:"string"},description:"Optional tags"},force:{type:"boolean",description:"Overwrite an existing skill of the same slug (default false)"},register:{type:"boolean",description:"Register in the skill registry for discovery (default true)"}},required:["name","description","body"]},annotations:v.wyrm_skill_create,aliases:[],handler:async(c,p)=>{const{db:d}=p,n=c||{},o=(S=>{const x=S.filter(_=>!n[_]&&n[_]!==0&&n[_]!==!1);return x.length>0?{content:[{type:"text",text:`Missing required arguments: ${x.join(", ")}`}],isError:!0}:null})(["name","description","body"]);if(o)return o;const{name:t,description:s,body:g,argumentHint:m,userInvocable:a,category:y,tags:i,force:e,register:l}=c,k={name:t,description:s,body:g,argumentHint:m,userInvocable:a,category:y,tags:i},u=L(k);if(!u.ok)return{content:[{type:"text",text:`\u274C Skill rejected (not clean/atomic):
2
+ - ${u.errors.join(`
3
+ - `)}`}]};let f;try{f=j(k,{force:e})}catch(S){return{content:[{type:"text",text:`\u274C Deploy failed: ${S instanceof Error?S.message:String(S)}`}]}}let b=!1;if(l!==!1)try{d.registerSkill(u.slug,s,f.path,y,"Ghost Protocol","1.0.0",(i||[]).join(",")),b=!0}catch{}const w=u.warnings.length?`
4
+
5
+ \u26A0\uFE0F ${u.warnings.join(`
6
+ \u26A0\uFE0F `)}`:"";return{content:[{type:"text",text:`\u{F115D} Skill "${u.slug}" ${f.action}${b?" + registered (discoverable via wyrm_skill_search)":""}
7
+ ${f.path}${w}`}]}}},{name:"wyrm_skill_register",description:"Register or update a skill and store metadata in Wyrm. Supports GOD-SKILL SPEC v2 apex tiers (god > mega > atomic) with governs/composes routing.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Skill name (e.g., 'professional-lead-scraping')"},description:{type:"string",description:"Skill description"},skillPath:{type:"string",description:"File path to skill (e.g., ~/.copilot/skills/name or project relative path)"},category:{type:"string",description:"Skill category (e.g., 'data-extraction', 'testing', 'documentation')"},author:{type:"string",description:"Skill author or creator"},version:{type:"string",description:"Skill version"},tags:{type:"string",description:"Comma-separated tags (e.g., 'scraping,leads,email-validation')"},tier:{type:"string",enum:["atomic","mega","god"],description:"GOD-SKILL SPEC v2 apex tier. Default 'atomic'. 'mega' composes atomics; 'god' governs megas."},governs:{type:"array",items:{type:"string"},description:"Skill names this node routes DOWN to (god\u2192megas, mega\u2192atomics). Default []."},composes:{type:"array",items:{type:"string"},description:"Skill names this node pulls in laterally. Default []."}},required:["name","description","skillPath"]},annotations:v.wyrm_skill_register,aliases:[],handler:async(c,p)=>{const{db:d}=p,{name:n,description:r,skillPath:o,category:t,author:s,version:g,tags:m,tier:a,governs:y,composes:i}=c,e=a||y||i?{tier:a,governs:y,composes:i}:void 0,l=d.registerSkill(n,r,o,t,s,g,m,e);h.invalidate("wyrm_skill_list"),h.invalidate("wyrm_skill_stats");const k=l.governs?JSON.parse(l.governs):[],u=l.composes?JSON.parse(l.composes):[];let f=`\u{F115D} **Skill Registered**
8
+
9
+ Name: ${l.name}
10
+ Path: ${l.skill_path}
11
+ Category: ${l.category||"uncategorized"}
12
+ Version: ${l.version||"1.0.0"}
13
+ Tier: ${l.tier}
14
+ Status: ${l.is_active?"Active":"Inactive"}`;return k.length&&(f+=`
15
+ Governs: ${k.join(", ")}`),u.length&&(f+=`
16
+ Composes: ${u.join(", ")}`),{content:[{type:"text",text:f}]}}},{name:"wyrm_skill_list",description:"List registered skills with filtering options",inputSchema:{type:"object",properties:{active:{type:"boolean",description:"Filter by active status"},category:{type:"string",description:"Filter by category"},search:{type:"string",description:"Full-text search by name, description, or tags"},tier:{type:"string",enum:["atomic","mega","god"],description:"Filter by GOD-SKILL SPEC v2 tier (atomic|mega|god)"}}},annotations:v.wyrm_skill_list,aliases:[],handler:async(c,p)=>{const{cachedResponse:d,db:n}=p,r=$(),{active:o,category:t,search:s,tier:g}=c,m=n.listSkills(o,t,s,g);if(m.length===0)return{content:[{type:"text",text:`\u{F115D} **Skills**
17
+
18
+ No skills found matching your criteria.`}]};let a=`\u{F115D} **Skills Registry** (${m.length} total)
19
+
20
+ `;for(const i of m){const e=i.tier&&i.tier!=="atomic"?` [${i.tier.toUpperCase()}]`:"";a+=`### ${i.name}${e} ${i.is_active?"\u2705":"\u274C"}
21
+ `,a+=`Category: ${i.category||"uncategorized"}
22
+ `,a+=`Description: ${i.description}
23
+ `,i.version&&(a+=`Version: ${i.version}
24
+ `),i.author&&(a+=`Author: ${i.author}
25
+ `),i.tags&&(a+=`Tags: ${i.tags}
26
+ `),a+=`Path: \`${i.skill_path}\`
27
+ `,a+=`Used: ${i.usage_count} times`,i.last_used&&(a+=` (last: ${i.last_used})`),a+=`
28
+
29
+ `}const y=d(a);return r&&h.set(r,y,3e4),y}},{name:"wyrm_skill_get",description:"Get detailed information about a specific skill",inputSchema:{type:"object",properties:{name:{type:"string",description:"Skill name"}},required:["name"]},annotations:v.wyrm_skill_get,aliases:[],handler:async(c,p)=>{const{cachedResponse:d,db:n}=p,r=$(),{name:o}=c,t=n.getSkill(o);if(!t)return{content:[{type:"text",text:`\u{F115D} **Skill Not Found**: ${o}`}]};let s=`\u{F115D} **Skill: ${t.name}** ${t.is_active?"\u2705 Active":"\u274C Inactive"}
30
+
31
+ `;s+=`**Description:** ${t.description}
32
+ `,s+=`**Path:** \`${t.skill_path}\`
33
+ `,s+=`**Category:** ${t.category||"uncategorized"}
34
+ `,t.author&&(s+=`**Author:** ${t.author}
35
+ `),t.version&&(s+=`**Version:** ${t.version}
36
+ `),t.tags&&(s+=`**Tags:** ${t.tags}
37
+ `),s+=`**Usage Count:** ${t.usage_count}
38
+ `,t.last_used&&(s+=`**Last Used:** ${t.last_used}
39
+ `),s+=`**Created:** ${t.created_at}
40
+ `,s+=`**Updated:** ${t.updated_at}
41
+ `;const g=d(s);return r&&h.set(r,g,3e4),g}},{name:"wyrm_skill_delete",description:"Delete a skill from Wyrm registry",inputSchema:{type:"object",properties:{name:{type:"string",description:"Skill name"}},required:["name"]},annotations:v.wyrm_skill_delete,aliases:[],handler:async(c,p)=>{const{db:d}=p,{name:n}=c,r=d.deleteSkill(n);return h.invalidate("wyrm_skill_list"),h.invalidate("wyrm_skill_stats"),r?{content:[{type:"text",text:`\u{F115D} **Skill Deleted**: ${n}`}]}:{content:[{type:"text",text:`\u{F115D} **Skill Not Found**: ${n}`}]}}},{name:"wyrm_skill_activate",description:"Activate a skill (mark as active)",inputSchema:{type:"object",properties:{name:{type:"string",description:"Skill name"}},required:["name"]},annotations:v.wyrm_skill_activate,aliases:[],handler:async(c,p)=>{const{db:d}=p,{name:n}=c,r=d.activateSkill(n);return h.invalidate("wyrm_skill_list"),h.invalidate("wyrm_skill_stats"),r?{content:[{type:"text",text:`\u{F115D} **Skill Activated**: ${n}`}]}:{content:[{type:"text",text:`\u{F115D} **Skill Not Found**: ${n}`}]}}},{name:"wyrm_skill_deactivate",description:"Deactivate a skill (mark as inactive)",inputSchema:{type:"object",properties:{name:{type:"string",description:"Skill name"}},required:["name"]},annotations:v.wyrm_skill_deactivate,aliases:[],handler:async(c,p)=>{const{db:d}=p,{name:n}=c,r=d.deactivateSkill(n);return h.invalidate("wyrm_skill_list"),h.invalidate("wyrm_skill_stats"),r?{content:[{type:"text",text:`\u{F115D} **Skill Deactivated**: ${n}`}]}:{content:[{type:"text",text:`\u{F115D} **Skill Not Found**: ${n}`}]}}},{name:"wyrm_skill_search",description:"Search for skills by name, description, or tags. Optionally filter by GOD-SKILL SPEC v2 tier.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search query"},limit:{type:"number",description:"Max results (default: 20)"},tier:{type:"string",enum:["atomic","mega","god"],description:"Restrict results to a GOD-SKILL SPEC v2 tier (atomic|mega|god)"}},required:["query"]},annotations:v.wyrm_skill_search,aliases:[],handler:async(c,p)=>{const{cachedResponse:d,db:n}=p,r=$(),{query:o,limit:t,tier:s}=c,g=O(o),m=n.searchSkills(g,t||20,s);if(m.length===0)return{content:[{type:"text",text:`\u{F115D} **Search Skills**: No results found for "${o}"${s?` (tier=${s})`:""}`}]};let a=`\u{F115D} **Skill Search Results for "${o}"** (${m.length} found)
42
+
43
+ `;for(const i of m){const e=i.tier&&i.tier!=="atomic"?` [${i.tier.toUpperCase()}]`:"";a+=`- **${i.name}**${e} (${i.category||"uncategorized"}) ${i.is_active?"\u2705":"\u274C"}
44
+ `,a+=` ${i.description}
45
+
46
+ `}const y=d(a);return r&&h.set(r,y,3e4),y}},{name:"wyrm_skill_stats",description:"Get statistics on registered skills",inputSchema:{type:"object",properties:{}},annotations:v.wyrm_skill_stats,aliases:[],handler:async(c,p)=>{const{cachedResponse:d,db:n}=p,r=$(),o=n.getSkillStats();let t=`\u{F115D} **Skill Statistics**
47
+
48
+ `;if(t+=`**Total Skills:** ${o.total}
49
+ `,t+=`**Active Skills:** ${o.active}
50
+ `,t+=`**Inactive Skills:** ${o.total-o.active}
51
+
52
+ `,Object.keys(o.byCategory).length>0){t+=`**By Category:**
53
+ `;for(const[g,m]of Object.entries(o.byCategory))t+=`- ${g}: ${m}
54
+ `}const s=d(t);return r&&h.set(r,s,3e4),s}},{name:"wyrm_skill_graph",description:"Return the GOD-SKILL SPEC v2 governance graph: walks god \u2192 governs(mega) \u2192 governs(atomic) plus each node's composes, as a tree + edge-list the caller can render. Pass a root skill to scope to one apex; omit it to get the forest of every 'god' tier skill.",inputSchema:{type:"object",properties:{root:{type:"string",description:"Optional root skill name to scope the graph (e.g. 'ghost-godhead'). Omit for all god-tier apexes."},format:{type:"string",enum:["tree","edges","both"],description:"Output shape: 'tree' (nested), 'edges' (flat edge-list), or 'both' (default)."}}},annotations:v.wyrm_skill_graph,aliases:[],handler:async(c,p)=>{const{db:d,graph:n}=p,{root:r,format:o}=c,t=o||"both",s=d.getSkillGraph(r);if(s.length===0)return{content:[{type:"text",text:`\u{F115D} **Skill Graph**
55
+
56
+ ${r?`Skill "${r}" is not registered (or has no graph).`:"No god-tier skills registered. Register one with wyrm_skill_register tier='god' + governs=[...]."}`}]};const g=[],m=e=>{for(const l of e.governs)g.push({from:e.name,to:l,kind:"governs",resolved:e.children.some(k=>k.name===l)});for(const l of e.composes)g.push({from:e.name,to:l,kind:"composes",resolved:!1});for(const l of e.children)m(l)};for(const e of s)m(e);const a=e=>e==="god"?"\u{1F451}":e==="mega"?"\u25C6":"\xB7",y=(e,l)=>{const k=" ".repeat(l);let u=`${k}${a(e.tier)} ${e.name} (${e.tier})
57
+ `;e.composes.length&&(u+=`${k} ~composes: ${e.composes.join(", ")}
58
+ `),e.missing&&e.missing.length&&(u+=`${k} \u26A0 missing: ${e.missing.join(", ")}
59
+ `);for(const f of e.children)u+=y(f,l+1);return u};let i=`\u{F115D} **Skill Governance Graph**${r?` (root: ${r})`:" (all god apexes)"}
60
+
61
+ `;if(t==="tree"||t==="both")for(const e of s)i+=y(e,0);if(t==="edges"||t==="both"){i+=`
62
+ **Edges (${g.length}):**
63
+ `;for(const e of g)i+=`- ${e.from} \u2014${e.kind}\u2192 ${e.to}${e.kind==="governs"&&!e.resolved?" (unresolved)":""}
64
+ `}return i+=`
65
+ \`\`\`json
66
+ ${JSON.stringify({tree:s,edges:g},null,2)}
67
+ \`\`\``,{content:[{type:"text",text:i}]}}}];export{A as skillToolSpecs};