stigmergy 1.3.15 → 1.3.16-beta.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/package.json +1 -1
- package/src/adapters/claude/install_claude_integration.js +9 -1
- package/src/adapters/codebuddy/install_codebuddy_integration.js +3 -1
- package/src/adapters/codex/install_codex_integration.js +15 -5
- package/src/adapters/gemini/install_gemini_integration.js +3 -1
- package/src/adapters/qwen/install_qwen_integration.js +3 -1
- package/src/core/coordination/nodejs/HookDeploymentManager.js +33 -0
- package/src/core/coordination/nodejs/generators/ResumeSessionGenerator.js +212 -6
package/package.json
CHANGED
|
@@ -46,7 +46,9 @@ class ClaudeInstaller {
|
|
|
46
46
|
timeout: 30,
|
|
47
47
|
collaboration_mode: 'active',
|
|
48
48
|
claude_skills_integration: true,
|
|
49
|
-
claude_hooks_enabled: true
|
|
49
|
+
claude_hooks_enabled: true,
|
|
50
|
+
resumesession_enabled: true,
|
|
51
|
+
resumesession_integration: true
|
|
50
52
|
};
|
|
51
53
|
|
|
52
54
|
// Merge configs
|
|
@@ -85,6 +87,12 @@ class ClaudeInstaller {
|
|
|
85
87
|
enabled: true,
|
|
86
88
|
auto_register: true,
|
|
87
89
|
cross_cli_aware: true
|
|
90
|
+
},
|
|
91
|
+
resumesession: {
|
|
92
|
+
enabled: true,
|
|
93
|
+
command: '/stigmergy-resume',
|
|
94
|
+
description: 'Resume or query session history across CLIs',
|
|
95
|
+
version: '1.0.4'
|
|
88
96
|
}
|
|
89
97
|
};
|
|
90
98
|
|
|
@@ -68,7 +68,9 @@ class CodeBuddyIntegrationInstaller {
|
|
|
68
68
|
supported_clis: ['claude', 'gemini', 'qwen', 'iflow', 'qoder', 'copilot'],
|
|
69
69
|
auto_route: true,
|
|
70
70
|
timeout: 30,
|
|
71
|
-
collaboration_mode: 'active'
|
|
71
|
+
collaboration_mode: 'active',
|
|
72
|
+
resumesession_enabled: true,
|
|
73
|
+
resumesession_integration: true
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
};
|
|
@@ -60,7 +60,9 @@ class CodexIntegrationInstaller {
|
|
|
60
60
|
module: 'src.core.enhanced_init_processor',
|
|
61
61
|
enabled: true,
|
|
62
62
|
cross_cli_enabled: true,
|
|
63
|
-
supported_clis: ['claude', 'gemini', 'qwen', 'iflow', 'qoder', 'codebuddy', 'copilot']
|
|
63
|
+
supported_clis: ['claude', 'gemini', 'qwen', 'iflow', 'qoder', 'codebuddy', 'copilot'],
|
|
64
|
+
resumesession_enabled: true,
|
|
65
|
+
resumesession_integration: true
|
|
64
66
|
},
|
|
65
67
|
scan: {
|
|
66
68
|
command: 'scan',
|
|
@@ -68,7 +70,9 @@ class CodexIntegrationInstaller {
|
|
|
68
70
|
module: 'src.core.ai_environment_scanner',
|
|
69
71
|
enabled: true,
|
|
70
72
|
cross_cli_enabled: true,
|
|
71
|
-
supported_clis: ['claude', 'gemini', 'qwen', 'iflow', 'qoder', 'codebuddy', 'copilot']
|
|
73
|
+
supported_clis: ['claude', 'gemini', 'qwen', 'iflow', 'qoder', 'codebuddy', 'copilot'],
|
|
74
|
+
resumesession_enabled: true,
|
|
75
|
+
resumesession_integration: true
|
|
72
76
|
},
|
|
73
77
|
status: {
|
|
74
78
|
command: 'status',
|
|
@@ -76,7 +80,9 @@ class CodexIntegrationInstaller {
|
|
|
76
80
|
module: 'src.core.cli_hook_integration',
|
|
77
81
|
enabled: true,
|
|
78
82
|
cross_cli_enabled: true,
|
|
79
|
-
supported_clis: ['claude', 'gemini', 'qwen', 'iflow', 'qoder', 'codebuddy', 'copilot']
|
|
83
|
+
supported_clis: ['claude', 'gemini', 'qwen', 'iflow', 'qoder', 'codebuddy', 'copilot'],
|
|
84
|
+
resumesession_enabled: true,
|
|
85
|
+
resumesession_integration: true
|
|
80
86
|
},
|
|
81
87
|
deploy: {
|
|
82
88
|
command: 'deploy',
|
|
@@ -84,7 +90,9 @@ class CodexIntegrationInstaller {
|
|
|
84
90
|
module: 'src.core.cli_hook_integration',
|
|
85
91
|
enabled: true,
|
|
86
92
|
cross_cli_enabled: true,
|
|
87
|
-
supported_clis: ['claude', 'gemini', 'qwen', 'iflow', 'qoder', 'codebuddy', 'copilot']
|
|
93
|
+
supported_clis: ['claude', 'gemini', 'qwen', 'iflow', 'qoder', 'codebuddy', 'copilot'],
|
|
94
|
+
resumesession_enabled: true,
|
|
95
|
+
resumesession_integration: true
|
|
88
96
|
},
|
|
89
97
|
call: {
|
|
90
98
|
command: 'call',
|
|
@@ -92,7 +100,9 @@ class CodexIntegrationInstaller {
|
|
|
92
100
|
module: 'src.core.cli_hook_integration',
|
|
93
101
|
enabled: true,
|
|
94
102
|
cross_cli_enabled: true,
|
|
95
|
-
supported_clis: ['claude', 'gemini', 'qwen', 'iflow', 'qoder', 'codebuddy', 'copilot']
|
|
103
|
+
supported_clis: ['claude', 'gemini', 'qwen', 'iflow', 'qoder', 'codebuddy', 'copilot'],
|
|
104
|
+
resumesession_enabled: true,
|
|
105
|
+
resumesession_integration: true
|
|
96
106
|
}
|
|
97
107
|
};
|
|
98
108
|
|
|
@@ -63,7 +63,9 @@ class GeminiIntegrationInstaller {
|
|
|
63
63
|
auto_detect: true,
|
|
64
64
|
timeout: 30,
|
|
65
65
|
error_handling: 'continue',
|
|
66
|
-
collaboration_mode: 'active'
|
|
66
|
+
collaboration_mode: 'active',
|
|
67
|
+
resumesession_enabled: true,
|
|
68
|
+
resumesession_integration: true
|
|
67
69
|
}
|
|
68
70
|
},
|
|
69
71
|
cross_cli_response_processor: {
|
|
@@ -129,6 +129,9 @@ class HookDeploymentManager {
|
|
|
129
129
|
);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
// Create or update hooks.json to register the stigmergy-resume command
|
|
133
|
+
await this.updateHooksJson(cliName, hookDir, fileName);
|
|
134
|
+
|
|
132
135
|
return true;
|
|
133
136
|
} catch (error) {
|
|
134
137
|
console.error(`[HOOK_DEPLOYMENT] Failed to deploy ResumeSession extension for ${cliName}:`, error);
|
|
@@ -136,6 +139,36 @@ class HookDeploymentManager {
|
|
|
136
139
|
}
|
|
137
140
|
}
|
|
138
141
|
|
|
142
|
+
async updateHooksJson(cliName, hookDir, resumeSessionFileName) {
|
|
143
|
+
const hooksJsonPath = path.join(hookDir, 'hooks.json');
|
|
144
|
+
let hooksConfig = {};
|
|
145
|
+
|
|
146
|
+
// Load existing hooks.json if it exists
|
|
147
|
+
if (fs.existsSync(hooksJsonPath)) {
|
|
148
|
+
try {
|
|
149
|
+
const existingContent = fs.readFileSync(hooksJsonPath, 'utf8');
|
|
150
|
+
hooksConfig = JSON.parse(existingContent);
|
|
151
|
+
} catch (error) {
|
|
152
|
+
console.warn(`[HOOK_DEPLOYMENT] Failed to parse existing hooks.json, creating new one: ${error.message}`);
|
|
153
|
+
hooksConfig = {};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Register the stigmergy-resume command
|
|
158
|
+
hooksConfig.resumesession = {
|
|
159
|
+
enabled: true,
|
|
160
|
+
command: '/stigmergy-resume',
|
|
161
|
+
handler: resumeSessionFileName,
|
|
162
|
+
description: 'Resume or query session history across CLIs',
|
|
163
|
+
version: '1.0.4',
|
|
164
|
+
deploymentTime: new Date().toISOString()
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// Write the updated hooks.json
|
|
168
|
+
fs.writeFileSync(hooksJsonPath, JSON.stringify(hooksConfig, null, 2));
|
|
169
|
+
console.log(`[HOOK_DEPLOYMENT] Updated hooks.json with resumesession command: ${hooksJsonPath}`);
|
|
170
|
+
}
|
|
171
|
+
|
|
139
172
|
async deploySkillsIntegration(cliName, hookDir) {
|
|
140
173
|
console.log(`[HOOK_DEPLOYMENT] Deploying skills integration for ${cliName}...`);
|
|
141
174
|
|
|
@@ -578,13 +578,81 @@ ${this.generateCLIRegistrationCode(cliName, commandName, projectPath)}
|
|
|
578
578
|
case 'codebuddy':
|
|
579
579
|
return `
|
|
580
580
|
// ${cliName.charAt(0).toUpperCase() + cliName.slice(1)} CLI integration
|
|
581
|
+
|
|
582
|
+
// Main command handler
|
|
583
|
+
function handleHistoryCommand(input) {
|
|
584
|
+
if (!input || typeof input !== 'string') {
|
|
585
|
+
return {
|
|
586
|
+
response: 'Usage: ' + commandName + ' [options]\\n' +
|
|
587
|
+
'Options:\\n' +
|
|
588
|
+
' --cli <name> Filter by CLI (claude, gemini, qwen, etc.)\\n' +
|
|
589
|
+
' --search <term> Search in session content\\n' +
|
|
590
|
+
' --limit <num> Maximum sessions to show (default: 10)\\n' +
|
|
591
|
+
' --format <type> Output format: summary, detailed, json (default: summary)\\n' +
|
|
592
|
+
' --time <range> Time range: today, week, month, all (default: all)',
|
|
593
|
+
suggestions: []
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
try {
|
|
598
|
+
const options = parseCommandOptions(input);
|
|
599
|
+
const historyQuery = new HistoryQuery();
|
|
600
|
+
const result = historyQuery.queryHistory(options, projectPath);
|
|
601
|
+
|
|
602
|
+
return {
|
|
603
|
+
response: result.response,
|
|
604
|
+
suggestions: result.suggestions || []
|
|
605
|
+
};
|
|
606
|
+
} catch (error) {
|
|
607
|
+
return {
|
|
608
|
+
response: 'Error: ' + error.message,
|
|
609
|
+
suggestions: []
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// Parse command options
|
|
615
|
+
function parseCommandOptions(input) {
|
|
616
|
+
const options = {
|
|
617
|
+
limit: 10,
|
|
618
|
+
format: 'summary',
|
|
619
|
+
timeRange: 'all',
|
|
620
|
+
cli: null,
|
|
621
|
+
search: null
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
const cleanInput = input.replace(new RegExp('^\\\\/?' + commandName + '\\\\\s*', 'i'), '').trim();
|
|
625
|
+
const parts = cleanInput.split(/\\\s+/).filter(p => p.length > 0);
|
|
626
|
+
|
|
627
|
+
for (let i = 0; i < parts.length; i++) {
|
|
628
|
+
const part = parts[i].toLowerCase();
|
|
629
|
+
if (part === '--cli' && i + 1 < parts.length) {
|
|
630
|
+
options.cli = parts[++i];
|
|
631
|
+
} else if (part === '--search' && i + 1 < parts.length) {
|
|
632
|
+
options.search = parts[++i];
|
|
633
|
+
} else if (part === '--limit' && i + 1 < parts.length) {
|
|
634
|
+
options.limit = parseInt(parts[++i]);
|
|
635
|
+
} else if (part === '--format' && i + 1 < parts.length) {
|
|
636
|
+
options.format = parts[++i];
|
|
637
|
+
} else if (part === '--time' && i + 1 < parts.length) {
|
|
638
|
+
options.timeRange = parts[++i];
|
|
639
|
+
} else if (!part.startsWith('--') && !options.search) {
|
|
640
|
+
options.search = part;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
return options;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
// Register command
|
|
581
648
|
if (typeof ${cliName} !== 'undefined') {
|
|
582
649
|
${cliName}.addCommand('${commandName}', handleHistoryCommand);
|
|
583
650
|
}
|
|
584
651
|
|
|
585
652
|
// 导出处理器
|
|
586
653
|
module.exports = {
|
|
587
|
-
handleHistoryCommand
|
|
654
|
+
handleHistoryCommand,
|
|
655
|
+
parseCommandOptions
|
|
588
656
|
};`;
|
|
589
657
|
|
|
590
658
|
case 'gemini':
|
|
@@ -625,8 +693,8 @@ class GeminiHistoryHandler {
|
|
|
625
693
|
search: null
|
|
626
694
|
};
|
|
627
695
|
|
|
628
|
-
const cleanInput = input.replace(new RegExp('
|
|
629
|
-
const parts = cleanInput.split(
|
|
696
|
+
const cleanInput = input.replace(new RegExp('^\\\\/?' + this.commandName + '\\\\\s*', 'i'), '').trim();
|
|
697
|
+
const parts = cleanInput.split(/\\\s+/).filter(p => p.length > 0);
|
|
630
698
|
|
|
631
699
|
for (let i = 0; i < parts.length; i++) {
|
|
632
700
|
const part = parts[i].toLowerCase();
|
|
@@ -636,6 +704,10 @@ class GeminiHistoryHandler {
|
|
|
636
704
|
options.search = parts[++i];
|
|
637
705
|
} else if (part === '--limit' && i + 1 < parts.length) {
|
|
638
706
|
options.limit = parseInt(parts[++i]);
|
|
707
|
+
} else if (part === '--format' && i + 1 < parts.length) {
|
|
708
|
+
options.format = parts[++i];
|
|
709
|
+
} else if (part === '--time' && i + 1 < parts.length) {
|
|
710
|
+
options.timeRange = parts[++i];
|
|
639
711
|
} else if (!part.startsWith('--') && !options.search) {
|
|
640
712
|
options.search = part;
|
|
641
713
|
}
|
|
@@ -653,7 +725,7 @@ if (typeof module !== 'undefined' && module.exports) {
|
|
|
653
725
|
}
|
|
654
726
|
|
|
655
727
|
if (typeof geminiCLI !== 'undefined') {
|
|
656
|
-
const cmdName = '${commandName}'.replace(
|
|
728
|
+
const cmdName = '${commandName}'.replace(/^\\\//, '');
|
|
657
729
|
geminiCLI.addCommandHandler(cmdName, handler.handleCommand.bind(handler));
|
|
658
730
|
}`;
|
|
659
731
|
|
|
@@ -662,13 +734,81 @@ if (typeof geminiCLI !== 'undefined') {
|
|
|
662
734
|
case 'kode':
|
|
663
735
|
return `
|
|
664
736
|
// ${cliName.charAt(0).toUpperCase() + cliName.slice(1)} CLI integration
|
|
737
|
+
|
|
738
|
+
// Main command handler
|
|
739
|
+
function handleHistoryCommand(input) {
|
|
740
|
+
if (!input || typeof input !== 'string') {
|
|
741
|
+
return {
|
|
742
|
+
response: 'Usage: ' + commandName + ' [options]\\n' +
|
|
743
|
+
'Options:\\n' +
|
|
744
|
+
' --cli <name> Filter by CLI (claude, gemini, qwen, etc.)\\n' +
|
|
745
|
+
' --search <term> Search in session content\\n' +
|
|
746
|
+
' --limit <num> Maximum sessions to show (default: 10)\\n' +
|
|
747
|
+
' --format <type> Output format: summary, detailed, json (default: summary)\\n' +
|
|
748
|
+
' --time <range> Time range: today, week, month, all (default: all)',
|
|
749
|
+
suggestions: []
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
try {
|
|
754
|
+
const options = parseCommandOptions(input);
|
|
755
|
+
const historyQuery = new HistoryQuery();
|
|
756
|
+
const result = historyQuery.queryHistory(options, projectPath);
|
|
757
|
+
|
|
758
|
+
return {
|
|
759
|
+
response: result.response,
|
|
760
|
+
suggestions: result.suggestions || []
|
|
761
|
+
};
|
|
762
|
+
} catch (error) {
|
|
763
|
+
return {
|
|
764
|
+
response: 'Error: ' + error.message,
|
|
765
|
+
suggestions: []
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// Parse command options
|
|
771
|
+
function parseCommandOptions(input) {
|
|
772
|
+
const options = {
|
|
773
|
+
limit: 10,
|
|
774
|
+
format: 'summary',
|
|
775
|
+
timeRange: 'all',
|
|
776
|
+
cli: null,
|
|
777
|
+
search: null
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
const cleanInput = input.replace(new RegExp('^\\\\/?' + commandName + '\\\\\s*', 'i'), '').trim();
|
|
781
|
+
const parts = cleanInput.split(/\\\s+/).filter(p => p.length > 0);
|
|
782
|
+
|
|
783
|
+
for (let i = 0; i < parts.length; i++) {
|
|
784
|
+
const part = parts[i].toLowerCase();
|
|
785
|
+
if (part === '--cli' && i + 1 < parts.length) {
|
|
786
|
+
options.cli = parts[++i];
|
|
787
|
+
} else if (part === '--search' && i + 1 < parts.length) {
|
|
788
|
+
options.search = parts[++i];
|
|
789
|
+
} else if (part === '--limit' && i + 1 < parts.length) {
|
|
790
|
+
options.limit = parseInt(parts[++i]);
|
|
791
|
+
} else if (part === '--format' && i + 1 < parts.length) {
|
|
792
|
+
options.format = parts[++i];
|
|
793
|
+
} else if (part === '--time' && i + 1 < parts.length) {
|
|
794
|
+
options.timeRange = parts[++i];
|
|
795
|
+
} else if (!part.startsWith('--') && !options.search) {
|
|
796
|
+
options.search = part;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
return options;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
// Register extension
|
|
665
804
|
if (typeof ${cliName} !== 'undefined' && ${cliName}.addExtension) {
|
|
666
805
|
${cliName}.addExtension('history', handleHistoryCommand);
|
|
667
806
|
}
|
|
668
807
|
|
|
669
808
|
// 导出处理器
|
|
670
809
|
module.exports = {
|
|
671
|
-
handleHistoryCommand
|
|
810
|
+
handleHistoryCommand,
|
|
811
|
+
parseCommandOptions
|
|
672
812
|
};`;
|
|
673
813
|
|
|
674
814
|
default:
|
|
@@ -676,9 +816,75 @@ module.exports = {
|
|
|
676
816
|
// ${cliName.charAt(0).toUpperCase() + cliName.slice(1)} CLI integration
|
|
677
817
|
// Generic registration - may need customization for specific CLI
|
|
678
818
|
|
|
819
|
+
// Main command handler
|
|
820
|
+
function handleHistoryCommand(input) {
|
|
821
|
+
if (!input || typeof input !== 'string') {
|
|
822
|
+
return {
|
|
823
|
+
response: 'Usage: ' + commandName + ' [options]\\n' +
|
|
824
|
+
'Options:\\n' +
|
|
825
|
+
' --cli <name> Filter by CLI (claude, gemini, qwen, etc.)\\n' +
|
|
826
|
+
' --search <term> Search in session content\\n' +
|
|
827
|
+
' --limit <num> Maximum sessions to show (default: 10)\\n' +
|
|
828
|
+
' --format <type> Output format: summary, detailed, json (default: summary)\\n' +
|
|
829
|
+
' --time <range> Time range: today, week, month, all (default: all)',
|
|
830
|
+
suggestions: []
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
try {
|
|
835
|
+
const options = parseCommandOptions(input);
|
|
836
|
+
const historyQuery = new HistoryQuery();
|
|
837
|
+
const result = historyQuery.queryHistory(options, projectPath);
|
|
838
|
+
|
|
839
|
+
return {
|
|
840
|
+
response: result.response,
|
|
841
|
+
suggestions: result.suggestions || []
|
|
842
|
+
};
|
|
843
|
+
} catch (error) {
|
|
844
|
+
return {
|
|
845
|
+
response: 'Error: ' + error.message,
|
|
846
|
+
suggestions: []
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
// Parse command options
|
|
852
|
+
function parseCommandOptions(input) {
|
|
853
|
+
const options = {
|
|
854
|
+
limit: 10,
|
|
855
|
+
format: 'summary',
|
|
856
|
+
timeRange: 'all',
|
|
857
|
+
cli: null,
|
|
858
|
+
search: null
|
|
859
|
+
};
|
|
860
|
+
|
|
861
|
+
const cleanInput = input.replace(new RegExp('^\\\\/?' + commandName + '\\\\\s*', 'i'), '').trim();
|
|
862
|
+
const parts = cleanInput.split(/\\\s+/).filter(p => p.length > 0);
|
|
863
|
+
|
|
864
|
+
for (let i = 0; i < parts.length; i++) {
|
|
865
|
+
const part = parts[i].toLowerCase();
|
|
866
|
+
if (part === '--cli' && i + 1 < parts.length) {
|
|
867
|
+
options.cli = parts[++i];
|
|
868
|
+
} else if (part === '--search' && i + 1 < parts.length) {
|
|
869
|
+
options.search = parts[++i];
|
|
870
|
+
} else if (part === '--limit' && i + 1 < parts.length) {
|
|
871
|
+
options.limit = parseInt(parts[++i]);
|
|
872
|
+
} else if (part === '--format' && i + 1 < parts.length) {
|
|
873
|
+
options.format = parts[++i];
|
|
874
|
+
} else if (part === '--time' && i + 1 < parts.length) {
|
|
875
|
+
options.timeRange = parts[++i];
|
|
876
|
+
} else if (!part.startsWith('--') && !options.search) {
|
|
877
|
+
options.search = part;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
return options;
|
|
882
|
+
}
|
|
883
|
+
|
|
679
884
|
if (typeof module !== 'undefined' && module.exports) {
|
|
680
885
|
module.exports = {
|
|
681
|
-
handleHistoryCommand
|
|
886
|
+
handleHistoryCommand,
|
|
887
|
+
parseCommandOptions
|
|
682
888
|
};
|
|
683
889
|
}`;
|
|
684
890
|
}
|