@mitsein-ai/cli 0.2.1 → 0.3.0
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/README.md +75 -41
- package/dist/index.js +138 -140
- package/package.json +1 -1
- package/src/commands/agent.ts +90 -108
- package/src/commands/api-auto.ts +1 -1
- package/src/commands/dev.ts +1 -1
- package/src/commands/files.ts +1 -1
- package/src/commands/project.ts +6 -6
- package/src/commands/thread.ts +66 -143
- package/src/core/chat-output.ts +93 -0
- package/src/core/chat-run.ts +156 -0
- package/src/core/chat-stream.ts +188 -0
- package/src/core/client.ts +9 -2
- package/src/core/config.ts +1 -1
- package/src/core/credentials.ts +1 -1
- package/src/core/output.ts +14 -1
- package/src/index.ts +1 -3
- package/src/commands/messages.ts +0 -61
- package/src/core/sse.ts +0 -135
- package/src/core/waiters-output.ts +0 -95
- package/src/core/waiters.ts +0 -169
package/README.md
CHANGED
|
@@ -19,27 +19,23 @@ bun run src/index.ts --help
|
|
|
19
19
|
## Quick Start
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
+
# Login
|
|
23
|
+
mitsein auth login
|
|
24
|
+
mitsein auth whoami
|
|
25
|
+
|
|
22
26
|
# Check backend health
|
|
23
27
|
mitsein dev health
|
|
24
28
|
|
|
25
|
-
#
|
|
26
|
-
mitsein
|
|
29
|
+
# Create a thread, send a message, stream the agent run
|
|
30
|
+
TID=$(mitsein --json thread create | jq -r .thread_id)
|
|
31
|
+
mitsein agent invoke "$TID" "Hello" --stream
|
|
27
32
|
|
|
28
33
|
# List threads
|
|
29
34
|
mitsein thread list
|
|
30
35
|
|
|
31
|
-
# Send a message and stream the agent run
|
|
32
|
-
mitsein thread send <thread_id> "Hello" --stream
|
|
33
|
-
|
|
34
36
|
# Auto-generated API commands from OpenAPI
|
|
35
37
|
mitsein api list-tags
|
|
36
38
|
mitsein api list-ops threads
|
|
37
|
-
mitsein api threads list-threads
|
|
38
|
-
|
|
39
|
-
# Login
|
|
40
|
-
mitsein auth login
|
|
41
|
-
mitsein auth login --device-code
|
|
42
|
-
mitsein auth whoami
|
|
43
39
|
```
|
|
44
40
|
|
|
45
41
|
## Commands
|
|
@@ -55,17 +51,17 @@ mitsein auth whoami
|
|
|
55
51
|
| `mitsein api <tag> <operation>` | Execute an API operation |
|
|
56
52
|
| `mitsein thread list` | List threads |
|
|
57
53
|
| `mitsein thread get <id>` | Get thread details |
|
|
58
|
-
| `mitsein thread create` | Create a new thread |
|
|
54
|
+
| `mitsein thread create [--name] [--agent]` | Create a new thread |
|
|
55
|
+
| `mitsein thread rename <id> <name>` | Rename a thread |
|
|
56
|
+
| `mitsein thread delete <id>` | Delete a thread |
|
|
59
57
|
| `mitsein thread history <id>` | Show message history |
|
|
60
|
-
| `mitsein
|
|
61
|
-
| `mitsein
|
|
62
|
-
| `mitsein
|
|
63
|
-
| `mitsein
|
|
64
|
-
| `mitsein
|
|
65
|
-
| `mitsein
|
|
66
|
-
| `mitsein
|
|
67
|
-
| `mitsein messages send <id> <msg>` | Add message (no agent) |
|
|
68
|
-
| `mitsein agent invoke <id> <prompt>` | Message + agent start |
|
|
58
|
+
| `mitsein agent invoke <id> <prompt>` | Send message + run agent (SSE) |
|
|
59
|
+
| `mitsein agent running list` | List all active runs for the account |
|
|
60
|
+
| `mitsein agent running status <tid>` | Read active-run state for a thread |
|
|
61
|
+
| `mitsein agent running tail <tid>` | Reconnect to an in-progress run (`tail -f`) |
|
|
62
|
+
| `mitsein agent running wait <tid>` | Block until the thread's run completes |
|
|
63
|
+
| `mitsein agent running cancel <tid>` | Cancel a thread's running agent |
|
|
64
|
+
| `mitsein files list/read/write/upload/mkdir/delete/download <tid>` | Sandbox file ops |
|
|
69
65
|
| `mitsein project list` | List projects |
|
|
70
66
|
| `mitsein project get <id>` | Get project details |
|
|
71
67
|
| `mitsein project delete <id>` | Delete a project |
|
|
@@ -79,7 +75,7 @@ mitsein auth whoami
|
|
|
79
75
|
|------|-------------|
|
|
80
76
|
| `--endpoint <url>` | API base URL (default: `http://localhost:8000`) |
|
|
81
77
|
| `--token <token>` | Bearer token |
|
|
82
|
-
| `--profile <name>` | Profile name (default: `
|
|
78
|
+
| `--profile <name>` | Profile name (default: `default`) |
|
|
83
79
|
| `--real` | Use real account for dev token |
|
|
84
80
|
| `--json` | Machine-readable JSON output |
|
|
85
81
|
| `--debug` | Log HTTP details to stderr |
|
|
@@ -96,17 +92,39 @@ Same 4-step chain as the Python CLI:
|
|
|
96
92
|
3. **OAuthProvider** — `~/.mitsein/oauth/<profile>.json`
|
|
97
93
|
4. **DevTokenProvider** — `scripts/dev-token.sh` (localhost only)
|
|
98
94
|
|
|
99
|
-
###
|
|
95
|
+
### `agent invoke` Modes
|
|
96
|
+
|
|
97
|
+
`agent invoke` always hits `POST /api/next/chat` which streams SSE. The three flags control how the client surfaces those events:
|
|
100
98
|
|
|
101
99
|
```bash
|
|
102
|
-
#
|
|
103
|
-
mitsein
|
|
100
|
+
# Default: wait silently, emit a structured result on exit
|
|
101
|
+
mitsein agent invoke <tid> "msg"
|
|
102
|
+
|
|
103
|
+
# Live streaming to stdout (human-readable or NDJSON with --json)
|
|
104
|
+
mitsein agent invoke <tid> "msg" --stream
|
|
104
105
|
|
|
105
|
-
#
|
|
106
|
-
mitsein
|
|
106
|
+
# Event-type filter
|
|
107
|
+
mitsein agent invoke <tid> "msg" --stream --filter tool_call,tool_result
|
|
107
108
|
|
|
108
|
-
#
|
|
109
|
-
mitsein
|
|
109
|
+
# Cancel the run on Ctrl-C (default is detach-only)
|
|
110
|
+
mitsein agent invoke <tid> "msg" --stream --cancel-on-interrupt
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Exit code: `0` on `done.reason == completed`, `1` on `error`, `124` on timeout, `130` on Ctrl-C.
|
|
114
|
+
|
|
115
|
+
### Reconnect / Attach to a Running Agent
|
|
116
|
+
|
|
117
|
+
Any client can attach to a thread's running agent and keep streaming from the last delivered event:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Read status (includes last_event_id)
|
|
121
|
+
mitsein agent running status <tid>
|
|
122
|
+
|
|
123
|
+
# Resume from a specific event id
|
|
124
|
+
mitsein agent running tail <tid> --since 1775915617543-0
|
|
125
|
+
|
|
126
|
+
# Or block-wait until the run ends
|
|
127
|
+
mitsein agent running wait <tid>
|
|
110
128
|
```
|
|
111
129
|
|
|
112
130
|
### OpenAPI Auto-Commands
|
|
@@ -114,10 +132,9 @@ mitsein thread send <id> "msg" --stream
|
|
|
114
132
|
The `api` command dynamically generates subcommands from the backend's OpenAPI spec:
|
|
115
133
|
|
|
116
134
|
```bash
|
|
117
|
-
mitsein api list-tags
|
|
118
|
-
mitsein api
|
|
135
|
+
mitsein api list-tags
|
|
136
|
+
mitsein api list-ops threads
|
|
119
137
|
mitsein api threads list-threads --body '{"limit": 10}'
|
|
120
|
-
mitsein api threads list-threads --body @payload.json
|
|
121
138
|
echo '{}' | mitsein api threads list-threads --body-stdin
|
|
122
139
|
```
|
|
123
140
|
|
|
@@ -125,18 +142,35 @@ echo '{}' | mitsein api threads list-threads --body-stdin
|
|
|
125
142
|
|
|
126
143
|
```bash
|
|
127
144
|
bun run typecheck # TypeScript check
|
|
128
|
-
bun test # Run tests
|
|
145
|
+
bun test # Run tests
|
|
129
146
|
bun run build # Build single binary
|
|
130
147
|
```
|
|
131
148
|
|
|
132
|
-
##
|
|
149
|
+
## CHANGELOG
|
|
150
|
+
|
|
151
|
+
### 0.3.0 (2026-04-11) — `/api/next` migration
|
|
152
|
+
|
|
153
|
+
**Breaking changes** — CLI migrated from the deprecated `/api/thread/*` + `/api/message/*` + `/api/agent-run/*` routes to the unified `POST /api/next/chat` SSE endpoint.
|
|
154
|
+
|
|
155
|
+
- **Removed**: `mitsein thread send` (was a duplicate of `agent invoke`)
|
|
156
|
+
- **Removed**: `mitsein messages` command group entirely (backend no longer has a "add message without run" action; `messages list` duplicated `thread history`)
|
|
157
|
+
- **Added**: `mitsein thread rename` (`PATCH /api/next/threads/{id}`), `mitsein thread delete`
|
|
158
|
+
- **Changed**: `mitsein agent running {list,status,tail,wait,cancel}` now take `<thread_id>` instead of `<run_id>` — the backend no longer exposes per-run endpoints; a thread has at most one active run at a time
|
|
159
|
+
- **Changed**: `mitsein agent running list` is now account-level (lists all active runs, not per-thread)
|
|
160
|
+
- **Added**: `--since <event_id>` on `running tail` and `running wait` for precise reconnect
|
|
161
|
+
- **Internal**: removed `core/sse.ts` + `core/waiters.ts`; replaced by `core/chat-stream.ts` (SSE reader with event-id support) + `core/chat-run.ts` (stream consumer with filter/accumulator) + `core/chat-output.ts` (human/NDJSON formatter)
|
|
162
|
+
|
|
163
|
+
### 0.2.3 (2026-04-11)
|
|
164
|
+
|
|
165
|
+
- Fix: unify profile default from `e2e` → `default` (`auth login` wrote `default.json` but other commands read `e2e.json`, causing "No credentials found" immediately after login)
|
|
166
|
+
- Fix: `thread list/get/history` + `messages list` + `project list` migrated to working routes
|
|
167
|
+
- Fix: `printDictHuman` no longer renders nested objects as `[object Object]`
|
|
168
|
+
- Fix: `--debug` now logs method and URL correctly
|
|
169
|
+
|
|
170
|
+
### 0.2.0 — 0.2.2
|
|
133
171
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
| P2 | Extended core + API auto commands | ✅ Done |
|
|
138
|
-
| P3 | Thread + run + messages commands | ✅ Done |
|
|
139
|
-
| P4 | Agent + project + auth commands | ✅ Done |
|
|
140
|
-
| P5 | npm publish + docs | ✅ Done |
|
|
172
|
+
- P5 files command group
|
|
173
|
+
- Auth: browser login, device code, whoami
|
|
174
|
+
- Initial Python → TS port (0.1.0)
|
|
141
175
|
|
|
142
176
|
RFC: [II95V6](https://gitee.com/mitsein/mitsein/issues/II95V6)
|