kiwi-code 0.0.4__py3-none-any.whl

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.
@@ -0,0 +1,234 @@
1
+ Metadata-Version: 2.4
2
+ Name: kiwi-code
3
+ Version: 0.0.4
4
+ Summary: A textual-based terminal user interface application
5
+ Project-URL: Homepage, https://meetkiwi.ai
6
+ Project-URL: Repository, https://github.com/jetoslabs/kiwi-code
7
+ Author-email: Anurag Jha <anurag@meetkiwi.co>
8
+ License: MIT
9
+ Keywords: cli,terminal,textual,tui
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Requires-Python: <4.0,>=3.13
16
+ Requires-Dist: autobots-client==0.1.0
17
+ Requires-Dist: httpx>=0.25.0
18
+ Requires-Dist: loguru>=0.7.3
19
+ Requires-Dist: psutil>=5.9.0
20
+ Requires-Dist: pydantic>=2.12.5
21
+ Requires-Dist: textual-dev>=1.8.0
22
+ Requires-Dist: textual>=8.1.1
23
+ Requires-Dist: typer>=0.24.1
24
+ Requires-Dist: websockets>=14.1
25
+ Description-Content-Type: text/markdown
26
+
27
+ # Kiwi Code
28
+
29
+ A terminal-based interface for the [Kiwi AI](https://meetkiwi.ai) platform. Built with [Textual](https://textual.textualize.io/) and [Typer](https://typer.tiangolo.com/), it provides a chat-style TUI and command-line access to manage and interact with actions, action graphs, and their runs.
30
+
31
+ Requires Python 3.13+.
32
+
33
+ ## Architecture
34
+
35
+ Kiwi Code has three entry points, but they are **not three services** — they are independent frontends to the same shared code:
36
+
37
+ ```
38
+ ┌──────────────────────────────────┐
39
+ │ Shared Libraries │
40
+ │ │
41
+ │ commands.py Command handlers │
42
+ │ client.py HTTP/SSE client │
43
+ │ auth.py Token management │
44
+ │ autobots_client (generated SDK) │
45
+ └──────┬───────────┬─────────────────┘
46
+ │ │
47
+ ┌──────────┘ └──────────┐
48
+ │ │
49
+ ┌────────▼────────┐ ┌─────────▼─────────┐
50
+ │ kiwi (TUI) │ │ kiwicli (CLI) │
51
+ │ │ │ │
52
+ │ Full-screen │ │ Typer commands │
53
+ │ Textual app │ │ for scripting │
54
+ │ │ │ and automation │
55
+ └────────┬─────────┘ └────────────────────┘
56
+ │ auto-starts
57
+ │ (if not already running)
58
+
59
+ ┌────────▼──────────────────────────────────────────┐
60
+ │ kiwi-runtime │
61
+ │ │
62
+ │ Independent process — one per working directory │
63
+ │ Connects to Kiwi server via WebSocket │
64
+ │ Executes shell commands for the LLM agent │
65
+ │ │
66
+ │ Can also be started directly: │
67
+ │ kiwi-runtime connect --server app │
68
+ │ │
69
+ │ Survives TUI quit, logout, and restarts │
70
+ │ Stop explicitly: kiwicli runtime stop │
71
+ └───────────────────────────────────────────────────┘
72
+ ```
73
+
74
+ **Key points:**
75
+
76
+ - **`kiwi` and `kiwicli` do not depend on each other.** They both import the same `commands.py`, `client.py`, and `auth.py` modules directly. Neither needs the other to be running.
77
+ - **`kiwi` automatically spawns `kiwi-runtime`** when you log in. The runtime runs as an independent process — quitting or restarting the TUI does **not** kill it.
78
+ - **One runtime per directory.** Each working directory gets its own runtime, scoped to that directory. Opening the TUI in two different project folders runs two independent runtimes.
79
+ - **`kiwicli` is for headless/scripting use.** It provides the same query commands (actions, runs, graphs) as the TUI, but as standalone CLI commands.
80
+ - **Authentication is shared.** Both use `TokenManager` to read/write tokens from `~/.autobots-tui/tokens.json`, so logging in via one works for the other.
81
+ - **Runtime lifecycle is independent.** The runtime persists across TUI restarts. Use `kiwicli runtime stop` to explicitly stop it.
82
+
83
+ ## Installation
84
+
85
+ ```bash
86
+ pip install kiwi-code
87
+ ```
88
+
89
+ This installs three commands:
90
+
91
+ | Command | Description |
92
+ |---------|-------------|
93
+ | `kiwi` | Launch the interactive TUI (auto-starts runtime) |
94
+ | `kiwicli` | CLI for scripting — login, query actions/runs/graphs |
95
+ | `kiwi-runtime` | WebSocket agent for LLM command execution (usually auto-started by TUI) |
96
+
97
+ ## Quick Start
98
+
99
+ ```bash
100
+ # Login (once — tokens are saved locally)
101
+ kiwicli login
102
+
103
+ # Launch the interactive TUI (starts runtime automatically)
104
+ kiwi
105
+
106
+ # Or use CLI commands directly
107
+ kiwicli actions list
108
+ kiwicli runs list --status processing
109
+ ```
110
+
111
+ ## Commands
112
+
113
+ ```
114
+ kiwicli login Authenticate with email and password
115
+ kiwicli logout Logout and clear saved tokens
116
+ kiwicli whoami Check authentication status
117
+ kiwicli tui Launch the interactive TUI
118
+
119
+ kiwicli actions list [--name N] List actions
120
+ kiwicli actions get <id> Get action details
121
+
122
+ kiwicli runs list [--action-id ID] List action runs (results)
123
+ [--action-name N] [--status S]
124
+ kiwicli runs get <id> Get run details
125
+
126
+ kiwicli graphs list [--name N] List action graphs
127
+ kiwicli graphs get <id> Get graph details
128
+
129
+ kiwicli graph-runs list [--graph-id ID] List graph runs (results)
130
+ [--graph-name N] [--status S]
131
+ kiwicli graph-runs get <id> Get graph run details
132
+
133
+ kiwicli runtime status Check if runtime is running (current dir)
134
+ kiwicli runtime stop [--all] Stop runtime (current dir, or all)
135
+ kiwicli runtime list List all runtimes across directories
136
+ kiwicli runtime logs Tail the runtime log (current dir)
137
+ ```
138
+
139
+ All list commands support `--limit` and `--offset` for pagination. Runs can be filtered by `--status` (processing, success, error, stuck, waiting).
140
+
141
+ ## Interactive TUI
142
+
143
+ Launch with `kiwi` or `kiwicli tui`. The TUI provides a full-screen chat interface for conversing with actions in real time.
144
+
145
+ - **Chat interface** — Send messages to actions and receive streamed responses via SSE
146
+ - **Session management** — Switch actions, continue existing runs, or start new conversations
147
+ - **Slash commands** — All CLI commands work inside the TUI chat with a `/` prefix
148
+ - **Authentication** — Login screen with automatic token refresh
149
+ - **Runtime logs** — View the runtime agent's output in real time (`Ctrl+R`)
150
+ - **Theming** — Dark/light mode toggle (`Ctrl+D`)
151
+
152
+ ### Keyboard Shortcuts
153
+
154
+ | Key | Action |
155
+ |-----|--------|
156
+ | `Ctrl+C` | Quit |
157
+ | `Ctrl+R` | Runtime logs |
158
+ | `Ctrl+D` | Toggle dark/light mode |
159
+ | `Ctrl+L` | Logout |
160
+
161
+ ### Slash Commands (inside TUI)
162
+
163
+ ```
164
+ /use <action_id> Switch to a different action
165
+ /continue <run_id> Continue an existing conversation run
166
+ /new Start a new conversation (resets to default action)
167
+ /status Show current action and run IDs
168
+
169
+ /actions list List all actions
170
+ /runs list --status success Filter runs by status
171
+ /graphs get <id> View graph details
172
+ /help Show all available commands
173
+ ```
174
+
175
+ ### Streaming
176
+
177
+ Actions execute asynchronously. The TUI streams status updates in real time via SSE and automatically fetches the final result on completion. Falls back to polling if the SSE stream ends without delivering a result.
178
+
179
+ ## Runtime Agent
180
+
181
+ The runtime agent connects to the Kiwi server via WebSocket and executes terminal commands on behalf of the LLM agent.
182
+
183
+ The TUI auto-starts the runtime on login. Each working directory gets its own runtime instance, restricted to that directory. The runtime runs as an **independent process** — it survives TUI quit, logout, and restarts. When the TUI starts again, it detects the running runtime and reattaches to its logs.
184
+
185
+ To manage runtimes independently:
186
+
187
+ ```bash
188
+ kiwicli runtime status # Check if running (for current directory)
189
+ kiwicli runtime stop # Stop the runtime (for current directory)
190
+ kiwicli runtime stop --all # Stop all runtimes
191
+ kiwicli runtime list # List all runtimes across directories
192
+ kiwicli runtime logs # Tail the runtime log (for current directory)
193
+ ```
194
+
195
+ You can also run it standalone:
196
+
197
+ ```bash
198
+ kiwi-runtime connect --server app # Production (api.meetkiwi.ai)
199
+ kiwi-runtime connect --server dev # Development
200
+ kiwi-runtime connect --server local # Localhost
201
+ kiwi-runtime connect --server wss://custom # Custom URL
202
+ kiwi-runtime connect --scope full # Unrestricted execution (default: restricted)
203
+ kiwi-runtime connect --allow /extra/dir # Allow additional directory in restricted mode
204
+ ```
205
+
206
+ In **restricted mode** (default), commands are sandboxed to the current working directory. The `--allow` flag adds extra allowed paths.
207
+
208
+ ## Configuration
209
+
210
+ Stored at `~/.autobots-tui/config.json`:
211
+
212
+ ```json
213
+ {
214
+ "backend_url": "https://api.example.com",
215
+ "log_level": "INFO",
216
+ "theme": "dark",
217
+ "refresh_interval": 5
218
+ }
219
+ ```
220
+
221
+ Logs are written to `~/.autobots-tui/autobots_tui.log`.
222
+
223
+ ## Development
224
+
225
+ ```bash
226
+ git clone https://github.com/jetoslabs/kiwi-code.git
227
+ cd kiwi-code
228
+ uv sync
229
+ uv run kiwi
230
+ ```
231
+
232
+ ## License
233
+
234
+ MIT
@@ -0,0 +1,24 @@
1
+ kiwi_runtime/__init__.py,sha256=ZReaJwO3ZZMDQeei-5lkwkHC9GKYuzJBGOZjreJawYI,104
2
+ kiwi_runtime/__main__.py,sha256=FxmEl4G17ig5ByYU88qFKJn9xj2RbUoLCqpBIl6LN2I,79
3
+ kiwi_runtime/main.py,sha256=1Ci7iLnJjxPmBOZBLtSxjpKMup38VPB8FPxIn2hFHg0,36827
4
+ kiwi_tui/__init__.py,sha256=UXU9lAZ-Z0xZXaRvPgStWQueAzbW4fkOkLG0QWaxWw4,85
5
+ kiwi_tui/auth.py,sha256=qF7ejXX2_iI-_Dsv9Pg5F_CUw245QS4ptJ1oeAWVGjE,3585
6
+ kiwi_tui/cli.py,sha256=5NB5EPktpUzq49HysKy67Tg0qJR-SupLbC5t5VfTG9A,8158
7
+ kiwi_tui/client.py,sha256=wR1700-XwufV3G1lRkWtgZs0eRSLr82WkGfxUg6q5kw,22163
8
+ kiwi_tui/commands.py,sha256=_YZrDsLr2vTKTnfjMoVsQ4FL3pYJN4htIBigejsdQSs,15677
9
+ kiwi_tui/config.py,sha256=HtyWBLVg7JKgXAGtnF_uOA-1IT8rB7P1rHG4Ut8XAfQ,2503
10
+ kiwi_tui/logger.py,sha256=ngDaZ_L3XGdsZDkpy1lR5kfFtgqLCifrEHmhcSnUDGM,963
11
+ kiwi_tui/main.py,sha256=LTAwjcwmlX4x0q_wtc15Z09wUyOoJJDNF74eOkLKr3Q,11042
12
+ kiwi_tui/models.py,sha256=aF_wbjVcB8OQBhQWstYrD4LgaLasinspJHp0nHjP0MY,2163
13
+ kiwi_tui/runtime_manager.py,sha256=2nSL_ada1JOEziQ8iGnRaZZjqG5bq4pPQw8-CzhSL7Y,3698
14
+ kiwi_tui/widgets.py,sha256=PFGJ-E9vgIOf__mYzB_4-NiwUmqrfk-wPyb4gXRTZ8A,4594
15
+ kiwi_tui/screens/__init__.py,sha256=U2oRLA8rRQIi2h35Y-VQS9BGY8GVHUkib8_-6DPk5No,321
16
+ kiwi_tui/screens/actions.py,sha256=oYVn4Fo4OMJjESkUJF8EEYhtnoEy9TXM7orahtIM7V8,8240
17
+ kiwi_tui/screens/autobots.py,sha256=hA9n3Ru2e_Z6jc2ZZbw4-FOUDUvuLfSx9G2mxtF4I94,6407
18
+ kiwi_tui/screens/dashboard.py,sha256=THJzYn1shOYai0VOzLDVaOkVhaWHKwyT0NMa0cgWivM,23481
19
+ kiwi_tui/screens/login.py,sha256=zGrPciuAIbhfoe_XbhZsAn_1aD-QP8y27PkMFyEp5vA,8977
20
+ kiwi_tui/screens/runtime_logs.py,sha256=3fV35kHSTEzNiHfebASP5Y_4mCysv2PALVjgvedE82I,2918
21
+ kiwi_code-0.0.4.dist-info/METADATA,sha256=euPp9OWhzC2fNa5T1654hgEWtqDtOPw7gmNsdeIr5DI,10341
22
+ kiwi_code-0.0.4.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
23
+ kiwi_code-0.0.4.dist-info/entry_points.txt,sha256=W-gHjylQjsWHrWmnz-GQMsduaFMRkSbOTAUqxNlD2ks,109
24
+ kiwi_code-0.0.4.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,4 @@
1
+ [console_scripts]
2
+ kiwi = kiwi_tui.main:main
3
+ kiwi-runtime = kiwi_runtime.main:main
4
+ kiwicli = kiwi_tui.cli:cli
@@ -0,0 +1,3 @@
1
+ """Kiwi Runtime — terminal agent that connects to the server via WebSocket."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,5 @@
1
+ """Allow running as: python -m kiwi_runtime"""
2
+
3
+ from .main import main
4
+
5
+ main()