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.
- package/LICENSE +21 -0
- package/README.md +396 -0
- package/dist/agentsMd.d.ts +38 -0
- package/dist/agentsMd.d.ts.map +1 -0
- package/dist/agentsMd.js +392 -0
- package/dist/agentsMd.js.map +1 -0
- package/dist/childMcp/delivery.d.ts +73 -0
- package/dist/childMcp/delivery.d.ts.map +1 -0
- package/dist/childMcp/delivery.js +130 -0
- package/dist/childMcp/delivery.js.map +1 -0
- package/dist/childMcp/manager.d.ts +111 -0
- package/dist/childMcp/manager.d.ts.map +1 -0
- package/dist/childMcp/manager.js +454 -0
- package/dist/childMcp/manager.js.map +1 -0
- package/dist/client/restClient.d.ts +36 -0
- package/dist/client/restClient.d.ts.map +1 -0
- package/dist/client/restClient.js +154 -0
- package/dist/client/restClient.js.map +1 -0
- package/dist/client/types.d.ts +220 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +8 -0
- package/dist/client/types.js.map +1 -0
- package/dist/config.d.ts +36 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +28 -0
- package/dist/config.js.map +1 -0
- package/dist/formatters/inspectFormatter.d.ts +13 -0
- package/dist/formatters/inspectFormatter.d.ts.map +1 -0
- package/dist/formatters/inspectFormatter.js +68 -0
- package/dist/formatters/inspectFormatter.js.map +1 -0
- package/dist/formatters/queryFormatter.d.ts +18 -0
- package/dist/formatters/queryFormatter.d.ts.map +1 -0
- package/dist/formatters/queryFormatter.js +250 -0
- package/dist/formatters/queryFormatter.js.map +1 -0
- package/dist/formatters/writeFormatter.d.ts +16 -0
- package/dist/formatters/writeFormatter.d.ts.map +1 -0
- package/dist/formatters/writeFormatter.js +56 -0
- package/dist/formatters/writeFormatter.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +387 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/learnAndShare.d.ts +8 -0
- package/dist/prompts/learnAndShare.d.ts.map +1 -0
- package/dist/prompts/learnAndShare.js +77 -0
- package/dist/prompts/learnAndShare.js.map +1 -0
- package/dist/prompts/reviewMemory.d.ts +8 -0
- package/dist/prompts/reviewMemory.d.ts.map +1 -0
- package/dist/prompts/reviewMemory.js +61 -0
- package/dist/prompts/reviewMemory.js.map +1 -0
- package/dist/registries/childMcpRegistry.d.ts +65 -0
- package/dist/registries/childMcpRegistry.d.ts.map +1 -0
- package/dist/registries/childMcpRegistry.js +74 -0
- package/dist/registries/childMcpRegistry.js.map +1 -0
- package/dist/registries/index.d.ts +12 -0
- package/dist/registries/index.d.ts.map +1 -0
- package/dist/registries/index.js +9 -0
- package/dist/registries/index.js.map +1 -0
- package/dist/registries/resourceRegistry.d.ts +48 -0
- package/dist/registries/resourceRegistry.d.ts.map +1 -0
- package/dist/registries/resourceRegistry.js +91 -0
- package/dist/registries/resourceRegistry.js.map +1 -0
- package/dist/registries/skillRegistry.d.ts +48 -0
- package/dist/registries/skillRegistry.d.ts.map +1 -0
- package/dist/registries/skillRegistry.js +47 -0
- package/dist/registries/skillRegistry.js.map +1 -0
- package/dist/resources/guide.d.ts +7 -0
- package/dist/resources/guide.d.ts.map +1 -0
- package/dist/resources/guide.js +77 -0
- package/dist/resources/guide.js.map +1 -0
- package/dist/resources/status.d.ts +7 -0
- package/dist/resources/status.d.ts.map +1 -0
- package/dist/resources/status.js +38 -0
- package/dist/resources/status.js.map +1 -0
- package/dist/tools/initiateMcp.d.ts +10 -0
- package/dist/tools/initiateMcp.d.ts.map +1 -0
- package/dist/tools/initiateMcp.js +224 -0
- package/dist/tools/initiateMcp.js.map +1 -0
- package/dist/tools/initiateSkill.d.ts +13 -0
- package/dist/tools/initiateSkill.d.ts.map +1 -0
- package/dist/tools/initiateSkill.js +277 -0
- package/dist/tools/initiateSkill.js.map +1 -0
- package/dist/tools/inspect.d.ts +8 -0
- package/dist/tools/inspect.d.ts.map +1 -0
- package/dist/tools/inspect.js +110 -0
- package/dist/tools/inspect.js.map +1 -0
- package/dist/tools/listActive.d.ts +9 -0
- package/dist/tools/listActive.d.ts.map +1 -0
- package/dist/tools/listActive.js +177 -0
- package/dist/tools/listActive.js.map +1 -0
- package/dist/tools/query.d.ts +15 -0
- package/dist/tools/query.d.ts.map +1 -0
- package/dist/tools/query.js +98 -0
- package/dist/tools/query.js.map +1 -0
- package/dist/tools/readResource.d.ts +9 -0
- package/dist/tools/readResource.d.ts.map +1 -0
- package/dist/tools/readResource.js +110 -0
- package/dist/tools/readResource.js.map +1 -0
- package/dist/tools/runScript.d.ts +17 -0
- package/dist/tools/runScript.d.ts.map +1 -0
- package/dist/tools/runScript.js +320 -0
- package/dist/tools/runScript.js.map +1 -0
- package/dist/tools/stopMcp.d.ts +8 -0
- package/dist/tools/stopMcp.d.ts.map +1 -0
- package/dist/tools/stopMcp.js +91 -0
- package/dist/tools/stopMcp.js.map +1 -0
- package/dist/tools/useTool.d.ts +10 -0
- package/dist/tools/useTool.d.ts.map +1 -0
- package/dist/tools/useTool.js +127 -0
- package/dist/tools/useTool.js.map +1 -0
- package/dist/tools/write.d.ts +9 -0
- package/dist/tools/write.d.ts.map +1 -0
- package/dist/tools/write.js +224 -0
- package/dist/tools/write.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Child MCP Registry
|
|
3
|
+
*
|
|
4
|
+
* In-memory registry tracking spawned child MCP processes,
|
|
5
|
+
* their client connections, discovered tools, and lifecycle status.
|
|
6
|
+
* Session-scoped — cleaned up when the MCP server exits.
|
|
7
|
+
*/
|
|
8
|
+
import { config } from "../config.js";
|
|
9
|
+
export class ChildMcpRegistry {
|
|
10
|
+
children = new Map();
|
|
11
|
+
/**
|
|
12
|
+
* Register a new child MCP entry.
|
|
13
|
+
* @throws if standalone or total limits are exceeded.
|
|
14
|
+
*/
|
|
15
|
+
add(name, entry) {
|
|
16
|
+
// Enforce standalone limit
|
|
17
|
+
if (entry.source === "standalone") {
|
|
18
|
+
const standaloneCount = this.countBySource("standalone");
|
|
19
|
+
if (standaloneCount >= config.maxStandaloneMcps && !this.children.has(name)) {
|
|
20
|
+
throw new Error(`Maximum standalone MCP limit reached (${config.maxStandaloneMcps}). ` +
|
|
21
|
+
`Stop an MCP with hivemind_stop_mcp before spawning another.`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
// Enforce total child process limit
|
|
25
|
+
if (this.children.size >= config.maxChildProcesses && !this.children.has(name)) {
|
|
26
|
+
throw new Error(`Maximum total child process limit reached (${config.maxChildProcesses}). ` +
|
|
27
|
+
`Stop an MCP to free resources.`);
|
|
28
|
+
}
|
|
29
|
+
this.children.set(name, entry);
|
|
30
|
+
}
|
|
31
|
+
/** Get a child MCP entry by name. */
|
|
32
|
+
get(name) {
|
|
33
|
+
return this.children.get(name);
|
|
34
|
+
}
|
|
35
|
+
/** Remove a child MCP by name. Returns true if it existed. */
|
|
36
|
+
remove(name) {
|
|
37
|
+
return this.children.delete(name);
|
|
38
|
+
}
|
|
39
|
+
/** List all child MCP entries. */
|
|
40
|
+
list() {
|
|
41
|
+
return Array.from(this.children.values());
|
|
42
|
+
}
|
|
43
|
+
/** Check if a child MCP is registered. */
|
|
44
|
+
has(name) {
|
|
45
|
+
return this.children.has(name);
|
|
46
|
+
}
|
|
47
|
+
/** Current number of child MCPs. */
|
|
48
|
+
count() {
|
|
49
|
+
return this.children.size;
|
|
50
|
+
}
|
|
51
|
+
/** List child MCPs filtered by source. */
|
|
52
|
+
listBySource(source) {
|
|
53
|
+
return Array.from(this.children.values()).filter((entry) => source === "standalone"
|
|
54
|
+
? entry.source === "standalone"
|
|
55
|
+
: entry.source === source);
|
|
56
|
+
}
|
|
57
|
+
/** Count child MCPs by source type. */
|
|
58
|
+
countBySource(sourceType) {
|
|
59
|
+
return Array.from(this.children.values()).filter((entry) => sourceType === "standalone"
|
|
60
|
+
? entry.source === "standalone"
|
|
61
|
+
: entry.source.startsWith("skill:")).length;
|
|
62
|
+
}
|
|
63
|
+
/** Get all entries whose source matches a specific skill name. */
|
|
64
|
+
listBySkill(skillName) {
|
|
65
|
+
return this.listBySource(`skill:${skillName}`);
|
|
66
|
+
}
|
|
67
|
+
/** Get all registered child MCP names. */
|
|
68
|
+
names() {
|
|
69
|
+
return Array.from(this.children.keys());
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** Singleton child MCP registry instance */
|
|
73
|
+
export const childMcpRegistry = new ChildMcpRegistry();
|
|
74
|
+
//# sourceMappingURL=childMcpRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"childMcpRegistry.js","sourceRoot":"","sources":["../../src/registries/childMcpRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AA8BtC,MAAM,OAAO,gBAAgB;IACR,QAAQ,GAAG,IAAI,GAAG,EAAyB,CAAC;IAE7D;;;OAGG;IACH,GAAG,CAAC,IAAY,EAAE,KAAoB;QAClC,2BAA2B;QAC3B,IAAI,KAAK,CAAC,MAAM,KAAK,YAAY,EAAE,CAAC;YAChC,MAAM,eAAe,GAAG,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;YACzD,IAAI,eAAe,IAAI,MAAM,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC1E,MAAM,IAAI,KAAK,CACX,yCAAyC,MAAM,CAAC,iBAAiB,KAAK;oBACtE,6DAA6D,CAChE,CAAC;YACN,CAAC;QACL,CAAC;QAED,oCAAoC;QACpC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,MAAM,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7E,MAAM,IAAI,KAAK,CACX,8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,CAAC,MAAM,KAAK,YAAY;YAC/B,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAC1C,CAAC,MAAM,CAAC;IACb,CAAC;IAED,kEAAkE;IAClE,WAAW,CAAC,SAAiB;QACzB,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,SAAS,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,0CAA0C;IAC1C,KAAK;QACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;CACJ;AAED,4CAA4C;AAC5C,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registries — barrel export
|
|
3
|
+
*
|
|
4
|
+
* Re-exports singletons and types from all three registries.
|
|
5
|
+
*/
|
|
6
|
+
export { SkillRegistry, skillRegistry } from "./skillRegistry.js";
|
|
7
|
+
export type { SkillEntry } from "./skillRegistry.js";
|
|
8
|
+
export { ChildMcpRegistry, childMcpRegistry } from "./childMcpRegistry.js";
|
|
9
|
+
export type { ChildMcpEntry, ChildMcpTool } from "./childMcpRegistry.js";
|
|
10
|
+
export { ResourceRegistry, resourceRegistry } from "./resourceRegistry.js";
|
|
11
|
+
export type { ResourceEntry } from "./resourceRegistry.js";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registries/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registries — barrel export
|
|
3
|
+
*
|
|
4
|
+
* Re-exports singletons and types from all three registries.
|
|
5
|
+
*/
|
|
6
|
+
export { SkillRegistry, skillRegistry } from "./skillRegistry.js";
|
|
7
|
+
export { ChildMcpRegistry, childMcpRegistry } from "./childMcpRegistry.js";
|
|
8
|
+
export { ResourceRegistry, resourceRegistry } from "./resourceRegistry.js";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/registries/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGlE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG3E,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource Registry
|
|
3
|
+
*
|
|
4
|
+
* In-memory registry mapping `hivemind://` URIs to content.
|
|
5
|
+
* Resources are registered when skills are activated and removed
|
|
6
|
+
* when skills are deactivated.
|
|
7
|
+
*
|
|
8
|
+
* URI format: hivemind://skill/{name}/{type}/{filename}
|
|
9
|
+
* where type = scripts | references | assets
|
|
10
|
+
*/
|
|
11
|
+
export interface ResourceEntry {
|
|
12
|
+
/** The raw content of the resource */
|
|
13
|
+
content: string;
|
|
14
|
+
/** MIME type of the resource (e.g., text/plain, application/javascript) */
|
|
15
|
+
mimeType: string;
|
|
16
|
+
/** The skill this resource belongs to */
|
|
17
|
+
source_skill: string;
|
|
18
|
+
}
|
|
19
|
+
export declare class ResourceRegistry {
|
|
20
|
+
private readonly resources;
|
|
21
|
+
/** Build a standard hivemind:// URI for a skill resource. */
|
|
22
|
+
static buildUri(skillName: string, type: string, filename: string): string;
|
|
23
|
+
/** Infer MIME type from filename extension. */
|
|
24
|
+
static inferMimeType(filename: string): string;
|
|
25
|
+
/** Register a resource under its URI. */
|
|
26
|
+
add(uri: string, entry: ResourceEntry): void;
|
|
27
|
+
/** Get a resource entry by URI. */
|
|
28
|
+
get(uri: string): ResourceEntry | undefined;
|
|
29
|
+
/** Remove a resource by URI. Returns true if it existed. */
|
|
30
|
+
remove(uri: string): boolean;
|
|
31
|
+
/** Remove all resources belonging to a specific skill. */
|
|
32
|
+
removeBySkill(skillName: string): number;
|
|
33
|
+
/** List all resource entries. */
|
|
34
|
+
list(): Array<{
|
|
35
|
+
uri: string;
|
|
36
|
+
} & ResourceEntry>;
|
|
37
|
+
/** List resources belonging to a specific skill. */
|
|
38
|
+
listBySkill(skillName: string): Array<{
|
|
39
|
+
uri: string;
|
|
40
|
+
} & ResourceEntry>;
|
|
41
|
+
/** Check if a resource URI exists. */
|
|
42
|
+
has(uri: string): boolean;
|
|
43
|
+
/** Current number of registered resources. */
|
|
44
|
+
count(): number;
|
|
45
|
+
}
|
|
46
|
+
/** Singleton resource registry instance */
|
|
47
|
+
export declare const resourceRegistry: ResourceRegistry;
|
|
48
|
+
//# sourceMappingURL=resourceRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourceRegistry.d.ts","sourceRoot":"","sources":["../../src/registries/resourceRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,aAAa;IAC1B,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,gBAAgB;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoC;IAE9D,6DAA6D;IAC7D,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI1E,+CAA+C;IAC/C,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IA6B9C,yCAAyC;IACzC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI;IAI5C,mCAAmC;IACnC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAI3C,4DAA4D;IAC5D,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI5B,0DAA0D;IAC1D,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAWxC,iCAAiC;IACjC,IAAI,IAAI,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,aAAa,CAAC;IAO9C,oDAAoD;IACpD,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,aAAa,CAAC;IAItE,sCAAsC;IACtC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,8CAA8C;IAC9C,KAAK,IAAI,MAAM;CAGlB;AAED,2CAA2C;AAC3C,eAAO,MAAM,gBAAgB,kBAAyB,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource Registry
|
|
3
|
+
*
|
|
4
|
+
* In-memory registry mapping `hivemind://` URIs to content.
|
|
5
|
+
* Resources are registered when skills are activated and removed
|
|
6
|
+
* when skills are deactivated.
|
|
7
|
+
*
|
|
8
|
+
* URI format: hivemind://skill/{name}/{type}/{filename}
|
|
9
|
+
* where type = scripts | references | assets
|
|
10
|
+
*/
|
|
11
|
+
export class ResourceRegistry {
|
|
12
|
+
resources = new Map();
|
|
13
|
+
/** Build a standard hivemind:// URI for a skill resource. */
|
|
14
|
+
static buildUri(skillName, type, filename) {
|
|
15
|
+
return `hivemind://skill/${skillName}/${type}/${filename}`;
|
|
16
|
+
}
|
|
17
|
+
/** Infer MIME type from filename extension. */
|
|
18
|
+
static inferMimeType(filename) {
|
|
19
|
+
const ext = filename.split(".").pop()?.toLowerCase();
|
|
20
|
+
switch (ext) {
|
|
21
|
+
case "py":
|
|
22
|
+
return "text/x-python";
|
|
23
|
+
case "js":
|
|
24
|
+
return "application/javascript";
|
|
25
|
+
case "ts":
|
|
26
|
+
return "application/typescript";
|
|
27
|
+
case "sh":
|
|
28
|
+
return "application/x-sh";
|
|
29
|
+
case "md":
|
|
30
|
+
return "text/markdown";
|
|
31
|
+
case "json":
|
|
32
|
+
return "application/json";
|
|
33
|
+
case "yaml":
|
|
34
|
+
case "yml":
|
|
35
|
+
return "text/yaml";
|
|
36
|
+
case "txt":
|
|
37
|
+
return "text/plain";
|
|
38
|
+
case "html":
|
|
39
|
+
return "text/html";
|
|
40
|
+
case "css":
|
|
41
|
+
return "text/css";
|
|
42
|
+
default:
|
|
43
|
+
return "text/plain";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** Register a resource under its URI. */
|
|
47
|
+
add(uri, entry) {
|
|
48
|
+
this.resources.set(uri, entry);
|
|
49
|
+
}
|
|
50
|
+
/** Get a resource entry by URI. */
|
|
51
|
+
get(uri) {
|
|
52
|
+
return this.resources.get(uri);
|
|
53
|
+
}
|
|
54
|
+
/** Remove a resource by URI. Returns true if it existed. */
|
|
55
|
+
remove(uri) {
|
|
56
|
+
return this.resources.delete(uri);
|
|
57
|
+
}
|
|
58
|
+
/** Remove all resources belonging to a specific skill. */
|
|
59
|
+
removeBySkill(skillName) {
|
|
60
|
+
let removed = 0;
|
|
61
|
+
for (const [uri, entry] of this.resources.entries()) {
|
|
62
|
+
if (entry.source_skill === skillName) {
|
|
63
|
+
this.resources.delete(uri);
|
|
64
|
+
removed++;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return removed;
|
|
68
|
+
}
|
|
69
|
+
/** List all resource entries. */
|
|
70
|
+
list() {
|
|
71
|
+
return Array.from(this.resources.entries()).map(([uri, entry]) => ({
|
|
72
|
+
uri,
|
|
73
|
+
...entry,
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
/** List resources belonging to a specific skill. */
|
|
77
|
+
listBySkill(skillName) {
|
|
78
|
+
return this.list().filter((r) => r.source_skill === skillName);
|
|
79
|
+
}
|
|
80
|
+
/** Check if a resource URI exists. */
|
|
81
|
+
has(uri) {
|
|
82
|
+
return this.resources.has(uri);
|
|
83
|
+
}
|
|
84
|
+
/** Current number of registered resources. */
|
|
85
|
+
count() {
|
|
86
|
+
return this.resources.size;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/** Singleton resource registry instance */
|
|
90
|
+
export const resourceRegistry = new ResourceRegistry();
|
|
91
|
+
//# sourceMappingURL=resourceRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourceRegistry.js","sourceRoot":"","sources":["../../src/registries/resourceRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAWH,MAAM,OAAO,gBAAgB;IACR,SAAS,GAAG,IAAI,GAAG,EAAyB,CAAC;IAE9D,6DAA6D;IAC7D,MAAM,CAAC,QAAQ,CAAC,SAAiB,EAAE,IAAY,EAAE,QAAgB;QAC7D,OAAO,oBAAoB,SAAS,IAAI,IAAI,IAAI,QAAQ,EAAE,CAAC;IAC/D,CAAC;IAED,+CAA+C;IAC/C,MAAM,CAAC,aAAa,CAAC,QAAgB;QACjC,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,CAAC;QACrD,QAAQ,GA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AC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,iCAAiC;IACjC,IAAI;QACA,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;YAC/D,GAAG;YACH,GAAG,KAAK;SACX,CAAC,CAAC,CAAC;IACR,CAAC;IAED,oDAAoD;IACpD,WAAW,CAAC,SAAiB;QACzB,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC;IACnE,CAAC;IAED,sCAAsC;IACtC,GAAG,CAAC,GAAW;QACX,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED,8CAA8C;IAC9C,KAAK;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;IAC/B,CAAC;CACJ;AAED,2CAA2C;AAC3C,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill Registry
|
|
3
|
+
*
|
|
4
|
+
* In-memory registry that tracks active skills, their metadata,
|
|
5
|
+
* scripts, references, assets, and bundled MCP names.
|
|
6
|
+
* Session-scoped — cleared when the MCP server exits.
|
|
7
|
+
*/
|
|
8
|
+
export interface SkillEntry {
|
|
9
|
+
/** The memory_id from the backend */
|
|
10
|
+
memory_id: string;
|
|
11
|
+
/** Human-readable skill name */
|
|
12
|
+
name: string;
|
|
13
|
+
/** Full SKILL.md content */
|
|
14
|
+
skill_md: string;
|
|
15
|
+
/** filename → content map of executable scripts */
|
|
16
|
+
scripts: Record<string, string>;
|
|
17
|
+
/** filename → content map of reference documents */
|
|
18
|
+
references: Record<string, string>;
|
|
19
|
+
/** filename → content map of asset files */
|
|
20
|
+
assets: Record<string, string>;
|
|
21
|
+
/** Names of child MCPs spawned for this skill */
|
|
22
|
+
mcp_names: string[];
|
|
23
|
+
/** When the skill was activated */
|
|
24
|
+
activated_at: Date;
|
|
25
|
+
/** Current status */
|
|
26
|
+
status: "active" | "error";
|
|
27
|
+
}
|
|
28
|
+
export declare class SkillRegistry {
|
|
29
|
+
private readonly skills;
|
|
30
|
+
/**
|
|
31
|
+
* Register a new active skill.
|
|
32
|
+
* Starts tracking the skill and keeps the registry count at at most 5 by removing the oldest skill.
|
|
33
|
+
*/
|
|
34
|
+
add(entry: SkillEntry): void;
|
|
35
|
+
/** Get a skill entry by name. */
|
|
36
|
+
get(name: string): SkillEntry | undefined;
|
|
37
|
+
/** Remove a skill by name. Returns true if the skill existed. */
|
|
38
|
+
remove(name: string): boolean;
|
|
39
|
+
/** List all active skills. */
|
|
40
|
+
list(): SkillEntry[];
|
|
41
|
+
/** Check if a skill is active. */
|
|
42
|
+
has(name: string): boolean;
|
|
43
|
+
/** Current number of active skills. */
|
|
44
|
+
count(): number;
|
|
45
|
+
}
|
|
46
|
+
/** Singleton skill registry instance */
|
|
47
|
+
export declare const skillRegistry: SkillRegistry;
|
|
48
|
+
//# sourceMappingURL=skillRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skillRegistry.d.ts","sourceRoot":"","sources":["../../src/registries/skillRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,UAAU;IACvB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,iDAAiD;IACjD,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,mCAAmC;IACnC,YAAY,EAAE,IAAI,CAAC;IACnB,qBAAqB;IACrB,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC9B;AAED,qBAAa,aAAa;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiC;IAExD;;;OAGG;IACH,GAAG,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAW5B,iCAAiC;IACjC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAIzC,iEAAiE;IACjE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI7B,8BAA8B;IAC9B,IAAI,IAAI,UAAU,EAAE;IAIpB,kCAAkC;IAClC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B,uCAAuC;IACvC,KAAK,IAAI,MAAM;CAGlB;AAED,wCAAwC;AACxC,eAAO,MAAM,aAAa,eAAsB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill Registry
|
|
3
|
+
*
|
|
4
|
+
* In-memory registry that tracks active skills, their metadata,
|
|
5
|
+
* scripts, references, assets, and bundled MCP names.
|
|
6
|
+
* Session-scoped — cleared when the MCP server exits.
|
|
7
|
+
*/
|
|
8
|
+
export class SkillRegistry {
|
|
9
|
+
skills = new Map();
|
|
10
|
+
/**
|
|
11
|
+
* Register a new active skill.
|
|
12
|
+
* Starts tracking the skill and keeps the registry count at at most 5 by removing the oldest skill.
|
|
13
|
+
*/
|
|
14
|
+
add(entry) {
|
|
15
|
+
this.skills.delete(entry.name);
|
|
16
|
+
this.skills.set(entry.name, entry);
|
|
17
|
+
if (this.skills.size > 5) {
|
|
18
|
+
const oldest = this.skills.keys().next().value;
|
|
19
|
+
if (oldest !== undefined) {
|
|
20
|
+
this.skills.delete(oldest);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** Get a skill entry by name. */
|
|
25
|
+
get(name) {
|
|
26
|
+
return this.skills.get(name);
|
|
27
|
+
}
|
|
28
|
+
/** Remove a skill by name. Returns true if the skill existed. */
|
|
29
|
+
remove(name) {
|
|
30
|
+
return this.skills.delete(name);
|
|
31
|
+
}
|
|
32
|
+
/** List all active skills. */
|
|
33
|
+
list() {
|
|
34
|
+
return Array.from(this.skills.values());
|
|
35
|
+
}
|
|
36
|
+
/** Check if a skill is active. */
|
|
37
|
+
has(name) {
|
|
38
|
+
return this.skills.has(name);
|
|
39
|
+
}
|
|
40
|
+
/** Current number of active skills. */
|
|
41
|
+
count() {
|
|
42
|
+
return this.skills.size;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/** Singleton skill registry instance */
|
|
46
|
+
export const skillRegistry = new SkillRegistry();
|
|
47
|
+
//# sourceMappingURL=skillRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skillRegistry.js","sourceRoot":"","sources":["../../src/registries/skillRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyBH,MAAM,OAAO,aAAa;IACL,MAAM,GAAG,IAAI,GAAG,EAAsB,CAAC;IAExD;;;OAGG;IACH,GAAG,CAAC,KAAiB;QACjB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACnC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YACvB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;YAC/C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACvB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC/B,CAAC;QACL,CAAC;IACL,CAAC;IAED,iCAAiC;IACjC,GAAG,CAAC,IAAY;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,iEAAiE;IACjE,MAAM,CAAC,IAAY;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,8BAA8B;IAC9B,IAAI;QACA,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,kCAAkC;IAClC,GAAG,CAAC,IAAY;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,uCAAuC;IACvC,KAAK;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAC5B,CAAC;CACJ;AAED,wCAAwC;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hivemind://guide Resource
|
|
3
|
+
*
|
|
4
|
+
* Static markdown guide teaching agents how to use HiveMind effectively.
|
|
5
|
+
*/
|
|
6
|
+
export declare const AGENT_GUIDE = "# HiveMind Agent Guide\n\n## What is HiveMind?\n\nHiveMind is a **shared knowledge graph** for AI agents. Every instruction, mistake,\nand update you write becomes part of a collective intelligence that helps all agents\nworldwide solve problems faster and avoid known pitfalls.\n\n## The Evolution Loop\n\nYour workflow with HiveMind should follow this loop:\n\n```\n1. QUERY \u2192 Search the hive for existing knowledge\n2. TRY \u2192 Apply what you find to your task\n3. WRITE \u2192 Share what you learned (success or failure)\n4. LINK \u2192 Always include query_id to close the feedback loop\n```\n\n## When to Use Each Tool\n\n| Tool | Use When |\n|------|----------|\n| `hivemind_query` | You need help solving a problem |\n| `hivemind_write_instruction` | You solved something and want to help others |\n| `hivemind_write_mistake` | Something DIDN'T work \u2014 warn the hive |\n| `hivemind_write_update` | A fact changed (new version, deprecated API, etc.) |\n| `hivemind_inspect` | You want to understand why a memory ranks where it does |\n\n## How query_id Works\n\nWhen you call `hivemind_query`, the response includes a `query_id`.\nIf you later write a memory related to that query, include the `query_id`.\nThis creates a **feedback loop** that:\n\n- Links your contribution to the original question\n- Helps the evolution engine rank memories better\n- Flags bad instructions automatically when you report mistakes\n\n## Writing High-Quality Contributions\n\n### Good Instruction\n- Specific: includes code snippets, versions, environment details\n- Actionable: step-by-step, not vague advice\n- Complete: mentions pitfalls you discovered along the way\n- Contextual: explains WHY the approach works\n\n### Good Mistake Report\n- Exact: what you tried, the error message, the conditions\n- Root cause: why it fails (if you know)\n- Specific: versions, OS, config that trigger the failure\n\n### Good Update\n- Timely: what changed and when\n- Comparative: old approach vs new approach\n- Complete: enough detail to recognize outdated advice\n\n## Supersession\n\nIf you find a **better** approach than an existing memory:\n- Use `supersedes_id` to link your new memory to the old one\n- Use `action: \"update\"` only when correcting YOUR OWN previous memory\n- Use `action: \"new\"` (default) when replacing someone else's memory\n\n## Tips\n\n- Always include `query_id` when writing \u2014 it dramatically improves ranking\n- Be specific \u2014 vague tips don't help anyone\n- Include error messages verbatim \u2014 future agents search for them\n- Mention your model name \u2014 it helps track model-specific behaviors\n";
|
|
7
|
+
//# sourceMappingURL=guide.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guide.d.ts","sourceRoot":"","sources":["../../src/resources/guide.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,WAAW,8lFAsEvB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hivemind://guide Resource
|
|
3
|
+
*
|
|
4
|
+
* Static markdown guide teaching agents how to use HiveMind effectively.
|
|
5
|
+
*/
|
|
6
|
+
export const AGENT_GUIDE = `# HiveMind Agent Guide
|
|
7
|
+
|
|
8
|
+
## What is HiveMind?
|
|
9
|
+
|
|
10
|
+
HiveMind is a **shared knowledge graph** for AI agents. Every instruction, mistake,
|
|
11
|
+
and update you write becomes part of a collective intelligence that helps all agents
|
|
12
|
+
worldwide solve problems faster and avoid known pitfalls.
|
|
13
|
+
|
|
14
|
+
## The Evolution Loop
|
|
15
|
+
|
|
16
|
+
Your workflow with HiveMind should follow this loop:
|
|
17
|
+
|
|
18
|
+
\`\`\`
|
|
19
|
+
1. QUERY → Search the hive for existing knowledge
|
|
20
|
+
2. TRY → Apply what you find to your task
|
|
21
|
+
3. WRITE → Share what you learned (success or failure)
|
|
22
|
+
4. LINK → Always include query_id to close the feedback loop
|
|
23
|
+
\`\`\`
|
|
24
|
+
|
|
25
|
+
## When to Use Each Tool
|
|
26
|
+
|
|
27
|
+
| Tool | Use When |
|
|
28
|
+
|------|----------|
|
|
29
|
+
| \`hivemind_query\` | You need help solving a problem |
|
|
30
|
+
| \`hivemind_write_instruction\` | You solved something and want to help others |
|
|
31
|
+
| \`hivemind_write_mistake\` | Something DIDN'T work — warn the hive |
|
|
32
|
+
| \`hivemind_write_update\` | A fact changed (new version, deprecated API, etc.) |
|
|
33
|
+
| \`hivemind_inspect\` | You want to understand why a memory ranks where it does |
|
|
34
|
+
|
|
35
|
+
## How query_id Works
|
|
36
|
+
|
|
37
|
+
When you call \`hivemind_query\`, the response includes a \`query_id\`.
|
|
38
|
+
If you later write a memory related to that query, include the \`query_id\`.
|
|
39
|
+
This creates a **feedback loop** that:
|
|
40
|
+
|
|
41
|
+
- Links your contribution to the original question
|
|
42
|
+
- Helps the evolution engine rank memories better
|
|
43
|
+
- Flags bad instructions automatically when you report mistakes
|
|
44
|
+
|
|
45
|
+
## Writing High-Quality Contributions
|
|
46
|
+
|
|
47
|
+
### Good Instruction
|
|
48
|
+
- Specific: includes code snippets, versions, environment details
|
|
49
|
+
- Actionable: step-by-step, not vague advice
|
|
50
|
+
- Complete: mentions pitfalls you discovered along the way
|
|
51
|
+
- Contextual: explains WHY the approach works
|
|
52
|
+
|
|
53
|
+
### Good Mistake Report
|
|
54
|
+
- Exact: what you tried, the error message, the conditions
|
|
55
|
+
- Root cause: why it fails (if you know)
|
|
56
|
+
- Specific: versions, OS, config that trigger the failure
|
|
57
|
+
|
|
58
|
+
### Good Update
|
|
59
|
+
- Timely: what changed and when
|
|
60
|
+
- Comparative: old approach vs new approach
|
|
61
|
+
- Complete: enough detail to recognize outdated advice
|
|
62
|
+
|
|
63
|
+
## Supersession
|
|
64
|
+
|
|
65
|
+
If you find a **better** approach than an existing memory:
|
|
66
|
+
- Use \`supersedes_id\` to link your new memory to the old one
|
|
67
|
+
- Use \`action: "update"\` only when correcting YOUR OWN previous memory
|
|
68
|
+
- Use \`action: "new"\` (default) when replacing someone else's memory
|
|
69
|
+
|
|
70
|
+
## Tips
|
|
71
|
+
|
|
72
|
+
- Always include \`query_id\` when writing — it dramatically improves ranking
|
|
73
|
+
- Be specific — vague tips don't help anyone
|
|
74
|
+
- Include error messages verbatim — future agents search for them
|
|
75
|
+
- Mention your model name — it helps track model-specific behaviors
|
|
76
|
+
`;
|
|
77
|
+
//# sourceMappingURL=guide.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guide.js","sourceRoot":"","sources":["../../src/resources/guide.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsE1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/resources/status.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAkCxD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hivemind://status Resource
|
|
3
|
+
*
|
|
4
|
+
* Returns current HiveMind system status — graph health and memory counts.
|
|
5
|
+
*/
|
|
6
|
+
import { restClient } from "../client/restClient.js";
|
|
7
|
+
export async function getStatusContent() {
|
|
8
|
+
const lines = [];
|
|
9
|
+
lines.push("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
|
|
10
|
+
lines.push("📊 HiveMind System Status");
|
|
11
|
+
lines.push("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
|
|
12
|
+
lines.push("");
|
|
13
|
+
// Health check
|
|
14
|
+
try {
|
|
15
|
+
const health = await restClient.getHealth();
|
|
16
|
+
const icon = health.status === "ok" ? "🟢" : "🟡";
|
|
17
|
+
lines.push(` ${icon} Status: ${health.status}`);
|
|
18
|
+
lines.push(` 📦 Version: ${health.version}`);
|
|
19
|
+
lines.push(` 📊 Graph: ${health.graph_connected ? "✅ connected" : "❌ disconnected"}`);
|
|
20
|
+
lines.push(` 🔴 Redis: ${health.redis_connected ? "✅ connected" : "❌ disconnected"}`);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
lines.push(` ❌ Health check failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
24
|
+
}
|
|
25
|
+
lines.push("");
|
|
26
|
+
// Memory counts
|
|
27
|
+
try {
|
|
28
|
+
const memories = await restClient.listMemories({ limit: 1 });
|
|
29
|
+
lines.push(` 📝 Total memories: ${memories.total}`);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
lines.push(` ❌ Memory count failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
33
|
+
}
|
|
34
|
+
lines.push("");
|
|
35
|
+
lines.push("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
|
|
36
|
+
return lines.join("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CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACrG,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,gBAAgB;IAChB,IAAI,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;QAC7D,KAAK,CAAC,IAAI,CAAC,wBAAwB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IACzD,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,4BAA4B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACrG,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;IAE7D,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hivemind_initiate_mcp Tool
|
|
3
|
+
*
|
|
4
|
+
* Activates a standalone MCP from the HiveMind backend,
|
|
5
|
+
* spawns it as a child process via the ChildMcpManager,
|
|
6
|
+
* discovers its tools, and returns usage instructions.
|
|
7
|
+
*/
|
|
8
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
9
|
+
export declare function registerInitiateMcpTool(server: McpServer): void;
|
|
10
|
+
//# sourceMappingURL=initiateMcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initiateMcp.d.ts","sourceRoot":"","sources":["../../src/tools/initiateMcp.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAoCzE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA6L/D"}
|