Skip to content

Commit 5f202c2

Browse files
committed
support empty login commands
1 parent 43dacc4 commit 5f202c2

File tree

17 files changed

+116
-105
lines changed

17 files changed

+116
-105
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44

55
- Remove the need to pass `requestId` on prompt messages.
6+
- Support empty `/login` command to ask what provider to login.
67

78
## 0.45.0
89

docs/features.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Eca supports commands that usually are triggered via shash (`/`) in the chat, co
8585
The built-in commands are:
8686

8787
`/init`: Create/update the AGENTS.md file with details about the workspace for best LLM output quality.
88-
`/login`: Log into a provider. Ex: `/login github-copilot`, `/login anthropic`
88+
`/login`: Log into a provider. Ex: `github-copilot`, `anthropic`.
8989
`/costs`: Show costs about current session.
9090
`/resume`: Resume a chat from previous session of this workspace folder.
9191
`/config`: Show ECA config for troubleshooting.
@@ -99,7 +99,7 @@ It's possible to configure custom command prompts, for more details check [its c
9999

100100
### Login
101101

102-
It's possible to login to some providers using `/login <provider>`, ECA will ask and give instructions on how to authenticate in that provider and save the login info globally in its cache `~/.cache/eca/db.transit.json`.
102+
It's possible to login to some providers using `/login` command, ECA will ask and give instructions on how to authenticate in the chosen provider and save the login info globally in its cache `~/.cache/eca/db.transit.json`.
103103

104104
Current supported providers with login:
105105
- `anthropic`: with options to login to Claude Max/Pro or create API keys.

docs/models.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,18 @@ Only set this when your provider uses a different path or expects query paramete
123123

124124
=== "Anthropic"
125125

126-
1. Login to Anthropic via the chat command `/login anthropic`.
127-
2. Type the chosen method
128-
3. Authenticate in your browser, copy the code.
129-
4. Paste and send the code and done!
126+
1. Login to Anthropic via the chat command `/login`.
127+
2. Type 'anthropic' and send it.
128+
3. Type the chosen method
129+
4. Authenticate in your browser, copy the code.
130+
5. Paste and send the code and done!
130131

131132
=== "Github Copilot"
132133

133-
1. Login to Github copilot via the chat command `/login github-copilot`.
134-
2. Authenticate in Github in your browser with the given code.
135-
3. Type anything in the chat to continue and done!
134+
1. Login to Github copilot via the chat command `/login`.
135+
2. Type 'github-copilot' and send it.
136+
3. Authenticate in Github in your browser with the given code.
137+
4. Type anything in the chat to continue and done!
136138

137139
_Tip: check [Your Copilot plan](https://github.com/settings/copilot/features) to enable models to your account._
138140

docs/protocol.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,10 @@ interface ChatPromptResponse {
346346
*/
347347
model: ChatModel;
348348

349-
status: 'success';
349+
/**
350+
* What the server is doing after receing this prompt
351+
*/
352+
status: 'prompting' | 'login';
350353
}
351354
```
352355

integration-test/integration/chat/anthropic_test.clj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
(is (match?
2727
{:chatId (m/pred string?)
2828
:model "anthropic/claude-sonnet-4-20250514"
29-
:status "success"}
29+
:status "prompting"}
3030
resp))
3131

3232
(match-content chat-id "user" {:type "text" :text "Tell me a joke!\n"})
@@ -55,7 +55,7 @@
5555
(is (match?
5656
{:chatId (m/pred string?)
5757
:model "anthropic/claude-sonnet-4-20250514"
58-
:status "success"}
58+
:status "prompting"}
5959
resp))
6060

6161
(match-content chat-id "user" {:type "text" :text "Who's there?\n"})
@@ -84,7 +84,7 @@
8484
(is (match?
8585
{:chatId (m/pred string?)
8686
:model "anthropic/claude-sonnet-4-20250514"
87-
:status "success"}
87+
:status "prompting"}
8888
resp))
8989

9090
(match-content chat-id "user" {:type "text" :text "What foo?\n"})
@@ -123,7 +123,7 @@
123123
(is (match?
124124
{:chatId (m/pred string?)
125125
:model "anthropic/claude-sonnet-4-20250514"
126-
:status "success"}
126+
:status "prompting"}
127127
resp))
128128

129129
(match-content chat-id "user" {:type "text" :text "hello!\n"})
@@ -156,7 +156,7 @@
156156
(is (match?
157157
{:chatId (m/pred string?)
158158
:model "anthropic/claude-sonnet-4-20250514"
159-
:status "success"}
159+
:status "prompting"}
160160
resp))
161161

162162
(match-content chat-id "user" {:type "text" :text "how are you?\n"})
@@ -200,7 +200,7 @@
200200
(is (match?
201201
{:chatId (m/pred string?)
202202
:model "anthropic/claude-sonnet-4-20250514"
203-
:status "success"}
203+
:status "prompting"}
204204
resp))
205205

206206
(match-content chat-id "user" {:type "text" :text "What files you see?\n"})

integration-test/integration/chat/custom_provider_test.clj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
(is (match?
4343
{:chatId (m/pred string?)
4444
:model "my-provider/foo1"
45-
:status "success"}
45+
:status "prompting"}
4646
resp))
4747

4848
(match-content chat-id "user" {:type "text" :text "Tell me a joke!\n"})
@@ -71,7 +71,7 @@
7171
(is (match?
7272
{:chatId (m/pred string?)
7373
:model "my-provider/foo1"
74-
:status "success"}
74+
:status "prompting"}
7575
resp))
7676

7777
(match-content chat-id "user" {:type "text" :text "Who's there?\n"})
@@ -100,7 +100,7 @@
100100
(is (match?
101101
{:chatId (m/pred string?)
102102
:model "my-provider/foo1"
103-
:status "success"}
103+
:status "prompting"}
104104
resp))
105105

106106
(match-content chat-id "user" {:type "text" :text "What foo?\n"})
@@ -154,7 +154,7 @@
154154
(is (match?
155155
{:chatId (m/pred string?)
156156
:model "my-provider/deepseekcoder"
157-
:status "success"}
157+
:status "prompting"}
158158
resp))
159159

160160
(match-content chat-id "user" {:type "text" :text "Tell me a joke!\n"})
@@ -179,7 +179,7 @@
179179
(is (match?
180180
{:chatId (m/pred string?)
181181
:model "my-provider/deepseekcoder"
182-
:status "success"}
182+
:status "prompting"}
183183
resp))
184184

185185
(match-content chat-id "user" {:type "text" :text "Who's there?\n"})
@@ -204,7 +204,7 @@
204204
(is (match?
205205
{:chatId (m/pred string?)
206206
:model "my-provider/deepseekcoder"
207-
:status "success"}
207+
:status "prompting"}
208208
resp))
209209

210210
(match-content chat-id "user" {:type "text" :text "What foo?\n"})

integration-test/integration/chat/github_copilot_test.clj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
(is (match?
2727
{:chatId (m/pred string?)
2828
:model "github-copilot/gpt-5"
29-
:status "success"}
29+
:status "prompting"}
3030
resp))
3131

3232
(match-content chat-id "user" {:type "text" :text "Tell me a joke!\n"})
@@ -51,7 +51,7 @@
5151
(is (match?
5252
{:chatId (m/pred string?)
5353
:model "github-copilot/gpt-5"
54-
:status "success"}
54+
:status "prompting"}
5555
resp))
5656

5757
(match-content chat-id "user" {:type "text" :text "Who's there?\n"})
@@ -77,7 +77,7 @@
7777
(is (match?
7878
{:chatId (m/pred string?)
7979
:model "github-copilot/gpt-5"
80-
:status "success"}
80+
:status "prompting"}
8181
resp))
8282

8383
(match-content chat-id "user" {:type "text" :text "What foo?\n"})
@@ -114,7 +114,7 @@
114114
(is (match?
115115
{:chatId (m/pred string?)
116116
:model "github-copilot/gpt-5"
117-
:status "success"}
117+
:status "prompting"}
118118
resp))
119119

120120
(match-content chat-id "user" {:type "text" :text "hello!\n"})
@@ -149,7 +149,7 @@
149149
(is (match?
150150
{:chatId (m/pred string?)
151151
:model "github-copilot/gpt-5"
152-
:status "success"}
152+
:status "prompting"}
153153
resp))
154154

155155
(match-content chat-id "user" {:type "text" :text "how are you?\n"})
@@ -198,7 +198,7 @@
198198
(is (match?
199199
{:chatId (m/pred string?)
200200
:model "github-copilot/gpt-5"
201-
:status "success"}
201+
:status "prompting"}
202202
resp))
203203

204204
(match-content chat-id "user" {:type "text" :text "What files you see?\n"})

integration-test/integration/chat/ollama_test.clj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
(is (match?
3535
{:chatId (m/pred string?)
3636
:model "ollama/qwen3"
37-
:status "success"}
37+
:status "prompting"}
3838
resp))
3939

4040
(match-content chat-id "user" {:type "text" :text "Tell me a joke!\n"})
@@ -60,7 +60,7 @@
6060
(is (match?
6161
{:chatId (m/pred string?)
6262
:model "ollama/qwen3"
63-
:status "success"}
63+
:status "prompting"}
6464
resp))
6565

6666
(match-content chat-id "user" {:type "text" :text "Who's there?\n"})
@@ -80,7 +80,7 @@
8080
(is (match?
8181
{:chatId (m/pred string?)
8282
:model "ollama/qwen3"
83-
:status "success"}
83+
:status "prompting"}
8484
resp))
8585

8686
(match-content chat-id "user" {:type "text" :text "What foo?\n"})
@@ -125,7 +125,7 @@
125125
(is (match?
126126
{:chatId (m/pred string?)
127127
:model "ollama/qwen3"
128-
:status "success"}
128+
:status "prompting"}
129129
resp))
130130

131131
(match-content chat-id "user" {:type "text" :text "hello!\n"})
@@ -155,7 +155,7 @@
155155
(is (match?
156156
{:chatId (m/pred string?)
157157
:model "ollama/qwen3"
158-
:status "success"}
158+
:status "prompting"}
159159
resp))
160160

161161
(match-content chat-id "user" {:type "text" :text "how are you?\n"})
@@ -201,7 +201,7 @@
201201
(is (match?
202202
{:chatId (m/pred string?)
203203
:model "ollama/qwen3"
204-
:status "success"}
204+
:status "prompting"}
205205
resp))
206206

207207
(match-content chat-id "user" {:type "text" :text "What files you see?\n"})

integration-test/integration/chat/openai_test.clj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
(is (match?
2727
{:chatId (m/pred string?)
2828
:model "openai/gpt-4.1"
29-
:status "success"}
29+
:status "prompting"}
3030
resp))
3131

3232
(match-content chat-id "user" {:type "text" :text "Tell me a joke!\n"})
@@ -55,7 +55,7 @@
5555
(is (match?
5656
{:chatId (m/pred string?)
5757
:model "openai/gpt-4.1"
58-
:status "success"}
58+
:status "prompting"}
5959
resp))
6060

6161
(match-content chat-id "user" {:type "text" :text "Who's there?\n"})
@@ -84,7 +84,7 @@
8484
(is (match?
8585
{:chatId (m/pred string?)
8686
:model "openai/gpt-4.1"
87-
:status "success"}
87+
:status "prompting"}
8888
resp))
8989

9090
(match-content chat-id "user" {:type "text" :text "What foo?\n"})
@@ -123,7 +123,7 @@
123123
(is (match?
124124
{:chatId (m/pred string?)
125125
:model "openai/gpt-5"
126-
:status "success"}
126+
:status "prompting"}
127127
resp))
128128

129129
(match-content chat-id "user" {:type "text" :text "hello!\n"})
@@ -156,7 +156,7 @@
156156
(is (match?
157157
{:chatId (m/pred string?)
158158
:model "openai/gpt-5"
159-
:status "success"}
159+
:status "prompting"}
160160
resp))
161161

162162
(match-content chat-id "user" {:type "text" :text "how are you?\n"})
@@ -200,7 +200,7 @@
200200
(is (match?
201201
{:chatId (m/pred string?)
202202
:model "openai/gpt-5"
203-
:status "success"}
203+
:status "prompting"}
204204
resp))
205205

206206
(match-content chat-id "user" {:type "text" :text "What files you see?\n"})

src/eca/db.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030

3131
;; cacheable, bump cache when changing
3232
:chats {}
33-
:auth {}})
33+
:auth {"anthropic" {}
34+
"github-copilot" {}}})
3435

3536
(defonce db* (atom initial-db))
3637

0 commit comments

Comments
 (0)