stigmergy 1.3.15 → 1.3.16-beta.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stigmergy",
3
- "version": "1.3.15",
3
+ "version": "1.3.16-beta.1",
4
4
  "description": "Stigmergy CLI - Multi-Agents Cross-AI CLI Tools Collaboration System",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -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: {
@@ -45,7 +45,9 @@ class QwenInstaller {
45
45
  auto_detect: true,
46
46
  timeout: 30,
47
47
  collaboration_mode: 'active',
48
- qwen_oauth_integration: true
48
+ qwen_oauth_integration: true,
49
+ resumesession_enabled: true,
50
+ resumesession_integration: true
49
51
  };
50
52
 
51
53
  // Merge configs
@@ -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
 
@@ -29,8 +29,20 @@ const fs = require('fs');
29
29
  const path = require('path');
30
30
  const os = require('os');
31
31
 
32
- // Load shared path configuration
33
- const pathConfigLoader = require(path.join(__dirname, 'path-config-loader.js'));
32
+ // Embedded path configuration for CLI session paths
33
+ const getAllCLISessionPaths = () => {
34
+ const homeDir = os.homedir();
35
+ return {
36
+ claude: [path.join(homeDir, '.claude', 'projects')],
37
+ gemini: [path.join(homeDir, '.config', 'gemini', 'tmp')],
38
+ qwen: [path.join(homeDir, '.qwen', 'projects')],
39
+ iflow: [path.join(homeDir, '.iflow', 'projects')],
40
+ qodercli: [path.join(homeDir, '.qoder', 'projects')],
41
+ codebuddy: [path.join(homeDir, '.codebuddy')],
42
+ codex: [path.join(homeDir, '.config', 'codex')],
43
+ kode: [path.join(homeDir, '.kode', 'projects')]
44
+ };
45
+ };
34
46
 
35
47
  // Embedded ResumeSession Core Functionality
36
48
 
@@ -212,7 +224,7 @@ class SessionScanner {
212
224
 
213
225
  scanAllCLISessions(projectPath) {
214
226
  const allSessions = [];
215
- const cliPathsMap = pathConfigLoader.getAllCLISessionPaths();
227
+ const cliPathsMap = getAllCLISessionPaths();
216
228
 
217
229
  for (const [cliType, sessionsPaths] of Object.entries(cliPathsMap)) {
218
230
  for (const sessionsPath of sessionsPaths) {
@@ -578,13 +590,81 @@ ${this.generateCLIRegistrationCode(cliName, commandName, projectPath)}
578
590
  case 'codebuddy':
579
591
  return `
580
592
  // ${cliName.charAt(0).toUpperCase() + cliName.slice(1)} CLI integration
593
+
594
+ // Main command handler
595
+ function handleHistoryCommand(input) {
596
+ if (!input || typeof input !== 'string') {
597
+ return {
598
+ response: 'Usage: ' + commandName + ' [options]\\n' +
599
+ 'Options:\\n' +
600
+ ' --cli <name> Filter by CLI (claude, gemini, qwen, etc.)\\n' +
601
+ ' --search <term> Search in session content\\n' +
602
+ ' --limit <num> Maximum sessions to show (default: 10)\\n' +
603
+ ' --format <type> Output format: summary, detailed, json (default: summary)\\n' +
604
+ ' --time <range> Time range: today, week, month, all (default: all)',
605
+ suggestions: []
606
+ };
607
+ }
608
+
609
+ try {
610
+ const options = parseCommandOptions(input);
611
+ const historyQuery = new HistoryQuery();
612
+ const result = historyQuery.queryHistory(options, projectPath);
613
+
614
+ return {
615
+ response: result.response,
616
+ suggestions: result.suggestions || []
617
+ };
618
+ } catch (error) {
619
+ return {
620
+ response: 'Error: ' + error.message,
621
+ suggestions: []
622
+ };
623
+ }
624
+ }
625
+
626
+ // Parse command options
627
+ function parseCommandOptions(input) {
628
+ const options = {
629
+ limit: 10,
630
+ format: 'summary',
631
+ timeRange: 'all',
632
+ cli: null,
633
+ search: null
634
+ };
635
+
636
+ const cleanInput = input.replace(new RegExp('^\\\\/?' + commandName + '\\\\\s*', 'i'), '').trim();
637
+ const parts = cleanInput.split(/\\\s+/).filter(p => p.length > 0);
638
+
639
+ for (let i = 0; i < parts.length; i++) {
640
+ const part = parts[i].toLowerCase();
641
+ if (part === '--cli' && i + 1 < parts.length) {
642
+ options.cli = parts[++i];
643
+ } else if (part === '--search' && i + 1 < parts.length) {
644
+ options.search = parts[++i];
645
+ } else if (part === '--limit' && i + 1 < parts.length) {
646
+ options.limit = parseInt(parts[++i]);
647
+ } else if (part === '--format' && i + 1 < parts.length) {
648
+ options.format = parts[++i];
649
+ } else if (part === '--time' && i + 1 < parts.length) {
650
+ options.timeRange = parts[++i];
651
+ } else if (!part.startsWith('--') && !options.search) {
652
+ options.search = part;
653
+ }
654
+ }
655
+
656
+ return options;
657
+ }
658
+
659
+ // Register command
581
660
  if (typeof ${cliName} !== 'undefined') {
582
661
  ${cliName}.addCommand('${commandName}', handleHistoryCommand);
583
662
  }
584
663
 
585
664
  // 导出处理器
586
665
  module.exports = {
587
- handleHistoryCommand
666
+ handleHistoryCommand,
667
+ parseCommandOptions
588
668
  };`;
589
669
 
590
670
  case 'gemini':
@@ -625,8 +705,8 @@ class GeminiHistoryHandler {
625
705
  search: null
626
706
  };
627
707
 
628
- const cleanInput = input.replace(new RegExp('^\\\\\\\\/?' + this.commandName + '\\\\\\s*', 'i'), '').trim();
629
- const parts = cleanInput.split(/\\\\s+/).filter(p => p.length > 0);
708
+ const cleanInput = input.replace(new RegExp('^\\\\/?' + this.commandName + '\\\\\s*', 'i'), '').trim();
709
+ const parts = cleanInput.split(/\\\s+/).filter(p => p.length > 0);
630
710
 
631
711
  for (let i = 0; i < parts.length; i++) {
632
712
  const part = parts[i].toLowerCase();
@@ -636,6 +716,10 @@ class GeminiHistoryHandler {
636
716
  options.search = parts[++i];
637
717
  } else if (part === '--limit' && i + 1 < parts.length) {
638
718
  options.limit = parseInt(parts[++i]);
719
+ } else if (part === '--format' && i + 1 < parts.length) {
720
+ options.format = parts[++i];
721
+ } else if (part === '--time' && i + 1 < parts.length) {
722
+ options.timeRange = parts[++i];
639
723
  } else if (!part.startsWith('--') && !options.search) {
640
724
  options.search = part;
641
725
  }
@@ -653,7 +737,7 @@ if (typeof module !== 'undefined' && module.exports) {
653
737
  }
654
738
 
655
739
  if (typeof geminiCLI !== 'undefined') {
656
- const cmdName = '${commandName}'.replace(/^\\//, '');
740
+ const cmdName = '${commandName}'.replace(/^\\\//, '');
657
741
  geminiCLI.addCommandHandler(cmdName, handler.handleCommand.bind(handler));
658
742
  }`;
659
743
 
@@ -662,13 +746,81 @@ if (typeof geminiCLI !== 'undefined') {
662
746
  case 'kode':
663
747
  return `
664
748
  // ${cliName.charAt(0).toUpperCase() + cliName.slice(1)} CLI integration
749
+
750
+ // Main command handler
751
+ function handleHistoryCommand(input) {
752
+ if (!input || typeof input !== 'string') {
753
+ return {
754
+ response: 'Usage: ' + commandName + ' [options]\\n' +
755
+ 'Options:\\n' +
756
+ ' --cli <name> Filter by CLI (claude, gemini, qwen, etc.)\\n' +
757
+ ' --search <term> Search in session content\\n' +
758
+ ' --limit <num> Maximum sessions to show (default: 10)\\n' +
759
+ ' --format <type> Output format: summary, detailed, json (default: summary)\\n' +
760
+ ' --time <range> Time range: today, week, month, all (default: all)',
761
+ suggestions: []
762
+ };
763
+ }
764
+
765
+ try {
766
+ const options = parseCommandOptions(input);
767
+ const historyQuery = new HistoryQuery();
768
+ const result = historyQuery.queryHistory(options, projectPath);
769
+
770
+ return {
771
+ response: result.response,
772
+ suggestions: result.suggestions || []
773
+ };
774
+ } catch (error) {
775
+ return {
776
+ response: 'Error: ' + error.message,
777
+ suggestions: []
778
+ };
779
+ }
780
+ }
781
+
782
+ // Parse command options
783
+ function parseCommandOptions(input) {
784
+ const options = {
785
+ limit: 10,
786
+ format: 'summary',
787
+ timeRange: 'all',
788
+ cli: null,
789
+ search: null
790
+ };
791
+
792
+ const cleanInput = input.replace(new RegExp('^\\\\/?' + commandName + '\\\\\s*', 'i'), '').trim();
793
+ const parts = cleanInput.split(/\\\s+/).filter(p => p.length > 0);
794
+
795
+ for (let i = 0; i < parts.length; i++) {
796
+ const part = parts[i].toLowerCase();
797
+ if (part === '--cli' && i + 1 < parts.length) {
798
+ options.cli = parts[++i];
799
+ } else if (part === '--search' && i + 1 < parts.length) {
800
+ options.search = parts[++i];
801
+ } else if (part === '--limit' && i + 1 < parts.length) {
802
+ options.limit = parseInt(parts[++i]);
803
+ } else if (part === '--format' && i + 1 < parts.length) {
804
+ options.format = parts[++i];
805
+ } else if (part === '--time' && i + 1 < parts.length) {
806
+ options.timeRange = parts[++i];
807
+ } else if (!part.startsWith('--') && !options.search) {
808
+ options.search = part;
809
+ }
810
+ }
811
+
812
+ return options;
813
+ }
814
+
815
+ // Register extension
665
816
  if (typeof ${cliName} !== 'undefined' && ${cliName}.addExtension) {
666
817
  ${cliName}.addExtension('history', handleHistoryCommand);
667
818
  }
668
819
 
669
820
  // 导出处理器
670
821
  module.exports = {
671
- handleHistoryCommand
822
+ handleHistoryCommand,
823
+ parseCommandOptions
672
824
  };`;
673
825
 
674
826
  default:
@@ -676,9 +828,75 @@ module.exports = {
676
828
  // ${cliName.charAt(0).toUpperCase() + cliName.slice(1)} CLI integration
677
829
  // Generic registration - may need customization for specific CLI
678
830
 
831
+ // Main command handler
832
+ function handleHistoryCommand(input) {
833
+ if (!input || typeof input !== 'string') {
834
+ return {
835
+ response: 'Usage: ' + commandName + ' [options]\\n' +
836
+ 'Options:\\n' +
837
+ ' --cli <name> Filter by CLI (claude, gemini, qwen, etc.)\\n' +
838
+ ' --search <term> Search in session content\\n' +
839
+ ' --limit <num> Maximum sessions to show (default: 10)\\n' +
840
+ ' --format <type> Output format: summary, detailed, json (default: summary)\\n' +
841
+ ' --time <range> Time range: today, week, month, all (default: all)',
842
+ suggestions: []
843
+ };
844
+ }
845
+
846
+ try {
847
+ const options = parseCommandOptions(input);
848
+ const historyQuery = new HistoryQuery();
849
+ const result = historyQuery.queryHistory(options, projectPath);
850
+
851
+ return {
852
+ response: result.response,
853
+ suggestions: result.suggestions || []
854
+ };
855
+ } catch (error) {
856
+ return {
857
+ response: 'Error: ' + error.message,
858
+ suggestions: []
859
+ };
860
+ }
861
+ }
862
+
863
+ // Parse command options
864
+ function parseCommandOptions(input) {
865
+ const options = {
866
+ limit: 10,
867
+ format: 'summary',
868
+ timeRange: 'all',
869
+ cli: null,
870
+ search: null
871
+ };
872
+
873
+ const cleanInput = input.replace(new RegExp('^\\\\/?' + commandName + '\\\\\s*', 'i'), '').trim();
874
+ const parts = cleanInput.split(/\\\s+/).filter(p => p.length > 0);
875
+
876
+ for (let i = 0; i < parts.length; i++) {
877
+ const part = parts[i].toLowerCase();
878
+ if (part === '--cli' && i + 1 < parts.length) {
879
+ options.cli = parts[++i];
880
+ } else if (part === '--search' && i + 1 < parts.length) {
881
+ options.search = parts[++i];
882
+ } else if (part === '--limit' && i + 1 < parts.length) {
883
+ options.limit = parseInt(parts[++i]);
884
+ } else if (part === '--format' && i + 1 < parts.length) {
885
+ options.format = parts[++i];
886
+ } else if (part === '--time' && i + 1 < parts.length) {
887
+ options.timeRange = parts[++i];
888
+ } else if (!part.startsWith('--') && !options.search) {
889
+ options.search = part;
890
+ }
891
+ }
892
+
893
+ return options;
894
+ }
895
+
679
896
  if (typeof module !== 'undefined' && module.exports) {
680
897
  module.exports = {
681
- handleHistoryCommand
898
+ handleHistoryCommand,
899
+ parseCommandOptions
682
900
  };
683
901
  }`;
684
902
  }