kiwi-code 0.0.38__tar.gz → 0.0.40__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.
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/PKG-INFO +149 -39
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/README.md +148 -38
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/pyproject.toml +1 -1
- kiwi_code-0.0.40/src/kiwi_cli/terminal_mode.py +518 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/main.py +109 -28
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/screens/dashboard.py +39 -1
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/tests/test_cli_help.py +15 -0
- kiwi_code-0.0.40/tests/test_terminal_mode.py +87 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/tests/test_tui_headless.py +108 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/uv.lock +1 -1
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/.github/workflows/publish.yml +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/.github/workflows/test.yml +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/.gitignore +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/.python-version +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/CLAUDE.md +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/Makefile +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_cli/__init__.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_cli/auth.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_cli/cli.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_cli/client.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_cli/commands.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_cli/logger.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_cli/models.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_cli/runtime_manager.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_cli/server.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_runtime/__init__.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_runtime/__main__.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_runtime/main.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_runtime/snake_game/.gitignore +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_runtime/snake_game/requirements.txt +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/__init__.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/inline_file_picker.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/random_words.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/runtime_agent.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/screens/__init__.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/screens/attach_content.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/screens/command_result.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/screens/file_browser.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/screens/help.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/screens/id_picker.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/screens/login.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/screens/runtime_cleanup.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/screens/runtime_logs.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/screens/slash_picker.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/slash_commands.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/status_words.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/src/kiwi_tui/widgets.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/test_hello.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/tests/__init__.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/tests/conftest.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/tests/test_imports.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/tests/test_reexec_kiwi.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/tests/test_runtime_log_trimming.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/tests/test_slash_commands.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/tests/test_tokens.py +0 -0
- {kiwi_code-0.0.38 → kiwi_code-0.0.40}/tests/test_tui_palette.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kiwi-code
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.40
|
|
4
4
|
Summary: A textual-based terminal user interface application
|
|
5
5
|
Project-URL: Homepage, https://meetkiwi.ai
|
|
6
6
|
Project-URL: Repository, https://github.com/jetoslabs/kiwi-code
|
|
@@ -30,12 +30,16 @@ Description-Content-Type: text/markdown
|
|
|
30
30
|
|
|
31
31
|
# Kiwi Code
|
|
32
32
|
|
|
33
|
-
Kiwi Code is a terminal-first
|
|
33
|
+
Kiwi Code is a terminal-first interface for chatting with **Kiwi Actions**, managing **runs** (action results), and connecting the **Kiwi Runtime** (a local CLI / terminal agent) so actions can execute terminal commands on your machine.
|
|
34
|
+
|
|
35
|
+
Primary entrypoints:
|
|
34
36
|
|
|
35
37
|
- **TUI:** `kiwi` (or `python -m kiwi_tui.main`)
|
|
36
|
-
- **
|
|
38
|
+
- **Terminal mode:** `kiwi --terminal ...`
|
|
39
|
+
- **Inspection CLI:** `kiwicli` (optional; list/get style scripting)
|
|
40
|
+
- **Runtime:** `kiwi-runtime`
|
|
37
41
|
|
|
38
|
-
> Requires **Python 3.
|
|
42
|
+
> Requires **Python 3.11+**.
|
|
39
43
|
|
|
40
44
|
---
|
|
41
45
|
|
|
@@ -43,66 +47,133 @@ Kiwi Code is a terminal-first UI (TUI) for chatting with **Kiwi Actions** and ma
|
|
|
43
47
|
|
|
44
48
|
### 1) Install
|
|
45
49
|
|
|
50
|
+
```bash
|
|
46
51
|
pip install kiwi-code
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 2) Log in from the terminal
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
kiwi login
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
This prompts for your email and password and stores tokens at:
|
|
61
|
+
|
|
62
|
+
- `~/.kiwi/tokens.json`
|
|
63
|
+
|
|
64
|
+
You can inspect auth state anytime with:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
kiwi whoami
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
To clear saved credentials:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
kiwi logout
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 3) Launch the TUI (unchanged default)
|
|
47
77
|
|
|
48
|
-
|
|
78
|
+
```bash
|
|
79
|
+
kiwi
|
|
80
|
+
```
|
|
49
81
|
|
|
50
|
-
|
|
82
|
+
Or choose a server preset:
|
|
51
83
|
|
|
52
|
-
|
|
84
|
+
```bash
|
|
85
|
+
kiwi --server dev
|
|
86
|
+
```
|
|
53
87
|
|
|
54
88
|
Available presets:
|
|
55
|
-
- app (prod)
|
|
56
|
-
- dev (dev)
|
|
57
89
|
|
|
58
|
-
|
|
90
|
+
- `app` (prod)
|
|
91
|
+
- `dev` (dev)
|
|
92
|
+
- `local` (localhost)
|
|
59
93
|
|
|
60
|
-
|
|
94
|
+
### 4) Use terminal mode instead of the full-screen TUI
|
|
61
95
|
|
|
62
|
-
|
|
96
|
+
Fresh conversation on the default action:
|
|
63
97
|
|
|
64
|
-
|
|
98
|
+
```bash
|
|
99
|
+
kiwi --terminal "Hi, what are you doing?"
|
|
100
|
+
```
|
|
65
101
|
|
|
66
|
-
|
|
102
|
+
Fresh conversation for a specific action:
|
|
67
103
|
|
|
68
|
-
|
|
104
|
+
```bash
|
|
105
|
+
kiwi --terminal --action-id <ACTION_ID> "Inspect this repository"
|
|
106
|
+
```
|
|
69
107
|
|
|
70
|
-
|
|
108
|
+
Continue an existing run:
|
|
71
109
|
|
|
72
|
-
|
|
110
|
+
```bash
|
|
111
|
+
kiwi --terminal --run-id <RUN_ID> "What changed?"
|
|
112
|
+
```
|
|
73
113
|
|
|
74
|
-
|
|
114
|
+
Pipe the message on stdin:
|
|
75
115
|
|
|
76
|
-
|
|
116
|
+
```bash
|
|
117
|
+
echo "Summarize the latest output" | kiwi --terminal --run-id <RUN_ID>
|
|
118
|
+
```
|
|
77
119
|
|
|
78
|
-
|
|
79
|
-
- In most cases, you can skip manual runtime startup and just use /connect-cli inside the TUI.
|
|
120
|
+
Connect the local CLI runtime from terminal mode:
|
|
80
121
|
|
|
81
|
-
|
|
122
|
+
```bash
|
|
123
|
+
kiwi --terminal --connect-cli
|
|
124
|
+
kiwi --terminal --connect-cli --action-id <ACTION_ID>
|
|
125
|
+
kiwi --terminal --connect-cli --run-id <RUN_ID>
|
|
126
|
+
```
|
|
82
127
|
|
|
83
|
-
|
|
128
|
+
Rules:
|
|
84
129
|
|
|
85
|
-
- `
|
|
86
|
-
- `
|
|
87
|
-
- `
|
|
130
|
+
- `kiwi` by itself still launches the TUI.
|
|
131
|
+
- `--action-id` starts a **fresh** conversation for that action.
|
|
132
|
+
- `--run-id` continues an **existing** run.
|
|
133
|
+
- `--action-id` and `--run-id` are mutually exclusive.
|
|
134
|
+
- `--connect-cli` cannot be combined with a user message.
|
|
135
|
+
|
|
136
|
+
### 5) (Optional) Start the runtime manually
|
|
137
|
+
|
|
138
|
+
In most cases, let Kiwi manage the runtime automatically via `/connect-cli` in the TUI or `kiwi --terminal --connect-cli` in terminal mode.
|
|
139
|
+
|
|
140
|
+
If you want to run it yourself:
|
|
88
141
|
|
|
89
142
|
```bash
|
|
90
|
-
|
|
143
|
+
kiwi-runtime connect --server dev --scope restricted --allow "$PWD"
|
|
91
144
|
```
|
|
92
145
|
|
|
93
|
-
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Terminal mode usage
|
|
149
|
+
|
|
150
|
+
### Human-readable output
|
|
94
151
|
|
|
95
152
|
```bash
|
|
96
|
-
kiwi --
|
|
153
|
+
kiwi --terminal "Hello"
|
|
97
154
|
```
|
|
98
155
|
|
|
99
|
-
|
|
156
|
+
This prints the run result directly in your terminal.
|
|
100
157
|
|
|
101
|
-
|
|
158
|
+
### JSON output for scripts
|
|
102
159
|
|
|
103
|
-
|
|
160
|
+
```bash
|
|
161
|
+
kiwi --terminal --json --action-id <ACTION_ID> "Hello"
|
|
162
|
+
```
|
|
104
163
|
|
|
105
|
-
|
|
164
|
+
### Disable live status streaming
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
kiwi --terminal --no-stream --run-id <RUN_ID> "Continue this task"
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Authentication in terminal mode
|
|
171
|
+
|
|
172
|
+
If you are not logged in, terminal mode exits with a helpful message telling you to run:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
kiwi login
|
|
176
|
+
```
|
|
106
177
|
|
|
107
178
|
---
|
|
108
179
|
|
|
@@ -132,15 +203,24 @@ Some actions can execute terminal commands via a local runtime process.
|
|
|
132
203
|
|
|
133
204
|
### Connect the runtime to the current run
|
|
134
205
|
|
|
135
|
-
|
|
206
|
+
From the TUI:
|
|
136
207
|
|
|
137
208
|
- `/connect-cli`
|
|
138
209
|
|
|
210
|
+
From terminal mode:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
kiwi --terminal --connect-cli
|
|
214
|
+
kiwi --terminal --connect-cli --action-id <ACTION_ID>
|
|
215
|
+
kiwi --terminal --connect-cli --run-id <RUN_ID>
|
|
216
|
+
```
|
|
217
|
+
|
|
139
218
|
What it does:
|
|
140
219
|
|
|
141
220
|
- Ensures a local runtime exists **for the current run_id**.
|
|
142
|
-
- If the runtime was disconnected (e.g
|
|
143
|
-
- Sends the instruction prompt:
|
|
221
|
+
- If the runtime was disconnected (e.g. after a server redeploy), Kiwi Code detects it and starts a fresh one.
|
|
222
|
+
- Sends the instruction prompt: `Connect to the CLI right now before asking or doing anything.`
|
|
223
|
+
- In terminal mode, `--connect-cli` is a setup action only, so it **must not** be combined with a message.
|
|
144
224
|
|
|
145
225
|
### View runtime logs
|
|
146
226
|
|
|
@@ -195,9 +275,25 @@ These are designed to work even when input is blocked during streaming.
|
|
|
195
275
|
|
|
196
276
|
---
|
|
197
277
|
|
|
198
|
-
## CLI
|
|
278
|
+
## CLI overview
|
|
279
|
+
|
|
280
|
+
### `kiwi`
|
|
199
281
|
|
|
200
|
-
`
|
|
282
|
+
`kiwi` is the primary user-facing CLI.
|
|
283
|
+
|
|
284
|
+
Examples:
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
kiwi
|
|
288
|
+
kiwi login
|
|
289
|
+
kiwi whoami
|
|
290
|
+
kiwi --terminal "Hello"
|
|
291
|
+
kiwi --terminal --connect-cli --run-id <RUN_ID>
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### `kiwicli`
|
|
295
|
+
|
|
296
|
+
`kiwicli` remains available for list/get style scripting and inspection.
|
|
201
297
|
|
|
202
298
|
Examples:
|
|
203
299
|
|
|
@@ -213,7 +309,7 @@ kiwicli runs get <run_id>
|
|
|
213
309
|
|
|
214
310
|
## Server / flags
|
|
215
311
|
|
|
216
|
-
`kiwi` / `python -m kiwi_tui.main` supports runtime flags (mirrors `kiwi-runtime connect`). These flags are used
|
|
312
|
+
`kiwi` / `python -m kiwi_tui.main` supports runtime flags (mirrors `kiwi-runtime connect`). These flags are used whenever Kiwi Code needs to start a runtime, whether you are in the TUI or terminal mode.
|
|
217
313
|
|
|
218
314
|
```bash
|
|
219
315
|
kiwi --server dev \
|
|
@@ -221,9 +317,23 @@ kiwi --server dev \
|
|
|
221
317
|
--allow /some/extra/dir
|
|
222
318
|
```
|
|
223
319
|
|
|
320
|
+
Terminal mode examples:
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
kiwi --terminal --server dev "Hello"
|
|
324
|
+
kiwi --terminal --json --action-id <ACTION_ID> "Hello"
|
|
325
|
+
kiwi --terminal --no-stream --run-id <RUN_ID> "Continue"
|
|
326
|
+
```
|
|
327
|
+
|
|
224
328
|
- `--server`: `app | dev | local | <full url>`
|
|
225
329
|
- `--scope`: `restricted | full`
|
|
226
330
|
- `--allow PATH`: repeatable; additional allowed directories in restricted mode
|
|
331
|
+
- `--terminal`: run Kiwi in plain terminal mode instead of the full-screen TUI
|
|
332
|
+
- `--action-id`: start a fresh conversation for the given action
|
|
333
|
+
- `--run-id`: continue an existing run
|
|
334
|
+
- `--connect-cli`: ensure runtime exists and send the connect prompt
|
|
335
|
+
- `--json`: print machine-readable output for terminal mode
|
|
336
|
+
- `--no-stream`: wait for the final result without live status streaming
|
|
227
337
|
|
|
228
338
|
> Note: Kiwi Code does **not** modify the runtime implementation under `src/kiwi_runtime/`.
|
|
229
339
|
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
# Kiwi Code
|
|
2
2
|
|
|
3
|
-
Kiwi Code is a terminal-first
|
|
3
|
+
Kiwi Code is a terminal-first interface for chatting with **Kiwi Actions**, managing **runs** (action results), and connecting the **Kiwi Runtime** (a local CLI / terminal agent) so actions can execute terminal commands on your machine.
|
|
4
|
+
|
|
5
|
+
Primary entrypoints:
|
|
4
6
|
|
|
5
7
|
- **TUI:** `kiwi` (or `python -m kiwi_tui.main`)
|
|
6
|
-
- **
|
|
8
|
+
- **Terminal mode:** `kiwi --terminal ...`
|
|
9
|
+
- **Inspection CLI:** `kiwicli` (optional; list/get style scripting)
|
|
10
|
+
- **Runtime:** `kiwi-runtime`
|
|
7
11
|
|
|
8
|
-
> Requires **Python 3.
|
|
12
|
+
> Requires **Python 3.11+**.
|
|
9
13
|
|
|
10
14
|
---
|
|
11
15
|
|
|
@@ -13,66 +17,133 @@ Kiwi Code is a terminal-first UI (TUI) for chatting with **Kiwi Actions** and ma
|
|
|
13
17
|
|
|
14
18
|
### 1) Install
|
|
15
19
|
|
|
20
|
+
```bash
|
|
16
21
|
pip install kiwi-code
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 2) Log in from the terminal
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
kiwi login
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This prompts for your email and password and stores tokens at:
|
|
31
|
+
|
|
32
|
+
- `~/.kiwi/tokens.json`
|
|
33
|
+
|
|
34
|
+
You can inspect auth state anytime with:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
kiwi whoami
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
To clear saved credentials:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
kiwi logout
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 3) Launch the TUI (unchanged default)
|
|
17
47
|
|
|
18
|
-
|
|
48
|
+
```bash
|
|
49
|
+
kiwi
|
|
50
|
+
```
|
|
19
51
|
|
|
20
|
-
|
|
52
|
+
Or choose a server preset:
|
|
21
53
|
|
|
22
|
-
|
|
54
|
+
```bash
|
|
55
|
+
kiwi --server dev
|
|
56
|
+
```
|
|
23
57
|
|
|
24
58
|
Available presets:
|
|
25
|
-
- app (prod)
|
|
26
|
-
- dev (dev)
|
|
27
59
|
|
|
28
|
-
|
|
60
|
+
- `app` (prod)
|
|
61
|
+
- `dev` (dev)
|
|
62
|
+
- `local` (localhost)
|
|
29
63
|
|
|
30
|
-
|
|
64
|
+
### 4) Use terminal mode instead of the full-screen TUI
|
|
31
65
|
|
|
32
|
-
|
|
66
|
+
Fresh conversation on the default action:
|
|
33
67
|
|
|
34
|
-
|
|
68
|
+
```bash
|
|
69
|
+
kiwi --terminal "Hi, what are you doing?"
|
|
70
|
+
```
|
|
35
71
|
|
|
36
|
-
|
|
72
|
+
Fresh conversation for a specific action:
|
|
37
73
|
|
|
38
|
-
|
|
74
|
+
```bash
|
|
75
|
+
kiwi --terminal --action-id <ACTION_ID> "Inspect this repository"
|
|
76
|
+
```
|
|
39
77
|
|
|
40
|
-
|
|
78
|
+
Continue an existing run:
|
|
41
79
|
|
|
42
|
-
|
|
80
|
+
```bash
|
|
81
|
+
kiwi --terminal --run-id <RUN_ID> "What changed?"
|
|
82
|
+
```
|
|
43
83
|
|
|
44
|
-
|
|
84
|
+
Pipe the message on stdin:
|
|
45
85
|
|
|
46
|
-
|
|
86
|
+
```bash
|
|
87
|
+
echo "Summarize the latest output" | kiwi --terminal --run-id <RUN_ID>
|
|
88
|
+
```
|
|
47
89
|
|
|
48
|
-
|
|
49
|
-
- In most cases, you can skip manual runtime startup and just use /connect-cli inside the TUI.
|
|
90
|
+
Connect the local CLI runtime from terminal mode:
|
|
50
91
|
|
|
51
|
-
|
|
92
|
+
```bash
|
|
93
|
+
kiwi --terminal --connect-cli
|
|
94
|
+
kiwi --terminal --connect-cli --action-id <ACTION_ID>
|
|
95
|
+
kiwi --terminal --connect-cli --run-id <RUN_ID>
|
|
96
|
+
```
|
|
52
97
|
|
|
53
|
-
|
|
98
|
+
Rules:
|
|
54
99
|
|
|
55
|
-
- `
|
|
56
|
-
- `
|
|
57
|
-
- `
|
|
100
|
+
- `kiwi` by itself still launches the TUI.
|
|
101
|
+
- `--action-id` starts a **fresh** conversation for that action.
|
|
102
|
+
- `--run-id` continues an **existing** run.
|
|
103
|
+
- `--action-id` and `--run-id` are mutually exclusive.
|
|
104
|
+
- `--connect-cli` cannot be combined with a user message.
|
|
105
|
+
|
|
106
|
+
### 5) (Optional) Start the runtime manually
|
|
107
|
+
|
|
108
|
+
In most cases, let Kiwi manage the runtime automatically via `/connect-cli` in the TUI or `kiwi --terminal --connect-cli` in terminal mode.
|
|
109
|
+
|
|
110
|
+
If you want to run it yourself:
|
|
58
111
|
|
|
59
112
|
```bash
|
|
60
|
-
|
|
113
|
+
kiwi-runtime connect --server dev --scope restricted --allow "$PWD"
|
|
61
114
|
```
|
|
62
115
|
|
|
63
|
-
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Terminal mode usage
|
|
119
|
+
|
|
120
|
+
### Human-readable output
|
|
64
121
|
|
|
65
122
|
```bash
|
|
66
|
-
kiwi --
|
|
123
|
+
kiwi --terminal "Hello"
|
|
67
124
|
```
|
|
68
125
|
|
|
69
|
-
|
|
126
|
+
This prints the run result directly in your terminal.
|
|
70
127
|
|
|
71
|
-
|
|
128
|
+
### JSON output for scripts
|
|
72
129
|
|
|
73
|
-
|
|
130
|
+
```bash
|
|
131
|
+
kiwi --terminal --json --action-id <ACTION_ID> "Hello"
|
|
132
|
+
```
|
|
74
133
|
|
|
75
|
-
|
|
134
|
+
### Disable live status streaming
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
kiwi --terminal --no-stream --run-id <RUN_ID> "Continue this task"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Authentication in terminal mode
|
|
141
|
+
|
|
142
|
+
If you are not logged in, terminal mode exits with a helpful message telling you to run:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
kiwi login
|
|
146
|
+
```
|
|
76
147
|
|
|
77
148
|
---
|
|
78
149
|
|
|
@@ -102,15 +173,24 @@ Some actions can execute terminal commands via a local runtime process.
|
|
|
102
173
|
|
|
103
174
|
### Connect the runtime to the current run
|
|
104
175
|
|
|
105
|
-
|
|
176
|
+
From the TUI:
|
|
106
177
|
|
|
107
178
|
- `/connect-cli`
|
|
108
179
|
|
|
180
|
+
From terminal mode:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
kiwi --terminal --connect-cli
|
|
184
|
+
kiwi --terminal --connect-cli --action-id <ACTION_ID>
|
|
185
|
+
kiwi --terminal --connect-cli --run-id <RUN_ID>
|
|
186
|
+
```
|
|
187
|
+
|
|
109
188
|
What it does:
|
|
110
189
|
|
|
111
190
|
- Ensures a local runtime exists **for the current run_id**.
|
|
112
|
-
- If the runtime was disconnected (e.g
|
|
113
|
-
- Sends the instruction prompt:
|
|
191
|
+
- If the runtime was disconnected (e.g. after a server redeploy), Kiwi Code detects it and starts a fresh one.
|
|
192
|
+
- Sends the instruction prompt: `Connect to the CLI right now before asking or doing anything.`
|
|
193
|
+
- In terminal mode, `--connect-cli` is a setup action only, so it **must not** be combined with a message.
|
|
114
194
|
|
|
115
195
|
### View runtime logs
|
|
116
196
|
|
|
@@ -165,9 +245,25 @@ These are designed to work even when input is blocked during streaming.
|
|
|
165
245
|
|
|
166
246
|
---
|
|
167
247
|
|
|
168
|
-
## CLI
|
|
248
|
+
## CLI overview
|
|
249
|
+
|
|
250
|
+
### `kiwi`
|
|
169
251
|
|
|
170
|
-
`
|
|
252
|
+
`kiwi` is the primary user-facing CLI.
|
|
253
|
+
|
|
254
|
+
Examples:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
kiwi
|
|
258
|
+
kiwi login
|
|
259
|
+
kiwi whoami
|
|
260
|
+
kiwi --terminal "Hello"
|
|
261
|
+
kiwi --terminal --connect-cli --run-id <RUN_ID>
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### `kiwicli`
|
|
265
|
+
|
|
266
|
+
`kiwicli` remains available for list/get style scripting and inspection.
|
|
171
267
|
|
|
172
268
|
Examples:
|
|
173
269
|
|
|
@@ -183,7 +279,7 @@ kiwicli runs get <run_id>
|
|
|
183
279
|
|
|
184
280
|
## Server / flags
|
|
185
281
|
|
|
186
|
-
`kiwi` / `python -m kiwi_tui.main` supports runtime flags (mirrors `kiwi-runtime connect`). These flags are used
|
|
282
|
+
`kiwi` / `python -m kiwi_tui.main` supports runtime flags (mirrors `kiwi-runtime connect`). These flags are used whenever Kiwi Code needs to start a runtime, whether you are in the TUI or terminal mode.
|
|
187
283
|
|
|
188
284
|
```bash
|
|
189
285
|
kiwi --server dev \
|
|
@@ -191,9 +287,23 @@ kiwi --server dev \
|
|
|
191
287
|
--allow /some/extra/dir
|
|
192
288
|
```
|
|
193
289
|
|
|
290
|
+
Terminal mode examples:
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
kiwi --terminal --server dev "Hello"
|
|
294
|
+
kiwi --terminal --json --action-id <ACTION_ID> "Hello"
|
|
295
|
+
kiwi --terminal --no-stream --run-id <RUN_ID> "Continue"
|
|
296
|
+
```
|
|
297
|
+
|
|
194
298
|
- `--server`: `app | dev | local | <full url>`
|
|
195
299
|
- `--scope`: `restricted | full`
|
|
196
300
|
- `--allow PATH`: repeatable; additional allowed directories in restricted mode
|
|
301
|
+
- `--terminal`: run Kiwi in plain terminal mode instead of the full-screen TUI
|
|
302
|
+
- `--action-id`: start a fresh conversation for the given action
|
|
303
|
+
- `--run-id`: continue an existing run
|
|
304
|
+
- `--connect-cli`: ensure runtime exists and send the connect prompt
|
|
305
|
+
- `--json`: print machine-readable output for terminal mode
|
|
306
|
+
- `--no-stream`: wait for the final result without live status streaming
|
|
197
307
|
|
|
198
308
|
> Note: Kiwi Code does **not** modify the runtime implementation under `src/kiwi_runtime/`.
|
|
199
309
|
|