stigmergy 1.0.57
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/LICENSE +19 -0
- package/README.de.md +301 -0
- package/README.en.md +301 -0
- package/README.es.md +301 -0
- package/README.fr.md +301 -0
- package/README.ja.md +301 -0
- package/README.ko.md +301 -0
- package/README.md +301 -0
- package/README.ru.md +301 -0
- package/README.zh.md +301 -0
- package/package.json +82 -0
- package/src/adapters/claude/__init__.py +13 -0
- package/src/adapters/claude/claude_skills_integration.py +609 -0
- package/src/adapters/claude/hook_adapter.py +663 -0
- package/src/adapters/claude/install_claude_integration.py +265 -0
- package/src/adapters/claude/skills_hook_adapter.py +841 -0
- package/src/adapters/claude/standalone_claude_adapter.py +384 -0
- package/src/adapters/cline/__init__.py +20 -0
- package/src/adapters/cline/config.py +108 -0
- package/src/adapters/cline/install_cline_integration.py +617 -0
- package/src/adapters/cline/mcp_server.py +713 -0
- package/src/adapters/cline/standalone_cline_adapter.py +459 -0
- package/src/adapters/codebuddy/__init__.py +13 -0
- package/src/adapters/codebuddy/buddy_adapter.py +1125 -0
- package/src/adapters/codebuddy/install_codebuddy_integration.py +279 -0
- package/src/adapters/codebuddy/skills_hook_adapter.py +672 -0
- package/src/adapters/codebuddy/skills_integration.py +395 -0
- package/src/adapters/codebuddy/standalone_codebuddy_adapter.py +403 -0
- package/src/adapters/codex/__init__.py +11 -0
- package/src/adapters/codex/base.py +46 -0
- package/src/adapters/codex/install_codex_integration.py +311 -0
- package/src/adapters/codex/mcp_server.py +493 -0
- package/src/adapters/codex/natural_language_parser.py +82 -0
- package/src/adapters/codex/slash_command_adapter.py +326 -0
- package/src/adapters/codex/standalone_codex_adapter.py +362 -0
- package/src/adapters/copilot/__init__.py +13 -0
- package/src/adapters/copilot/install_copilot_integration.py +564 -0
- package/src/adapters/copilot/mcp_adapter.py +772 -0
- package/src/adapters/copilot/mcp_server.py +168 -0
- package/src/adapters/copilot/standalone_copilot_adapter.py +114 -0
- package/src/adapters/gemini/__init__.py +13 -0
- package/src/adapters/gemini/extension_adapter.py +690 -0
- package/src/adapters/gemini/install_gemini_integration.py +257 -0
- package/src/adapters/gemini/standalone_gemini_adapter.py +366 -0
- package/src/adapters/iflow/__init__.py +7 -0
- package/src/adapters/iflow/hook_adapter.py +1038 -0
- package/src/adapters/iflow/hook_installer.py +536 -0
- package/src/adapters/iflow/install_iflow_integration.py +271 -0
- package/src/adapters/iflow/official_hook_adapter.py +1272 -0
- package/src/adapters/iflow/standalone_iflow_adapter.py +48 -0
- package/src/adapters/iflow/workflow_adapter.py +793 -0
- package/src/adapters/qoder/hook_installer.py +732 -0
- package/src/adapters/qoder/install_qoder_integration.py +265 -0
- package/src/adapters/qoder/notification_hook_adapter.py +863 -0
- package/src/adapters/qoder/standalone_qoder_adapter.py +48 -0
- package/src/adapters/qwen/__init__.py +17 -0
- package/src/adapters/qwencode/__init__.py +13 -0
- package/src/adapters/qwencode/inheritance_adapter.py +818 -0
- package/src/adapters/qwencode/install_qwencode_integration.py +276 -0
- package/src/adapters/qwencode/standalone_qwencode_adapter.py +399 -0
- package/src/atomic_collaboration_handler.py +461 -0
- package/src/cli_collaboration_agent.py +697 -0
- package/src/collaboration/hooks.py +315 -0
- package/src/core/__init__.py +21 -0
- package/src/core/ai_environment_scanner.py +331 -0
- package/src/core/base_adapter.py +220 -0
- package/src/core/cli_hook_integration.py +406 -0
- package/src/core/cross_cli_executor.py +713 -0
- package/src/core/cross_cli_mapping.py +1163 -0
- package/src/core/cross_platform_encoding.py +365 -0
- package/src/core/cross_platform_safe_cli.py +894 -0
- package/src/core/direct_cli_executor.py +805 -0
- package/src/core/direct_cli_hook_system.py +958 -0
- package/src/core/enhanced_init_processor.py +427 -0
- package/src/core/graceful_cli_executor.py +912 -0
- package/src/core/md_enhancer.py +342 -0
- package/src/core/md_generator.py +619 -0
- package/src/core/models.py +218 -0
- package/src/core/parser.py +108 -0
- package/src/core/real_cli_hook_system.py +852 -0
- package/src/core/real_cross_cli_system.py +925 -0
- package/src/core/verified_cross_cli_system.py +961 -0
- package/src/deploy.js +737 -0
- package/src/enhanced_deploy.js +303 -0
- package/src/enhanced_universal_cli_setup.py +930 -0
- package/src/kimi_wrapper.py +104 -0
- package/src/main.js +1309 -0
- package/src/shell_integration.py +398 -0
- package/src/simple-main.js +315 -0
- package/src/smart_router_creator.py +323 -0
- package/src/universal_cli_setup.py +1289 -0
- package/src/utils/__init__.py +12 -0
- package/src/utils/cli_detector.py +445 -0
- package/src/utils/file_utils.py +246 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
Kimi CLI包装器 - 解决兼容性问题
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import subprocess
|
|
8
|
+
import sys
|
|
9
|
+
import os
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def kimi_chat(prompt, model="moonshot-v1-8k"):
|
|
13
|
+
"""使用kimi进行对话"""
|
|
14
|
+
try:
|
|
15
|
+
# 方法1: 尝试使用环境变量传递提示
|
|
16
|
+
env = os.environ.copy()
|
|
17
|
+
env['KIMI_PROMPT'] = prompt
|
|
18
|
+
|
|
19
|
+
# 使用子进程启动kimi,然后发送输入
|
|
20
|
+
process = subprocess.Popen(
|
|
21
|
+
['kimi', '--model', model],
|
|
22
|
+
stdin=subprocess.PIPE,
|
|
23
|
+
stdout=subprocess.PIPE,
|
|
24
|
+
stderr=subprocess.PIPE,
|
|
25
|
+
text=True,
|
|
26
|
+
env=env
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# 发送提示并等待输出
|
|
30
|
+
stdout, stderr = process.communicate(input=prompt + '\n', timeout=60)
|
|
31
|
+
|
|
32
|
+
if process.returncode == 0:
|
|
33
|
+
return stdout
|
|
34
|
+
else:
|
|
35
|
+
return f"错误: {stderr}"
|
|
36
|
+
|
|
37
|
+
except subprocess.TimeoutExpired:
|
|
38
|
+
return "请求超时"
|
|
39
|
+
except Exception as e:
|
|
40
|
+
return f"异常: {str(e)}"
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def kimi_direct_api(prompt):
|
|
44
|
+
"""直接调用Kimi API(如果可用)"""
|
|
45
|
+
try:
|
|
46
|
+
import requests
|
|
47
|
+
|
|
48
|
+
api_key = os.getenv('KIMI_API_KEY')
|
|
49
|
+
if not api_key:
|
|
50
|
+
return "未设置KIMI_API_KEY环境变量"
|
|
51
|
+
|
|
52
|
+
headers = {
|
|
53
|
+
'Authorization': f'Bearer {api_key}',
|
|
54
|
+
'Content-Type': 'application/json'
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
data = {
|
|
58
|
+
'model': 'moonshot-v1-8k',
|
|
59
|
+
'messages': [
|
|
60
|
+
{'role': 'user', 'content': prompt}
|
|
61
|
+
],
|
|
62
|
+
'temperature': 0.7
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
response = requests.post(
|
|
66
|
+
'https://api.moonshot.cn/v1/chat/completions',
|
|
67
|
+
headers=headers,
|
|
68
|
+
json=data,
|
|
69
|
+
timeout=30
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
if response.status_code == 200:
|
|
73
|
+
return response.json()['choices'][0]['message']['content']
|
|
74
|
+
else:
|
|
75
|
+
return f"API错误: {response.status_code} - {response.text}"
|
|
76
|
+
|
|
77
|
+
except ImportError:
|
|
78
|
+
return "需要安装requests库: pip install requests"
|
|
79
|
+
except Exception as e:
|
|
80
|
+
return f"API调用失败: {str(e)}"
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def main():
|
|
84
|
+
if len(sys.argv) < 2:
|
|
85
|
+
print("用法: kimi_wrapper.py '你的提示'")
|
|
86
|
+
return
|
|
87
|
+
|
|
88
|
+
prompt = ' '.join(sys.argv[1:])
|
|
89
|
+
print(f"🚀 Kimi处理中...")
|
|
90
|
+
|
|
91
|
+
# 尝试直接API
|
|
92
|
+
result = kimi_direct_api(prompt)
|
|
93
|
+
if "未设置" not in result and "API错误" not in result:
|
|
94
|
+
print(result)
|
|
95
|
+
return
|
|
96
|
+
|
|
97
|
+
# 如果API不可用,尝试CLI包装
|
|
98
|
+
print("⚠️ API不可用,尝试CLI包装...")
|
|
99
|
+
result = kimi_chat(prompt)
|
|
100
|
+
print(result)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
if __name__ == "__main__":
|
|
104
|
+
main()
|