snow-flow 8.3.2 ā 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/OPENCODE-SETUP.md +312 -0
- package/OPENCODE-TROUBLESHOOTING.md +381 -0
- package/dist/agents/index.d.ts +2 -2
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +2 -4
- package/dist/agents/index.js.map +1 -1
- package/dist/cli.js +208 -244
- package/dist/cli.js.map +1 -1
- package/dist/memory/session-memory.d.ts +80 -0
- package/dist/memory/session-memory.d.ts.map +1 -0
- package/dist/memory/session-memory.js +468 -0
- package/dist/memory/session-memory.js.map +1 -0
- package/dist/sdk/claude-agent-sdk-integration.d.ts +4 -1
- package/dist/sdk/claude-agent-sdk-integration.d.ts.map +1 -1
- package/dist/sdk/claude-agent-sdk-integration.js.map +1 -1
- package/dist/sdk/index.d.ts +2 -7
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +2 -7
- package/dist/sdk/index.js.map +1 -1
- package/dist/snow-flow-system.d.ts +3 -7
- package/dist/snow-flow-system.d.ts.map +1 -1
- package/dist/snow-flow-system.js +59 -40
- package/dist/snow-flow-system.js.map +1 -1
- package/dist/utils/mcp-output-formatter.d.ts +128 -0
- package/dist/utils/mcp-output-formatter.d.ts.map +1 -0
- package/dist/utils/mcp-output-formatter.js +442 -0
- package/dist/utils/mcp-output-formatter.js.map +1 -0
- package/dist/utils/opencode-output-interceptor.d.ts +40 -0
- package/dist/utils/opencode-output-interceptor.d.ts.map +1 -0
- package/dist/utils/opencode-output-interceptor.js +258 -0
- package/dist/utils/opencode-output-interceptor.js.map +1 -0
- package/package.json +4 -2
- package/scripts/bulk-optimize-tools.js +486 -0
- package/scripts/cleanup-mcp-servers.js +115 -0
- package/scripts/generate-mcp-config.js +45 -0
- package/scripts/mcp-server-manager.sh +320 -0
- package/scripts/optimize-mcp-tools.ts +410 -0
- package/scripts/reset-mcp-servers.js +266 -0
- package/scripts/safe-mcp-cleanup.js +151 -0
- package/scripts/setup-mcp.js +106 -0
- package/scripts/start-mcp-proper.js +76 -0
- package/scripts/start-opencode.sh +123 -0
- package/scripts/start-sysprops-mcp.js +43 -0
- package/scripts/test-todowrite-timeout.js +108 -0
- package/scripts/update-version.js +31 -0
package/dist/agents/index.js
CHANGED
|
@@ -4,13 +4,11 @@
|
|
|
4
4
|
* DEPRECATED: Custom agents replaced by @anthropic-ai/claude-agent-sdk@0.1.1
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.ClaudeAgentSDKIntegration = void 0;
|
|
8
8
|
// Re-export SDK components for backward compatibility
|
|
9
9
|
var index_js_1 = require("../sdk/index.js");
|
|
10
10
|
Object.defineProperty(exports, "ClaudeAgentSDKIntegration", { enumerable: true, get: function () { return index_js_1.ClaudeAgentSDKIntegration; } });
|
|
11
|
-
Object.defineProperty(exports, "QueenOrchestrator", { enumerable: true, get: function () { return index_js_1.QueenOrchestrator; } });
|
|
12
11
|
// SDK-based agent system:
|
|
13
12
|
// - Agents are spawned via ClaudeAgentSDKIntegration
|
|
14
|
-
// - Queen
|
|
15
|
-
// - 86% code reduction (2832 ā 400 lines)
|
|
13
|
+
// - Queen orchestration deprecated (use swarm command instead)
|
|
16
14
|
//# sourceMappingURL=index.js.map
|
package/dist/agents/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,sDAAsD;AACtD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,sDAAsD;AACtD,4CAA4D;AAAnD,qHAAA,yBAAyB,OAAA;AAGlC,0BAA0B;AAC1B,qDAAqD;AACrD,+DAA+D"}
|
package/dist/cli.js
CHANGED
|
@@ -55,6 +55,8 @@ const logger_js_1 = require("./utils/logger.js");
|
|
|
55
55
|
const chalk_1 = __importDefault(require("chalk"));
|
|
56
56
|
// Load MCP Persistent Guard for bulletproof server protection
|
|
57
57
|
const mcp_persistent_guard_js_1 = require("./utils/mcp-persistent-guard.js");
|
|
58
|
+
// Load OpenCode output interceptor for beautiful MCP formatting
|
|
59
|
+
const opencode_output_interceptor_js_1 = require("./utils/opencode-output-interceptor.js");
|
|
58
60
|
// Activate MCP guard ONLY for commands that actually use MCP servers
|
|
59
61
|
// Explicitly exclude: init, version, help, auth, export, config commands
|
|
60
62
|
const commandsNeedingMCP = ['swarm', 'status', 'monitor', 'mcp'];
|
|
@@ -310,8 +312,8 @@ program
|
|
|
310
312
|
if (options.verbose) {
|
|
311
313
|
cliLogger.info('\nš¾ Initializing swarm memory system...');
|
|
312
314
|
}
|
|
313
|
-
const {
|
|
314
|
-
const memorySystem = new
|
|
315
|
+
const { SessionMemorySystem } = await Promise.resolve().then(() => __importStar(require('./memory/session-memory.js')));
|
|
316
|
+
const memorySystem = new SessionMemorySystem();
|
|
315
317
|
// Generate swarm session ID
|
|
316
318
|
const sessionId = `swarm_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
317
319
|
// Session ID only in verbose mode
|
|
@@ -476,7 +478,7 @@ async function executeOpenCode(objective) {
|
|
|
476
478
|
opencodeCommand = `opencode --model "${defaultModel}" < "${tmpFile}"`;
|
|
477
479
|
}
|
|
478
480
|
const opencodeProcess = (0, child_process_1.spawn)('sh', ['-c', opencodeCommand], {
|
|
479
|
-
stdio: 'inherit', //
|
|
481
|
+
stdio: ['inherit', 'pipe', 'pipe'], // stdin inherited, stdout/stderr piped for interception
|
|
480
482
|
cwd: process.cwd(),
|
|
481
483
|
env: {
|
|
482
484
|
...process.env,
|
|
@@ -485,6 +487,17 @@ async function executeOpenCode(objective) {
|
|
|
485
487
|
DEFAULT_LLM_PROVIDER: defaultProvider || ''
|
|
486
488
|
}
|
|
487
489
|
});
|
|
490
|
+
// Create output interceptor for beautiful MCP formatting
|
|
491
|
+
const quiet = process.env.QUIET === 'true';
|
|
492
|
+
const interceptor = (0, opencode_output_interceptor_js_1.interceptOpenCodeOutput)({ quiet });
|
|
493
|
+
// Pipe OpenCode stdout through interceptor to user's stdout
|
|
494
|
+
if (opencodeProcess.stdout) {
|
|
495
|
+
opencodeProcess.stdout.pipe(interceptor).pipe(process.stdout);
|
|
496
|
+
}
|
|
497
|
+
// Pipe OpenCode stderr through interceptor to user's stderr
|
|
498
|
+
if (opencodeProcess.stderr) {
|
|
499
|
+
opencodeProcess.stderr.pipe(interceptor).pipe(process.stderr);
|
|
500
|
+
}
|
|
488
501
|
// Set up process monitoring
|
|
489
502
|
return new Promise((resolve) => {
|
|
490
503
|
opencodeProcess.on('close', async (code) => {
|
|
@@ -1330,8 +1343,8 @@ program
|
|
|
1330
1343
|
.action(async (sessionId, options) => {
|
|
1331
1344
|
cliLogger.info('\nš Checking swarm status...\n');
|
|
1332
1345
|
try {
|
|
1333
|
-
const {
|
|
1334
|
-
const memorySystem = new
|
|
1346
|
+
const { SessionMemorySystem } = await Promise.resolve().then(() => __importStar(require('./memory/session-memory.js')));
|
|
1347
|
+
const memorySystem = new SessionMemorySystem();
|
|
1335
1348
|
if (!sessionId) {
|
|
1336
1349
|
// List all recent swarm sessions
|
|
1337
1350
|
cliLogger.info('š Recent swarm sessions:');
|
|
@@ -1584,15 +1597,20 @@ program
|
|
|
1584
1597
|
await copyOpenCodeConfig(targetDir, options.force);
|
|
1585
1598
|
// Copy OpenCode themes
|
|
1586
1599
|
await copyOpenCodeThemes(targetDir, options.force);
|
|
1600
|
+
// Copy MCP server management scripts
|
|
1601
|
+
console.log('š§ Setting up MCP server management scripts...');
|
|
1602
|
+
await copyMCPServerScripts(targetDir, options.force);
|
|
1587
1603
|
console.log(chalk_1.default.green.bold('\nā
Snow-Flow project initialized successfully!'));
|
|
1588
1604
|
console.log('\nš Created Snow-Flow configuration:');
|
|
1589
1605
|
console.log(' ā .opencode/ - OpenCode configuration with both MCP servers');
|
|
1590
1606
|
console.log(' ā .opencode/themes/ - ServiceNow custom theme for OpenCode');
|
|
1591
1607
|
console.log(' ā .claude/ - Claude Code MCP configuration (backward compatibility)');
|
|
1592
|
-
console.log(' ā .mcp.json - 2 unified MCP servers (
|
|
1608
|
+
console.log(' ā .mcp.json - 2 unified MCP servers (370 tools total)');
|
|
1609
|
+
console.log(' ā scripts/ - MCP server management and OpenCode launcher');
|
|
1593
1610
|
console.log(' ā AGENTS.md - OpenCode primary instructions');
|
|
1594
1611
|
console.log(' ā CLAUDE.md - Claude Code compatibility');
|
|
1595
1612
|
console.log(' ā README.md - Complete capabilities documentation');
|
|
1613
|
+
console.log(' ā OPENCODE-TROUBLESHOOTING.md - Troubleshooting guide');
|
|
1596
1614
|
console.log(' ā .snow-flow/ - Project workspace and memory');
|
|
1597
1615
|
if (!options.skipMcp) {
|
|
1598
1616
|
// NOTE: MCP servers work with OpenCode's native Task() system
|
|
@@ -1603,14 +1621,18 @@ program
|
|
|
1603
1621
|
// Check and optionally install OpenCode
|
|
1604
1622
|
const configImported = await checkAndInstallOpenCode();
|
|
1605
1623
|
console.log(chalk_1.default.blue.bold('\nšÆ Next steps:'));
|
|
1606
|
-
console.log('1.
|
|
1624
|
+
console.log('1. Configure credentials: Edit ' + chalk_1.default.cyan('.env'));
|
|
1625
|
+
console.log(' - Add your ServiceNow instance URL, username/password or OAuth credentials');
|
|
1626
|
+
console.log('2. Authenticate: ' + chalk_1.default.cyan('snow-flow auth login'));
|
|
1607
1627
|
console.log(' - Authenticates with your LLM provider (Claude/OpenAI/Google/Ollama)');
|
|
1608
1628
|
console.log(' - Then authenticates with ServiceNow OAuth');
|
|
1609
1629
|
console.log(' - Your provider choice is automatically saved to .env');
|
|
1610
|
-
console.log('
|
|
1630
|
+
console.log('3. Start developing with OpenCode: ' + chalk_1.default.cyan('./scripts/start-opencode.sh'));
|
|
1631
|
+
console.log(' - Smart launcher with pre-flight checks and MCP server management');
|
|
1632
|
+
console.log(' - Or use swarm: ' + chalk_1.default.cyan('snow-flow swarm "create incident dashboard"'));
|
|
1611
1633
|
console.log(' - Or launch OpenCode directly: ' + chalk_1.default.cyan('opencode'));
|
|
1612
1634
|
console.log('\nš Documentation: ' + chalk_1.default.blue('https://github.com/groeimetai/snow-flow'));
|
|
1613
|
-
console.log('š”
|
|
1635
|
+
console.log('š” 370+ ServiceNow tools ⢠2 MCP servers ⢠Multi-LLM support');
|
|
1614
1636
|
// Force exit to prevent hanging
|
|
1615
1637
|
process.exit(0);
|
|
1616
1638
|
}
|
|
@@ -1796,7 +1818,8 @@ async function createDirectoryStructure(targetDir, force = false) {
|
|
|
1796
1818
|
'memory', 'memory/agents', 'memory/sessions',
|
|
1797
1819
|
'coordination', 'coordination/memory_bank', 'coordination/subtasks',
|
|
1798
1820
|
'servicenow', 'servicenow/widgets', 'servicenow/workflows', 'servicenow/scripts',
|
|
1799
|
-
'templates', 'templates/widgets', 'templates/workflows'
|
|
1821
|
+
'templates', 'templates/widgets', 'templates/workflows',
|
|
1822
|
+
'scripts'
|
|
1800
1823
|
];
|
|
1801
1824
|
for (const dir of directories) {
|
|
1802
1825
|
const dirPath = (0, path_1.join)(targetDir, dir);
|
|
@@ -2020,9 +2043,168 @@ async function copyOpenCodeThemes(targetDir, force = false) {
|
|
|
2020
2043
|
console.error('ā Error copying OpenCode themes:', error);
|
|
2021
2044
|
}
|
|
2022
2045
|
}
|
|
2046
|
+
async function copyMCPServerScripts(targetDir, force = false) {
|
|
2047
|
+
try {
|
|
2048
|
+
// Determine the snow-flow installation directory (same logic as other copy functions)
|
|
2049
|
+
let snowFlowRoot;
|
|
2050
|
+
const isGlobalInstall = __dirname.includes('node_modules/snow-flow') ||
|
|
2051
|
+
__dirname.includes('node_modules/.pnpm') ||
|
|
2052
|
+
__dirname.includes('npm/snow-flow');
|
|
2053
|
+
if (isGlobalInstall) {
|
|
2054
|
+
const parts = __dirname.split(/node_modules[\/\\]/);
|
|
2055
|
+
snowFlowRoot = parts[0] + 'node_modules/snow-flow';
|
|
2056
|
+
}
|
|
2057
|
+
else {
|
|
2058
|
+
let currentDir = __dirname;
|
|
2059
|
+
while (currentDir !== '/') {
|
|
2060
|
+
try {
|
|
2061
|
+
const packageJsonPath = (0, path_1.join)(currentDir, 'package.json');
|
|
2062
|
+
const packageJson = JSON.parse(await fs_1.promises.readFile(packageJsonPath, 'utf-8'));
|
|
2063
|
+
if (packageJson.name === 'snow-flow') {
|
|
2064
|
+
snowFlowRoot = currentDir;
|
|
2065
|
+
break;
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
catch {
|
|
2069
|
+
// Continue searching up
|
|
2070
|
+
}
|
|
2071
|
+
currentDir = (0, path_1.dirname)(currentDir);
|
|
2072
|
+
}
|
|
2073
|
+
if (!snowFlowRoot) {
|
|
2074
|
+
throw new Error('Could not find snow-flow project root');
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
// Find scripts directory
|
|
2078
|
+
const scriptsSourcePaths = [
|
|
2079
|
+
(0, path_1.join)(snowFlowRoot, 'scripts'),
|
|
2080
|
+
(0, path_1.join)(__dirname, '..', 'scripts'),
|
|
2081
|
+
(0, path_1.join)(__dirname, 'scripts')
|
|
2082
|
+
];
|
|
2083
|
+
let scriptsSourceDir = null;
|
|
2084
|
+
for (const sourcePath of scriptsSourcePaths) {
|
|
2085
|
+
try {
|
|
2086
|
+
await fs_1.promises.access(sourcePath);
|
|
2087
|
+
scriptsSourceDir = sourcePath;
|
|
2088
|
+
console.log(`ā
Found scripts directory at: ${sourcePath}`);
|
|
2089
|
+
break;
|
|
2090
|
+
}
|
|
2091
|
+
catch {
|
|
2092
|
+
// Continue to next path
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
if (!scriptsSourceDir) {
|
|
2096
|
+
console.log('ā ļø Could not find scripts directory, skipping script installation');
|
|
2097
|
+
return;
|
|
2098
|
+
}
|
|
2099
|
+
// Create target scripts directory
|
|
2100
|
+
const scriptsTargetDir = (0, path_1.join)(targetDir, 'scripts');
|
|
2101
|
+
await fs_1.promises.mkdir(scriptsTargetDir, { recursive: true });
|
|
2102
|
+
// Copy specific scripts
|
|
2103
|
+
const scriptFiles = [
|
|
2104
|
+
'mcp-server-manager.sh',
|
|
2105
|
+
'start-opencode.sh'
|
|
2106
|
+
];
|
|
2107
|
+
let copiedCount = 0;
|
|
2108
|
+
for (const scriptFile of scriptFiles) {
|
|
2109
|
+
const sourcePath = (0, path_1.join)(scriptsSourceDir, scriptFile);
|
|
2110
|
+
const targetPath = (0, path_1.join)(scriptsTargetDir, scriptFile);
|
|
2111
|
+
try {
|
|
2112
|
+
// Check if file already exists
|
|
2113
|
+
try {
|
|
2114
|
+
await fs_1.promises.access(targetPath);
|
|
2115
|
+
if (!force) {
|
|
2116
|
+
console.log(`ā
Script ${scriptFile} already exists`);
|
|
2117
|
+
continue;
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
catch {
|
|
2121
|
+
// File doesn't exist, continue with copy
|
|
2122
|
+
}
|
|
2123
|
+
const content = await fs_1.promises.readFile(sourcePath, 'utf8');
|
|
2124
|
+
await fs_1.promises.writeFile(targetPath, content, { mode: 0o755 }); // Make executable
|
|
2125
|
+
copiedCount++;
|
|
2126
|
+
}
|
|
2127
|
+
catch (error) {
|
|
2128
|
+
console.log(`ā ļø Could not copy script ${scriptFile}:`, error);
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
if (copiedCount > 0) {
|
|
2132
|
+
console.log(`ā
Copied ${copiedCount} MCP server management script(s) to scripts/`);
|
|
2133
|
+
console.log(`ā
Scripts are executable and ready to use`);
|
|
2134
|
+
}
|
|
2135
|
+
// Also copy OPENCODE-TROUBLESHOOTING.md to project root
|
|
2136
|
+
const troubleshootingSourcePaths = [
|
|
2137
|
+
(0, path_1.join)(snowFlowRoot, 'OPENCODE-TROUBLESHOOTING.md'),
|
|
2138
|
+
(0, path_1.join)(__dirname, '..', 'OPENCODE-TROUBLESHOOTING.md'),
|
|
2139
|
+
(0, path_1.join)(__dirname, 'OPENCODE-TROUBLESHOOTING.md')
|
|
2140
|
+
];
|
|
2141
|
+
let troubleshootingSourcePath = null;
|
|
2142
|
+
for (const sourcePath of troubleshootingSourcePaths) {
|
|
2143
|
+
try {
|
|
2144
|
+
await fs_1.promises.access(sourcePath);
|
|
2145
|
+
troubleshootingSourcePath = sourcePath;
|
|
2146
|
+
break;
|
|
2147
|
+
}
|
|
2148
|
+
catch {
|
|
2149
|
+
// Continue to next path
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
if (troubleshootingSourcePath) {
|
|
2153
|
+
const targetPath = (0, path_1.join)(targetDir, 'OPENCODE-TROUBLESHOOTING.md');
|
|
2154
|
+
try {
|
|
2155
|
+
await fs_1.promises.access(targetPath);
|
|
2156
|
+
if (!force) {
|
|
2157
|
+
console.log(`ā
OPENCODE-TROUBLESHOOTING.md already exists`);
|
|
2158
|
+
}
|
|
2159
|
+
else {
|
|
2160
|
+
const content = await fs_1.promises.readFile(troubleshootingSourcePath, 'utf8');
|
|
2161
|
+
await fs_1.promises.writeFile(targetPath, content);
|
|
2162
|
+
console.log(`ā
Created OPENCODE-TROUBLESHOOTING.md`);
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
catch {
|
|
2166
|
+
const content = await fs_1.promises.readFile(troubleshootingSourcePath, 'utf8');
|
|
2167
|
+
await fs_1.promises.writeFile(targetPath, content);
|
|
2168
|
+
console.log(`ā
Created OPENCODE-TROUBLESHOOTING.md`);
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
catch (error) {
|
|
2173
|
+
console.error('ā Error copying MCP server scripts:', error);
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2023
2176
|
async function copyCLAUDEmd(targetDir, force = false) {
|
|
2024
2177
|
let claudeMdContent = '';
|
|
2025
2178
|
let agentsMdContent = '';
|
|
2179
|
+
// Determine the snow-flow installation directory for absolute MCP paths
|
|
2180
|
+
let snowFlowRoot;
|
|
2181
|
+
const isGlobalInstall = __dirname.includes('node_modules/snow-flow') ||
|
|
2182
|
+
__dirname.includes('node_modules/.pnpm') ||
|
|
2183
|
+
__dirname.includes('npm/snow-flow');
|
|
2184
|
+
if (isGlobalInstall) {
|
|
2185
|
+
const parts = __dirname.split(/node_modules[\/\\]/);
|
|
2186
|
+
snowFlowRoot = parts[0] + 'node_modules/snow-flow';
|
|
2187
|
+
}
|
|
2188
|
+
else {
|
|
2189
|
+
let currentDir = __dirname;
|
|
2190
|
+
while (currentDir !== '/') {
|
|
2191
|
+
try {
|
|
2192
|
+
const packageJsonPath = (0, path_1.join)(currentDir, 'package.json');
|
|
2193
|
+
const packageJson = JSON.parse(await fs_1.promises.readFile(packageJsonPath, 'utf-8'));
|
|
2194
|
+
if (packageJson.name === 'snow-flow') {
|
|
2195
|
+
snowFlowRoot = currentDir;
|
|
2196
|
+
break;
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
catch {
|
|
2200
|
+
// Continue searching up
|
|
2201
|
+
}
|
|
2202
|
+
currentDir = (0, path_1.dirname)(currentDir);
|
|
2203
|
+
}
|
|
2204
|
+
if (!snowFlowRoot) {
|
|
2205
|
+
throw new Error('Could not find snow-flow project root');
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2026
2208
|
try {
|
|
2027
2209
|
// First try to find the CLAUDE.md in the source directory (for global installs)
|
|
2028
2210
|
const sourceClaudeFiles = [
|
|
@@ -2115,6 +2297,8 @@ async function copyCLAUDEmd(targetDir, force = false) {
|
|
|
2115
2297
|
// Silently continue - agent configs are in opencode.json, not separate files
|
|
2116
2298
|
}
|
|
2117
2299
|
// Create .opencode/opencode.json with both MCP servers
|
|
2300
|
+
// CRITICAL: Use ABSOLUTE paths so OpenCode can find the servers!
|
|
2301
|
+
const distPath = (0, path_1.join)(snowFlowRoot, 'dist');
|
|
2118
2302
|
const opencodeConfig = {
|
|
2119
2303
|
name: "snow-flow",
|
|
2120
2304
|
description: "ServiceNow development with OpenCode and multi-LLM support",
|
|
@@ -2127,7 +2311,7 @@ async function copyCLAUDEmd(targetDir, force = false) {
|
|
|
2127
2311
|
"servicenow-unified": {
|
|
2128
2312
|
type: "local",
|
|
2129
2313
|
command: "node",
|
|
2130
|
-
args: ["
|
|
2314
|
+
args: [(0, path_1.join)(distPath, "mcp/servicenow-mcp-unified/index.js")],
|
|
2131
2315
|
env: {
|
|
2132
2316
|
SNOW_INSTANCE: "${SNOW_INSTANCE}",
|
|
2133
2317
|
SNOW_CLIENT_ID: "${SNOW_CLIENT_ID}",
|
|
@@ -2139,7 +2323,7 @@ async function copyCLAUDEmd(targetDir, force = false) {
|
|
|
2139
2323
|
"snow-flow": {
|
|
2140
2324
|
type: "local",
|
|
2141
2325
|
command: "node",
|
|
2142
|
-
args: ["
|
|
2326
|
+
args: [(0, path_1.join)(distPath, "mcp/snow-flow-mcp.js")],
|
|
2143
2327
|
env: {
|
|
2144
2328
|
SNOW_FLOW_ENV: "production"
|
|
2145
2329
|
},
|
|
@@ -2972,238 +3156,18 @@ async function handleMCPDebug(options) {
|
|
|
2972
3156
|
console.log(' 3. Start developing: snow-flow swarm "your objective"');
|
|
2973
3157
|
console.log(' 4. OpenCode will automatically connect to Snow-Flow\'s MCP servers');
|
|
2974
3158
|
}
|
|
2975
|
-
// SPARC Detailed Help Command
|
|
2976
|
-
program
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
});
|
|
2988
|
-
// ===================================================
|
|
2989
|
-
// š QUEEN AGENT COMMANDS - Elegant Orchestration
|
|
2990
|
-
// ===================================================
|
|
2991
|
-
/**
|
|
2992
|
-
* Main Queen command - replaces complex swarm orchestration
|
|
2993
|
-
* Simple, elegant, and intelligent ServiceNow objective execution
|
|
2994
|
-
*/
|
|
2995
|
-
program
|
|
2996
|
-
.command('queen <objective>')
|
|
2997
|
-
.description('š Execute ServiceNow objective with Queen Agent hive-mind intelligence')
|
|
2998
|
-
.option('--learn', 'Enable enhanced learning from execution (default: true)', true)
|
|
2999
|
-
.option('--no-learn', 'Disable learning')
|
|
3000
|
-
.option('--debug', 'Enable debug mode for detailed insights')
|
|
3001
|
-
.option('--dry-run', 'Preview execution plan without deployment')
|
|
3002
|
-
.option('--memory-driven', 'Use memory for optimal workflow patterns')
|
|
3003
|
-
.option('--monitor', 'Show real-time hive-mind monitoring')
|
|
3004
|
-
.option('--type <type>', 'Hint at task type (widget, flow, app, integration)')
|
|
3005
|
-
.action(async (objective, options) => {
|
|
3006
|
-
// Check for flow deprecation first
|
|
3007
|
-
checkFlowDeprecation('queen', objective);
|
|
3008
|
-
console.log(`\nš ServiceNow Queen Agent v${version_js_1.VERSION} - Hive-Mind Intelligence`);
|
|
3009
|
-
console.log('š Elegant orchestration replacing complex team coordination\n');
|
|
3010
|
-
try {
|
|
3011
|
-
const { QueenIntegration } = await Promise.resolve().then(() => __importStar(require('./examples/queen/integration-example.js')));
|
|
3012
|
-
const queenIntegration = new QueenIntegration({
|
|
3013
|
-
debugMode: options.debug || false
|
|
3014
|
-
});
|
|
3015
|
-
if (options.dryRun) {
|
|
3016
|
-
console.log('š DRY RUN MODE - Analyzing objective...');
|
|
3017
|
-
// TODO: Add dry run analysis
|
|
3018
|
-
console.log(`š Objective: ${objective}`);
|
|
3019
|
-
console.log('šÆ Queen would analyze, spawn agents, coordinate, and deploy');
|
|
3020
|
-
return;
|
|
3021
|
-
}
|
|
3022
|
-
console.log(`šÆ Queen analyzing objective: ${objective}`);
|
|
3023
|
-
const result = await queenIntegration.executeSwarmObjective(objective, {
|
|
3024
|
-
learn: options.learn,
|
|
3025
|
-
memoryDriven: options.memoryDriven,
|
|
3026
|
-
monitor: options.monitor
|
|
3027
|
-
});
|
|
3028
|
-
if (result.success) {
|
|
3029
|
-
console.log('\nā
Queen Agent completed objective successfully!');
|
|
3030
|
-
console.log(`š Hive-Mind coordination: ${result.queen_managed ? 'ACTIVE' : 'INACTIVE'}`);
|
|
3031
|
-
if (result.hive_mind_status) {
|
|
3032
|
-
console.log(`š„ Active Agents: ${result.hive_mind_status.activeAgents}`);
|
|
3033
|
-
console.log(`š Active Tasks: ${result.hive_mind_status.activeTasks}`);
|
|
3034
|
-
console.log(`š§ Learned Patterns: ${result.hive_mind_status.memoryStats.patterns}`);
|
|
3035
|
-
}
|
|
3036
|
-
if (options.monitor) {
|
|
3037
|
-
console.log('\nš HIVE-MIND MONITORING:');
|
|
3038
|
-
queenIntegration.logHiveMindStatus();
|
|
3039
|
-
}
|
|
3040
|
-
}
|
|
3041
|
-
else {
|
|
3042
|
-
console.error('\nā Queen Agent execution failed!');
|
|
3043
|
-
if (result.fallback_required) {
|
|
3044
|
-
console.log('š Consider using traditional swarm command as fallback:');
|
|
3045
|
-
console.log(` snow-flow swarm "${objective}"`);
|
|
3046
|
-
}
|
|
3047
|
-
process.exit(1);
|
|
3048
|
-
}
|
|
3049
|
-
await queenIntegration.shutdown();
|
|
3050
|
-
}
|
|
3051
|
-
catch (error) {
|
|
3052
|
-
console.error('\nš„ Queen Agent error:', error.message);
|
|
3053
|
-
console.log('\nš Fallback to traditional swarm:');
|
|
3054
|
-
console.log(` snow-flow swarm "${objective}"`);
|
|
3055
|
-
process.exit(1);
|
|
3056
|
-
}
|
|
3057
|
-
});
|
|
3058
|
-
/**
|
|
3059
|
-
* Queen Memory Management
|
|
3060
|
-
*/
|
|
3061
|
-
const queenMemory = program.command('queen-memory');
|
|
3062
|
-
queenMemory.description('š§ Manage Queen Agent hive-mind memory');
|
|
3063
|
-
queenMemory
|
|
3064
|
-
.command('export [file]')
|
|
3065
|
-
.description('Export Queen memory to file')
|
|
3066
|
-
.action(async (file = 'queen-memory.json') => {
|
|
3067
|
-
console.log(`\nš§ Exporting Queen hive-mind memory to ${file}...`);
|
|
3068
|
-
try {
|
|
3069
|
-
const { createServiceNowQueen } = await Promise.resolve().then(() => __importStar(require('./queen/index.js')));
|
|
3070
|
-
const queen = createServiceNowQueen({ debugMode: true });
|
|
3071
|
-
const memoryData = queen.exportMemory();
|
|
3072
|
-
const { promises: fs } = await Promise.resolve().then(() => __importStar(require('fs')));
|
|
3073
|
-
await fs.writeFile(file, memoryData, 'utf-8');
|
|
3074
|
-
console.log(`ā
Memory exported successfully to ${file}`);
|
|
3075
|
-
console.log(`š Memory contains learned patterns and successful deployments`);
|
|
3076
|
-
await queen.shutdown();
|
|
3077
|
-
}
|
|
3078
|
-
catch (error) {
|
|
3079
|
-
console.error('ā Memory export failed:', error.message);
|
|
3080
|
-
process.exit(1);
|
|
3081
|
-
}
|
|
3082
|
-
});
|
|
3083
|
-
queenMemory
|
|
3084
|
-
.command('import <file>')
|
|
3085
|
-
.description('Import Queen memory from file')
|
|
3086
|
-
.action(async (file) => {
|
|
3087
|
-
console.log(`\nš§ Importing Queen hive-mind memory from ${file}...`);
|
|
3088
|
-
try {
|
|
3089
|
-
const { promises: fs } = await Promise.resolve().then(() => __importStar(require('fs')));
|
|
3090
|
-
const memoryData = await fs.readFile(file, 'utf-8');
|
|
3091
|
-
const { createServiceNowQueen } = await Promise.resolve().then(() => __importStar(require('./queen/index.js')));
|
|
3092
|
-
const queen = createServiceNowQueen({ debugMode: true });
|
|
3093
|
-
queen.importMemory(memoryData);
|
|
3094
|
-
console.log(`ā
Memory imported successfully from ${file}`);
|
|
3095
|
-
console.log(`š§ Queen now has access to previous learning patterns`);
|
|
3096
|
-
await queen.shutdown();
|
|
3097
|
-
}
|
|
3098
|
-
catch (error) {
|
|
3099
|
-
console.error('ā Memory import failed:', error.message);
|
|
3100
|
-
process.exit(1);
|
|
3101
|
-
}
|
|
3102
|
-
});
|
|
3103
|
-
queenMemory
|
|
3104
|
-
.command('clear')
|
|
3105
|
-
.description('Clear Queen memory (reset learning)')
|
|
3106
|
-
.option('--confirm', 'Confirm memory clearing')
|
|
3107
|
-
.action(async (options) => {
|
|
3108
|
-
if (!options.confirm) {
|
|
3109
|
-
console.log('\nā ļø This will clear all Queen hive-mind learning!');
|
|
3110
|
-
console.log('Use --confirm to proceed: snow-flow queen-memory clear --confirm');
|
|
3111
|
-
return;
|
|
3112
|
-
}
|
|
3113
|
-
console.log('\nš§ Clearing Queen hive-mind memory...');
|
|
3114
|
-
try {
|
|
3115
|
-
const { createServiceNowQueen } = await Promise.resolve().then(() => __importStar(require('./queen/index.js')));
|
|
3116
|
-
const queen = createServiceNowQueen({ debugMode: true });
|
|
3117
|
-
queen.clearMemory();
|
|
3118
|
-
console.log('ā
Queen memory cleared successfully');
|
|
3119
|
-
console.log('š Queen will start fresh learning from next execution');
|
|
3120
|
-
await queen.shutdown();
|
|
3121
|
-
}
|
|
3122
|
-
catch (error) {
|
|
3123
|
-
console.error('ā Memory clear failed:', error.message);
|
|
3124
|
-
process.exit(1);
|
|
3125
|
-
}
|
|
3126
|
-
});
|
|
3127
|
-
/**
|
|
3128
|
-
* Queen Status and Insights
|
|
3129
|
-
*/
|
|
3130
|
-
program
|
|
3131
|
-
.command('queen-status')
|
|
3132
|
-
.description('š Show Queen Agent hive-mind status and insights')
|
|
3133
|
-
.option('--detailed', 'Show detailed memory and learning statistics')
|
|
3134
|
-
.action(async (options) => {
|
|
3135
|
-
console.log(`\nš ServiceNow Queen Agent Status v${version_js_1.VERSION}`);
|
|
3136
|
-
try {
|
|
3137
|
-
const { createServiceNowQueen } = await Promise.resolve().then(() => __importStar(require('./queen/index.js')));
|
|
3138
|
-
const queen = createServiceNowQueen({ debugMode: true });
|
|
3139
|
-
const status = queen.getHiveMindStatus();
|
|
3140
|
-
console.log('\nš HIVE-MIND STATUS š');
|
|
3141
|
-
console.log('āāāāāāāāāāāāāāāāāāāāāāā');
|
|
3142
|
-
console.log(`š Active Tasks: ${status.activeTasks}`);
|
|
3143
|
-
console.log(`š„ Active Agents: ${status.activeAgents}`);
|
|
3144
|
-
console.log(`š§ Learned Patterns: ${status.memoryStats.patterns}`);
|
|
3145
|
-
console.log(`š Stored Artifacts: ${status.memoryStats.artifacts}`);
|
|
3146
|
-
console.log(`š” Learning Insights: ${status.memoryStats.learnings}`);
|
|
3147
|
-
if (status.factoryStats.agentTypeCounts) {
|
|
3148
|
-
console.log('\nš„ AGENT BREAKDOWN:');
|
|
3149
|
-
Object.entries(status.factoryStats.agentTypeCounts).forEach(([type, count]) => {
|
|
3150
|
-
console.log(` ${type}: ${count}`);
|
|
3151
|
-
});
|
|
3152
|
-
}
|
|
3153
|
-
if (options.detailed) {
|
|
3154
|
-
console.log('\nš DETAILED MEMORY ANALYSIS:');
|
|
3155
|
-
console.log(` Memory Size: ${status.memoryStats.totalSize || 'Unknown'}`);
|
|
3156
|
-
console.log(` Success Rate: ${status.memoryStats.successRate || 'Unknown'}%`);
|
|
3157
|
-
console.log(` Most Effective Pattern: ${status.memoryStats.bestPattern || 'Learning...'}`);
|
|
3158
|
-
}
|
|
3159
|
-
console.log('āāāāāāāāāāāāāāāāāāāāāāā\n');
|
|
3160
|
-
await queen.shutdown();
|
|
3161
|
-
}
|
|
3162
|
-
catch (error) {
|
|
3163
|
-
console.error('ā Status check failed:', error.message);
|
|
3164
|
-
process.exit(1);
|
|
3165
|
-
}
|
|
3166
|
-
});
|
|
3167
|
-
program
|
|
3168
|
-
.command('queen-insights')
|
|
3169
|
-
.description('š” Show Queen Agent learning insights and recommendations')
|
|
3170
|
-
.action(async () => {
|
|
3171
|
-
console.log(`\nš” Queen Agent Learning Insights v${version_js_1.VERSION}`);
|
|
3172
|
-
try {
|
|
3173
|
-
const { createServiceNowQueen } = await Promise.resolve().then(() => __importStar(require('./queen/index.js')));
|
|
3174
|
-
const queen = createServiceNowQueen({ debugMode: true });
|
|
3175
|
-
const insights = queen.getLearningInsights();
|
|
3176
|
-
console.log('\nš§ LEARNING INSIGHTS š§ ');
|
|
3177
|
-
console.log('āāāāāāāāāāāāāāāāāāāāāāā');
|
|
3178
|
-
if (insights.successfulPatterns && insights.successfulPatterns.length > 0) {
|
|
3179
|
-
console.log('\nā
SUCCESSFUL PATTERNS:');
|
|
3180
|
-
insights.successfulPatterns.forEach((pattern, idx) => {
|
|
3181
|
-
console.log(` ${idx + 1}. ${pattern.description} (${pattern.successRate}% success)`);
|
|
3182
|
-
});
|
|
3183
|
-
}
|
|
3184
|
-
else {
|
|
3185
|
-
console.log('\nš No patterns learned yet - execute objectives to build intelligence');
|
|
3186
|
-
}
|
|
3187
|
-
if (insights.recommendations && insights.recommendations.length > 0) {
|
|
3188
|
-
console.log('\nš” RECOMMENDATIONS:');
|
|
3189
|
-
insights.recommendations.forEach((rec, idx) => {
|
|
3190
|
-
console.log(` ${idx + 1}. ${rec}`);
|
|
3191
|
-
});
|
|
3192
|
-
}
|
|
3193
|
-
if (insights.commonTasks && insights.commonTasks.length > 0) {
|
|
3194
|
-
console.log('\nšÆ COMMON TASK TYPES:');
|
|
3195
|
-
insights.commonTasks.forEach((task, idx) => {
|
|
3196
|
-
console.log(` ${idx + 1}. ${task.type}: ${task.count} executions`);
|
|
3197
|
-
});
|
|
3198
|
-
}
|
|
3199
|
-
console.log('āāāāāāāāāāāāāāāāāāāāāāā\n');
|
|
3200
|
-
await queen.shutdown();
|
|
3201
|
-
}
|
|
3202
|
-
catch (error) {
|
|
3203
|
-
console.error('ā Insights failed:', error.message);
|
|
3204
|
-
process.exit(1);
|
|
3205
|
-
}
|
|
3206
|
-
});
|
|
3159
|
+
// SPARC Detailed Help Command - DISABLED (sparc-help.js file missing)
|
|
3160
|
+
// program
|
|
3161
|
+
// .command('sparc-help')
|
|
3162
|
+
// .description('Show detailed SPARC help information')
|
|
3163
|
+
// .action(async () => {
|
|
3164
|
+
// try {
|
|
3165
|
+
// const { displayTeamHelp } = await import('./sparc/sparc-help.js');
|
|
3166
|
+
// displayTeamHelp();
|
|
3167
|
+
// } catch (error) {
|
|
3168
|
+
// console.error('ā Failed to load SPARC help:', error instanceof Error ? error.message : String(error));
|
|
3169
|
+
// }
|
|
3170
|
+
// });
|
|
3207
3171
|
// ===================================================
|
|
3208
3172
|
// š¤ CLAUDE DESKTOP EXPORT COMMAND
|
|
3209
3173
|
// ===================================================
|