stigmergy 1.2.12 → 1.2.13
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/package.json +1 -1
- package/src/cli/router.js +48 -2
package/package.json
CHANGED
package/src/cli/router.js
CHANGED
|
@@ -69,6 +69,32 @@ function getWorkingDirectoryForTool(toolName) {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
// Helper function to add OAuth authentication for CLI tools that support it
|
|
73
|
+
function addOAuthAuthArgs(toolName, existingArgs) {
|
|
74
|
+
const args = [...existingArgs];
|
|
75
|
+
|
|
76
|
+
switch (toolName) {
|
|
77
|
+
case 'qwen':
|
|
78
|
+
// Add OAuth authentication for Qwen CLI to avoid API key errors
|
|
79
|
+
args.unshift('--auth-type', 'qwen-oauth');
|
|
80
|
+
break;
|
|
81
|
+
case 'claude':
|
|
82
|
+
// Claude uses token-based auth, no special args needed
|
|
83
|
+
break;
|
|
84
|
+
case 'gemini':
|
|
85
|
+
// Gemini might support OAuth in future versions
|
|
86
|
+
break;
|
|
87
|
+
case 'iflow':
|
|
88
|
+
// Add web authentication for iFlow if supported
|
|
89
|
+
break;
|
|
90
|
+
default:
|
|
91
|
+
// No special authentication for other tools
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return args;
|
|
96
|
+
}
|
|
97
|
+
|
|
72
98
|
async function main() {
|
|
73
99
|
const args = process.argv.slice(2);
|
|
74
100
|
|
|
@@ -641,6 +667,9 @@ async function main() {
|
|
|
641
667
|
}
|
|
642
668
|
}
|
|
643
669
|
|
|
670
|
+
// Add OAuth authentication for tools that support it
|
|
671
|
+
toolArgs = addOAuthAuthArgs(route.tool, toolArgs);
|
|
672
|
+
|
|
644
673
|
// Use the reliable cross-platform execution function
|
|
645
674
|
try {
|
|
646
675
|
// Validate that the tool exists before attempting to execute
|
|
@@ -784,8 +813,11 @@ async function main() {
|
|
|
784
813
|
// Set environment for tools that need specific working directories
|
|
785
814
|
const env = { ...process.env };
|
|
786
815
|
if (route.tool === 'qwen') {
|
|
787
|
-
// For Qwen CLI, clear
|
|
816
|
+
// For Qwen CLI, clear Node.js environment variables to avoid import conflicts
|
|
788
817
|
delete env.NODE_PATH;
|
|
818
|
+
delete env.NODE_OPTIONS;
|
|
819
|
+
// Ensure clean environment
|
|
820
|
+
env.PWD = getWorkingDirectoryForTool(route.tool);
|
|
789
821
|
}
|
|
790
822
|
|
|
791
823
|
const result = await executeCommand(execCommand, execArgs, {
|
|
@@ -845,7 +877,11 @@ async function main() {
|
|
|
845
877
|
// Set environment for tools that need specific working directories
|
|
846
878
|
const env = { ...process.env };
|
|
847
879
|
if (route.tool === 'qwen') {
|
|
880
|
+
// For Qwen CLI, clear Node.js environment variables to avoid import conflicts
|
|
848
881
|
delete env.NODE_PATH;
|
|
882
|
+
delete env.NODE_OPTIONS;
|
|
883
|
+
// Ensure clean environment
|
|
884
|
+
env.PWD = getWorkingDirectoryForTool(route.tool);
|
|
849
885
|
}
|
|
850
886
|
|
|
851
887
|
const result = await executeCommand(toolPath, toolArgs, {
|
|
@@ -1493,6 +1529,9 @@ async function main() {
|
|
|
1493
1529
|
cliPattern,
|
|
1494
1530
|
);
|
|
1495
1531
|
|
|
1532
|
+
// Add OAuth authentication for tools that support it
|
|
1533
|
+
toolArgs = addOAuthAuthArgs(route.tool, toolArgs);
|
|
1534
|
+
|
|
1496
1535
|
// Add debug logging for the final arguments
|
|
1497
1536
|
console.log(`[DEBUG] Final toolArgs: ${JSON.stringify(toolArgs)}`);
|
|
1498
1537
|
} catch (patternError) {
|
|
@@ -1511,7 +1550,10 @@ async function main() {
|
|
|
1511
1550
|
// For other tools, pass the prompt with -p flag
|
|
1512
1551
|
toolArgs = ['-p', `"${route.prompt}"`];
|
|
1513
1552
|
}
|
|
1514
|
-
|
|
1553
|
+
|
|
1554
|
+
// Add OAuth authentication for tools that support it
|
|
1555
|
+
toolArgs = addOAuthAuthArgs(route.tool, toolArgs);
|
|
1556
|
+
|
|
1515
1557
|
// Add debug logging for the fallback arguments
|
|
1516
1558
|
console.log(`[DEBUG] Fallback toolArgs: ${JSON.stringify(toolArgs)}`);
|
|
1517
1559
|
}
|
|
@@ -1696,7 +1738,11 @@ async function main() {
|
|
|
1696
1738
|
// Set environment for tools that need specific working directories
|
|
1697
1739
|
const env = { ...process.env };
|
|
1698
1740
|
if (route.tool === 'qwen') {
|
|
1741
|
+
// For Qwen CLI, clear Node.js environment variables to avoid import conflicts
|
|
1699
1742
|
delete env.NODE_PATH;
|
|
1743
|
+
delete env.NODE_OPTIONS;
|
|
1744
|
+
// Ensure clean environment
|
|
1745
|
+
env.PWD = getWorkingDirectoryForTool(route.tool);
|
|
1700
1746
|
}
|
|
1701
1747
|
|
|
1702
1748
|
const result = await executeCommand(toolPath, toolArgs, {
|