#110 Claude : connexion non vérifiée, login dans le terminal
L'erreur « couldn't verify your sign-in … sign in again (claude auth login) » (org_config_required_unavailable) envoie aussi l'agent dans son terminal, avec un message en mots simples. Le programme de connexion (claude, agy) est tapé une fois le shell de la sandbox prêt, et dans le terminal affiché quand l'agent a déjà ses 8 terminaux. #110 fermé (testé sur le Mac). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2ce7739 parent: 7526205 added
.memory/handoffs/2026-11-15-110-claude-sign-in-again.md +4 -0 | new file mode 100644 | ||
| @@ -0,0 +1,4 @@ | ||
| 1 | +# 2026-11-15 — #110 Claude sign-in not verified | |
| 2 | + | |
| 3 | +- Closed and merged into main (not pushed). The terminal sign-in now also triggers on Claude's "couldn't verify your sign-in" (-32603, org_config_required_unavailable) and on errors that arrive as system messages (session/new); the sign-in program is typed once the shell printed and went quiet (600 ms, fallback 8 s), or into the shown terminal at the 8-terminal limit. | |
| 4 | +- Next: #102 — publish 1.6.0 (version, README + doc index intros, make verify, local CI on the Mac). main is 12 commits ahead of origin/main. | |
| new file mode 100644 | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | +# 2026-11-15 — #110 Claude sign-in not verified | ||
| 2 | + | ||
| 3 | +- Closed and merged into main (not pushed). The terminal sign-in now also triggers on Claude's "couldn't verify your sign-in" (-32603, org_config_required_unavailable) and on errors that arrive as system messages (session/new); the sign-in program is typed once the shell printed and went quiet (600 ms, fallback 8 s), or into the shown terminal at the 8-terminal limit. | ||
| 4 | +- Next: #102 — publish 1.6.0 (version, README + doc index intros, make verify, local CI on the Mac). main is 12 commits ahead of origin/main. | ||
modified
.memory/history.md +3 -0 | @@ -358,3 +358,6 @@ | ||
| 358 | 358 | - Done: `signInPrograms["agy"]="agy"`, `Kind.SignIn="agy"` (antigravity); per-program texts via `signInKey` (signin.ts) with fallback: `signIn.terminal(.claude|.agy)`, `sbxCreator.signIn.choice|later(.claude|.agy)`; docs EN/FR, release notes. Tests Go + vitest (200), lint, bindings; Xvfb with a fake agy. Not committed. Open: #109 task 1 (agy's real sign-in output → refine `.agy` texts), task 5 (Mac). |
| 359 | 359 | - **#109 fix** (owner on the Mac: no switch to the terminal): agy acp refuses at session/new, so the error comes as a system message ("{agent} could not answer"); the auto switch and the sign-in button now also apply to system messages (state.svelte.ts, MessageView). Reproduced and checked under Xvfb. |
| 360 | 360 | - **2026-11-15 — #109 closed** (owner tested Antigravity on the Mac: it works); feature/109-antigravity-signin merged into main (not pushed). |
| 361 | +- **2026-11-15 — #110** (owner: Claude sandbox after removing the anthropic secret → -32603 "couldn't verify your sign-in … sign in again (claude auth login)", org_config_required_unavailable; offer the terminal login too): branch feature/110-claude-sign-in-again; signin.ts authRequired pattern extended, errors.ts error.signInNotVerified; Xvfb with a fake agent. Not committed. | |
| 362 | +- **#110 follow-up** (owner: claude must launch by itself): the sign-in input is now typed when the shell has printed then stayed quiet 600 ms (fallback 8 s), not right after TerminalService.Open; at the terminals limit it goes to the shown terminal (typeInActive). Xvfb with a slow fake sbx -it. | |
| 363 | +- **2026-11-15 — #110 closed** (owner: all good on the Mac); feature/110-claude-sign-in-again merged into main (not pushed). All v1.6.0 feature tickets closed; #102 (publish) remains. | |
| @@ -358,3 +358,6 @@ | |||
| 358 | - Done: `signInPrograms["agy"]="agy"`, `Kind.SignIn="agy"` (antigravity); per-program texts via `signInKey` (signin.ts) with fallback: `signIn.terminal(.claude|.agy)`, `sbxCreator.signIn.choice|later(.claude|.agy)`; docs EN/FR, release notes. Tests Go + vitest (200), lint, bindings; Xvfb with a fake agy. Not committed. Open: #109 task 1 (agy's real sign-in output → refine `.agy` texts), task 5 (Mac). | 358 | - Done: `signInPrograms["agy"]="agy"`, `Kind.SignIn="agy"` (antigravity); per-program texts via `signInKey` (signin.ts) with fallback: `signIn.terminal(.claude|.agy)`, `sbxCreator.signIn.choice|later(.claude|.agy)`; docs EN/FR, release notes. Tests Go + vitest (200), lint, bindings; Xvfb with a fake agy. Not committed. Open: #109 task 1 (agy's real sign-in output → refine `.agy` texts), task 5 (Mac). |
| 359 | - **#109 fix** (owner on the Mac: no switch to the terminal): agy acp refuses at session/new, so the error comes as a system message ("{agent} could not answer"); the auto switch and the sign-in button now also apply to system messages (state.svelte.ts, MessageView). Reproduced and checked under Xvfb. | 359 | - **#109 fix** (owner on the Mac: no switch to the terminal): agy acp refuses at session/new, so the error comes as a system message ("{agent} could not answer"); the auto switch and the sign-in button now also apply to system messages (state.svelte.ts, MessageView). Reproduced and checked under Xvfb. |
| 360 | - **2026-11-15 — #109 closed** (owner tested Antigravity on the Mac: it works); feature/109-antigravity-signin merged into main (not pushed). | 360 | - **2026-11-15 — #109 closed** (owner tested Antigravity on the Mac: it works); feature/109-antigravity-signin merged into main (not pushed). |
| 361 | +- **2026-11-15 — #110** (owner: Claude sandbox after removing the anthropic secret → -32603 "couldn't verify your sign-in … sign in again (claude auth login)", org_config_required_unavailable; offer the terminal login too): branch feature/110-claude-sign-in-again; signin.ts authRequired pattern extended, errors.ts error.signInNotVerified; Xvfb with a fake agent. Not committed. | ||
| 362 | +- **#110 follow-up** (owner: claude must launch by itself): the sign-in input is now typed when the shell has printed then stayed quiet 600 ms (fallback 8 s), not right after TerminalService.Open; at the terminals limit it goes to the shown terminal (typeInActive). Xvfb with a slow fake sbx -it. | ||
| 363 | +- **2026-11-15 — #110 closed** (owner: all good on the Mac); feature/110-claude-sign-in-again merged into main (not pushed). All v1.6.0 feature tickets closed; #102 (publish) remains. | ||
modified
.tickets/issues/0102-publier-la-version-1-6-0.yaml +2 -0 | @@ -21,6 +21,7 @@ related: | ||
| 21 | 21 | - 107 |
| 22 | 22 | - 108 |
| 23 | 23 | - 109 |
| 24 | + - 110 | |
| 24 | 25 | body: | |
| 25 | 26 | Publier Sidekicks 1.6.0 avec ce qui sera fait après la 1.5.0 (liste à compléter) : |
| 26 | 27 | - [#103](.tickets/issues/0103-github-copilot-cli-dans-l-assistant-des-sandboxe.yaml) — GitHub Copilot CLI dans l'assistant des sandboxes |
| @@ -30,6 +31,7 @@ body: | | ||
| 30 | 31 | - [#107](.tickets/issues/0107-assistant-des-sandboxes-codex-cle-facultative-et.yaml) — Codex : clé facultative et connexion ChatGPT |
| 31 | 32 | - [#108](.tickets/issues/0108-assistant-des-sandboxes-gemini-devient-antigravit.yaml) — Gemini devient Antigravity (nom et logo) |
| 32 | 33 | - [#109](.tickets/issues/0109-antigravity-sans-cle-ne-pas-bloquer-et-se-connec.yaml) — Antigravity sans clé : connexion OAuth avec agy dans le terminal |
| 34 | + - [#110](.tickets/issues/0110-claude-connexion-non-verifiee-proposer-aussi-le-l.yaml) — Claude : connexion non vérifiée, login dans le terminal | |
| 33 | 35 | |
| 34 | 36 | Même déroulé que [#93 — Publier la version 1.5.0](.tickets/issues/0093-publier-la-version-1-5-0.yaml), en suivant |
| 35 | 37 | [RELEASING.fr.md](RELEASING.fr.md) (scripts `local-ci-*.sh`), **kDrive en pause** pendant la construction. |
| @@ -21,6 +21,7 @@ related: | |||
| 21 | - 107 | 21 | - 107 |
| 22 | - 108 | 22 | - 108 |
| 23 | - 109 | 23 | - 109 |
| 24 | + - 110 | ||
| 24 | body: | | 25 | body: | |
| 25 | Publier Sidekicks 1.6.0 avec ce qui sera fait après la 1.5.0 (liste à compléter) : | 26 | Publier Sidekicks 1.6.0 avec ce qui sera fait après la 1.5.0 (liste à compléter) : |
| 26 | - [#103](.tickets/issues/0103-github-copilot-cli-dans-l-assistant-des-sandboxe.yaml) — GitHub Copilot CLI dans l'assistant des sandboxes | 27 | - [#103](.tickets/issues/0103-github-copilot-cli-dans-l-assistant-des-sandboxe.yaml) — GitHub Copilot CLI dans l'assistant des sandboxes |
| @@ -30,6 +31,7 @@ body: | | |||
| 30 | - [#107](.tickets/issues/0107-assistant-des-sandboxes-codex-cle-facultative-et.yaml) — Codex : clé facultative et connexion ChatGPT | 31 | - [#107](.tickets/issues/0107-assistant-des-sandboxes-codex-cle-facultative-et.yaml) — Codex : clé facultative et connexion ChatGPT |
| 31 | - [#108](.tickets/issues/0108-assistant-des-sandboxes-gemini-devient-antigravit.yaml) — Gemini devient Antigravity (nom et logo) | 32 | - [#108](.tickets/issues/0108-assistant-des-sandboxes-gemini-devient-antigravit.yaml) — Gemini devient Antigravity (nom et logo) |
| 32 | - [#109](.tickets/issues/0109-antigravity-sans-cle-ne-pas-bloquer-et-se-connec.yaml) — Antigravity sans clé : connexion OAuth avec agy dans le terminal | 33 | - [#109](.tickets/issues/0109-antigravity-sans-cle-ne-pas-bloquer-et-se-connec.yaml) — Antigravity sans clé : connexion OAuth avec agy dans le terminal |
| 34 | + - [#110](.tickets/issues/0110-claude-connexion-non-verifiee-proposer-aussi-le-l.yaml) — Claude : connexion non vérifiée, login dans le terminal | ||
| 33 | 35 | ||
| 34 | Même déroulé que [#93 — Publier la version 1.5.0](.tickets/issues/0093-publier-la-version-1-5-0.yaml), en suivant | 36 | Même déroulé que [#93 — Publier la version 1.5.0](.tickets/issues/0093-publier-la-version-1-5-0.yaml), en suivant |
| 35 | [RELEASING.fr.md](RELEASING.fr.md) (scripts `local-ci-*.sh`), **kDrive en pause** pendant la construction. | 37 | [RELEASING.fr.md](RELEASING.fr.md) (scripts `local-ci-*.sh`), **kDrive en pause** pendant la construction. |
added
.tickets/issues/0110-claude-connexion-non-verifiee-proposer-aussi-le-l.yaml +101 -0 | new file mode 100644 | ||
| @@ -0,0 +1,101 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 110 | |
| 3 | +title: "Claude : connexion non vérifiée, proposer aussi le login dans le terminal" | |
| 4 | +state: closed | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-15T09:54:14.000Z | |
| 9 | +updatedAt: 2026-11-15T10:02:15.000Z | |
| 10 | +labels: | |
| 11 | + - kind::bug | |
| 12 | + - area::workspace | |
| 13 | + - citizen-ux | |
| 14 | + - real-agents | |
| 15 | +milestone: "v1.6.0 · Release" | |
| 16 | +epic: Docker SBX | |
| 17 | +related: | |
| 18 | + - 106 | |
| 19 | + - 109 | |
| 20 | +body: | | |
| 21 | + Relevé par l'owner : secret `anthropic` supprimé de sbx, sandbox d'un agent Claude relancée, puis : | |
| 22 | + | |
| 23 | + ``` | |
| 24 | + Coucou could not answer. | |
| 25 | + {"code":-32603,"message":"Internal error: Claude Code couldn't verify your sign-in with Anthropic yet (its sign-in | |
| 26 | + token was still being refreshed, often by another Claude Code process), so it couldn't load your organization's | |
| 27 | + settings. …'s Organization requires them before a session can start. Try again; if this persists, sign in again | |
| 28 | + (claude auth login).","data":{"startupFailureReason":"org_config_required_unavailable"}} | |
| 29 | + ``` | |
| 30 | + | |
| 31 | + Ce n'est pas « Authentication required » : la bascule vers le terminal | |
| 32 | + ([#106](.tickets/issues/0106-claude-en-sandbox-sans-authentification-ouvrir-l.yaml), | |
| 33 | + [#109](.tickets/issues/0109-antigravity-sans-cle-ne-pas-bloquer-et-se-connec.yaml)) ne se fait pas, et le message reste | |
| 34 | + technique. Il faut **proposer aussi le login dans le terminal** dans ce cas. | |
| 35 | + | |
| 36 | + ## Critères d'acceptation | |
| 37 | + - Cette erreur (texte « couldn't verify your sign-in », « sign in again », `org_config_required_unavailable`) envoie | |
| 38 | + l'agent dans son terminal comme « Authentication required », avec le bouton sous l'erreur. | |
| 39 | + - Un message en mots simples (EN + FR) : la connexion n'a pas pu être vérifiée, se reconnecter dans le terminal. | |
| 40 | + - Tests vitest ; notes de release v1.6.0. | |
| 41 | +tasks: | |
| 42 | + - id: 1 | |
| 43 | + title: "Reconnaître l'erreur de connexion non vérifiée (needsSignIn + errors.ts) et l'expliquer (EN + FR)" | |
| 44 | + state: closed | |
| 45 | + priority: high | |
| 46 | + author: | |
| 47 | + name: k33g | |
| 48 | + email: ph.charriere@gmail.com | |
| 49 | + createdAt: 2026-11-15T09:54:14.000Z | |
| 50 | + updatedAt: 2026-11-15T09:55:11.000Z | |
| 51 | + closedAt: 2026-11-15T09:55:11.000Z | |
| 52 | + - id: 2 | |
| 53 | + title: "Tests vitest, notes de release v1.6.0" | |
| 54 | + state: closed | |
| 55 | + priority: medium | |
| 56 | + author: | |
| 57 | + name: k33g | |
| 58 | + email: ph.charriere@gmail.com | |
| 59 | + createdAt: 2026-11-15T09:54:14.000Z | |
| 60 | + updatedAt: 2026-11-15T09:55:11.000Z | |
| 61 | + closedAt: 2026-11-15T09:55:11.000Z | |
| 62 | + - id: 3 | |
| 63 | + title: "Tester sur le Mac : Claude sans secret anthropic, après une connexion expirée" | |
| 64 | + state: closed | |
| 65 | + priority: high | |
| 66 | + author: | |
| 67 | + name: k33g | |
| 68 | + email: ph.charriere@gmail.com | |
| 69 | + createdAt: 2026-11-15T09:54:14.000Z | |
| 70 | + updatedAt: 2026-11-15T10:02:15.000Z | |
| 71 | + closedAt: 2026-11-15T10:02:15.000Z | |
| 72 | +comments: | |
| 73 | + - id: 1 | |
| 74 | + author: | |
| 75 | + name: k33g | |
| 76 | + email: ph.charriere@gmail.com | |
| 77 | + createdAt: 2026-11-15T09:55:11.000Z | |
| 78 | + body: | | |
| 79 | + Fait sur `feature/110-claude-sign-in-again` : `authRequired` (signin.ts) reconnaît aussi « couldn't verify your | |
| 80 | + sign-in », « sign in again (claude auth login) » et `org_config_required_unavailable` ; règle | |
| 81 | + `error.signInNotVerified` (EN + FR) avant `error.authRequired`. Vérifié sous Xvfb avec un faux claude-agent-acp | |
| 82 | + qui renvoie l'erreur relevée à `session/new` : bascule vers le terminal, `claude` lancé, bouton sous l'erreur. | |
| 83 | + - id: 2 | |
| 84 | + author: | |
| 85 | + name: k33g | |
| 86 | + email: ph.charriere@gmail.com | |
| 87 | + createdAt: 2026-11-15T09:58:43.000Z | |
| 88 | + body: | | |
| 89 | + Owner : « il faudrait que cela lance automatiquement claude » — sur le Mac le terminal s'ouvrait sans lancer | |
| 90 | + `claude`. Causes probables : `claude\r` écrit dès l'ouverture du terminal, avant que `sbx exec -it` ait relié le | |
| 91 | + shell de la sandbox (frappe perdue) ; ou l'agent avait déjà ses 8 terminaux (aucun nouveau, rien de tapé). | |
| 92 | + Corrigé (terminalSessions) : le programme est tapé quand le shell a affiché quelque chose puis s'est tu 600 ms | |
| 93 | + (bannière et invite passées), ou au bout de 8 s s'il n'affiche rien ; à la limite de terminaux, il va dans le | |
| 94 | + terminal affiché (`typeInActive`). Vérifié sous Xvfb avec un faux sbx dont le terminal met 2 s à démarrer. | |
| 95 | + - id: 3 | |
| 96 | + author: | |
| 97 | + name: k33g | |
| 98 | + email: ph.charriere@gmail.com | |
| 99 | + createdAt: 2026-11-15T10:02:15.000Z | |
| 100 | + body: | | |
| 101 | + Testé sur le Mac par l'owner : ça fonctionne (claude se lance tout seul). Mergé dans main. Ticket fermé. | |
| new file mode 100644 | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 110 | ||
| 3 | +title: "Claude : connexion non vérifiée, proposer aussi le login dans le terminal" | ||
| 4 | +state: closed | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-15T09:54:14.000Z | ||
| 9 | +updatedAt: 2026-11-15T10:02:15.000Z | ||
| 10 | +labels: | ||
| 11 | + - kind::bug | ||
| 12 | + - area::workspace | ||
| 13 | + - citizen-ux | ||
| 14 | + - real-agents | ||
| 15 | +milestone: "v1.6.0 · Release" | ||
| 16 | +epic: Docker SBX | ||
| 17 | +related: | ||
| 18 | + - 106 | ||
| 19 | + - 109 | ||
| 20 | +body: | | ||
| 21 | + Relevé par l'owner : secret `anthropic` supprimé de sbx, sandbox d'un agent Claude relancée, puis : | ||
| 22 | + | ||
| 23 | + ``` | ||
| 24 | + Coucou could not answer. | ||
| 25 | + {"code":-32603,"message":"Internal error: Claude Code couldn't verify your sign-in with Anthropic yet (its sign-in | ||
| 26 | + token was still being refreshed, often by another Claude Code process), so it couldn't load your organization's | ||
| 27 | + settings. …'s Organization requires them before a session can start. Try again; if this persists, sign in again | ||
| 28 | + (claude auth login).","data":{"startupFailureReason":"org_config_required_unavailable"}} | ||
| 29 | + ``` | ||
| 30 | + | ||
| 31 | + Ce n'est pas « Authentication required » : la bascule vers le terminal | ||
| 32 | + ([#106](.tickets/issues/0106-claude-en-sandbox-sans-authentification-ouvrir-l.yaml), | ||
| 33 | + [#109](.tickets/issues/0109-antigravity-sans-cle-ne-pas-bloquer-et-se-connec.yaml)) ne se fait pas, et le message reste | ||
| 34 | + technique. Il faut **proposer aussi le login dans le terminal** dans ce cas. | ||
| 35 | + | ||
| 36 | + ## Critères d'acceptation | ||
| 37 | + - Cette erreur (texte « couldn't verify your sign-in », « sign in again », `org_config_required_unavailable`) envoie | ||
| 38 | + l'agent dans son terminal comme « Authentication required », avec le bouton sous l'erreur. | ||
| 39 | + - Un message en mots simples (EN + FR) : la connexion n'a pas pu être vérifiée, se reconnecter dans le terminal. | ||
| 40 | + - Tests vitest ; notes de release v1.6.0. | ||
| 41 | +tasks: | ||
| 42 | + - id: 1 | ||
| 43 | + title: "Reconnaître l'erreur de connexion non vérifiée (needsSignIn + errors.ts) et l'expliquer (EN + FR)" | ||
| 44 | + state: closed | ||
| 45 | + priority: high | ||
| 46 | + author: | ||
| 47 | + name: k33g | ||
| 48 | + email: ph.charriere@gmail.com | ||
| 49 | + createdAt: 2026-11-15T09:54:14.000Z | ||
| 50 | + updatedAt: 2026-11-15T09:55:11.000Z | ||
| 51 | + closedAt: 2026-11-15T09:55:11.000Z | ||
| 52 | + - id: 2 | ||
| 53 | + title: "Tests vitest, notes de release v1.6.0" | ||
| 54 | + state: closed | ||
| 55 | + priority: medium | ||
| 56 | + author: | ||
| 57 | + name: k33g | ||
| 58 | + email: ph.charriere@gmail.com | ||
| 59 | + createdAt: 2026-11-15T09:54:14.000Z | ||
| 60 | + updatedAt: 2026-11-15T09:55:11.000Z | ||
| 61 | + closedAt: 2026-11-15T09:55:11.000Z | ||
| 62 | + - id: 3 | ||
| 63 | + title: "Tester sur le Mac : Claude sans secret anthropic, après une connexion expirée" | ||
| 64 | + state: closed | ||
| 65 | + priority: high | ||
| 66 | + author: | ||
| 67 | + name: k33g | ||
| 68 | + email: ph.charriere@gmail.com | ||
| 69 | + createdAt: 2026-11-15T09:54:14.000Z | ||
| 70 | + updatedAt: 2026-11-15T10:02:15.000Z | ||
| 71 | + closedAt: 2026-11-15T10:02:15.000Z | ||
| 72 | +comments: | ||
| 73 | + - id: 1 | ||
| 74 | + author: | ||
| 75 | + name: k33g | ||
| 76 | + email: ph.charriere@gmail.com | ||
| 77 | + createdAt: 2026-11-15T09:55:11.000Z | ||
| 78 | + body: | | ||
| 79 | + Fait sur `feature/110-claude-sign-in-again` : `authRequired` (signin.ts) reconnaît aussi « couldn't verify your | ||
| 80 | + sign-in », « sign in again (claude auth login) » et `org_config_required_unavailable` ; règle | ||
| 81 | + `error.signInNotVerified` (EN + FR) avant `error.authRequired`. Vérifié sous Xvfb avec un faux claude-agent-acp | ||
| 82 | + qui renvoie l'erreur relevée à `session/new` : bascule vers le terminal, `claude` lancé, bouton sous l'erreur. | ||
| 83 | + - id: 2 | ||
| 84 | + author: | ||
| 85 | + name: k33g | ||
| 86 | + email: ph.charriere@gmail.com | ||
| 87 | + createdAt: 2026-11-15T09:58:43.000Z | ||
| 88 | + body: | | ||
| 89 | + Owner : « il faudrait que cela lance automatiquement claude » — sur le Mac le terminal s'ouvrait sans lancer | ||
| 90 | + `claude`. Causes probables : `claude\r` écrit dès l'ouverture du terminal, avant que `sbx exec -it` ait relié le | ||
| 91 | + shell de la sandbox (frappe perdue) ; ou l'agent avait déjà ses 8 terminaux (aucun nouveau, rien de tapé). | ||
| 92 | + Corrigé (terminalSessions) : le programme est tapé quand le shell a affiché quelque chose puis s'est tu 600 ms | ||
| 93 | + (bannière et invite passées), ou au bout de 8 s s'il n'affiche rien ; à la limite de terminaux, il va dans le | ||
| 94 | + terminal affiché (`typeInActive`). Vérifié sous Xvfb avec un faux sbx dont le terminal met 2 s à démarrer. | ||
| 95 | + - id: 3 | ||
| 96 | + author: | ||
| 97 | + name: k33g | ||
| 98 | + email: ph.charriere@gmail.com | ||
| 99 | + createdAt: 2026-11-15T10:02:15.000Z | ||
| 100 | + body: | | ||
| 101 | + Testé sur le Mac par l'owner : ça fonctionne (claude se lance tout seul). Mergé dans main. Ticket fermé. | ||
modified
docs/release-notes/v1.6.0.fr.md +1 -1 | @@ -15,7 +15,7 @@ Sidekicks 1.6.0 ajoute GitHub Copilot aux agents que crée l'assistant des sandb | ||
| 15 | 15 | ### Claude avec votre compte Claude (#105, #106) |
| 16 | 16 | |
| 17 | 17 | - Dans l'assistant des sandboxes, Claude n'exige plus de clé d'API : cliquez sur **Plus tard**, et l'assistant explique que vous vous connecterez avec votre compte Claude par `/login` dans le terminal de l'agent. |
| 18 | -- Quand un agent Claude répond « Authentication required », Sidekicks ouvre son **Terminal**, lance `claude` dans la sandbox et vous dit de taper `/login`. **Je suis connecté : redémarrer l'agent** vous ramène à la conversation ; **Se connecter dans son terminal**, sous l'erreur, le rouvre. | |
| 18 | +- Quand un agent Claude répond « Authentication required », Sidekicks ouvre son **Terminal**, lance `claude` dans la sandbox et vous dit de taper `/login`. **Je suis connecté : redémarrer l'agent** vous ramène à la conversation ; **Se connecter dans son terminal**, sous l'erreur, le rouvre. De même quand Claude Code ne peut pas vérifier sa connexion (elle a expiré, ou sa clé a été retirée de sbx, #110). | |
| 19 | 19 | |
| 20 | 20 | ### Antigravity avec votre compte Google (#109) |
| 21 | 21 | |
| @@ -15,7 +15,7 @@ Sidekicks 1.6.0 ajoute GitHub Copilot aux agents que crée l'assistant des sandb | |||
| 15 | ### Claude avec votre compte Claude (#105, #106) | 15 | ### Claude avec votre compte Claude (#105, #106) |
| 16 | 16 | ||
| 17 | - Dans l'assistant des sandboxes, Claude n'exige plus de clé d'API : cliquez sur **Plus tard**, et l'assistant explique que vous vous connecterez avec votre compte Claude par `/login` dans le terminal de l'agent. | 17 | - Dans l'assistant des sandboxes, Claude n'exige plus de clé d'API : cliquez sur **Plus tard**, et l'assistant explique que vous vous connecterez avec votre compte Claude par `/login` dans le terminal de l'agent. |
| 18 | -- Quand un agent Claude répond « Authentication required », Sidekicks ouvre son **Terminal**, lance `claude` dans la sandbox et vous dit de taper `/login`. **Je suis connecté : redémarrer l'agent** vous ramène à la conversation ; **Se connecter dans son terminal**, sous l'erreur, le rouvre. | 18 | +- Quand un agent Claude répond « Authentication required », Sidekicks ouvre son **Terminal**, lance `claude` dans la sandbox et vous dit de taper `/login`. **Je suis connecté : redémarrer l'agent** vous ramène à la conversation ; **Se connecter dans son terminal**, sous l'erreur, le rouvre. De même quand Claude Code ne peut pas vérifier sa connexion (elle a expiré, ou sa clé a été retirée de sbx, #110). |
| 19 | 19 | ||
| 20 | ### Antigravity avec votre compte Google (#109) | 20 | ### Antigravity avec votre compte Google (#109) |
| 21 | 21 | ||
modified
docs/release-notes/v1.6.0.md +1 -1 | @@ -15,7 +15,7 @@ Sidekicks 1.6.0 adds GitHub Copilot to the agents the sandbox assistant creates, | ||
| 15 | 15 | ### Claude with your Claude account (#105, #106) |
| 16 | 16 | |
| 17 | 17 | - In the sandbox assistant, Claude no longer needs an API key: click **Later**, and the assistant explains that you will sign in with your Claude account with `/login` in the agent's terminal. |
| 18 | -- When a Claude agent answers "Authentication required", Sidekicks opens its **Terminal**, runs `claude` in the sandbox and tells you to type `/login`. **I am signed in: restart the agent** brings you back to the conversation; **Sign in in its terminal**, under the error, opens it again. | |
| 18 | +- When a Claude agent answers "Authentication required", Sidekicks opens its **Terminal**, runs `claude` in the sandbox and tells you to type `/login`. **I am signed in: restart the agent** brings you back to the conversation; **Sign in in its terminal**, under the error, opens it again. The same happens when Claude Code cannot verify its sign-in (it expired, or its key was removed from sbx, #110). | |
| 19 | 19 | |
| 20 | 20 | ### Antigravity with your Google account (#109) |
| 21 | 21 | |
| @@ -15,7 +15,7 @@ Sidekicks 1.6.0 adds GitHub Copilot to the agents the sandbox assistant creates, | |||
| 15 | ### Claude with your Claude account (#105, #106) | 15 | ### Claude with your Claude account (#105, #106) |
| 16 | 16 | ||
| 17 | - In the sandbox assistant, Claude no longer needs an API key: click **Later**, and the assistant explains that you will sign in with your Claude account with `/login` in the agent's terminal. | 17 | - In the sandbox assistant, Claude no longer needs an API key: click **Later**, and the assistant explains that you will sign in with your Claude account with `/login` in the agent's terminal. |
| 18 | -- When a Claude agent answers "Authentication required", Sidekicks opens its **Terminal**, runs `claude` in the sandbox and tells you to type `/login`. **I am signed in: restart the agent** brings you back to the conversation; **Sign in in its terminal**, under the error, opens it again. | 18 | +- When a Claude agent answers "Authentication required", Sidekicks opens its **Terminal**, runs `claude` in the sandbox and tells you to type `/login`. **I am signed in: restart the agent** brings you back to the conversation; **Sign in in its terminal**, under the error, opens it again. The same happens when Claude Code cannot verify its sign-in (it expired, or its key was removed from sbx, #110). |
| 19 | 19 | ||
| 20 | ### Antigravity with your Google account (#109) | 20 | ### Antigravity with your Google account (#109) |
| 21 | 21 | ||
modified
frontend/src/lib/errors.ts +3 -0 | @@ -26,6 +26,9 @@ const rules: Rule[] = [ | ||
| 26 | 26 | // sbx asking, while creating a Codex sandbox, whether to sign in to OpenAI |
| 27 | 27 | // on the web (issue #107): ErrorText offers the ChatGPT sign-in. |
| 28 | 28 | { pattern: /authenticate (?:on|in|with|via|using) (?:the |your )?(?:web|browser)|no OpenAI credential|sign in with ChatGPT|secret set openai/i, key: 'error.openaiSignIn' }, |
| 29 | + // Claude Code whose sign-in could not be verified (issue #110): before the | |
| 30 | + // generic rule below, which would not match it anyway. | |
| 31 | + { pattern: /couldn't verify your sign-in|org_config_required_unavailable/i, key: 'error.signInNotVerified' }, | |
| 29 | 32 | // An agent without a key nor a signed-in account (issues #105, #106). |
| 30 | 33 | { pattern: /Authentication required/i, key: 'error.authRequired' }, |
| 31 | 34 | // gh without a token (issue #103). |
| @@ -26,6 +26,9 @@ const rules: Rule[] = [ | |||
| 26 | // sbx asking, while creating a Codex sandbox, whether to sign in to OpenAI | 26 | // sbx asking, while creating a Codex sandbox, whether to sign in to OpenAI |
| 27 | // on the web (issue #107): ErrorText offers the ChatGPT sign-in. | 27 | // on the web (issue #107): ErrorText offers the ChatGPT sign-in. |
| 28 | { pattern: /authenticate (?:on|in|with|via|using) (?:the |your )?(?:web|browser)|no OpenAI credential|sign in with ChatGPT|secret set openai/i, key: 'error.openaiSignIn' }, | 28 | { pattern: /authenticate (?:on|in|with|via|using) (?:the |your )?(?:web|browser)|no OpenAI credential|sign in with ChatGPT|secret set openai/i, key: 'error.openaiSignIn' }, |
| 29 | + // Claude Code whose sign-in could not be verified (issue #110): before the | ||
| 30 | + // generic rule below, which would not match it anyway. | ||
| 31 | + { pattern: /couldn't verify your sign-in|org_config_required_unavailable/i, key: 'error.signInNotVerified' }, | ||
| 29 | // An agent without a key nor a signed-in account (issues #105, #106). | 32 | // An agent without a key nor a signed-in account (issues #105, #106). |
| 30 | { pattern: /Authentication required/i, key: 'error.authRequired' }, | 33 | { pattern: /Authentication required/i, key: 'error.authRequired' }, |
| 31 | // gh without a token (issue #103). | 34 | // gh without a token (issue #103). |
modified
frontend/src/lib/i18n/messages.ts +2 -0 | @@ -190,6 +190,7 @@ export const en = { | ||
| 190 | 190 | 'sbxCreator.oauth.choice': '{title} works with an OpenAI API key or with your ChatGPT account. Signing in opens your browser; sbx keeps the sign-in in your keychain, and the sandbox never sees it.', |
| 191 | 191 | 'sbxCreator.oauth.orKey': 'Or paste an OpenAI API key:', |
| 192 | 192 | 'sbxCreator.oauth.later': 'No OpenAI key nor ChatGPT sign-in in sbx yet. You can go on: if sbx asks to sign in when it creates the sandbox, Sidekicks shows a "Sign in with my ChatGPT account" button under the error.', |
| 193 | + 'error.signInNotVerified': 'The agent could not verify its sign-in (it may have expired, or its key was removed): sign in again in its terminal.', | |
| 193 | 194 | 'error.authRequired': 'The agent is not signed in: it has no API key, and nobody signed in with an account yet.', |
| 194 | 195 | 'signIn.open': 'Sign in in its terminal', |
| 195 | 196 | 'signIn.terminal': '{agent} is not signed in. {program} is starting in this terminal: follow its steps to sign in with your account (copy the link into your browser if asked). Then click the button: the agent restarts and you can send your message again.', |
| @@ -717,6 +718,7 @@ export const fr: Record<MessageKey, string> = { | ||
| 717 | 718 | 'sbxCreator.oauth.choice': "{title} fonctionne avec une clé d'API OpenAI ou avec votre compte ChatGPT. La connexion ouvre votre navigateur ; sbx garde la connexion dans votre trousseau, et la sandbox ne la voit jamais.", |
| 718 | 719 | 'sbxCreator.oauth.orKey': "Ou collez une clé d'API OpenAI :", |
| 719 | 720 | 'sbxCreator.oauth.later': "Pas encore de clé OpenAI ni de connexion ChatGPT dans sbx. Vous pouvez continuer : si sbx demande de se connecter en créant la sandbox, Sidekicks affiche un bouton « Me connecter avec mon compte ChatGPT » sous l'erreur.", |
| 721 | + 'error.signInNotVerified': "L'agent n'a pas pu vérifier sa connexion (elle a peut-être expiré, ou sa clé a été retirée) : reconnectez-le dans son terminal.", | |
| 720 | 722 | 'error.authRequired': "L'agent n'est pas connecté : il n'a pas de clé d'API, et personne ne s'est encore connecté avec un compte.", |
| 721 | 723 | 'signIn.open': 'Se connecter dans son terminal', |
| 722 | 724 | 'signIn.terminal': "{agent} n'est pas connecté. {program} démarre dans ce terminal : suivez ses étapes pour vous connecter avec votre compte (copiez le lien dans votre navigateur si on vous le demande). Puis cliquez sur le bouton : l'agent redémarre et vous pouvez renvoyer votre message.", |
| @@ -190,6 +190,7 @@ export const en = { | |||
| 190 | 'sbxCreator.oauth.choice': '{title} works with an OpenAI API key or with your ChatGPT account. Signing in opens your browser; sbx keeps the sign-in in your keychain, and the sandbox never sees it.', | 190 | 'sbxCreator.oauth.choice': '{title} works with an OpenAI API key or with your ChatGPT account. Signing in opens your browser; sbx keeps the sign-in in your keychain, and the sandbox never sees it.', |
| 191 | 'sbxCreator.oauth.orKey': 'Or paste an OpenAI API key:', | 191 | 'sbxCreator.oauth.orKey': 'Or paste an OpenAI API key:', |
| 192 | 'sbxCreator.oauth.later': 'No OpenAI key nor ChatGPT sign-in in sbx yet. You can go on: if sbx asks to sign in when it creates the sandbox, Sidekicks shows a "Sign in with my ChatGPT account" button under the error.', | 192 | 'sbxCreator.oauth.later': 'No OpenAI key nor ChatGPT sign-in in sbx yet. You can go on: if sbx asks to sign in when it creates the sandbox, Sidekicks shows a "Sign in with my ChatGPT account" button under the error.', |
| 193 | + 'error.signInNotVerified': 'The agent could not verify its sign-in (it may have expired, or its key was removed): sign in again in its terminal.', | ||
| 193 | 'error.authRequired': 'The agent is not signed in: it has no API key, and nobody signed in with an account yet.', | 194 | 'error.authRequired': 'The agent is not signed in: it has no API key, and nobody signed in with an account yet.', |
| 194 | 'signIn.open': 'Sign in in its terminal', | 195 | 'signIn.open': 'Sign in in its terminal', |
| 195 | 'signIn.terminal': '{agent} is not signed in. {program} is starting in this terminal: follow its steps to sign in with your account (copy the link into your browser if asked). Then click the button: the agent restarts and you can send your message again.', | 196 | 'signIn.terminal': '{agent} is not signed in. {program} is starting in this terminal: follow its steps to sign in with your account (copy the link into your browser if asked). Then click the button: the agent restarts and you can send your message again.', |
| @@ -717,6 +718,7 @@ export const fr: Record<MessageKey, string> = { | |||
| 717 | 'sbxCreator.oauth.choice': "{title} fonctionne avec une clé d'API OpenAI ou avec votre compte ChatGPT. La connexion ouvre votre navigateur ; sbx garde la connexion dans votre trousseau, et la sandbox ne la voit jamais.", | 718 | 'sbxCreator.oauth.choice': "{title} fonctionne avec une clé d'API OpenAI ou avec votre compte ChatGPT. La connexion ouvre votre navigateur ; sbx garde la connexion dans votre trousseau, et la sandbox ne la voit jamais.", |
| 718 | 'sbxCreator.oauth.orKey': "Ou collez une clé d'API OpenAI :", | 719 | 'sbxCreator.oauth.orKey': "Ou collez une clé d'API OpenAI :", |
| 719 | 'sbxCreator.oauth.later': "Pas encore de clé OpenAI ni de connexion ChatGPT dans sbx. Vous pouvez continuer : si sbx demande de se connecter en créant la sandbox, Sidekicks affiche un bouton « Me connecter avec mon compte ChatGPT » sous l'erreur.", | 720 | 'sbxCreator.oauth.later': "Pas encore de clé OpenAI ni de connexion ChatGPT dans sbx. Vous pouvez continuer : si sbx demande de se connecter en créant la sandbox, Sidekicks affiche un bouton « Me connecter avec mon compte ChatGPT » sous l'erreur.", |
| 721 | + 'error.signInNotVerified': "L'agent n'a pas pu vérifier sa connexion (elle a peut-être expiré, ou sa clé a été retirée) : reconnectez-le dans son terminal.", | ||
| 720 | 'error.authRequired': "L'agent n'est pas connecté : il n'a pas de clé d'API, et personne ne s'est encore connecté avec un compte.", | 722 | 'error.authRequired': "L'agent n'est pas connecté : il n'a pas de clé d'API, et personne ne s'est encore connecté avec un compte.", |
| 721 | 'signIn.open': 'Se connecter dans son terminal', | 723 | 'signIn.open': 'Se connecter dans son terminal', |
| 722 | 'signIn.terminal': "{agent} n'est pas connecté. {program} démarre dans ce terminal : suivez ses étapes pour vous connecter avec votre compte (copiez le lien dans votre navigateur si on vous le demande). Puis cliquez sur le bouton : l'agent redémarre et vous pouvez renvoyer votre message.", | 724 | 'signIn.terminal': "{agent} n'est pas connecté. {program} démarre dans ce terminal : suivez ses étapes pour vous connecter avec votre compte (copiez le lien dans votre navigateur si on vous le demande). Puis cliquez sur le bouton : l'agent redémarre et vous pouvez renvoyer votre message.", |
modified
frontend/src/lib/signin.test.ts +6 -0 | @@ -9,6 +9,12 @@ describe('signing in from the terminal (issues #105, #106)', () => { | ||
| 9 | 9 | expect(needsSignIn('Authentication required', 'claude')).toBe(true) |
| 10 | 10 | expect(needsSignIn('session/prompt: Authentication required', 'claude')).toBe(true) |
| 11 | 11 | }) |
| 12 | + it('also when Claude Code could not verify its sign-in (issue #110)', () => { | |
| 13 | + const raw = `{"code":-32603,"message":"Internal error: Claude Code couldn't verify your sign-in with Anthropic yet (its sign-in token was still being refreshed). Try again; if this persists, sign in again (claude auth login).","data":{"startupFailureReason":"org_config_required_unavailable"}}` | |
| 14 | + expect(needsSignIn(raw, 'claude')).toBe(true) | |
| 15 | + expect(explain(raw)?.key).toBe('error.signInNotVerified') | |
| 16 | + expect(needsSignIn('{"code":-32603,"message":"Internal error: something else"}', 'claude')).toBe(false) | |
| 17 | + }) | |
| 12 | 18 | it('does not for another error, or an agent with no sign-in program', () => { |
| 13 | 19 | expect(needsSignIn('the agent stopped', 'claude')).toBe(false) |
| 14 | 20 | expect(needsSignIn('Authentication required', '')).toBe(false) |
| @@ -9,6 +9,12 @@ describe('signing in from the terminal (issues #105, #106)', () => { | |||
| 9 | expect(needsSignIn('Authentication required', 'claude')).toBe(true) | 9 | expect(needsSignIn('Authentication required', 'claude')).toBe(true) |
| 10 | expect(needsSignIn('session/prompt: Authentication required', 'claude')).toBe(true) | 10 | expect(needsSignIn('session/prompt: Authentication required', 'claude')).toBe(true) |
| 11 | }) | 11 | }) |
| 12 | + it('also when Claude Code could not verify its sign-in (issue #110)', () => { | ||
| 13 | + const raw = `{"code":-32603,"message":"Internal error: Claude Code couldn't verify your sign-in with Anthropic yet (its sign-in token was still being refreshed). Try again; if this persists, sign in again (claude auth login).","data":{"startupFailureReason":"org_config_required_unavailable"}}` | ||
| 14 | + expect(needsSignIn(raw, 'claude')).toBe(true) | ||
| 15 | + expect(explain(raw)?.key).toBe('error.signInNotVerified') | ||
| 16 | + expect(needsSignIn('{"code":-32603,"message":"Internal error: something else"}', 'claude')).toBe(false) | ||
| 17 | + }) | ||
| 12 | it('does not for another error, or an agent with no sign-in program', () => { | 18 | it('does not for another error, or an agent with no sign-in program', () => { |
| 13 | expect(needsSignIn('the agent stopped', 'claude')).toBe(false) | 19 | expect(needsSignIn('the agent stopped', 'claude')).toBe(false) |
| 14 | expect(needsSignIn('Authentication required', '')).toBe(false) | 20 | expect(needsSignIn('Authentication required', '')).toBe(false) |
modified
frontend/src/lib/signin.ts +7 -2 | @@ -5,8 +5,13 @@ | ||
| 5 | 5 | // "Authentication required". Sidekicks then opens the sandbox's terminal, |
| 6 | 6 | // runs claude in it and tells the user to type /login. |
| 7 | 7 | |
| 8 | -/** The error of an agent that has neither a key nor a signed-in account. */ | |
| 9 | -export const authRequired = /Authentication required/i | |
| 8 | +/** | |
| 9 | + * The errors of an agent that has neither a key nor a signed-in account | |
| 10 | + * ("Authentication required"), or whose sign-in could not be verified — | |
| 11 | + * Claude Code: "couldn't verify your sign-in … sign in again (claude auth | |
| 12 | + * login)", startupFailureReason org_config_required_unavailable (issue #110). | |
| 13 | + */ | |
| 14 | +export const authRequired = /Authentication required|couldn't verify your sign-in|sign in again \(claude auth login\)|org_config_required_unavailable/i | |
| 10 | 15 | |
| 11 | 16 | /** |
| 12 | 17 | * Whether an answer's error should send the user to the agent's terminal to |
| @@ -5,8 +5,13 @@ | |||
| 5 | // "Authentication required". Sidekicks then opens the sandbox's terminal, | 5 | // "Authentication required". Sidekicks then opens the sandbox's terminal, |
| 6 | // runs claude in it and tells the user to type /login. | 6 | // runs claude in it and tells the user to type /login. |
| 7 | 7 | ||
| 8 | -/** The error of an agent that has neither a key nor a signed-in account. */ | 8 | +/** |
| 9 | -export const authRequired = /Authentication required/i | 9 | + * The errors of an agent that has neither a key nor a signed-in account |
| 10 | + * ("Authentication required"), or whose sign-in could not be verified — | ||
| 11 | + * Claude Code: "couldn't verify your sign-in … sign in again (claude auth | ||
| 12 | + * login)", startupFailureReason org_config_required_unavailable (issue #110). | ||
| 13 | + */ | ||
| 14 | +export const authRequired = /Authentication required|couldn't verify your sign-in|sign in again \(claude auth login\)|org_config_required_unavailable/i | ||
| 10 | 15 | ||
| 11 | /** | 16 | /** |
| 12 | * Whether an answer's error should send the user to the agent's terminal to | 17 | * Whether an answer's error should send the user to the agent's terminal to |
modified
frontend/src/lib/state.svelte.ts +3 -2 | @@ -12,7 +12,7 @@ import type { AgentLogPayload, AgentProgressPayload, AgentStatePayload, ConfigCh | ||
| 12 | 12 | import { nextProgress, type Progress } from './progress' |
| 13 | 13 | import type { ExitPayload, OutputPayload } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/workspace' |
| 14 | 14 | import { terminalExit, terminalOutput } from './terminals' |
| 15 | -import { newTerminal } from './terminalSessions.svelte' | |
| 15 | +import { newTerminal, typeInActive } from './terminalSessions.svelte' | |
| 16 | 16 | import { needsSignIn, signInInput } from './signin' |
| 17 | 17 | import type { |
| 18 | 18 | Channel, |
| @@ -249,7 +249,8 @@ export function signInInTerminal(agent: string) { | ||
| 249 | 249 | if (!program) return |
| 250 | 250 | signInOpened.add(agent) |
| 251 | 251 | openWorkspace(agent) |
| 252 | - newTerminal(agent, signInInput(program)) | |
| 252 | + // A new terminal; when the agent already has as many as allowed, the one shown. | |
| 253 | + if (!newTerminal(agent, signInInput(program))) typeInActive(agent, signInInput(program)) | |
| 253 | 254 | appState.signInAgent = agent |
| 254 | 255 | appState.terminalRequest++ |
| 255 | 256 | } |
| @@ -12,7 +12,7 @@ import type { AgentLogPayload, AgentProgressPayload, AgentStatePayload, ConfigCh | |||
| 12 | import { nextProgress, type Progress } from './progress' | 12 | import { nextProgress, type Progress } from './progress' |
| 13 | import type { ExitPayload, OutputPayload } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/workspace' | 13 | import type { ExitPayload, OutputPayload } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/workspace' |
| 14 | import { terminalExit, terminalOutput } from './terminals' | 14 | import { terminalExit, terminalOutput } from './terminals' |
| 15 | -import { newTerminal } from './terminalSessions.svelte' | 15 | +import { newTerminal, typeInActive } from './terminalSessions.svelte' |
| 16 | import { needsSignIn, signInInput } from './signin' | 16 | import { needsSignIn, signInInput } from './signin' |
| 17 | import type { | 17 | import type { |
| 18 | Channel, | 18 | Channel, |
| @@ -249,7 +249,8 @@ export function signInInTerminal(agent: string) { | |||
| 249 | if (!program) return | 249 | if (!program) return |
| 250 | signInOpened.add(agent) | 250 | signInOpened.add(agent) |
| 251 | openWorkspace(agent) | 251 | openWorkspace(agent) |
| 252 | - newTerminal(agent, signInInput(program)) | 252 | + // A new terminal; when the agent already has as many as allowed, the one shown. |
| 253 | + if (!newTerminal(agent, signInInput(program))) typeInActive(agent, signInInput(program)) | ||
| 253 | appState.signInAgent = agent | 254 | appState.signInAgent = agent |
| 254 | appState.terminalRequest++ | 255 | appState.terminalRequest++ |
| 255 | } | 256 | } |
modified
frontend/src/lib/terminalSessions.svelte.ts +47 -6 | @@ -38,6 +38,8 @@ type Screen = { | ||
| 38 | 38 | stop: () => void |
| 39 | 39 | /** Typed once its shell has started, e.g. "claude\r" to sign in (issue #106). */ |
| 40 | 40 | input: string |
| 41 | + /** The pending typing of input. */ | |
| 42 | + typing?: ReturnType<typeof setTimeout> | |
| 41 | 43 | } |
| 42 | 44 | |
| 43 | 45 | /** The terminals of each agent, in the order they were opened. */ |
| @@ -120,18 +122,55 @@ async function start(key: string) { | ||
| 120 | 122 | } |
| 121 | 123 | screen.stop = listenTerminal( |
| 122 | 124 | screen.id, |
| 123 | - (data) => screen.xterm.write(data), | |
| 125 | + (data) => { | |
| 126 | + screen.xterm.write(data) | |
| 127 | + if (screen.input) typeWhenQuiet(screen) | |
| 128 | + }, | |
| 124 | 129 | () => { |
| 125 | 130 | screen.id = '' |
| 126 | 131 | const ended = sessionOf(key) |
| 127 | 132 | if (ended) ended.ended = true |
| 128 | 133 | }, |
| 129 | 134 | ) |
| 130 | - // The sign-in program (issue #106), typed once the shell is there. | |
| 131 | - if (screen.input) { | |
| 132 | - void TerminalService.Write(screen.id, screen.input) | |
| 133 | - screen.input = '' | |
| 134 | - } | |
| 135 | + // The sign-in program (issue #106) is typed once the shell is there: when | |
| 136 | + // it has printed its prompt and gone quiet (typeWhenQuiet). Typed earlier, | |
| 137 | + // before sbx exec has joined the sandbox's shell, it would be lost. A | |
| 138 | + // shell that prints nothing still gets it after a while. | |
| 139 | + if (screen.input) screen.typing = setTimeout(() => typeNow(screen), silentShellWait) | |
| 140 | +} | |
| 141 | + | |
| 142 | +/** How long the shell must stay quiet, after printing, before typing into it. */ | |
| 143 | +const quietWait = 600 | |
| 144 | +/** How long to wait for a shell that prints nothing. */ | |
| 145 | +const silentShellWait = 8000 | |
| 146 | + | |
| 147 | +// typeWhenQuiet types screen.input once the shell has been quiet for a | |
| 148 | +// moment: its login banner and its prompt are printed by then. | |
| 149 | +function typeWhenQuiet(screen: Screen) { | |
| 150 | + clearTimeout(screen.typing) | |
| 151 | + screen.typing = setTimeout(() => typeNow(screen), quietWait) | |
| 152 | +} | |
| 153 | + | |
| 154 | +function typeNow(screen: Screen) { | |
| 155 | + clearTimeout(screen.typing) | |
| 156 | + if (!screen.input || !screen.id) return | |
| 157 | + void TerminalService.Write(screen.id, screen.input) | |
| 158 | + screen.input = '' | |
| 159 | +} | |
| 160 | + | |
| 161 | +/** | |
| 162 | + * Types input into the terminal of agent shown last (issue #110: when it | |
| 163 | + * has as many terminals as allowed, the sign-in program goes there). Returns | |
| 164 | + * false when the agent has no terminal. | |
| 165 | + */ | |
| 166 | +export function typeInActive(agent: string, input: string): boolean { | |
| 167 | + const key = activeTerminal[agent] ?? terminalsOf(agent)[0]?.key | |
| 168 | + const screen = key ? screens.get(key) : undefined | |
| 169 | + if (!screen) return false | |
| 170 | + screen.input = input | |
| 171 | + if (screen.id) typeNow(screen) | |
| 172 | + else if (sessionOf(key)?.ended) restartTerminal(key) | |
| 173 | + return true | |
| 135 | 174 | } |
| 136 | 175 | |
| 137 | 176 | /** |
| @@ -185,6 +224,8 @@ export function closeTerminal(key: string) { | ||
| 185 | 224 | const screen = screens.get(key) |
| 186 | 225 | screens.delete(key) |
| 187 | 226 | if (screen) { |
| 227 | + clearTimeout(screen.typing) | |
| 228 | + screen.input = '' | |
| 188 | 229 | screen.stop() |
| 189 | 230 | if (screen.id) void TerminalService.Close(screen.id) |
| 190 | 231 | screen.element.remove() |
| @@ -38,6 +38,8 @@ type Screen = { | |||
| 38 | stop: () => void | 38 | stop: () => void |
| 39 | /** Typed once its shell has started, e.g. "claude\r" to sign in (issue #106). */ | 39 | /** Typed once its shell has started, e.g. "claude\r" to sign in (issue #106). */ |
| 40 | input: string | 40 | input: string |
| 41 | + /** The pending typing of input. */ | ||
| 42 | + typing?: ReturnType<typeof setTimeout> | ||
| 41 | } | 43 | } |
| 42 | 44 | ||
| 43 | /** The terminals of each agent, in the order they were opened. */ | 45 | /** The terminals of each agent, in the order they were opened. */ |
| @@ -120,18 +122,55 @@ async function start(key: string) { | |||
| 120 | } | 122 | } |
| 121 | screen.stop = listenTerminal( | 123 | screen.stop = listenTerminal( |
| 122 | screen.id, | 124 | screen.id, |
| 123 | - (data) => screen.xterm.write(data), | 125 | + (data) => { |
| 126 | + screen.xterm.write(data) | ||
| 127 | + if (screen.input) typeWhenQuiet(screen) | ||
| 128 | + }, | ||
| 124 | () => { | 129 | () => { |
| 125 | screen.id = '' | 130 | screen.id = '' |
| 126 | const ended = sessionOf(key) | 131 | const ended = sessionOf(key) |
| 127 | if (ended) ended.ended = true | 132 | if (ended) ended.ended = true |
| 128 | }, | 133 | }, |
| 129 | ) | 134 | ) |
| 130 | - // The sign-in program (issue #106), typed once the shell is there. | 135 | + // The sign-in program (issue #106) is typed once the shell is there: when |
| 131 | - if (screen.input) { | 136 | + // it has printed its prompt and gone quiet (typeWhenQuiet). Typed earlier, |
| 132 | - void TerminalService.Write(screen.id, screen.input) | 137 | + // before sbx exec has joined the sandbox's shell, it would be lost. A |
| 133 | - screen.input = '' | 138 | + // shell that prints nothing still gets it after a while. |
| 134 | - } | 139 | + if (screen.input) screen.typing = setTimeout(() => typeNow(screen), silentShellWait) |
| 140 | +} | ||
| 141 | + | ||
| 142 | +/** How long the shell must stay quiet, after printing, before typing into it. */ | ||
| 143 | +const quietWait = 600 | ||
| 144 | +/** How long to wait for a shell that prints nothing. */ | ||
| 145 | +const silentShellWait = 8000 | ||
| 146 | + | ||
| 147 | +// typeWhenQuiet types screen.input once the shell has been quiet for a | ||
| 148 | +// moment: its login banner and its prompt are printed by then. | ||
| 149 | +function typeWhenQuiet(screen: Screen) { | ||
| 150 | + clearTimeout(screen.typing) | ||
| 151 | + screen.typing = setTimeout(() => typeNow(screen), quietWait) | ||
| 152 | +} | ||
| 153 | + | ||
| 154 | +function typeNow(screen: Screen) { | ||
| 155 | + clearTimeout(screen.typing) | ||
| 156 | + if (!screen.input || !screen.id) return | ||
| 157 | + void TerminalService.Write(screen.id, screen.input) | ||
| 158 | + screen.input = '' | ||
| 159 | +} | ||
| 160 | + | ||
| 161 | +/** | ||
| 162 | + * Types input into the terminal of agent shown last (issue #110: when it | ||
| 163 | + * has as many terminals as allowed, the sign-in program goes there). Returns | ||
| 164 | + * false when the agent has no terminal. | ||
| 165 | + */ | ||
| 166 | +export function typeInActive(agent: string, input: string): boolean { | ||
| 167 | + const key = activeTerminal[agent] ?? terminalsOf(agent)[0]?.key | ||
| 168 | + const screen = key ? screens.get(key) : undefined | ||
| 169 | + if (!screen) return false | ||
| 170 | + screen.input = input | ||
| 171 | + if (screen.id) typeNow(screen) | ||
| 172 | + else if (sessionOf(key)?.ended) restartTerminal(key) | ||
| 173 | + return true | ||
| 135 | } | 174 | } |
| 136 | 175 | ||
| 137 | /** | 176 | /** |
| @@ -185,6 +224,8 @@ export function closeTerminal(key: string) { | |||
| 185 | const screen = screens.get(key) | 224 | const screen = screens.get(key) |
| 186 | screens.delete(key) | 225 | screens.delete(key) |
| 187 | if (screen) { | 226 | if (screen) { |
| 227 | + clearTimeout(screen.typing) | ||
| 228 | + screen.input = '' | ||
| 188 | screen.stop() | 229 | screen.stop() |
| 189 | if (screen.id) void TerminalService.Close(screen.id) | 230 | if (screen.id) void TerminalService.Close(screen.id) |
| 190 | screen.element.remove() | 231 | screen.element.remove() |