ottopilot 0.1.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 (33) hide show
  1. ottopilot-0.1.0/.github/workflows/ci.yml +26 -0
  2. ottopilot-0.1.0/.github/workflows/publish.yml +41 -0
  3. ottopilot-0.1.0/.gitignore +28 -0
  4. ottopilot-0.1.0/LICENSE +21 -0
  5. ottopilot-0.1.0/PKG-INFO +168 -0
  6. ottopilot-0.1.0/README.md +116 -0
  7. ottopilot-0.1.0/pyproject.toml +69 -0
  8. ottopilot-0.1.0/src/ottoai/__init__.py +7 -0
  9. ottopilot-0.1.0/src/ottoai/__main__.py +4 -0
  10. ottopilot-0.1.0/src/ottoai/agent.py +244 -0
  11. ottopilot-0.1.0/src/ottoai/cli.py +456 -0
  12. ottopilot-0.1.0/src/ottoai/config.py +142 -0
  13. ottopilot-0.1.0/src/ottoai/memory/__init__.py +5 -0
  14. ottopilot-0.1.0/src/ottoai/memory/compaction.py +60 -0
  15. ottopilot-0.1.0/src/ottoai/memory/embeddings.py +40 -0
  16. ottopilot-0.1.0/src/ottoai/memory/store.py +245 -0
  17. ottopilot-0.1.0/src/ottoai/plugins.py +66 -0
  18. ottopilot-0.1.0/src/ottoai/prompts.py +30 -0
  19. ottopilot-0.1.0/src/ottoai/providers/__init__.py +38 -0
  20. ottopilot-0.1.0/src/ottoai/providers/anthropic.py +122 -0
  21. ottopilot-0.1.0/src/ottoai/providers/base.py +60 -0
  22. ottopilot-0.1.0/src/ottoai/providers/gemini.py +125 -0
  23. ottopilot-0.1.0/src/ottoai/providers/openai_compatible.py +243 -0
  24. ottopilot-0.1.0/src/ottoai/tools/__init__.py +78 -0
  25. ottopilot-0.1.0/src/ottoai/tools/files.py +121 -0
  26. ottopilot-0.1.0/src/ottoai/tools/git.py +41 -0
  27. ottopilot-0.1.0/src/ottoai/tools/history.py +67 -0
  28. ottopilot-0.1.0/src/ottoai/tools/mcp.py +119 -0
  29. ottopilot-0.1.0/src/ottoai/tools/search.py +89 -0
  30. ottopilot-0.1.0/src/ottoai/tools/shell.py +50 -0
  31. ottopilot-0.1.0/src/ottoai/tools/web.py +53 -0
  32. ottopilot-0.1.0/src/ottoai/types.py +105 -0
  33. ottopilot-0.1.0/tests/test_agent.py +179 -0
@@ -0,0 +1,26 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12"]
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - name: Set up Python ${{ matrix.python-version }}
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: ${{ matrix.python-version }}
21
+ - name: Install package + dev deps
22
+ run: |
23
+ python -m pip install --upgrade pip
24
+ pip install -e ".[dev]"
25
+ - name: Run tests
26
+ run: pytest -q
@@ -0,0 +1,41 @@
1
+ name: Publish to PyPI
2
+
3
+ # Publishes on every pushed version tag (e.g. v0.1.0) using PyPI Trusted
4
+ # Publishing (OIDC) — no API token/secret required.
5
+ on:
6
+ push:
7
+ tags:
8
+ - "v*"
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.12"
18
+ - name: Build sdist and wheel
19
+ run: |
20
+ python -m pip install --upgrade pip build
21
+ python -m build
22
+ - name: Upload build artifacts
23
+ uses: actions/upload-artifact@v4
24
+ with:
25
+ name: dist
26
+ path: dist/
27
+
28
+ publish:
29
+ needs: build
30
+ runs-on: ubuntu-latest
31
+ environment: pypi
32
+ permissions:
33
+ id-token: write # required for Trusted Publishing (OIDC)
34
+ steps:
35
+ - name: Download build artifacts
36
+ uses: actions/download-artifact@v4
37
+ with:
38
+ name: dist
39
+ path: dist/
40
+ - name: Publish to PyPI
41
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,28 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .eggs/
6
+ build/
7
+ dist/
8
+
9
+ # Virtual environments
10
+ .venv/
11
+ venv/
12
+ env/
13
+
14
+ # Test / tooling caches
15
+ .pytest_cache/
16
+ .mypy_cache/
17
+ .ruff_cache/
18
+ .coverage
19
+ htmlcov/
20
+
21
+ # OttoAI runtime data (if ever created inside repo)
22
+ .ottoai/
23
+
24
+ # OS / editor
25
+ .DS_Store
26
+ *.swp
27
+ .idea/
28
+ .vscode/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 arshad2108
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,168 @@
1
+ Metadata-Version: 2.5
2
+ Name: ottopilot
3
+ Version: 0.1.0
4
+ Summary: OttoAI — a local-first, extensible coding agent (Copilot-CLI style) with Ollama by default and optional cloud providers.
5
+ Project-URL: Homepage, https://github.com/arshad2108/OttoAI
6
+ Project-URL: Repository, https://github.com/arshad2108/OttoAI
7
+ Project-URL: Issues, https://github.com/arshad2108/OttoAI/issues
8
+ Author-email: arshad2108 <warsiarshad384@gmail.com>
9
+ License: MIT License
10
+
11
+ Copyright (c) 2026 arshad2108
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Keywords: agent,cli,coding-assistant,llm,local-first,ollama
32
+ Classifier: Development Status :: 4 - Beta
33
+ Classifier: Environment :: Console
34
+ Classifier: Intended Audience :: Developers
35
+ Classifier: License :: OSI Approved :: MIT License
36
+ Classifier: Operating System :: OS Independent
37
+ Classifier: Programming Language :: Python :: 3
38
+ Classifier: Programming Language :: Python :: 3.11
39
+ Classifier: Programming Language :: Python :: 3.12
40
+ Classifier: Topic :: Software Development :: Code Generators
41
+ Classifier: Topic :: Utilities
42
+ Requires-Python: >=3.11
43
+ Requires-Dist: httpx>=0.27
44
+ Requires-Dist: prompt-toolkit>=3.0
45
+ Requires-Dist: rich>=13.7
46
+ Requires-Dist: tomli-w>=1.0
47
+ Provides-Extra: dev
48
+ Requires-Dist: pytest>=8.0; extra == 'dev'
49
+ Provides-Extra: embeddings
50
+ Requires-Dist: numpy>=1.26; extra == 'embeddings'
51
+ Description-Content-Type: text/markdown
52
+
53
+ # OttoAI
54
+
55
+ A **local-first, extensible coding agent** for your terminal — think "Copilot CLI, but yours."
56
+ Runs on local models (Ollama / Qwen3) by default, works fully offline, and can optionally
57
+ use cloud providers (OpenAI, Anthropic, Gemini, Azure, OpenRouter, or any OpenAI-compatible
58
+ endpoint) when you choose to turn them on.
59
+
60
+ ## Features
61
+
62
+ - 🧠 **Local by default** — Ollama + Qwen3 out of the box, no cloud required.
63
+ - 🔌 **Cloud-optional & pluggable** — flip to online and use OpenAI / Claude / Gemini / Azure
64
+ / OpenRouter / any OpenAI-compatible server via config.
65
+ - 🛠️ **Real agent tools** — shell, file read/write/edit, grep/glob code search, git, web fetch,
66
+ cross-session history search, and MCP (Model Context Protocol) servers.
67
+ - 💾 **Sessions + memory** — every conversation is persisted in SQLite, with FTS5 keyword
68
+ search and optional embeddings for semantic recall across past sessions.
69
+ - ♻️ **Conversation compaction** — long chats are automatically summarized to stay within context,
70
+ while the full history stays searchable.
71
+ - 🧩 **Extensible** — add providers/tools via pip entry points **or** drop a `.py` file in
72
+ `~/.ottoai/plugins/`.
73
+
74
+ ## Install
75
+
76
+ ```bash
77
+ pip install ottopilot # from PyPI (once published)
78
+ # or, from source:
79
+ pip install -e .
80
+ ```
81
+
82
+ Install [Ollama](https://ollama.com) and pull the default model:
83
+
84
+ ```bash
85
+ otto pull qwen3
86
+ ```
87
+
88
+ ## Usage
89
+
90
+ ```bash
91
+ otto # interactive REPL (local-first)
92
+ otto chat "explain this repo"
93
+ otto chat --provider openai --model gpt-4o "review my diff"
94
+ otto models # list models for the default provider
95
+ otto sessions # list past sessions
96
+ otto resume # resume the latest session
97
+ otto search "auth bug" # search across all past sessions
98
+ otto config init # write ~/.ottoai/config.toml to customize
99
+ ```
100
+
101
+ ### In the REPL
102
+
103
+ ```
104
+ /model <name> switch model
105
+ /provider <name> [m] switch provider
106
+ /online /local toggle cloud access
107
+ /stream toggle streaming output
108
+ /think [on|off] toggle model reasoning (faster vs. higher quality)
109
+ /search <query> recall past sessions
110
+ /remember subj | fact store a durable fact
111
+ /compact compress the current conversation
112
+ /tools /sessions /memory /help /quit
113
+ ```
114
+
115
+ ## Configuration
116
+
117
+ Config lives at `~/.ottoai/config.toml` (run `otto config init`). Highlights:
118
+
119
+ ```toml
120
+ local_only = true # set false (or /online) to allow cloud providers
121
+ default_provider = "ollama"
122
+ default_model = "qwen3"
123
+ stream = true # token-by-token output (/stream to toggle)
124
+ think = true # model reasoning: true = higher quality, false = faster (/think)
125
+
126
+ [compaction]
127
+ enabled = true
128
+ trigger_messages = 40
129
+ keep_recent = 12
130
+
131
+ [embeddings]
132
+ enabled = false # set true for semantic cross-session search
133
+ provider = "ollama"
134
+ model = "nomic-embed-text"
135
+
136
+ [providers.openai]
137
+ type = "openai_compatible"
138
+ base_url = "https://api.openai.com/v1"
139
+ api_key_env = "OPENAI_API_KEY"
140
+
141
+ [mcp_servers.filesystem]
142
+ command = "npx"
143
+ args = ["-y", "@modelcontextprotocol/server-filesystem", "/path"]
144
+ ```
145
+
146
+ ## Extending OttoAI
147
+
148
+ **Local plugin** — create `~/.ottoai/plugins/my_tool.py`:
149
+
150
+ ```python
151
+ from ottoai.tools import Tool
152
+
153
+ class HelloTool(Tool):
154
+ name = "hello"
155
+ description = "Say hello"
156
+ parameters = {"type": "object", "properties": {"who": {"type": "string"}}}
157
+ def run(self, who="world", **_):
158
+ return f"Hello, {who}!"
159
+
160
+ TOOLS = [HelloTool]
161
+ # PROVIDERS = {"my_type": MyProviderClass} # providers work the same way
162
+ ```
163
+
164
+ **Pip plugin** — expose `ottoai.tools` / `ottoai.providers` entry points in your package.
165
+
166
+ ## License
167
+
168
+ MIT
@@ -0,0 +1,116 @@
1
+ # OttoAI
2
+
3
+ A **local-first, extensible coding agent** for your terminal — think "Copilot CLI, but yours."
4
+ Runs on local models (Ollama / Qwen3) by default, works fully offline, and can optionally
5
+ use cloud providers (OpenAI, Anthropic, Gemini, Azure, OpenRouter, or any OpenAI-compatible
6
+ endpoint) when you choose to turn them on.
7
+
8
+ ## Features
9
+
10
+ - 🧠 **Local by default** — Ollama + Qwen3 out of the box, no cloud required.
11
+ - 🔌 **Cloud-optional & pluggable** — flip to online and use OpenAI / Claude / Gemini / Azure
12
+ / OpenRouter / any OpenAI-compatible server via config.
13
+ - 🛠️ **Real agent tools** — shell, file read/write/edit, grep/glob code search, git, web fetch,
14
+ cross-session history search, and MCP (Model Context Protocol) servers.
15
+ - 💾 **Sessions + memory** — every conversation is persisted in SQLite, with FTS5 keyword
16
+ search and optional embeddings for semantic recall across past sessions.
17
+ - ♻️ **Conversation compaction** — long chats are automatically summarized to stay within context,
18
+ while the full history stays searchable.
19
+ - 🧩 **Extensible** — add providers/tools via pip entry points **or** drop a `.py` file in
20
+ `~/.ottoai/plugins/`.
21
+
22
+ ## Install
23
+
24
+ ```bash
25
+ pip install ottopilot # from PyPI (once published)
26
+ # or, from source:
27
+ pip install -e .
28
+ ```
29
+
30
+ Install [Ollama](https://ollama.com) and pull the default model:
31
+
32
+ ```bash
33
+ otto pull qwen3
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ ```bash
39
+ otto # interactive REPL (local-first)
40
+ otto chat "explain this repo"
41
+ otto chat --provider openai --model gpt-4o "review my diff"
42
+ otto models # list models for the default provider
43
+ otto sessions # list past sessions
44
+ otto resume # resume the latest session
45
+ otto search "auth bug" # search across all past sessions
46
+ otto config init # write ~/.ottoai/config.toml to customize
47
+ ```
48
+
49
+ ### In the REPL
50
+
51
+ ```
52
+ /model <name> switch model
53
+ /provider <name> [m] switch provider
54
+ /online /local toggle cloud access
55
+ /stream toggle streaming output
56
+ /think [on|off] toggle model reasoning (faster vs. higher quality)
57
+ /search <query> recall past sessions
58
+ /remember subj | fact store a durable fact
59
+ /compact compress the current conversation
60
+ /tools /sessions /memory /help /quit
61
+ ```
62
+
63
+ ## Configuration
64
+
65
+ Config lives at `~/.ottoai/config.toml` (run `otto config init`). Highlights:
66
+
67
+ ```toml
68
+ local_only = true # set false (or /online) to allow cloud providers
69
+ default_provider = "ollama"
70
+ default_model = "qwen3"
71
+ stream = true # token-by-token output (/stream to toggle)
72
+ think = true # model reasoning: true = higher quality, false = faster (/think)
73
+
74
+ [compaction]
75
+ enabled = true
76
+ trigger_messages = 40
77
+ keep_recent = 12
78
+
79
+ [embeddings]
80
+ enabled = false # set true for semantic cross-session search
81
+ provider = "ollama"
82
+ model = "nomic-embed-text"
83
+
84
+ [providers.openai]
85
+ type = "openai_compatible"
86
+ base_url = "https://api.openai.com/v1"
87
+ api_key_env = "OPENAI_API_KEY"
88
+
89
+ [mcp_servers.filesystem]
90
+ command = "npx"
91
+ args = ["-y", "@modelcontextprotocol/server-filesystem", "/path"]
92
+ ```
93
+
94
+ ## Extending OttoAI
95
+
96
+ **Local plugin** — create `~/.ottoai/plugins/my_tool.py`:
97
+
98
+ ```python
99
+ from ottoai.tools import Tool
100
+
101
+ class HelloTool(Tool):
102
+ name = "hello"
103
+ description = "Say hello"
104
+ parameters = {"type": "object", "properties": {"who": {"type": "string"}}}
105
+ def run(self, who="world", **_):
106
+ return f"Hello, {who}!"
107
+
108
+ TOOLS = [HelloTool]
109
+ # PROVIDERS = {"my_type": MyProviderClass} # providers work the same way
110
+ ```
111
+
112
+ **Pip plugin** — expose `ottoai.tools` / `ottoai.providers` entry points in your package.
113
+
114
+ ## License
115
+
116
+ MIT
@@ -0,0 +1,69 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "ottopilot"
7
+ version = "0.1.0"
8
+ description = "OttoAI — a local-first, extensible coding agent (Copilot-CLI style) with Ollama by default and optional cloud providers."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = { file = "LICENSE" }
12
+ authors = [{ name = "arshad2108", email = "warsiarshad384@gmail.com" }]
13
+ keywords = ["llm", "agent", "coding-assistant", "ollama", "local-first", "cli"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Environment :: Console",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Topic :: Software Development :: Code Generators",
24
+ "Topic :: Utilities",
25
+ ]
26
+ dependencies = [
27
+ "httpx>=0.27",
28
+ "rich>=13.7",
29
+ "prompt_toolkit>=3.0",
30
+ "tomli-w>=1.0",
31
+ ]
32
+
33
+ [project.optional-dependencies]
34
+ embeddings = ["numpy>=1.26"]
35
+ dev = ["pytest>=8.0"]
36
+
37
+ [project.scripts]
38
+ otto = "ottoai.cli:main"
39
+ ottoai = "ottoai.cli:main"
40
+
41
+ [project.urls]
42
+ Homepage = "https://github.com/arshad2108/OttoAI"
43
+ Repository = "https://github.com/arshad2108/OttoAI"
44
+ Issues = "https://github.com/arshad2108/OttoAI/issues"
45
+
46
+ # Built-in providers and tools are registered as entry points so third-party
47
+ # plugins can extend OttoAI the exact same way.
48
+ [project.entry-points."ottoai.providers"]
49
+ openai_compatible = "ottoai.providers.openai_compatible:OpenAICompatibleProvider"
50
+ anthropic = "ottoai.providers.anthropic:AnthropicProvider"
51
+ gemini = "ottoai.providers.gemini:GeminiProvider"
52
+
53
+ [project.entry-points."ottoai.tools"]
54
+ shell = "ottoai.tools.shell:ShellTool"
55
+ read_file = "ottoai.tools.files:ReadFileTool"
56
+ write_file = "ottoai.tools.files:WriteFileTool"
57
+ edit_file = "ottoai.tools.files:EditFileTool"
58
+ list_dir = "ottoai.tools.files:ListDirTool"
59
+ grep = "ottoai.tools.search:GrepTool"
60
+ glob = "ottoai.tools.search:GlobTool"
61
+ web_fetch = "ottoai.tools.web:WebFetchTool"
62
+ git = "ottoai.tools.git:GitTool"
63
+ search_history = "ottoai.tools.history:SearchHistoryTool"
64
+
65
+ [tool.hatch.build.targets.wheel]
66
+ packages = ["src/ottoai"]
67
+
68
+ [tool.pytest.ini_options]
69
+ testpaths = ["tests"]
@@ -0,0 +1,7 @@
1
+ """OttoAI — a local-first, extensible coding agent."""
2
+
3
+ __version__ = "0.1.0"
4
+
5
+ from .types import Message, ToolCall, ToolResult, ChatResponse
6
+
7
+ __all__ = ["Message", "ToolCall", "ToolResult", "ChatResponse", "__version__"]
@@ -0,0 +1,4 @@
1
+ from .cli import main
2
+
3
+ if __name__ == "__main__":
4
+ raise SystemExit(main())