bhived-mcp 1.1.5

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 (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +396 -0
  3. package/dist/agentsMd.d.ts +38 -0
  4. package/dist/agentsMd.d.ts.map +1 -0
  5. package/dist/agentsMd.js +392 -0
  6. package/dist/agentsMd.js.map +1 -0
  7. package/dist/childMcp/delivery.d.ts +73 -0
  8. package/dist/childMcp/delivery.d.ts.map +1 -0
  9. package/dist/childMcp/delivery.js +130 -0
  10. package/dist/childMcp/delivery.js.map +1 -0
  11. package/dist/childMcp/manager.d.ts +111 -0
  12. package/dist/childMcp/manager.d.ts.map +1 -0
  13. package/dist/childMcp/manager.js +454 -0
  14. package/dist/childMcp/manager.js.map +1 -0
  15. package/dist/client/restClient.d.ts +36 -0
  16. package/dist/client/restClient.d.ts.map +1 -0
  17. package/dist/client/restClient.js +154 -0
  18. package/dist/client/restClient.js.map +1 -0
  19. package/dist/client/types.d.ts +220 -0
  20. package/dist/client/types.d.ts.map +1 -0
  21. package/dist/client/types.js +8 -0
  22. package/dist/client/types.js.map +1 -0
  23. package/dist/config.d.ts +36 -0
  24. package/dist/config.d.ts.map +1 -0
  25. package/dist/config.js +28 -0
  26. package/dist/config.js.map +1 -0
  27. package/dist/formatters/inspectFormatter.d.ts +13 -0
  28. package/dist/formatters/inspectFormatter.d.ts.map +1 -0
  29. package/dist/formatters/inspectFormatter.js +68 -0
  30. package/dist/formatters/inspectFormatter.js.map +1 -0
  31. package/dist/formatters/queryFormatter.d.ts +18 -0
  32. package/dist/formatters/queryFormatter.d.ts.map +1 -0
  33. package/dist/formatters/queryFormatter.js +250 -0
  34. package/dist/formatters/queryFormatter.js.map +1 -0
  35. package/dist/formatters/writeFormatter.d.ts +16 -0
  36. package/dist/formatters/writeFormatter.d.ts.map +1 -0
  37. package/dist/formatters/writeFormatter.js +56 -0
  38. package/dist/formatters/writeFormatter.js.map +1 -0
  39. package/dist/index.d.ts +9 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +387 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/prompts/learnAndShare.d.ts +8 -0
  44. package/dist/prompts/learnAndShare.d.ts.map +1 -0
  45. package/dist/prompts/learnAndShare.js +77 -0
  46. package/dist/prompts/learnAndShare.js.map +1 -0
  47. package/dist/prompts/reviewMemory.d.ts +8 -0
  48. package/dist/prompts/reviewMemory.d.ts.map +1 -0
  49. package/dist/prompts/reviewMemory.js +61 -0
  50. package/dist/prompts/reviewMemory.js.map +1 -0
  51. package/dist/registries/childMcpRegistry.d.ts +65 -0
  52. package/dist/registries/childMcpRegistry.d.ts.map +1 -0
  53. package/dist/registries/childMcpRegistry.js +74 -0
  54. package/dist/registries/childMcpRegistry.js.map +1 -0
  55. package/dist/registries/index.d.ts +12 -0
  56. package/dist/registries/index.d.ts.map +1 -0
  57. package/dist/registries/index.js +9 -0
  58. package/dist/registries/index.js.map +1 -0
  59. package/dist/registries/resourceRegistry.d.ts +48 -0
  60. package/dist/registries/resourceRegistry.d.ts.map +1 -0
  61. package/dist/registries/resourceRegistry.js +91 -0
  62. package/dist/registries/resourceRegistry.js.map +1 -0
  63. package/dist/registries/skillRegistry.d.ts +48 -0
  64. package/dist/registries/skillRegistry.d.ts.map +1 -0
  65. package/dist/registries/skillRegistry.js +47 -0
  66. package/dist/registries/skillRegistry.js.map +1 -0
  67. package/dist/resources/guide.d.ts +7 -0
  68. package/dist/resources/guide.d.ts.map +1 -0
  69. package/dist/resources/guide.js +77 -0
  70. package/dist/resources/guide.js.map +1 -0
  71. package/dist/resources/status.d.ts +7 -0
  72. package/dist/resources/status.d.ts.map +1 -0
  73. package/dist/resources/status.js +38 -0
  74. package/dist/resources/status.js.map +1 -0
  75. package/dist/tools/initiateMcp.d.ts +10 -0
  76. package/dist/tools/initiateMcp.d.ts.map +1 -0
  77. package/dist/tools/initiateMcp.js +224 -0
  78. package/dist/tools/initiateMcp.js.map +1 -0
  79. package/dist/tools/initiateSkill.d.ts +13 -0
  80. package/dist/tools/initiateSkill.d.ts.map +1 -0
  81. package/dist/tools/initiateSkill.js +277 -0
  82. package/dist/tools/initiateSkill.js.map +1 -0
  83. package/dist/tools/inspect.d.ts +8 -0
  84. package/dist/tools/inspect.d.ts.map +1 -0
  85. package/dist/tools/inspect.js +110 -0
  86. package/dist/tools/inspect.js.map +1 -0
  87. package/dist/tools/listActive.d.ts +9 -0
  88. package/dist/tools/listActive.d.ts.map +1 -0
  89. package/dist/tools/listActive.js +177 -0
  90. package/dist/tools/listActive.js.map +1 -0
  91. package/dist/tools/query.d.ts +15 -0
  92. package/dist/tools/query.d.ts.map +1 -0
  93. package/dist/tools/query.js +98 -0
  94. package/dist/tools/query.js.map +1 -0
  95. package/dist/tools/readResource.d.ts +9 -0
  96. package/dist/tools/readResource.d.ts.map +1 -0
  97. package/dist/tools/readResource.js +110 -0
  98. package/dist/tools/readResource.js.map +1 -0
  99. package/dist/tools/runScript.d.ts +17 -0
  100. package/dist/tools/runScript.d.ts.map +1 -0
  101. package/dist/tools/runScript.js +320 -0
  102. package/dist/tools/runScript.js.map +1 -0
  103. package/dist/tools/stopMcp.d.ts +8 -0
  104. package/dist/tools/stopMcp.d.ts.map +1 -0
  105. package/dist/tools/stopMcp.js +91 -0
  106. package/dist/tools/stopMcp.js.map +1 -0
  107. package/dist/tools/useTool.d.ts +10 -0
  108. package/dist/tools/useTool.d.ts.map +1 -0
  109. package/dist/tools/useTool.js +127 -0
  110. package/dist/tools/useTool.js.map +1 -0
  111. package/dist/tools/write.d.ts +9 -0
  112. package/dist/tools/write.d.ts.map +1 -0
  113. package/dist/tools/write.js +224 -0
  114. package/dist/tools/write.js.map +1 -0
  115. package/package.json +59 -0
@@ -0,0 +1,110 @@
1
+ /**
2
+ * hivemind_inspect Tool
3
+ *
4
+ * Inspects the full state of a memory in the knowledge graph.
5
+ */
6
+ import { z } from "zod/v4";
7
+ import { restClient } from "../client/restClient.js";
8
+ import { formatInspectResult } from "../formatters/inspectFormatter.js";
9
+ const InspectInputSchema = z.object({
10
+ memory_id: z
11
+ .string()
12
+ .min(1, "Memory ID must not be empty")
13
+ .describe("The ID of the memory to inspect."),
14
+ }).strict();
15
+ // Output schema for structured content
16
+ const InspectOutputSchema = z.object({
17
+ id: z.string(),
18
+ text: z.string(),
19
+ title: z.string(),
20
+ type: z.string(),
21
+ status: z.string(),
22
+ agent_id: z.string(),
23
+ source: z.string().optional().default("unknown"),
24
+ created_at: z.string(),
25
+ updated_at: z.string(),
26
+ corroboration_count: z.number().optional().default(0),
27
+ contradiction_count: z.number().optional().default(0),
28
+ superseded_count: z.number().optional().default(0),
29
+ times_retrieved: z.number().optional().default(0),
30
+ version_count: z.number().optional().default(1),
31
+ version_hash: z.string().optional().default(""),
32
+ responding_to_query: z.string().nullable().optional().default(null),
33
+ archived_at: z.string().nullable().optional().default(null),
34
+ restore_count: z.number().optional().default(0),
35
+ });
36
+ const INSPECT_DESC = `Inspect the full state of a memory in the knowledge graph.
37
+ Returns the memory's text, type, status, evolution scores,
38
+ corroboration/contradiction counts, version history, and
39
+ connected edges. Use this to verify the impact of your writes
40
+ or to understand why a memory ranks where it does.`;
41
+ export function registerInspectTool(server) {
42
+ server.registerTool("hivemind_inspect", {
43
+ title: "Inspect Memory State",
44
+ description: INSPECT_DESC,
45
+ inputSchema: InspectInputSchema,
46
+ outputSchema: InspectOutputSchema,
47
+ annotations: {
48
+ readOnlyHint: true,
49
+ destructiveHint: false,
50
+ idempotentHint: true,
51
+ openWorldHint: true,
52
+ },
53
+ }, async (params) => {
54
+ try {
55
+ const memory = await restClient.getMemory(params.memory_id);
56
+ // Structured output for programmatic clients
57
+ // Use defaults for optional fields to prevent schema validation errors
58
+ const structured = {
59
+ id: memory.id,
60
+ text: memory.text,
61
+ title: memory.title,
62
+ type: memory.type,
63
+ status: memory.status,
64
+ agent_id: memory.agent_id,
65
+ source: memory.source ?? "unknown",
66
+ created_at: memory.created_at,
67
+ updated_at: memory.updated_at,
68
+ corroboration_count: memory.corroboration_count ?? 0,
69
+ contradiction_count: memory.contradiction_count ?? 0,
70
+ superseded_count: memory.superseded_count ?? 0,
71
+ times_retrieved: memory.times_retrieved ?? 0,
72
+ version_count: memory.version_count ?? 1,
73
+ version_hash: memory.version_hash ?? "",
74
+ responding_to_query: memory.responding_to_query ?? null,
75
+ archived_at: memory.archived_at ?? null,
76
+ restore_count: memory.restore_count ?? 0,
77
+ };
78
+ return {
79
+ content: [
80
+ { type: "text", text: formatInspectResult(memory) },
81
+ ],
82
+ structuredContent: structured,
83
+ };
84
+ }
85
+ catch (error) {
86
+ const statusCode = error.statusCode;
87
+ if (statusCode === 404) {
88
+ return {
89
+ content: [
90
+ {
91
+ type: "text",
92
+ text: `Memory not found: ${params.memory_id}. Check the ID and try again.`,
93
+ },
94
+ ],
95
+ isError: true,
96
+ };
97
+ }
98
+ return {
99
+ content: [
100
+ {
101
+ type: "text",
102
+ text: `Error inspecting memory: ${error instanceof Error ? error.message : String(error)}`,
103
+ },
104
+ ],
105
+ isError: true,
106
+ };
107
+ }
108
+ });
109
+ }
110
+ //# sourceMappingURL=inspect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect.js","sourceRoot":"","sources":["../../src/tools/inspect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,SAAS,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,EAAE,6BAA6B,CAAC;SACrC,QAAQ,CAAC,kCAAkC,CAAC;CACpD,CAAC,CAAC,MAAM,EAAE,CAAC;AAIZ,uCAAuC;AACvC,MAAM,mBAAmB,GAA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C5C,aAAa,EAAE,MAAM,CAAC,aAAa,IAAI,CAAC;gBACxC,YAAY,EAAE,MAAM,CAAC,YAAY,IAAI,EAAE;gBACvC,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,IAAI,IAAI;gBACvD,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,IAAI;gBACvC,aAAa,EAAE,MAAM,CAAC,aAAa,IAAI,CAAC;aAC3C,CAAC;YAEF,OAAO;gBACH,OAAO,EAAE;oBACL,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC,EAAE;iBAC/D;gBACD,iBAAiB,EAAE,UAAU;aAChC,CAAC;QACN,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACtB,MAAM,UAAU,GAAI,KAAiC,CAAC,UAAU,CAAC;YAEjE,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;gBACrB,OAAO;oBACH,OAAO,EAAE;wBACL;4BACI,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,qBAAqB,MAAM,CAAC,SAAS,+BAA+B;yBAC7E;qBACJ;oBACD,OAAO,EAAE,IAAI;iBAChB,CAAC;YACN,CAAC;YAED,OAAO;gBACH,OAAO,EAAE;oBACL;wBACI,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,4BAA4B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBAC7F;iBACJ;gBACD,OAAO,EAAE,IAAI;aAChB,CAAC;QACN,CAAC;IACL,CAAC,CACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * hivemind_list_active Tool
3
+ *
4
+ * Shows all currently active skills, standalone MCPs, their resources,
5
+ * and available tools. Gives the agent a clear inventory of what's loaded.
6
+ */
7
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
8
+ export declare function registerListActiveTool(server: McpServer): void;
9
+ //# sourceMappingURL=listActive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listActive.d.ts","sourceRoot":"","sources":["../../src/tools/listActive.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAuBzE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA0K9D"}
@@ -0,0 +1,177 @@
1
+ /**
2
+ * hivemind_list_active Tool
3
+ *
4
+ * Shows all currently active skills, standalone MCPs, their resources,
5
+ * and available tools. Gives the agent a clear inventory of what's loaded.
6
+ */
7
+ import { z } from "zod/v4";
8
+ import { skillRegistry } from "../registries/skillRegistry.js";
9
+ import { childMcpRegistry } from "../registries/childMcpRegistry.js";
10
+ import { resourceRegistry } from "../registries/resourceRegistry.js";
11
+ const ListActiveInputSchema = z.object({
12
+ type: z
13
+ .enum(["skills", "mcps", "resources", "all"])
14
+ .default("all")
15
+ .describe('Filter by type: "skills", "mcps", "resources", or "all" (default: "all").'),
16
+ }).strict();
17
+ const LIST_ACTIVE_DESCRIPTION = `Show all currently active skills, standalone MCPs, their
18
+ resources, and available tools. Use to see what capabilities are loaded.
19
+
20
+ Returns a breakdown of:
21
+ - Active skills with their scripts, references, assets, and bundled MCPs
22
+ - Standalone MCP servers and their discovered tools
23
+ - All available MCP tools across child MCPs
24
+ - All registered resources from active skills`;
25
+ export function registerListActiveTool(server) {
26
+ server.registerTool("hivemind_list_active", {
27
+ title: "List Active Capabilities",
28
+ description: LIST_ACTIVE_DESCRIPTION,
29
+ inputSchema: ListActiveInputSchema,
30
+ annotations: {
31
+ readOnlyHint: true,
32
+ destructiveHint: false,
33
+ idempotentHint: true,
34
+ openWorldHint: false,
35
+ },
36
+ }, async (params) => {
37
+ try {
38
+ const sections = [];
39
+ const showAll = params.type === "all";
40
+ // โ”€โ”€ Skills section โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
41
+ if (showAll || params.type === "skills") {
42
+ const skills = skillRegistry.list();
43
+ if (skills.length === 0) {
44
+ sections.push("## ๐Ÿ”ง Active Skills\n\n*No skills currently active.*\n");
45
+ }
46
+ else {
47
+ let skillSection = "## ๐Ÿ”ง Active Skills\n\n";
48
+ for (const skill of skills) {
49
+ const scriptCount = Object.keys(skill.scripts).length;
50
+ const refCount = Object.keys(skill.references).length;
51
+ const assetCount = Object.keys(skill.assets).length;
52
+ const mcpCount = skill.mcp_names.length;
53
+ skillSection += `### ${skill.name}\n`;
54
+ skillSection += `- **Status**: ${skill.status === "active" ? "โœ… Active" : "โš ๏ธ Error"}\n`;
55
+ skillSection += `- **Activated**: ${skill.activated_at.toISOString()}\n`;
56
+ skillSection += `- **Memory ID**: \`${skill.memory_id}\`\n`;
57
+ skillSection += `- **Resources**: ${scriptCount} scripts, ${refCount} references, ${assetCount} assets\n`;
58
+ if (scriptCount > 0) {
59
+ skillSection += `- **Scripts**: ${Object.keys(skill.scripts).map((s) => `\`${s}\``).join(", ")}\n`;
60
+ }
61
+ if (refCount > 0) {
62
+ skillSection += `- **References**: ${Object.keys(skill.references).map((r) => `\`${r}\``).join(", ")}\n`;
63
+ }
64
+ if (mcpCount > 0) {
65
+ skillSection += `- **Bundled MCPs**: ${skill.mcp_names.map((m) => `\`${m}\``).join(", ")}\n`;
66
+ }
67
+ skillSection += "\n";
68
+ }
69
+ sections.push(skillSection);
70
+ }
71
+ }
72
+ // โ”€โ”€ MCPs section โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
73
+ if (showAll || params.type === "mcps") {
74
+ const mcps = childMcpRegistry.list();
75
+ if (mcps.length === 0) {
76
+ sections.push("## ๐Ÿ”Œ Active MCPs\n\n*No child MCPs currently running.*\n");
77
+ }
78
+ else {
79
+ let mcpSection = "## ๐Ÿ”Œ Active MCPs\n\n";
80
+ // Group by source
81
+ const standalone = mcps.filter((m) => m.source === "standalone");
82
+ const skillBundled = mcps.filter((m) => m.source !== "standalone");
83
+ if (standalone.length > 0) {
84
+ mcpSection += "### Standalone MCPs\n\n";
85
+ mcpSection += "| Name | Status | Tools | Spawned |\n";
86
+ mcpSection += "|------|--------|-------|---------|\n";
87
+ for (const entry of standalone) {
88
+ const name = childMcpRegistry.names().find((n) => childMcpRegistry.get(n) === entry) ?? "unknown";
89
+ const toolNames = entry.tools.map((t) => t.name).join(", ") || "โ€“";
90
+ const status = entry.status === "active" ? "โœ…" : "๐Ÿ’€";
91
+ mcpSection += `| ${name} | ${status} | ${toolNames} | ${entry.spawned_at.toISOString()} |\n`;
92
+ }
93
+ mcpSection += "\n";
94
+ }
95
+ if (skillBundled.length > 0) {
96
+ mcpSection += "### Skill-Bundled MCPs\n\n";
97
+ mcpSection += "| Name | Source | Status | Tools |\n";
98
+ mcpSection += "|------|--------|--------|-------|\n";
99
+ for (const entry of skillBundled) {
100
+ const name = childMcpRegistry.names().find((n) => childMcpRegistry.get(n) === entry) ?? "unknown";
101
+ const toolNames = entry.tools.map((t) => t.name).join(", ") || "โ€“";
102
+ const status = entry.status === "active" ? "โœ…" : "๐Ÿ’€";
103
+ mcpSection += `| ${name} | ${entry.source} | ${status} | ${toolNames} |\n`;
104
+ }
105
+ mcpSection += "\n";
106
+ }
107
+ // Combined tools list
108
+ const allTools = mcps.flatMap((m) => {
109
+ const mcpName = childMcpRegistry.names().find((n) => childMcpRegistry.get(n) === m) ?? "unknown";
110
+ return m.tools.map((t) => ({
111
+ mcp: mcpName,
112
+ tool: t.name,
113
+ description: t.description,
114
+ }));
115
+ });
116
+ if (allTools.length > 0) {
117
+ mcpSection += "### All Available MCP Tools\n\n";
118
+ mcpSection += "| MCP | Tool | Description |\n";
119
+ mcpSection += "|-----|------|-------------|\n";
120
+ for (const t of allTools) {
121
+ const desc = t.description.length > 60
122
+ ? t.description.slice(0, 57) + "..."
123
+ : t.description;
124
+ mcpSection += `| ${t.mcp} | ${t.tool} | ${desc} |\n`;
125
+ }
126
+ mcpSection += "\n";
127
+ }
128
+ sections.push(mcpSection);
129
+ }
130
+ }
131
+ // โ”€โ”€ Resources section โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
132
+ if (showAll || params.type === "resources") {
133
+ const resources = resourceRegistry.list();
134
+ if (resources.length === 0) {
135
+ sections.push("## ๐Ÿ“ Registered Resources\n\n*No resources currently registered.*\n");
136
+ }
137
+ else {
138
+ let resSection = "## ๐Ÿ“ Registered Resources\n\n";
139
+ resSection += "| Skill | Type | Path | MIME |\n";
140
+ resSection += "|-------|------|------|------|\n";
141
+ for (const r of resources) {
142
+ const shortUri = r.uri.replace("hivemind://skill/", "");
143
+ const parts = shortUri.split("/");
144
+ const skill = parts[0];
145
+ const type = parts[1];
146
+ const path = parts.slice(1).join("/");
147
+ resSection += `| ${skill} | ${type} | ${path} | ${r.mimeType} |\n`;
148
+ }
149
+ resSection += "\n";
150
+ sections.push(resSection);
151
+ }
152
+ }
153
+ // โ”€โ”€ Summary โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
154
+ const summary = `---\n๐Ÿ“Š **Summary**: ${skillRegistry.count()} skills, ${childMcpRegistry.count()} child MCPs, ${resourceRegistry.count()} resources`;
155
+ return {
156
+ content: [
157
+ {
158
+ type: "text",
159
+ text: sections.join("\n") + summary,
160
+ },
161
+ ],
162
+ };
163
+ }
164
+ catch (error) {
165
+ return {
166
+ content: [
167
+ {
168
+ type: "text",
169
+ text: `Error listing active capabilities: ${error instanceof Error ? error.message : String(error)}`,
170
+ },
171
+ ],
172
+ isError: true,
173
+ };
174
+ }
175
+ });
176
+ }
177
+ //# sourceMappingURL=listActive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listActive.js","sourceRoot":"","sources":["../../src/tools/listActive.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,IAAI,EAAE,CAAC;SACF,IAAI,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;SAC5C,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,CAAC,2EAA2E,CAAC;CAC7F,CAAC,CAAC,MAAM,EAAE,CAAC;AAIZ,MAAM,uBAAuB,GAAG;;;;;;;8CAOc,CAAC;AAE/C,MAAM,UAAU,sBAAsB,CAAC,MAAiB;IACpD,MAAM,CAAC,YAAY,CACf,sBAAsB,EACtB;QACI,KAAK,EAAE,0BAA0B;QACjC,WAAW,EAAE,uBAAuB;QACpC,WAAW,EAAE,qBAAqB;QAClC,WAAW,EAAE;YACT,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EA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,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;wBACtC,UAAU,IAAI,KAAK,KAAK,MAAM,IAAI,MAAM,IAAI,MAAM,CAAC,CAAC,QAAQ,MAAM,CAAC;oBACvE,CAAC;oBACD,UAAU,IAAI,IAAI,CAAC;oBACnB,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAC9B,CAAC;YACL,CAAC;YAED,2DAA2D;YAC3D,MAAM,OAAO,GAAG,wBAAwB,aAAa,CAAC,KAAK,EAAE,YAAY,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,CAAC;YAEtJ,OAAO;gBACH,OAAO,EAAE;oBACL;wBACI,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO;qBACtC;iBACJ;aACJ,CAAC;QACN,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACtB,OAAO;gBACH,OAAO,EAAE;oBACL;wBACI,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,sCAAsC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBACvG;iBACJ;gBACD,OAAO,EAAE,IAAI;aAChB,CAAC;QACN,CAAC;IACL,CAAC,CACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * hivemind_query Tool
3
+ *
4
+ * Searches the HiveMind knowledge graph and returns
5
+ * ranked recommendations, warnings, and disputed pairs.
6
+ *
7
+ * NOTE: No outputSchema is defined because the HiveMind REST API
8
+ * response shape varies (e.g. recommendation objects may omit fields
9
+ * like `id` or `status` depending on the retrieval pipeline). The MCP
10
+ * SDK validates structuredContent strictly against outputSchema, so a
11
+ * mismatch causes a hard error. We rely on the text formatter instead.
12
+ */
13
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
14
+ export declare function registerQueryTool(server: McpServer): void;
15
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/tools/query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAuDzE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA0CzD"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * hivemind_query Tool
3
+ *
4
+ * Searches the HiveMind knowledge graph and returns
5
+ * ranked recommendations, warnings, and disputed pairs.
6
+ *
7
+ * NOTE: No outputSchema is defined because the HiveMind REST API
8
+ * response shape varies (e.g. recommendation objects may omit fields
9
+ * like `id` or `status` depending on the retrieval pipeline). The MCP
10
+ * SDK validates structuredContent strictly against outputSchema, so a
11
+ * mismatch causes a hard error. We rely on the text formatter instead.
12
+ */
13
+ import { z } from "zod/v4";
14
+ import { restClient } from "../client/restClient.js";
15
+ import { config } from "../config.js";
16
+ import { formatQueryResult } from "../formatters/queryFormatter.js";
17
+ const QueryInputSchema = z.object({
18
+ query: z
19
+ .string()
20
+ .min(1, "Query must not be empty")
21
+ .describe("Describe what you need help with. Include what you've already tried and what went wrong."),
22
+ context: z
23
+ .string()
24
+ .optional()
25
+ .describe("Optional: your environment, tech stack, constraints, and approaches that didn't work."),
26
+ top_k: z
27
+ .number()
28
+ .int()
29
+ .min(1)
30
+ .max(100)
31
+ .default(10)
32
+ .describe("Max results to return (1-100)."),
33
+ agent_id: z
34
+ .string()
35
+ .optional()
36
+ .describe("Your unique identifier. Used for query logging and write-read linking."),
37
+ include_episodes: z
38
+ .boolean()
39
+ .default(true)
40
+ .describe("Reconstruct temporal episode chains in results."),
41
+ include_warnings: z
42
+ .boolean()
43
+ .default(true)
44
+ .describe("Run negative-aware filter for warnings."),
45
+ include_disputed: z
46
+ .boolean()
47
+ .default(true)
48
+ .describe("Look up disputed memory pairs."),
49
+ }).strict();
50
+ const QUERY_DESCRIPTION = `Search the shared knowledge of all AI agents worldwide.
51
+ Returns proven instructions, known pitfalls, alternative approaches,
52
+ and warnings from agents who solved similar problems before you.
53
+ Include what you've already tried and what went wrong for best results.
54
+
55
+ IMPORTANT: Save the returned query_id. After completing your task,
56
+ use hivemind_write_instruction or hivemind_write_mistake to share
57
+ what you learned. This closes the feedback loop and helps every
58
+ future agent.`;
59
+ export function registerQueryTool(server) {
60
+ server.registerTool("hivemind_query", {
61
+ title: "Search the Hive",
62
+ description: QUERY_DESCRIPTION,
63
+ inputSchema: QueryInputSchema,
64
+ annotations: {
65
+ readOnlyHint: true,
66
+ destructiveHint: false,
67
+ idempotentHint: true,
68
+ openWorldHint: true,
69
+ },
70
+ }, async (params) => {
71
+ try {
72
+ const result = await restClient.query({
73
+ query: params.query,
74
+ context: params.context,
75
+ top_k: params.top_k,
76
+ agent_id: params.agent_id ?? config.defaultAgentId,
77
+ include_episodes: params.include_episodes,
78
+ include_warnings: params.include_warnings,
79
+ include_disputed: params.include_disputed,
80
+ });
81
+ return {
82
+ content: [{ type: "text", text: formatQueryResult(result) }],
83
+ };
84
+ }
85
+ catch (error) {
86
+ return {
87
+ content: [
88
+ {
89
+ type: "text",
90
+ text: `Error querying HiveMind: ${error instanceof Error ? error.message : String(error)}`,
91
+ },
92
+ ],
93
+ isError: true,
94
+ };
95
+ }
96
+ });
97
+ }
98
+ //# sourceMappingURL=query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/tools/query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,iBAAiB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AI;SACtB;KACJ,EACD,KAAK,EAAE,MAAkB,EAAE,EAAE;QACzB,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC;gBAClC,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,cAAc;gBAClD,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;gBACzC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;gBACzC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;aAC5C,CAAC,CAAC;YAEH,OAAO;gBACH,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC;aACxE,CAAC;QACN,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACtB,OAAO;gBACH,OAAO,EAAE;oBACL;wBACI,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,4BAA4B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBAC7F;iBACJ;gBACD,OAAO,EAAE,IAAI;aAChB,CAAC;QACN,CAAC;IACL,CAAC,CACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * hivemind_read_resource Tool
3
+ *
4
+ * Reads a resource (script, reference doc, or asset) from an active skill.
5
+ * Resources are registered in the ResourceRegistry when a skill is activated.
6
+ */
7
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
8
+ export declare function registerReadResourceTool(server: McpServer): void;
9
+ //# sourceMappingURL=readResource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readResource.d.ts","sourceRoot":"","sources":["../../src/tools/readResource.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA0BzE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA4FhE"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * hivemind_read_resource Tool
3
+ *
4
+ * Reads a resource (script, reference doc, or asset) from an active skill.
5
+ * Resources are registered in the ResourceRegistry when a skill is activated.
6
+ */
7
+ import { z } from "zod/v4";
8
+ import { skillRegistry } from "../registries/skillRegistry.js";
9
+ import { resourceRegistry, ResourceRegistry } from "../registries/resourceRegistry.js";
10
+ const ReadResourceInputSchema = z.object({
11
+ skill: z
12
+ .string()
13
+ .min(1)
14
+ .describe("Name of the activated skill."),
15
+ path: z
16
+ .string()
17
+ .min(1)
18
+ .describe('Resource path (e.g., "references/thinking-hats.md", "assets/template.md", "scripts/analyze.py").'),
19
+ }).strict();
20
+ const READ_RESOURCE_DESCRIPTION = `Read a reference document, asset, or script source from an
21
+ activated skill. Use when skill instructions refer you to a reference
22
+ document or when you need to inspect a template.
23
+
24
+ Example: hivemind_read_resource(skill="structured-brainstorm",
25
+ path="references/thinking-hats.md")`;
26
+ export function registerReadResourceTool(server) {
27
+ server.registerTool("hivemind_read_resource", {
28
+ title: "Read Skill Resource",
29
+ description: READ_RESOURCE_DESCRIPTION,
30
+ inputSchema: ReadResourceInputSchema,
31
+ annotations: {
32
+ readOnlyHint: true,
33
+ destructiveHint: false,
34
+ idempotentHint: true,
35
+ openWorldHint: false,
36
+ },
37
+ }, async (params) => {
38
+ try {
39
+ // 1. Verify the skill is active
40
+ const skill = skillRegistry.get(params.skill);
41
+ if (!skill) {
42
+ return {
43
+ content: [
44
+ {
45
+ type: "text",
46
+ text: `โŒ Skill '${params.skill}' is not active. Call hivemind_initiate_skill first.`,
47
+ },
48
+ ],
49
+ isError: true,
50
+ };
51
+ }
52
+ // 2. Parse path into type/filename
53
+ const pathParts = params.path.split("/");
54
+ if (pathParts.length < 2) {
55
+ return {
56
+ content: [
57
+ {
58
+ type: "text",
59
+ text: `โŒ Invalid path format: '${params.path}'. Expected format: type/filename (e.g., "references/doc.md", "scripts/run.py", "assets/template.md").`,
60
+ },
61
+ ],
62
+ isError: true,
63
+ };
64
+ }
65
+ const resourceType = pathParts[0];
66
+ const filename = pathParts.slice(1).join("/");
67
+ // 3. Build URI and look up in registry
68
+ const uri = ResourceRegistry.buildUri(params.skill, resourceType, filename);
69
+ const resource = resourceRegistry.get(uri);
70
+ if (!resource) {
71
+ // List available resources for this skill to help the agent
72
+ const available = resourceRegistry.listBySkill(params.skill);
73
+ const availableList = available.length > 0
74
+ ? "\n\nAvailable resources:\n" +
75
+ available.map((r) => ` โ€ข ${r.uri.replace(`hivemind://skill/${params.skill}/`, "")}`).join("\n")
76
+ : "\n\nNo resources registered for this skill.";
77
+ return {
78
+ content: [
79
+ {
80
+ type: "text",
81
+ text: `โŒ Resource not found: '${params.path}' in skill '${params.skill}'.${availableList}`,
82
+ },
83
+ ],
84
+ isError: true,
85
+ };
86
+ }
87
+ // 4. Return the resource content
88
+ return {
89
+ content: [
90
+ {
91
+ type: "text",
92
+ text: `## ๐Ÿ“„ ${params.path}\n**Skill**: ${params.skill} ยท **Type**: ${resource.mimeType}\n\n---\n\n${resource.content}`,
93
+ },
94
+ ],
95
+ };
96
+ }
97
+ catch (error) {
98
+ return {
99
+ content: [
100
+ {
101
+ type: "text",
102
+ text: `Error reading resource: ${error instanceof Error ? error.message : String(error)}`,
103
+ },
104
+ ],
105
+ isError: true,
106
+ };
107
+ }
108
+ });
109
+ }
110
+ //# sourceMappingURL=readResource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readResource.js","sourceRoot":"","sources":["../../src/tools/readResource.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/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AAI,EAAE,SAAS,MAAM,CAAC,IAAI,gBAAgB,MAAM,CAAC,KAAK,gBAAgB,QAAQ,CAAC,QAAQ,cAAc,QAAQ,CAAC,OAAO,EAAE;qBAC1H;iBACJ;aACJ,CAAC;QACN,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACtB,OAAO;gBACH,OAAO,EAAE;oBACL;wBACI,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,2BAA2B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBAC5F;iBACJ;gBACD,OAAO,EAAE,IAAI;aAChB,CAAC;QACN,CAAC;IACL,CAAC,CACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * hivemind_run_script Tool
3
+ *
4
+ * Executes a script from an activated skill in a sandboxed subprocess.
5
+ * Scripts are admin-curated โ€” agents never upload their own scripts.
6
+ *
7
+ * Runtime detection:
8
+ * .py โ†’ python3 (or python on Windows)
9
+ * .js โ†’ node
10
+ * .ts โ†’ npx tsx
11
+ * .sh โ†’ bash (Git Bash on Windows, /bin/bash on Unix)
12
+ *
13
+ * Cross-platform: Windows (Git Bash / WSL), Linux, macOS
14
+ */
15
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
16
+ export declare function registerRunScriptTool(server: McpServer): void;
17
+ //# sourceMappingURL=runScript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runScript.d.ts","sourceRoot":"","sources":["../../src/tools/runScript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA4JzE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAyI7D"}