snow-flow 1.1.76 → 1.1.78
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/.claude-flow/queen/queen-memory.db +0 -0
- package/CLAUDE.md +34 -5
- package/README.md +256 -384
- package/dist/agents/base-agent.d.ts +92 -0
- package/dist/agents/base-agent.d.ts.map +1 -0
- package/dist/agents/base-agent.js +228 -0
- package/dist/agents/base-agent.js.map +1 -0
- package/dist/agents/coordinator.d.ts +200 -0
- package/dist/agents/coordinator.d.ts.map +1 -0
- package/dist/agents/coordinator.js +775 -0
- package/dist/agents/coordinator.js.map +1 -0
- package/dist/agents/flow-builder-agent.d.ts +18 -0
- package/dist/agents/flow-builder-agent.d.ts.map +1 -0
- package/dist/agents/flow-builder-agent.js +536 -0
- package/dist/agents/flow-builder-agent.js.map +1 -0
- package/dist/agents/index.d.ts +18 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +61 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/queen-agent-example.d.ts +23 -0
- package/dist/agents/queen-agent-example.d.ts.map +1 -0
- package/dist/agents/queen-agent-example.js +241 -0
- package/dist/agents/queen-agent-example.js.map +1 -0
- package/dist/agents/queen-agent.d.ts +180 -0
- package/dist/agents/queen-agent.d.ts.map +1 -0
- package/dist/agents/queen-agent.js +909 -0
- package/dist/agents/queen-agent.js.map +1 -0
- package/dist/agents/queen-agent.test.d.ts +6 -0
- package/dist/agents/queen-agent.test.d.ts.map +1 -0
- package/dist/agents/queen-agent.test.js.map +1 -0
- package/dist/agents/script-writer-agent.d.ts +22 -0
- package/dist/agents/script-writer-agent.d.ts.map +1 -0
- package/dist/agents/script-writer-agent.js +695 -0
- package/dist/agents/script-writer-agent.js.map +1 -0
- package/dist/agents/security-agent.d.ts +23 -0
- package/dist/agents/security-agent.d.ts.map +1 -0
- package/dist/agents/security-agent.js +619 -0
- package/dist/agents/security-agent.js.map +1 -0
- package/dist/agents/test-agent.d.ts +26 -0
- package/dist/agents/test-agent.d.ts.map +1 -0
- package/dist/agents/test-agent.js +735 -0
- package/dist/agents/test-agent.js.map +1 -0
- package/dist/agents/test-agents.d.ts +7 -0
- package/dist/agents/test-agents.d.ts.map +1 -0
- package/dist/agents/test-agents.js +65 -0
- package/dist/agents/test-agents.js.map +1 -0
- package/dist/agents/widget-creator-agent.d.ts +18 -0
- package/dist/agents/widget-creator-agent.d.ts.map +1 -0
- package/dist/agents/widget-creator-agent.js +440 -0
- package/dist/agents/widget-creator-agent.js.map +1 -0
- package/dist/cli/snow-flow-cli-integration.d.ts +30 -0
- package/dist/cli/snow-flow-cli-integration.d.ts.map +1 -0
- package/dist/cli/snow-flow-cli-integration.js +385 -0
- package/dist/cli/snow-flow-cli-integration.js.map +1 -0
- package/dist/cli.js +466 -150
- package/dist/cli.js.map +1 -1
- package/dist/config/snow-flow-config.d.ts +1454 -0
- package/dist/config/snow-flow-config.d.ts.map +1 -0
- package/dist/config/snow-flow-config.js +403 -0
- package/dist/config/snow-flow-config.js.map +1 -0
- package/dist/health/system-health.d.ts +123 -0
- package/dist/health/system-health.d.ts.map +1 -0
- package/dist/health/system-health.js +580 -0
- package/dist/health/system-health.js.map +1 -0
- package/dist/index.d.ts +12 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp/servicenow-deployment-mcp-refactored.d.ts +58 -0
- package/dist/mcp/servicenow-deployment-mcp-refactored.d.ts.map +1 -0
- package/dist/mcp/servicenow-deployment-mcp-refactored.js +651 -0
- package/dist/mcp/servicenow-deployment-mcp-refactored.js.map +1 -0
- package/dist/mcp/servicenow-intelligent-mcp-refactored.d.ts +43 -0
- package/dist/mcp/servicenow-intelligent-mcp-refactored.d.ts.map +1 -0
- package/dist/mcp/servicenow-intelligent-mcp-refactored.js +576 -0
- package/dist/mcp/servicenow-intelligent-mcp-refactored.js.map +1 -0
- package/dist/mcp/servicenow-intelligent-mcp.d.ts +102 -1
- package/dist/mcp/servicenow-intelligent-mcp.d.ts.map +1 -1
- package/dist/mcp/servicenow-intelligent-mcp.js +2 -0
- package/dist/mcp/servicenow-intelligent-mcp.js.map +1 -1
- package/dist/mcp/shared/agent-context-provider.d.ts +77 -0
- package/dist/mcp/shared/agent-context-provider.d.ts.map +1 -0
- package/dist/mcp/shared/agent-context-provider.js +292 -0
- package/dist/mcp/shared/agent-context-provider.js.map +1 -0
- package/dist/mcp/shared/base-mcp-server.d.ts +97 -0
- package/dist/mcp/shared/base-mcp-server.d.ts.map +1 -0
- package/dist/mcp/shared/base-mcp-server.js +216 -0
- package/dist/mcp/shared/base-mcp-server.js.map +1 -0
- package/dist/mcp/shared/mcp-memory-manager.d.ts +87 -0
- package/dist/mcp/shared/mcp-memory-manager.d.ts.map +1 -0
- package/dist/mcp/shared/mcp-memory-manager.js +423 -0
- package/dist/mcp/shared/mcp-memory-manager.js.map +1 -0
- package/dist/memory/index.d.ts +9 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +20 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/mcp-integration-example.d.ts +6 -0
- package/dist/memory/mcp-integration-example.d.ts.map +1 -0
- package/dist/memory/mcp-integration-example.js +282 -0
- package/dist/memory/mcp-integration-example.js.map +1 -0
- package/dist/memory/memory-client.d.ts +184 -0
- package/dist/memory/memory-client.d.ts.map +1 -0
- package/dist/memory/memory-client.js +325 -0
- package/dist/memory/memory-client.js.map +1 -0
- package/dist/memory/memory-operations.d.ts +170 -0
- package/dist/memory/memory-operations.d.ts.map +1 -0
- package/dist/memory/memory-operations.js +639 -0
- package/dist/memory/memory-operations.js.map +1 -0
- package/dist/memory/memory-system.d.ts +118 -0
- package/dist/memory/memory-system.d.ts.map +1 -0
- package/dist/memory/memory-system.js +477 -0
- package/dist/memory/memory-system.js.map +1 -0
- package/dist/memory/memory-test.d.ts +6 -0
- package/dist/memory/memory-test.d.ts.map +1 -0
- package/dist/memory/memory-test.js +162 -0
- package/dist/memory/memory-test.js.map +1 -0
- package/dist/memory/swarm-memory.d.ts +135 -0
- package/dist/memory/swarm-memory.d.ts.map +1 -0
- package/dist/memory/swarm-memory.js +378 -0
- package/dist/memory/swarm-memory.js.map +1 -0
- package/dist/monitoring/performance-tracker.d.ts +157 -0
- package/dist/monitoring/performance-tracker.d.ts.map +1 -0
- package/dist/monitoring/performance-tracker.js +571 -0
- package/dist/monitoring/performance-tracker.js.map +1 -0
- package/dist/queen/agent-factory.d.ts +3 -0
- package/dist/queen/agent-factory.d.ts.map +1 -1
- package/dist/queen/agent-factory.js +52 -0
- package/dist/queen/agent-factory.js.map +1 -1
- package/dist/queen/queen-memory.d.ts +8 -2
- package/dist/queen/queen-memory.d.ts.map +1 -1
- package/dist/queen/queen-memory.js +46 -4
- package/dist/queen/queen-memory.js.map +1 -1
- package/dist/snow-flow-system.d.ts +132 -0
- package/dist/snow-flow-system.d.ts.map +1 -0
- package/dist/snow-flow-system.js +396 -0
- package/dist/snow-flow-system.js.map +1 -0
- package/dist/types/todo.types.d.ts +61 -0
- package/dist/types/todo.types.d.ts.map +1 -0
- package/dist/types/todo.types.js +7 -0
- package/dist/types/todo.types.js.map +1 -0
- package/dist/utils/error-recovery.d.ts +101 -0
- package/dist/utils/error-recovery.d.ts.map +1 -0
- package/dist/utils/error-recovery.js +548 -0
- package/dist/utils/error-recovery.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -2
- package/deploy.sh +0 -366
- package/docker/base/Dockerfile.base +0 -45
- package/docker/generate-services.js +0 -244
- package/docker/nginx/Dockerfile +0 -71
- package/docker/nginx/consul-template.hcl +0 -64
- package/docker/nginx/healthcheck.sh +0 -178
- package/docker/nginx/nginx.conf +0 -210
- package/docker/nginx/supervisord.conf +0 -57
- package/docker/nginx/templates/upstreams.conf.tpl +0 -48
- package/docker/services/automation-mcp/Dockerfile +0 -32
- package/docker/services/automation-mcp/config/service.json +0 -28
- package/docker/services/automation-mcp/entrypoint.js +0 -51
- package/docker/services/deployment-mcp/Dockerfile +0 -32
- package/docker/services/deployment-mcp/entrypoint.js +0 -51
- package/docker/services/flow-composer-mcp/Dockerfile +0 -32
- package/docker/services/flow-composer-mcp/config/service.json +0 -28
- package/docker/services/flow-composer-mcp/entrypoint.js +0 -51
- package/docker/services/graph-memory-mcp/Dockerfile +0 -32
- package/docker/services/graph-memory-mcp/config/service.json +0 -28
- package/docker/services/graph-memory-mcp/entrypoint.js +0 -51
- package/docker/services/integration-mcp/Dockerfile +0 -32
- package/docker/services/integration-mcp/config/service.json +0 -28
- package/docker/services/integration-mcp/entrypoint.js +0 -51
- package/docker/services/intelligent-mcp/Dockerfile +0 -32
- package/docker/services/intelligent-mcp/config/service.json +0 -28
- package/docker/services/intelligent-mcp/entrypoint.js +0 -51
- package/docker/services/operations-mcp/Dockerfile +0 -32
- package/docker/services/operations-mcp/config/service.json +0 -28
- package/docker/services/operations-mcp/entrypoint.js +0 -51
- package/docker/services/platform-development-mcp/Dockerfile +0 -32
- package/docker/services/platform-development-mcp/config/service.json +0 -28
- package/docker/services/platform-development-mcp/entrypoint.js +0 -51
- package/docker/services/reporting-analytics-mcp/Dockerfile +0 -32
- package/docker/services/reporting-analytics-mcp/config/service.json +0 -28
- package/docker/services/reporting-analytics-mcp/entrypoint.js +0 -51
- package/docker/services/security-compliance-mcp/Dockerfile +0 -32
- package/docker/services/security-compliance-mcp/config/service.json +0 -28
- package/docker/services/security-compliance-mcp/entrypoint.js +0 -51
- package/docker/services/update-set-mcp/Dockerfile +0 -32
- package/docker/services/update-set-mcp/config/service.json +0 -28
- package/docker/services/update-set-mcp/entrypoint.js +0 -51
- package/docker-compose.override.yml +0 -132
- package/docker-compose.prod.yml +0 -340
- package/docker-compose.yml +0 -579
- package/k8s/automation-mcp.yaml +0 -232
- package/k8s/configmap.yaml +0 -237
- package/k8s/deployment-mcp.yaml +0 -232
- package/k8s/flow-composer-mcp.yaml +0 -232
- package/k8s/generate-k8s-manifests.js +0 -453
- package/k8s/graph-memory-mcp.yaml +0 -232
- package/k8s/infrastructure.yaml +0 -456
- package/k8s/ingress.yaml +0 -361
- package/k8s/integration-mcp.yaml +0 -232
- package/k8s/intelligent-mcp.yaml +0 -232
- package/k8s/kustomization.yaml +0 -111
- package/k8s/mcp-services.yaml +0 -2552
- package/k8s/monitoring.yaml +0 -515
- package/k8s/namespace.yaml +0 -80
- package/k8s/operations-mcp.yaml +0 -232
- package/k8s/platform-development-mcp.yaml +0 -232
- package/k8s/rbac.yaml +0 -140
- package/k8s/reporting-analytics-mcp.yaml +0 -232
- package/k8s/security-compliance-mcp.yaml +0 -232
- package/k8s/update-set-mcp.yaml +0 -232
- package/test-clean-install/.claude/config.json +0 -12
- package/test-clean-install/.env.example +0 -49
- package/test-clean-install/CLAUDE.md +0 -26
- package/test-clean-install/README.md +0 -23
- package/test-global-install/.claude/config.json +0 -12
- package/test-global-install/CLAUDE.md +0 -26
- package/test-global-install/README.md +0 -23
- package/test-global-install/test-global-install/.claude/config.json +0 -12
- package/test-global-install/test-global-install/CLAUDE.md +0 -26
- package/test-global-install/test-global-install/README.md +0 -23
- package/test-global-install/test-global-install/test-global-install/.claude/config.json +0 -12
- package/test-global-install/test-global-install/test-global-install/.env.example +0 -49
- package/test-global-install/test-global-install/test-global-install/CLAUDE.md +0 -26
- package/test-global-install/test-global-install/test-global-install/README.md +0 -23
- package/test-init-debug/.claude/config.json +0 -12
- package/test-init-debug/CLAUDE.md +0 -693
- package/test-init-debug/README.md +0 -392
- package/test-init-real/.claude/config.json +0 -12
- package/test-init-real/.claude/mcp-config.json +0 -128
- package/test-init-real/.claude/settings.json +0 -37
- package/test-init-real/CLAUDE.md +0 -693
- package/test-init-real/README.md +0 -392
- package/test-init-real/activate-mcp.sh +0 -15
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Agent Class
|
|
3
|
+
* Common functionality for all ServiceNow specialist agents
|
|
4
|
+
*/
|
|
5
|
+
import { Agent, AgentType, AgentMessage, ServiceNowArtifact } from '../queen/types';
|
|
6
|
+
import { QueenMemorySystem } from '../queen/queen-memory';
|
|
7
|
+
export interface AgentConfig {
|
|
8
|
+
id?: string;
|
|
9
|
+
type: AgentType;
|
|
10
|
+
capabilities: string[];
|
|
11
|
+
mcpTools: string[];
|
|
12
|
+
memoryPath?: string;
|
|
13
|
+
debugMode?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface AgentResult {
|
|
16
|
+
success: boolean;
|
|
17
|
+
artifacts?: ServiceNowArtifact[];
|
|
18
|
+
message?: string;
|
|
19
|
+
error?: Error;
|
|
20
|
+
metadata?: Record<string, any>;
|
|
21
|
+
}
|
|
22
|
+
export declare abstract class BaseAgent implements Agent {
|
|
23
|
+
id: string;
|
|
24
|
+
type: AgentType;
|
|
25
|
+
status: Agent['status'];
|
|
26
|
+
task?: string;
|
|
27
|
+
capabilities: string[];
|
|
28
|
+
mcpTools: string[];
|
|
29
|
+
protected memory: QueenMemorySystem;
|
|
30
|
+
protected debugMode: boolean;
|
|
31
|
+
protected messageQueue: AgentMessage[];
|
|
32
|
+
constructor(config: AgentConfig);
|
|
33
|
+
/**
|
|
34
|
+
* Execute the agent's main task
|
|
35
|
+
* Must be implemented by each specific agent
|
|
36
|
+
*/
|
|
37
|
+
abstract execute(instruction: string, context?: Record<string, any>): Promise<AgentResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Validate agent can handle the task
|
|
40
|
+
* Can be overridden by specific agents
|
|
41
|
+
*/
|
|
42
|
+
canHandle(instruction: string): Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Store artifact in shared memory for other agents
|
|
45
|
+
*/
|
|
46
|
+
protected storeArtifact(artifact: ServiceNowArtifact): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Retrieve artifact from shared memory
|
|
49
|
+
*/
|
|
50
|
+
protected getArtifact(type: string, name: string): Promise<ServiceNowArtifact | null>;
|
|
51
|
+
/**
|
|
52
|
+
* Report progress to Queen Agent
|
|
53
|
+
*/
|
|
54
|
+
protected reportProgress(message: string, percentage: number): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Send message to another agent
|
|
57
|
+
*/
|
|
58
|
+
protected sendMessage(to: string, type: AgentMessage['type'], content: any): void;
|
|
59
|
+
/**
|
|
60
|
+
* Retrieve messages for this agent
|
|
61
|
+
*/
|
|
62
|
+
protected getMessages(): Promise<AgentMessage[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Handle coordination with other agents
|
|
65
|
+
*/
|
|
66
|
+
protected coordinateWith(agentType: AgentType, request: any): Promise<any>;
|
|
67
|
+
/**
|
|
68
|
+
* Log activity for learning
|
|
69
|
+
*/
|
|
70
|
+
protected logActivity(action: string, success: boolean, details?: any): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Update agent status
|
|
73
|
+
*/
|
|
74
|
+
protected setStatus(status: Agent['status']): void;
|
|
75
|
+
/**
|
|
76
|
+
* Check if agent should work with another agent
|
|
77
|
+
*/
|
|
78
|
+
protected shouldCoordinate(otherAgentType: AgentType): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Generate unique agent ID
|
|
81
|
+
*/
|
|
82
|
+
private generateAgentId;
|
|
83
|
+
/**
|
|
84
|
+
* Get agent information
|
|
85
|
+
*/
|
|
86
|
+
getInfo(): Record<string, any>;
|
|
87
|
+
/**
|
|
88
|
+
* Cleanup agent resources
|
|
89
|
+
*/
|
|
90
|
+
cleanup(): Promise<void>;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=base-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-agent.d.ts","sourceRoot":"","sources":["../../src/agents/base-agent.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBA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1E;;OAEG;cACa,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAK3F;;OAEG;cACa,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAelF;;OAEG;IACH,SAAS,CAAC,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,GAAG,IAAI;IAkBjF;;OAEG;cACa,WAAW,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAStD;;OAEG;cACa,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAwBhF;;OAEG;cACa,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAW3F;;OAEG;IACH,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,IAAI;IAUlD;;OAEG;IACH,SAAS,CAAC,gBAAgB,CAAC,cAAc,EAAE,SAAS,GAAG,OAAO;IAgB9D;;OAEG;IACH,OAAO,CAAC,eAAe;IAMvB;;OAEG;IACH,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAW9B;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAS/B"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Base Agent Class
|
|
4
|
+
* Common functionality for all ServiceNow specialist agents
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.BaseAgent = void 0;
|
|
41
|
+
const queen_memory_1 = require("../queen/queen-memory");
|
|
42
|
+
const crypto = __importStar(require("crypto"));
|
|
43
|
+
class BaseAgent {
|
|
44
|
+
constructor(config) {
|
|
45
|
+
this.messageQueue = [];
|
|
46
|
+
this.id = config.id || this.generateAgentId(config.type);
|
|
47
|
+
this.type = config.type;
|
|
48
|
+
this.status = 'idle';
|
|
49
|
+
this.capabilities = config.capabilities;
|
|
50
|
+
this.mcpTools = config.mcpTools;
|
|
51
|
+
this.debugMode = config.debugMode || false;
|
|
52
|
+
// Initialize memory system
|
|
53
|
+
this.memory = new queen_memory_1.QueenMemorySystem(config.memoryPath);
|
|
54
|
+
if (this.debugMode) {
|
|
55
|
+
console.log(`🤖 ${this.type} agent initialized with ID: ${this.id}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Validate agent can handle the task
|
|
60
|
+
* Can be overridden by specific agents
|
|
61
|
+
*/
|
|
62
|
+
async canHandle(instruction) {
|
|
63
|
+
// Default implementation checks if instruction mentions agent capabilities
|
|
64
|
+
const lowerInstruction = instruction.toLowerCase();
|
|
65
|
+
return this.capabilities.some(capability => lowerInstruction.includes(capability.toLowerCase().split(' ')[0]));
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Store artifact in shared memory for other agents
|
|
69
|
+
*/
|
|
70
|
+
async storeArtifact(artifact) {
|
|
71
|
+
const key = `artifact_${artifact.type}_${artifact.name}`;
|
|
72
|
+
await this.memory.storeInContext(key, artifact);
|
|
73
|
+
if (this.debugMode) {
|
|
74
|
+
console.log(`📦 Stored artifact: ${key}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Retrieve artifact from shared memory
|
|
79
|
+
*/
|
|
80
|
+
async getArtifact(type, name) {
|
|
81
|
+
const key = `artifact_${type}_${name}`;
|
|
82
|
+
return await this.memory.getFromContext(key);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Report progress to Queen Agent
|
|
86
|
+
*/
|
|
87
|
+
async reportProgress(message, percentage) {
|
|
88
|
+
const progressKey = `progress_${this.id}`;
|
|
89
|
+
await this.memory.storeInContext(progressKey, {
|
|
90
|
+
agentId: this.id,
|
|
91
|
+
agentType: this.type,
|
|
92
|
+
message,
|
|
93
|
+
percentage,
|
|
94
|
+
timestamp: new Date()
|
|
95
|
+
});
|
|
96
|
+
if (this.debugMode) {
|
|
97
|
+
console.log(`📊 ${this.type}: ${message} (${percentage}%)`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Send message to another agent
|
|
102
|
+
*/
|
|
103
|
+
sendMessage(to, type, content) {
|
|
104
|
+
const message = {
|
|
105
|
+
from: this.id,
|
|
106
|
+
to,
|
|
107
|
+
type,
|
|
108
|
+
content,
|
|
109
|
+
timestamp: new Date()
|
|
110
|
+
};
|
|
111
|
+
// Store in shared memory for recipient
|
|
112
|
+
const messageKey = `message_${to}_${Date.now()}`;
|
|
113
|
+
this.memory.storeInContext(messageKey, message);
|
|
114
|
+
if (this.debugMode) {
|
|
115
|
+
console.log(`📨 Message sent from ${this.id} to ${to}: ${type}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Retrieve messages for this agent
|
|
120
|
+
*/
|
|
121
|
+
async getMessages() {
|
|
122
|
+
const messagePrefix = `message_${this.id}_`;
|
|
123
|
+
const messages = [];
|
|
124
|
+
// This is a simplified implementation
|
|
125
|
+
// In a real system, we'd query the memory system more efficiently
|
|
126
|
+
return messages;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Handle coordination with other agents
|
|
130
|
+
*/
|
|
131
|
+
async coordinateWith(agentType, request) {
|
|
132
|
+
const coordinationKey = `coordination_${this.id}_${agentType}_${Date.now()}`;
|
|
133
|
+
await this.memory.storeInContext(coordinationKey, {
|
|
134
|
+
from: this.id,
|
|
135
|
+
toType: agentType,
|
|
136
|
+
request,
|
|
137
|
+
timestamp: new Date()
|
|
138
|
+
});
|
|
139
|
+
// Wait for response (simplified)
|
|
140
|
+
const responseKey = `${coordinationKey}_response`;
|
|
141
|
+
let attempts = 0;
|
|
142
|
+
while (attempts < 30) { // 30 second timeout
|
|
143
|
+
const response = await this.memory.getFromContext(responseKey);
|
|
144
|
+
if (response) {
|
|
145
|
+
return response;
|
|
146
|
+
}
|
|
147
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
148
|
+
attempts++;
|
|
149
|
+
}
|
|
150
|
+
throw new Error(`Coordination timeout with ${agentType}`);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Log activity for learning
|
|
154
|
+
*/
|
|
155
|
+
async logActivity(action, success, details) {
|
|
156
|
+
const learningKey = `agent_activity_${this.type}_${action}`;
|
|
157
|
+
await this.memory.storeLearning(learningKey, JSON.stringify({
|
|
158
|
+
agentId: this.id,
|
|
159
|
+
action,
|
|
160
|
+
success,
|
|
161
|
+
details,
|
|
162
|
+
timestamp: new Date()
|
|
163
|
+
}), success ? 0.9 : 0.3);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Update agent status
|
|
167
|
+
*/
|
|
168
|
+
setStatus(status) {
|
|
169
|
+
this.status = status;
|
|
170
|
+
const statusKey = `agent_status_${this.id}`;
|
|
171
|
+
this.memory.storeInContext(statusKey, {
|
|
172
|
+
agentId: this.id,
|
|
173
|
+
status,
|
|
174
|
+
timestamp: new Date()
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Check if agent should work with another agent
|
|
179
|
+
*/
|
|
180
|
+
shouldCoordinate(otherAgentType) {
|
|
181
|
+
// Define coordination rules
|
|
182
|
+
const coordinationRules = {
|
|
183
|
+
'widget-creator': ['tester', 'researcher', 'app-architect'],
|
|
184
|
+
'flow-builder': ['catalog-manager', 'tester', 'integration-specialist'],
|
|
185
|
+
'script-writer': ['tester', 'app-architect'],
|
|
186
|
+
'app-architect': ['widget-creator', 'script-writer', 'flow-builder'],
|
|
187
|
+
'integration-specialist': ['flow-builder', 'script-writer'],
|
|
188
|
+
'catalog-manager': ['flow-builder'],
|
|
189
|
+
'researcher': ['widget-creator', 'flow-builder', 'script-writer'],
|
|
190
|
+
'tester': ['widget-creator', 'flow-builder', 'script-writer']
|
|
191
|
+
};
|
|
192
|
+
return coordinationRules[this.type]?.includes(otherAgentType) || false;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Generate unique agent ID
|
|
196
|
+
*/
|
|
197
|
+
generateAgentId(type) {
|
|
198
|
+
const timestamp = Date.now().toString(36);
|
|
199
|
+
const random = crypto.randomBytes(4).toString('hex');
|
|
200
|
+
return `${type}_${timestamp}_${random}`;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Get agent information
|
|
204
|
+
*/
|
|
205
|
+
getInfo() {
|
|
206
|
+
return {
|
|
207
|
+
id: this.id,
|
|
208
|
+
type: this.type,
|
|
209
|
+
status: this.status,
|
|
210
|
+
capabilities: this.capabilities,
|
|
211
|
+
mcpTools: this.mcpTools,
|
|
212
|
+
task: this.task
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Cleanup agent resources
|
|
217
|
+
*/
|
|
218
|
+
async cleanup() {
|
|
219
|
+
// Clean up any resources
|
|
220
|
+
this.messageQueue = [];
|
|
221
|
+
this.status = 'idle';
|
|
222
|
+
if (this.debugMode) {
|
|
223
|
+
console.log(`🧹 ${this.type} agent ${this.id} cleaned up`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
exports.BaseAgent = BaseAgent;
|
|
228
|
+
//# sourceMappingURL=base-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-agent.js","sourceRoot":"","sources":["../../src/agents/base-agent.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,wDAA0D;AAC1D,+CAAiC;AAmBjC,MAAsB,SAAS;IAY7B,YAAY,MAAmB;QAFrB,iBAAY,GAAmB,EAAE,CAAC;QAG1C,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,I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C;IACzE,CAAC;IAED;;OAEG;IACK,eAAe,CAAC,IAAe;QACrC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC1C,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrD,OAAO,GAAG,IAAI,IAAI,SAAS,IAAI,MAAM,EAAE,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,OAAO;QACL,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,yBAAyB;QACzB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,UAAU,IAAI,CAAC,EAAE,aAAa,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;CACF;AAjOD,8BAiOC"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Coordination System
|
|
3
|
+
* Manages inter-agent communication, task dependencies, and handoffs
|
|
4
|
+
* Integrates with SQLite memory for persistent coordination state
|
|
5
|
+
*/
|
|
6
|
+
import { EventEmitter } from 'eventemitter3';
|
|
7
|
+
import { Agent, AgentMessage } from '../queen/types';
|
|
8
|
+
import { QueenMemorySystem } from '../queen/queen-memory';
|
|
9
|
+
export interface CoordinationContext {
|
|
10
|
+
sessionId: string;
|
|
11
|
+
objectiveId: string;
|
|
12
|
+
agents: Map<string, Agent>;
|
|
13
|
+
dependencies: Map<string, string[]>;
|
|
14
|
+
handoffs: Map<string, HandoffRequest>;
|
|
15
|
+
blockages: Map<string, BlockageInfo>;
|
|
16
|
+
}
|
|
17
|
+
export interface HandoffRequest {
|
|
18
|
+
id: string;
|
|
19
|
+
fromAgent: string;
|
|
20
|
+
toAgent: string;
|
|
21
|
+
artifactType: string;
|
|
22
|
+
artifactData: any;
|
|
23
|
+
status: 'pending' | 'accepted' | 'completed' | 'failed';
|
|
24
|
+
createdAt: Date;
|
|
25
|
+
completedAt?: Date;
|
|
26
|
+
}
|
|
27
|
+
export interface BlockageInfo {
|
|
28
|
+
agentId: string;
|
|
29
|
+
reason: string;
|
|
30
|
+
blockedTasks: string[];
|
|
31
|
+
dependencies: string[];
|
|
32
|
+
attemptedResolutions: string[];
|
|
33
|
+
createdAt: Date;
|
|
34
|
+
}
|
|
35
|
+
export interface CoordinationStrategy {
|
|
36
|
+
type: 'sequential' | 'parallel' | 'adaptive';
|
|
37
|
+
rules: CoordinationRule[];
|
|
38
|
+
fallbackStrategy?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface CoordinationRule {
|
|
41
|
+
condition: string;
|
|
42
|
+
action: string;
|
|
43
|
+
priority: number;
|
|
44
|
+
}
|
|
45
|
+
export interface RecoveryStrategy {
|
|
46
|
+
errorType: string;
|
|
47
|
+
recoveryActions: RecoveryAction[];
|
|
48
|
+
maxRetries: number;
|
|
49
|
+
}
|
|
50
|
+
export interface RecoveryAction {
|
|
51
|
+
type: 'retry' | 'fallback' | 'reassign' | 'escalate';
|
|
52
|
+
config: Record<string, any>;
|
|
53
|
+
}
|
|
54
|
+
export declare class AgentCoordinator extends EventEmitter {
|
|
55
|
+
private memory;
|
|
56
|
+
private contexts;
|
|
57
|
+
private strategies;
|
|
58
|
+
private recoveryStrategies;
|
|
59
|
+
private messageQueue;
|
|
60
|
+
constructor(memory: QueenMemorySystem);
|
|
61
|
+
/**
|
|
62
|
+
* Create a new coordination context for an objective
|
|
63
|
+
*/
|
|
64
|
+
createContext(sessionId: string, objectiveId: string): Promise<CoordinationContext>;
|
|
65
|
+
/**
|
|
66
|
+
* Register an agent with the coordinator
|
|
67
|
+
*/
|
|
68
|
+
registerAgent(agent: Agent, objectiveId?: string): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Manage task dependencies between agents
|
|
71
|
+
*/
|
|
72
|
+
manageDependencies(objectiveId: string, taskId: string, dependencies: string[]): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Coordinate handoff between agents
|
|
75
|
+
*/
|
|
76
|
+
coordinateHandoff(fromAgentId: string, toAgentId: string, artifactType: string, artifactData: any): Promise<HandoffRequest>;
|
|
77
|
+
/**
|
|
78
|
+
* Handle agent blockage with recovery strategies
|
|
79
|
+
*/
|
|
80
|
+
handleBlockage(agentId: string, reason: string, blockedTasks: string[]): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Send message between agents
|
|
83
|
+
*/
|
|
84
|
+
sendMessage(fromAgentId: string, toAgentId: string, messageType: AgentMessage['type'], content: any): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Get pending messages for an agent
|
|
87
|
+
*/
|
|
88
|
+
getAgentMessages(agentId: string): Promise<AgentMessage[]>;
|
|
89
|
+
/**
|
|
90
|
+
* Update handoff status
|
|
91
|
+
*/
|
|
92
|
+
updateHandoffStatus(handoffId: string, status: HandoffRequest['status']): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Get coordination status for an objective
|
|
95
|
+
*/
|
|
96
|
+
getCoordinationStatus(objectiveId: string): Promise<{
|
|
97
|
+
agents: {
|
|
98
|
+
total: number;
|
|
99
|
+
active: number;
|
|
100
|
+
blocked: number;
|
|
101
|
+
};
|
|
102
|
+
handoffs: {
|
|
103
|
+
total: number;
|
|
104
|
+
pending: number;
|
|
105
|
+
completed: number;
|
|
106
|
+
};
|
|
107
|
+
dependencies: {
|
|
108
|
+
total: number;
|
|
109
|
+
satisfied: number;
|
|
110
|
+
};
|
|
111
|
+
blockages: number;
|
|
112
|
+
}>;
|
|
113
|
+
/**
|
|
114
|
+
* Apply coordination strategy
|
|
115
|
+
*/
|
|
116
|
+
applyStrategy(objectiveId: string, strategyType: string): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Terminate an agent
|
|
119
|
+
*/
|
|
120
|
+
terminateAgent(agentId: string): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Initialize default coordination strategies
|
|
123
|
+
*/
|
|
124
|
+
private initializeDefaultStrategies;
|
|
125
|
+
/**
|
|
126
|
+
* Initialize recovery strategies for error handling
|
|
127
|
+
*/
|
|
128
|
+
private initializeRecoveryStrategies;
|
|
129
|
+
/**
|
|
130
|
+
* Set up memory synchronization
|
|
131
|
+
*/
|
|
132
|
+
private setupMemorySync;
|
|
133
|
+
/**
|
|
134
|
+
* Sync context to memory
|
|
135
|
+
*/
|
|
136
|
+
private syncContextToMemory;
|
|
137
|
+
/**
|
|
138
|
+
* Check if dependencies are satisfied
|
|
139
|
+
*/
|
|
140
|
+
private checkDependencySatisfaction;
|
|
141
|
+
/**
|
|
142
|
+
* Check if a specific dependency is satisfied
|
|
143
|
+
*/
|
|
144
|
+
private isDependencySatisfied;
|
|
145
|
+
/**
|
|
146
|
+
* Find blocked dependencies
|
|
147
|
+
*/
|
|
148
|
+
private findBlockedDependencies;
|
|
149
|
+
/**
|
|
150
|
+
* Attempt recovery for blocked agent
|
|
151
|
+
*/
|
|
152
|
+
private attemptRecovery;
|
|
153
|
+
/**
|
|
154
|
+
* Find recovery strategy for error type
|
|
155
|
+
*/
|
|
156
|
+
private findRecoveryStrategy;
|
|
157
|
+
/**
|
|
158
|
+
* Execute recovery action
|
|
159
|
+
*/
|
|
160
|
+
private executeRecoveryAction;
|
|
161
|
+
/**
|
|
162
|
+
* Find available agent of specified type
|
|
163
|
+
*/
|
|
164
|
+
private findAvailableAgent;
|
|
165
|
+
/**
|
|
166
|
+
* Reassign tasks from one agent to another
|
|
167
|
+
*/
|
|
168
|
+
private reassignTasks;
|
|
169
|
+
/**
|
|
170
|
+
* Process pending messages for an agent
|
|
171
|
+
*/
|
|
172
|
+
private processAgentMessages;
|
|
173
|
+
/**
|
|
174
|
+
* Evaluate strategy condition
|
|
175
|
+
*/
|
|
176
|
+
private evaluateCondition;
|
|
177
|
+
/**
|
|
178
|
+
* Execute strategy action
|
|
179
|
+
*/
|
|
180
|
+
private executeAction;
|
|
181
|
+
/**
|
|
182
|
+
* Generate unique ID
|
|
183
|
+
*/
|
|
184
|
+
private generateId;
|
|
185
|
+
/**
|
|
186
|
+
* Get coordinator statistics
|
|
187
|
+
*/
|
|
188
|
+
getStats(): Promise<{
|
|
189
|
+
activeContexts: number;
|
|
190
|
+
totalAgents: number;
|
|
191
|
+
activeHandoffs: number;
|
|
192
|
+
blockedAgents: number;
|
|
193
|
+
messagesInQueue: number;
|
|
194
|
+
}>;
|
|
195
|
+
/**
|
|
196
|
+
* Clean up completed contexts
|
|
197
|
+
*/
|
|
198
|
+
cleanup(): Promise<void>;
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=coordinator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../src/agents/coordinator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,YAAY,EAAa,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC3B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC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