sayacode 0.3.0__tar.gz

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.
Files changed (114) hide show
  1. sayacode-0.3.0/LICENSE +21 -0
  2. sayacode-0.3.0/PKG-INFO +144 -0
  3. sayacode-0.3.0/README.md +104 -0
  4. sayacode-0.3.0/lib/__init__.py +58 -0
  5. sayacode-0.3.0/lib/agent.py +1021 -0
  6. sayacode-0.3.0/lib/api_config/__init__.py +30 -0
  7. sayacode-0.3.0/lib/api_config/api_config.py +430 -0
  8. sayacode-0.3.0/lib/api_config/wizard.py +707 -0
  9. sayacode-0.3.0/lib/cli/__init__.py +34 -0
  10. sayacode-0.3.0/lib/cli/configure.py +404 -0
  11. sayacode-0.3.0/lib/cli/main.py +252 -0
  12. sayacode-0.3.0/lib/cli/parser.py +244 -0
  13. sayacode-0.3.0/lib/cli/permissions.py +155 -0
  14. sayacode-0.3.0/lib/cli/workspace.py +140 -0
  15. sayacode-0.3.0/lib/commands/__init__.py +79 -0
  16. sayacode-0.3.0/lib/commands/base.py +28 -0
  17. sayacode-0.3.0/lib/commands/conversation.py +149 -0
  18. sayacode-0.3.0/lib/commands/diagnostics.py +32 -0
  19. sayacode-0.3.0/lib/commands/hooks.py +72 -0
  20. sayacode-0.3.0/lib/commands/mcp.py +140 -0
  21. sayacode-0.3.0/lib/commands/mode.py +77 -0
  22. sayacode-0.3.0/lib/commands/model.py +161 -0
  23. sayacode-0.3.0/lib/commands/permissions.py +87 -0
  24. sayacode-0.3.0/lib/commands/preferences.py +196 -0
  25. sayacode-0.3.0/lib/commands/router.py +70 -0
  26. sayacode-0.3.0/lib/commands/runtime_handlers.py +80 -0
  27. sayacode-0.3.0/lib/commands/runtime_info.py +183 -0
  28. sayacode-0.3.0/lib/commands/session.py +181 -0
  29. sayacode-0.3.0/lib/commands/symbols.py +51 -0
  30. sayacode-0.3.0/lib/commands/tools.py +78 -0
  31. sayacode-0.3.0/lib/commands/workspace.py +189 -0
  32. sayacode-0.3.0/lib/core/__init__.py +166 -0
  33. sayacode-0.3.0/lib/core/agent_runtime.py +253 -0
  34. sayacode-0.3.0/lib/core/audit.py +236 -0
  35. sayacode-0.3.0/lib/core/context.py +481 -0
  36. sayacode-0.3.0/lib/core/context_packager.py +244 -0
  37. sayacode-0.3.0/lib/core/doctor.py +499 -0
  38. sayacode-0.3.0/lib/core/hooks.py +502 -0
  39. sayacode-0.3.0/lib/core/mcp_runtime.py +673 -0
  40. sayacode-0.3.0/lib/core/memory.py +540 -0
  41. sayacode-0.3.0/lib/core/modes.py +171 -0
  42. sayacode-0.3.0/lib/core/paths.py +151 -0
  43. sayacode-0.3.0/lib/core/permissions.py +648 -0
  44. sayacode-0.3.0/lib/core/private_io.py +56 -0
  45. sayacode-0.3.0/lib/core/project_memory.py +278 -0
  46. sayacode-0.3.0/lib/core/safety.py +535 -0
  47. sayacode-0.3.0/lib/core/session.py +778 -0
  48. sayacode-0.3.0/lib/core/symbols.py +324 -0
  49. sayacode-0.3.0/lib/custom_commands.py +163 -0
  50. sayacode-0.3.0/lib/i18n.py +1373 -0
  51. sayacode-0.3.0/lib/models/__init__.py +37 -0
  52. sayacode-0.3.0/lib/models/anthropic_model.py +372 -0
  53. sayacode-0.3.0/lib/models/base.py +470 -0
  54. sayacode-0.3.0/lib/models/gemini_model.py +351 -0
  55. sayacode-0.3.0/lib/models/ollama_model.py +371 -0
  56. sayacode-0.3.0/lib/models/openai_model.py +437 -0
  57. sayacode-0.3.0/lib/models/provider_catalog.py +157 -0
  58. sayacode-0.3.0/lib/models/registry.py +366 -0
  59. sayacode-0.3.0/lib/prompts/__init__.py +39 -0
  60. sayacode-0.3.0/lib/prompts/system_prompt.py +791 -0
  61. sayacode-0.3.0/lib/runtime/__init__.py +65 -0
  62. sayacode-0.3.0/lib/runtime/app.py +90 -0
  63. sayacode-0.3.0/lib/runtime/context.py +120 -0
  64. sayacode-0.3.0/lib/runtime/interactive.py +261 -0
  65. sayacode-0.3.0/lib/runtime/launch_config.py +188 -0
  66. sayacode-0.3.0/lib/runtime/model_profiles.py +328 -0
  67. sayacode-0.3.0/lib/runtime/session_store.py +344 -0
  68. sayacode-0.3.0/lib/runtime/startup.py +172 -0
  69. sayacode-0.3.0/lib/state.py +426 -0
  70. sayacode-0.3.0/lib/theme.py +684 -0
  71. sayacode-0.3.0/lib/tools/__init__.py +427 -0
  72. sayacode-0.3.0/lib/tools/_process.py +83 -0
  73. sayacode-0.3.0/lib/tools/context.py +82 -0
  74. sayacode-0.3.0/lib/tools/file_tools.py +926 -0
  75. sayacode-0.3.0/lib/tools/git_tools.py +693 -0
  76. sayacode-0.3.0/lib/tools/project_tools.py +783 -0
  77. sayacode-0.3.0/lib/tools/registry.py +62 -0
  78. sayacode-0.3.0/lib/tools/safety.py +402 -0
  79. sayacode-0.3.0/lib/tools/shell_tools.py +850 -0
  80. sayacode-0.3.0/pyproject.toml +58 -0
  81. sayacode-0.3.0/sayacode.egg-info/PKG-INFO +144 -0
  82. sayacode-0.3.0/sayacode.egg-info/SOURCES.txt +112 -0
  83. sayacode-0.3.0/sayacode.egg-info/dependency_links.txt +1 -0
  84. sayacode-0.3.0/sayacode.egg-info/entry_points.txt +2 -0
  85. sayacode-0.3.0/sayacode.egg-info/requires.txt +16 -0
  86. sayacode-0.3.0/sayacode.egg-info/top_level.txt +1 -0
  87. sayacode-0.3.0/setup.cfg +4 -0
  88. sayacode-0.3.0/tests/test_api_config_wizard.py +166 -0
  89. sayacode-0.3.0/tests/test_architecture_boundaries.py +115 -0
  90. sayacode-0.3.0/tests/test_command_router.py +102 -0
  91. sayacode-0.3.0/tests/test_context_packager.py +70 -0
  92. sayacode-0.3.0/tests/test_doctor.py +46 -0
  93. sayacode-0.3.0/tests/test_hooks.py +134 -0
  94. sayacode-0.3.0/tests/test_i18n.py +89 -0
  95. sayacode-0.3.0/tests/test_launch_config.py +132 -0
  96. sayacode-0.3.0/tests/test_mcp_runtime.py +240 -0
  97. sayacode-0.3.0/tests/test_model_context_window.py +118 -0
  98. sayacode-0.3.0/tests/test_model_profiles.py +48 -0
  99. sayacode-0.3.0/tests/test_model_providers.py +383 -0
  100. sayacode-0.3.0/tests/test_model_registry.py +101 -0
  101. sayacode-0.3.0/tests/test_modes.py +55 -0
  102. sayacode-0.3.0/tests/test_paths_audit_support.py +54 -0
  103. sayacode-0.3.0/tests/test_permissions.py +114 -0
  104. sayacode-0.3.0/tests/test_private_io.py +40 -0
  105. sayacode-0.3.0/tests/test_run_wrapper.py +100 -0
  106. sayacode-0.3.0/tests/test_runtime_application.py +97 -0
  107. sayacode-0.3.0/tests/test_runtime_context_tools.py +328 -0
  108. sayacode-0.3.0/tests/test_runtime_sync.py +19 -0
  109. sayacode-0.3.0/tests/test_safety.py +47 -0
  110. sayacode-0.3.0/tests/test_session_schema.py +95 -0
  111. sayacode-0.3.0/tests/test_shell_tools.py +65 -0
  112. sayacode-0.3.0/tests/test_symbols.py +73 -0
  113. sayacode-0.3.0/tests/test_theme.py +15 -0
  114. sayacode-0.3.0/tests/test_tools_and_safety.py +234 -0
sayacode-0.3.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SAYACODE Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,144 @@
1
+ Metadata-Version: 2.4
2
+ Name: sayacode
3
+ Version: 0.3.0
4
+ Summary: SAYACODE CLI coding assistant
5
+ Author: SAYACODE Contributors
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/saya-ch/sayacode
8
+ Project-URL: Repository, https://github.com/saya-ch/sayacode
9
+ Project-URL: Issues, https://github.com/saya-ch/sayacode/issues
10
+ Keywords: coding-agent,cli,llm,developer-tools,mcp
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development
20
+ Classifier: Topic :: Utilities
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: langchain-core>=0.3.0
25
+ Requires-Dist: langchain>=0.3.0
26
+ Requires-Dist: langgraph>=0.2.0
27
+ Requires-Dist: langchain-community>=0.3.0
28
+ Requires-Dist: langchain-openai>=0.2.0
29
+ Requires-Dist: langchain-anthropic>=0.3.0
30
+ Requires-Dist: langchain-ollama>=0.2.0
31
+ Requires-Dist: rich>=13.0.0
32
+ Requires-Dist: httpx>=0.27.0
33
+ Requires-Dist: requests>=2.31.0
34
+ Requires-Dist: pydantic>=2.0.0
35
+ Requires-Dist: typing-extensions>=4.8.0
36
+ Provides-Extra: dev
37
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
38
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
39
+ Dynamic: license-file
40
+
41
+ # SAYACODE
42
+
43
+ <a href="https://pypi.org/project/sayacode/"><img src="https://img.shields.io/pypi/v/sayacode?color=ff69b4" alt="PyPI"></a>
44
+ <a href="https://github.com/saya-ch/sayacode/actions"><img src="https://img.shields.io/github/actions/workflow/status/saya-ch/sayacode/ci.yml?branch=main" alt="CI"></a>
45
+ <img src="https://img.shields.io/badge/python-3.11%20|%203.12%20|%203.13-blue" alt="Python">
46
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-pink" alt="License"></a>
47
+
48
+ 终端里的 AI 编程搭档。基于 LangChain / LangGraph,接上你常用的模型就能用。聊天、改代码、跑命令、管 Git,都在一个框里搞定。
49
+
50
+ ---
51
+
52
+ ## 角色风格
53
+
54
+ SAYACODE 内置了 9 种对话人格:标准、简洁、傲娇、元气、雌小鬼、姐姐、偶像、猫娘、无口。随时用 `/style` 切换。
55
+
56
+ ---
57
+
58
+ ## 安装
59
+
60
+ **环境要求**:Python >= 3.11
61
+
62
+ ```bash
63
+ git clone https://github.com/saya-ch/sayacode.git
64
+ cd sayacode
65
+ pip install .
66
+ ```
67
+
68
+ conda 用户:
69
+
70
+ ```bash
71
+ conda create -n sayacode python=3.12 -y
72
+ conda activate sayacode
73
+ git clone https://github.com/saya-ch/sayacode.git
74
+ cd sayacode
75
+ pip install .
76
+ ```
77
+
78
+ 安装完成后,在任意目录执行 `sayacode` 即可启动。首次运行将进入配置向导,引导完成模型 Provider 和 API Key 的设置,配置自动保存至 `~/.sayacode/`。
79
+
80
+ ---
81
+
82
+ ## 使用
83
+
84
+ ```bash
85
+ sayacode # 交互式对话
86
+ sayacode --workspace ./my-project # 指定工作区
87
+ sayacode --style catgirl # 切换角色
88
+ sayacode --doctor # 自诊断
89
+ ```
90
+
91
+ 对话内命令:
92
+
93
+ | 命令 | 说明 |
94
+ |------|------|
95
+ | `/help`, `/guide`, `/start` | 帮助与引导 |
96
+ | `/status`, `/workspace`, `/context` | 状态与工作区 |
97
+ | `/model`, `/mode`, `/style`, `/lang` | 模型 / 模式 / 风格 / 语言 |
98
+ | `/session`, `/sessions`, `/history` | 会话管理 |
99
+ | `/tools`, `/commands`, `/mcp`, `/hooks` | 工具 & 扩展 |
100
+ | `/doctor`, `/permissions`, `/stats` | 诊断 & 安全 |
101
+ | `/git`, `/clear`, `/compact`, `/reset` | 快捷操作 |
102
+ | `/prefs`, `/settings`, `/config`, `/paths` | 偏好与配置 |
103
+ | `/symbols`, `/analyze` | 代码分析 |
104
+ | `/quit` | 退出 |
105
+
106
+ ---
107
+
108
+ ## 模型支持
109
+
110
+ | 接口 | 说明 |
111
+ |------|------|
112
+ | OpenAI 兼容 | GPT-4o 等,以及 Azure、自定义端点 |
113
+ | Anthropic 兼容 | Claude Opus / Sonnet / Haiku |
114
+ | Gemini | Google Gemini 系列 |
115
+ | Ollama | 本地运行,免费 |
116
+
117
+ ---
118
+
119
+ ## 能力
120
+
121
+ - **文件**:读写、搜索、正则替换、批量编辑
122
+ - **Shell**:执行命令、安全检查、查看环境
123
+ - **Git**:status / diff / add / commit / branch / stash / pull / push
124
+ - **项目分析**:结构扫描、符号索引、依赖梳理
125
+ - **MCP 扩展**:通过 Model Context Protocol 接外部工具
126
+
127
+ ## 安全
128
+
129
+ 危险操作(删系统文件、`rm -rf /`、格式化等)在执行前被硬拦截。密钥和私钥文件默认禁止读取。所有工具调用落审计日志。
130
+
131
+ ---
132
+
133
+ ## 开发
134
+
135
+ ```bash
136
+ pip install -e ".[dev]"
137
+ pytest tests/ -v
138
+ ```
139
+
140
+ ---
141
+
142
+ ## License
143
+
144
+ MIT © SAYACODE Contributors
@@ -0,0 +1,104 @@
1
+ # SAYACODE
2
+
3
+ <a href="https://pypi.org/project/sayacode/"><img src="https://img.shields.io/pypi/v/sayacode?color=ff69b4" alt="PyPI"></a>
4
+ <a href="https://github.com/saya-ch/sayacode/actions"><img src="https://img.shields.io/github/actions/workflow/status/saya-ch/sayacode/ci.yml?branch=main" alt="CI"></a>
5
+ <img src="https://img.shields.io/badge/python-3.11%20|%203.12%20|%203.13-blue" alt="Python">
6
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-pink" alt="License"></a>
7
+
8
+ 终端里的 AI 编程搭档。基于 LangChain / LangGraph,接上你常用的模型就能用。聊天、改代码、跑命令、管 Git,都在一个框里搞定。
9
+
10
+ ---
11
+
12
+ ## 角色风格
13
+
14
+ SAYACODE 内置了 9 种对话人格:标准、简洁、傲娇、元气、雌小鬼、姐姐、偶像、猫娘、无口。随时用 `/style` 切换。
15
+
16
+ ---
17
+
18
+ ## 安装
19
+
20
+ **环境要求**:Python >= 3.11
21
+
22
+ ```bash
23
+ git clone https://github.com/saya-ch/sayacode.git
24
+ cd sayacode
25
+ pip install .
26
+ ```
27
+
28
+ conda 用户:
29
+
30
+ ```bash
31
+ conda create -n sayacode python=3.12 -y
32
+ conda activate sayacode
33
+ git clone https://github.com/saya-ch/sayacode.git
34
+ cd sayacode
35
+ pip install .
36
+ ```
37
+
38
+ 安装完成后,在任意目录执行 `sayacode` 即可启动。首次运行将进入配置向导,引导完成模型 Provider 和 API Key 的设置,配置自动保存至 `~/.sayacode/`。
39
+
40
+ ---
41
+
42
+ ## 使用
43
+
44
+ ```bash
45
+ sayacode # 交互式对话
46
+ sayacode --workspace ./my-project # 指定工作区
47
+ sayacode --style catgirl # 切换角色
48
+ sayacode --doctor # 自诊断
49
+ ```
50
+
51
+ 对话内命令:
52
+
53
+ | 命令 | 说明 |
54
+ |------|------|
55
+ | `/help`, `/guide`, `/start` | 帮助与引导 |
56
+ | `/status`, `/workspace`, `/context` | 状态与工作区 |
57
+ | `/model`, `/mode`, `/style`, `/lang` | 模型 / 模式 / 风格 / 语言 |
58
+ | `/session`, `/sessions`, `/history` | 会话管理 |
59
+ | `/tools`, `/commands`, `/mcp`, `/hooks` | 工具 & 扩展 |
60
+ | `/doctor`, `/permissions`, `/stats` | 诊断 & 安全 |
61
+ | `/git`, `/clear`, `/compact`, `/reset` | 快捷操作 |
62
+ | `/prefs`, `/settings`, `/config`, `/paths` | 偏好与配置 |
63
+ | `/symbols`, `/analyze` | 代码分析 |
64
+ | `/quit` | 退出 |
65
+
66
+ ---
67
+
68
+ ## 模型支持
69
+
70
+ | 接口 | 说明 |
71
+ |------|------|
72
+ | OpenAI 兼容 | GPT-4o 等,以及 Azure、自定义端点 |
73
+ | Anthropic 兼容 | Claude Opus / Sonnet / Haiku |
74
+ | Gemini | Google Gemini 系列 |
75
+ | Ollama | 本地运行,免费 |
76
+
77
+ ---
78
+
79
+ ## 能力
80
+
81
+ - **文件**:读写、搜索、正则替换、批量编辑
82
+ - **Shell**:执行命令、安全检查、查看环境
83
+ - **Git**:status / diff / add / commit / branch / stash / pull / push
84
+ - **项目分析**:结构扫描、符号索引、依赖梳理
85
+ - **MCP 扩展**:通过 Model Context Protocol 接外部工具
86
+
87
+ ## 安全
88
+
89
+ 危险操作(删系统文件、`rm -rf /`、格式化等)在执行前被硬拦截。密钥和私钥文件默认禁止读取。所有工具调用落审计日志。
90
+
91
+ ---
92
+
93
+ ## 开发
94
+
95
+ ```bash
96
+ pip install -e ".[dev]"
97
+ pytest tests/ -v
98
+ ```
99
+
100
+ ---
101
+
102
+ ## License
103
+
104
+ MIT © SAYACODE Contributors
@@ -0,0 +1,58 @@
1
+ """Public runtime surface for SAYACODE."""
2
+
3
+ __version__ = "0.3.0"
4
+
5
+ from .agent import SAIAgent, create_sai_agent
6
+ from .api_config import APIConfig, APIConfigManager, APIConfigWizard, APIConfigWizardCLI, APIType
7
+ from .core.context import ChangeRecord, FileInfo, ProjectContext
8
+ from .core.memory import FileModification, Interaction, MemoryManager
9
+ from .core.safety import Operation, SafetyChecker, SafetyLevel, SafetyResult
10
+ from .core.session import Message, SessionManager
11
+ from .models import BaseModel
12
+ from .models.registry import ModelProviderRegistry, get_model_provider_registry
13
+ from .runtime import RuntimeContext
14
+ from .state import (
15
+ AppState,
16
+ ConfigState,
17
+ UserConfig,
18
+ create_app_state,
19
+ create_config_state,
20
+ create_user_config,
21
+ )
22
+ from .tools import ToolFactory, ToolRegistry, get_runtime_tool_catalog
23
+
24
+ __all__ = [
25
+ "__version__",
26
+ "APIType",
27
+ "APIConfig",
28
+ "APIConfigManager",
29
+ "APIConfigWizard",
30
+ "APIConfigWizardCLI",
31
+ "SessionManager",
32
+ "Message",
33
+ "ProjectContext",
34
+ "FileInfo",
35
+ "ChangeRecord",
36
+ "MemoryManager",
37
+ "Interaction",
38
+ "FileModification",
39
+ "SafetyChecker",
40
+ "SafetyLevel",
41
+ "SafetyResult",
42
+ "Operation",
43
+ "BaseModel",
44
+ "ModelProviderRegistry",
45
+ "get_model_provider_registry",
46
+ "RuntimeContext",
47
+ "SAIAgent",
48
+ "create_sai_agent",
49
+ "AppState",
50
+ "ConfigState",
51
+ "UserConfig",
52
+ "create_app_state",
53
+ "create_config_state",
54
+ "create_user_config",
55
+ "ToolFactory",
56
+ "ToolRegistry",
57
+ "get_runtime_tool_catalog",
58
+ ]