bots-garden/sidekickspublic Fork
⑂ 6e69727
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/sidekicks.git
git clone ssh://git@rickub.com/bots-garden/sidekicks.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

Merge feature/118-prompt-history into main

agent committed 2026-11-15T20:10:27+01:00 Browse files
6e69727 parents: 95bbae3 6dec065
modified .memory/history.md +2 -0
@@ -376,3 +376,5 @@
376376 - **2026-11-15 — #111 closed** (owner); feature/111-composer-height merged into main with tickets #117, #118 (not pushed).
377377 - **2026-11-15 — #117** (branch feature/117-linked-code-colours): LinkedFilePanel shows source code in a read-only FileEditor (codeLanguage() in files.ts); Xvfb light/dark/read-only. #118: owner wants the ↑ history per channel (comment + acceptance criterion added). Not committed.
378378 - **2026-11-15 — #117 closed** (owner); feature/117-linked-code-colours merged into main with the #118 per-channel note (not pushed).
379+- **2026-11-15 — #118** (branch feature/118-prompt-history): ↑ history per channel from Pebble — channels.Manager.Prompts + ChannelService.Prompts (100), history.seed, Composer loadHistory. Cause: Composer is keyed by channel, its in-memory history restarted each time. Xvfb after restart: direct and #general each recall only their own. make verify green. Not committed; #118 open for the owner's test.
380+- **2026-11-15 — #118 closed** (owner); feature/118-prompt-history merged into main (not pushed).
@@ -376,3 +376,5 @@
376 - **2026-11-15 — #111 closed** (owner); feature/111-composer-height merged into main with tickets #117, #118 (not pushed).376 - **2026-11-15 — #111 closed** (owner); feature/111-composer-height merged into main with tickets #117, #118 (not pushed).
377 - **2026-11-15 — #117** (branch feature/117-linked-code-colours): LinkedFilePanel shows source code in a read-only FileEditor (codeLanguage() in files.ts); Xvfb light/dark/read-only. #118: owner wants the ↑ history per channel (comment + acceptance criterion added). Not committed.377 - **2026-11-15 — #117** (branch feature/117-linked-code-colours): LinkedFilePanel shows source code in a read-only FileEditor (codeLanguage() in files.ts); Xvfb light/dark/read-only. #118: owner wants the ↑ history per channel (comment + acceptance criterion added). Not committed.
378 - **2026-11-15 — #117 closed** (owner); feature/117-linked-code-colours merged into main with the #118 per-channel note (not pushed).378 - **2026-11-15 — #117 closed** (owner); feature/117-linked-code-colours merged into main with the #118 per-channel note (not pushed).
379+- **2026-11-15 — #118** (branch feature/118-prompt-history): ↑ history per channel from Pebble — channels.Manager.Prompts + ChannelService.Prompts (100), history.seed, Composer loadHistory. Cause: Composer is keyed by channel, its in-memory history restarted each time. Xvfb after restart: direct and #general each recall only their own. make verify green. Not committed; #118 open for the owner's test.
380+- **2026-11-15 — #118 closed** (owner); feature/118-prompt-history merged into main (not pushed).
modified .tickets/issues/0118-rappeler-les-derniers-messages-avec-pour-tous-le.yaml +36 -5
@@ -1,12 +1,12 @@
11 # Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
22 id: 118
33 title: "Rappeler les derniers messages avec ↑ pour tous les types d'agents, pas seulement mini-me"
4-state: open
4+state: closed
55 author:
66 name: k33g
77 email: ph.charriere@gmail.com
88 createdAt: 2026-11-15T18:23:34.000Z
9-updatedAt: 2026-11-15T18:34:01.000Z
9+updatedAt: 2026-11-15T19:10:27.000Z
1010 labels:
1111 - kind::bug
1212 - area::ui
@@ -41,28 +41,34 @@ body: |
4141 tasks:
4242 - id: 1
4343 title: "Reproduire : mini-me (sessions gardées) contre un agent sbx ; trouver d'où vient le rappel avec mini-me"
44- state: open
44+ state: closed
4545 priority: high
4646 author:
4747 name: k33g
4848 email: ph.charriere@gmail.com
4949 createdAt: 2026-11-15T18:23:34.000Z
50+ updatedAt: 2026-11-15T18:59:33.000Z
51+ closedAt: 2026-11-15T18:59:33.000Z
5052 - id: 2
5153 title: "Historique de la zone de saisie rempli depuis les messages de l'utilisateur enregistrés du channel"
52- state: open
54+ state: closed
5355 priority: high
5456 author:
5557 name: k33g
5658 email: ph.charriere@gmail.com
5759 createdAt: 2026-11-15T18:23:34.000Z
60+ updatedAt: 2026-11-15T18:59:33.000Z
61+ closedAt: 2026-11-15T18:59:33.000Z
5862 - id: 3
5963 title: "Tests vitest, notes de release v1.7.0"
60- state: open
64+ state: closed
6165 priority: medium
6266 author:
6367 name: k33g
6468 email: ph.charriere@gmail.com
6569 createdAt: 2026-11-15T18:23:34.000Z
70+ updatedAt: 2026-11-15T18:59:33.000Z
71+ closedAt: 2026-11-15T18:59:33.000Z
6672 comments:
6773 - id: 1
6874 author:
@@ -72,3 +78,28 @@ comments:
7278 body: |
7379 Précision de l'owner : **l'historique est par channel** — dans un channel, ↑ ne rappelle que les messages envoyés
7480 dans ce channel (ou cette conversation directe), jamais ceux d'un autre channel.
81+ - id: 2
82+ author:
83+ name: k33g
84+ email: ph.charriere@gmail.com
85+ createdAt: 2026-11-15T18:59:33.000Z
86+ body: |
87+ Fait sur `feature/118-prompt-history`, avec la base comme demandé par l'owner (et pareil dans une conversation
88+ directe, qui est un channel à un membre). Cause : la zone de saisie est recréée à chaque channel
89+ (`{#key channel.id}`) et sa liste ↑ était en mémoire — elle repartait de zéro ; rien à voir avec le type d'agent.
90+
91+ - Go : `channels.Manager.Prompts(id, limit)` lit les messages du channel dans Pebble en remontant les pages, garde
92+ ceux de l'utilisateur (texte tel qu'écrit), sans répétition consécutive, du plus ancien au plus récent ;
93+ `ChannelService.Prompts(id)` (100 au plus).
94+ - Front : `createHistory().seed(earlier)` met ces messages avant ceux envoyés depuis l'ouverture ; `Composer`
95+ prop `loadHistory`, branchée par `ConversationPanel` sur `ChannelService.Prompts(channel.id)`.
96+ - Vérifié sous Xvfb : messages dans la conversation directe et dans #general, redémarrage, puis ↑ : chacun ne
97+ rappelle que les siens. Tests Go (plus d'une page, répétition, autre channel, channel inconnu) et vitest ;
98+ `make verify` vert. Doc (raccourcis, référence) EN + FR, notes v1.7.0.
99+ - id: 3
100+ author:
101+ name: k33g
102+ email: ph.charriere@gmail.com
103+ createdAt: 2026-11-15T19:10:27.000Z
104+ body: |
105+ Testé sur le Mac par l'owner : ça fonctionne. Mergé dans main. Ticket fermé.
@@ -1,12 +1,12 @@
1 # Managed by IssueSpec. Hand edits are welcome; keep the schema valid.1 # Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
2 id: 1182 id: 118
3 title: "Rappeler les derniers messages avec ↑ pour tous les types d'agents, pas seulement mini-me"3 title: "Rappeler les derniers messages avec ↑ pour tous les types d'agents, pas seulement mini-me"
4-state: open4+state: closed
5 author:5 author:
6 name: k33g6 name: k33g
7 email: ph.charriere@gmail.com7 email: ph.charriere@gmail.com
8 createdAt: 2026-11-15T18:23:34.000Z8 createdAt: 2026-11-15T18:23:34.000Z
9-updatedAt: 2026-11-15T18:34:01.000Z9+updatedAt: 2026-11-15T19:10:27.000Z
10 labels:10 labels:
11 - kind::bug11 - kind::bug
12 - area::ui12 - area::ui
@@ -41,28 +41,34 @@ body: |
41 tasks:41 tasks:
42 - id: 142 - id: 1
43 title: "Reproduire : mini-me (sessions gardées) contre un agent sbx ; trouver d'où vient le rappel avec mini-me"43 title: "Reproduire : mini-me (sessions gardées) contre un agent sbx ; trouver d'où vient le rappel avec mini-me"
44- state: open44+ state: closed
45 priority: high45 priority: high
46 author:46 author:
47 name: k33g47 name: k33g
48 email: ph.charriere@gmail.com48 email: ph.charriere@gmail.com
49 createdAt: 2026-11-15T18:23:34.000Z49 createdAt: 2026-11-15T18:23:34.000Z
50+ updatedAt: 2026-11-15T18:59:33.000Z
51+ closedAt: 2026-11-15T18:59:33.000Z
50 - id: 252 - id: 2
51 title: "Historique de la zone de saisie rempli depuis les messages de l'utilisateur enregistrés du channel"53 title: "Historique de la zone de saisie rempli depuis les messages de l'utilisateur enregistrés du channel"
52- state: open54+ state: closed
53 priority: high55 priority: high
54 author:56 author:
55 name: k33g57 name: k33g
56 email: ph.charriere@gmail.com58 email: ph.charriere@gmail.com
57 createdAt: 2026-11-15T18:23:34.000Z59 createdAt: 2026-11-15T18:23:34.000Z
60+ updatedAt: 2026-11-15T18:59:33.000Z
61+ closedAt: 2026-11-15T18:59:33.000Z
58 - id: 362 - id: 3
59 title: "Tests vitest, notes de release v1.7.0"63 title: "Tests vitest, notes de release v1.7.0"
60- state: open64+ state: closed
61 priority: medium65 priority: medium
62 author:66 author:
63 name: k33g67 name: k33g
64 email: ph.charriere@gmail.com68 email: ph.charriere@gmail.com
65 createdAt: 2026-11-15T18:23:34.000Z69 createdAt: 2026-11-15T18:23:34.000Z
70+ updatedAt: 2026-11-15T18:59:33.000Z
71+ closedAt: 2026-11-15T18:59:33.000Z
66 comments:72 comments:
67 - id: 173 - id: 1
68 author:74 author:
@@ -72,3 +78,28 @@ comments:
72 body: |78 body: |
73 Précision de l'owner : **l'historique est par channel** — dans un channel, ↑ ne rappelle que les messages envoyés79 Précision de l'owner : **l'historique est par channel** — dans un channel, ↑ ne rappelle que les messages envoyés
74 dans ce channel (ou cette conversation directe), jamais ceux d'un autre channel.80 dans ce channel (ou cette conversation directe), jamais ceux d'un autre channel.
81+ - id: 2
82+ author:
83+ name: k33g
84+ email: ph.charriere@gmail.com
85+ createdAt: 2026-11-15T18:59:33.000Z
86+ body: |
87+ Fait sur `feature/118-prompt-history`, avec la base comme demandé par l'owner (et pareil dans une conversation
88+ directe, qui est un channel à un membre). Cause : la zone de saisie est recréée à chaque channel
89+ (`{#key channel.id}`) et sa liste ↑ était en mémoire — elle repartait de zéro ; rien à voir avec le type d'agent.
90+
91+ - Go : `channels.Manager.Prompts(id, limit)` lit les messages du channel dans Pebble en remontant les pages, garde
92+ ceux de l'utilisateur (texte tel qu'écrit), sans répétition consécutive, du plus ancien au plus récent ;
93+ `ChannelService.Prompts(id)` (100 au plus).
94+ - Front : `createHistory().seed(earlier)` met ces messages avant ceux envoyés depuis l'ouverture ; `Composer`
95+ prop `loadHistory`, branchée par `ConversationPanel` sur `ChannelService.Prompts(channel.id)`.
96+ - Vérifié sous Xvfb : messages dans la conversation directe et dans #general, redémarrage, puis ↑ : chacun ne
97+ rappelle que les siens. Tests Go (plus d'une page, répétition, autre channel, channel inconnu) et vitest ;
98+ `make verify` vert. Doc (raccourcis, référence) EN + FR, notes v1.7.0.
99+ - id: 3
100+ author:
101+ name: k33g
102+ email: ph.charriere@gmail.com
103+ createdAt: 2026-11-15T19:10:27.000Z
104+ body: |
105+ Testé sur le Mac par l'owner : ça fonctionne. Mergé dans main. Ticket fermé.
modified docs/en/reference/agents-and-events.md +1 -0
@@ -147,6 +147,7 @@ A tool call has `id, title, kind` (`read, edit, delete, move, search, execute, t
147147 | `AnswerForm(id, answer)` | Answers a pending form: `{action: "accept", content: {name: value…}}`, `decline` or `cancel`. An unknown form or action is an error. |
148148 | `Conversation(id)` | `channel, messages` (the last 100), `more, busy, queued, answering, answerers, usage{agent: …}, permissions, forms`. |
149149 | `Older(id, beforeId)` | `{messages, more}`: the 100 messages before `beforeId`. |
150+| `Prompts(id)` | The last 100 messages the user wrote in the channel (or direct conversation) `id`, oldest first, without consecutive repeats, read from the history: what ↑ brings back in its message box (issue #118). |
150151 | `Commands(agent)` | The commands the agent announced last, kept from one run to the next; empty if it never announced any. |
151152 | `Prepare(id)` | Starts the members of the channel that never announced their commands and opens their session for it (no model is loaded); returns once the sessions are open, the commands arrive as `commands:changed`. A member answering elsewhere is skipped. The session serves the member's first answer, which is still told the channel's past. |
152153
@@ -147,6 +147,7 @@ A tool call has `id, title, kind` (`read, edit, delete, move, search, execute, t
147 | `AnswerForm(id, answer)` | Answers a pending form: `{action: "accept", content: {name: value…}}`, `decline` or `cancel`. An unknown form or action is an error. |147 | `AnswerForm(id, answer)` | Answers a pending form: `{action: "accept", content: {name: value…}}`, `decline` or `cancel`. An unknown form or action is an error. |
148 | `Conversation(id)` | `channel, messages` (the last 100), `more, busy, queued, answering, answerers, usage{agent: …}, permissions, forms`. |148 | `Conversation(id)` | `channel, messages` (the last 100), `more, busy, queued, answering, answerers, usage{agent: …}, permissions, forms`. |
149 | `Older(id, beforeId)` | `{messages, more}`: the 100 messages before `beforeId`. |149 | `Older(id, beforeId)` | `{messages, more}`: the 100 messages before `beforeId`. |
150+| `Prompts(id)` | The last 100 messages the user wrote in the channel (or direct conversation) `id`, oldest first, without consecutive repeats, read from the history: what ↑ brings back in its message box (issue #118). |
150 | `Commands(agent)` | The commands the agent announced last, kept from one run to the next; empty if it never announced any. |151 | `Commands(agent)` | The commands the agent announced last, kept from one run to the next; empty if it never announced any. |
151 | `Prepare(id)` | Starts the members of the channel that never announced their commands and opens their session for it (no model is loaded); returns once the sessions are open, the commands arrive as `commands:changed`. A member answering elsewhere is skipped. The session serves the member's first answer, which is still told the channel's past. |152 | `Prepare(id)` | Starts the members of the channel that never announced their commands and opens their session for it (no model is loaded); returns once the sessions are open, the commands arrive as `commands:changed`. A member answering elsewhere is skipped. The session serves the member's first answer, which is still told the channel's past. |
152 153
modified docs/en/reference/keyboard-shortcuts.md +1 -1
@@ -33,7 +33,7 @@ The palette lists, in order: the channels, a conversation per agent, the files o
3333 | --- | --- |
3434 | Enter | Sends |
3535 | Shift+Enter | New line |
36-| ↑ (empty box) | Previous messages |
36+| ↑ (empty box) | Previous messages you wrote in this channel or this conversation — after a restart too, never another channel's (issue #118); ↓ comes back |
3737 | `@`, `/` | Agent and command lists; Tab or Enter picks, ↑ ↓ move, Escape closes |
3838
3939 ## Editors (Settings, agents' files)
@@ -33,7 +33,7 @@ The palette lists, in order: the channels, a conversation per agent, the files o
33 | --- | --- |33 | --- | --- |
34 | Enter | Sends |34 | Enter | Sends |
35 | Shift+Enter | New line |35 | Shift+Enter | New line |
36-| ↑ (empty box) | Previous messages |36+| ↑ (empty box) | Previous messages you wrote in this channel or this conversation — after a restart too, never another channel's (issue #118); ↓ comes back |
37 | `@`, `/` | Agent and command lists; Tab or Enter picks, ↑ ↓ move, Escape closes |37 | `@`, `/` | Agent and command lists; Tab or Enter picks, ↑ ↓ move, Escape closes |
38 38
39 ## Editors (Settings, agents' files)39 ## Editors (Settings, agents' files)
modified docs/fr/reference/agents-et-evenements.md +1 -0
@@ -147,6 +147,7 @@ Un appel d'outil a `id, title, kind` (`read, edit, delete, move, search, execute
147147 | `AnswerForm(id, answer)` | Répond à un formulaire en attente : `{action: "accept", content: {nom: valeur…}}`, `decline` ou `cancel`. Un formulaire ou une action inconnus sont une erreur. |
148148 | `Conversation(id)` | `channel, messages` (les 100 derniers), `more, busy, queued, answering, answerers, usage{agent: …}, permissions, forms`. |
149149 | `Older(id, beforeId)` | `{messages, more}` : les 100 messages précédant `beforeId`. |
150+| `Prompts(id)` | Les 100 derniers messages que l'utilisateur a écrits dans le channel (ou la conversation directe) `id`, du plus ancien au plus récent, sans répétition consécutive, lus dans l'historique : ce que ↑ rappelle dans sa zone de saisie (issue #118). |
150151 | `Commands(agent)` | Les dernières commandes annoncées par l'agent, gardées d'un lancement à l'autre ; vide s'il n'en a jamais annoncé. |
151152 | `Prepare(id)` | Démarre les membres du channel qui n'ont jamais annoncé leurs commandes et ouvre leur session pour ce channel (aucun modèle n'est chargé) ; rend la main une fois les sessions ouvertes, les commandes arrivent par `commands:changed`. Un membre qui répond ailleurs est ignoré. La session sert la première réponse du membre, à qui l'on donne quand même le passé du channel. |
152153
@@ -147,6 +147,7 @@ Un appel d'outil a `id, title, kind` (`read, edit, delete, move, search, execute
147 | `AnswerForm(id, answer)` | Répond à un formulaire en attente : `{action: "accept", content: {nom: valeur…}}`, `decline` ou `cancel`. Un formulaire ou une action inconnus sont une erreur. |147 | `AnswerForm(id, answer)` | Répond à un formulaire en attente : `{action: "accept", content: {nom: valeur…}}`, `decline` ou `cancel`. Un formulaire ou une action inconnus sont une erreur. |
148 | `Conversation(id)` | `channel, messages` (les 100 derniers), `more, busy, queued, answering, answerers, usage{agent: …}, permissions, forms`. |148 | `Conversation(id)` | `channel, messages` (les 100 derniers), `more, busy, queued, answering, answerers, usage{agent: …}, permissions, forms`. |
149 | `Older(id, beforeId)` | `{messages, more}` : les 100 messages précédant `beforeId`. |149 | `Older(id, beforeId)` | `{messages, more}` : les 100 messages précédant `beforeId`. |
150+| `Prompts(id)` | Les 100 derniers messages que l'utilisateur a écrits dans le channel (ou la conversation directe) `id`, du plus ancien au plus récent, sans répétition consécutive, lus dans l'historique : ce que ↑ rappelle dans sa zone de saisie (issue #118). |
150 | `Commands(agent)` | Les dernières commandes annoncées par l'agent, gardées d'un lancement à l'autre ; vide s'il n'en a jamais annoncé. |151 | `Commands(agent)` | Les dernières commandes annoncées par l'agent, gardées d'un lancement à l'autre ; vide s'il n'en a jamais annoncé. |
151 | `Prepare(id)` | Démarre les membres du channel qui n'ont jamais annoncé leurs commandes et ouvre leur session pour ce channel (aucun modèle n'est chargé) ; rend la main une fois les sessions ouvertes, les commandes arrivent par `commands:changed`. Un membre qui répond ailleurs est ignoré. La session sert la première réponse du membre, à qui l'on donne quand même le passé du channel. |152 | `Prepare(id)` | Démarre les membres du channel qui n'ont jamais annoncé leurs commandes et ouvre leur session pour ce channel (aucun modèle n'est chargé) ; rend la main une fois les sessions ouvertes, les commandes arrivent par `commands:changed`. Un membre qui répond ailleurs est ignoré. La session sert la première réponse du membre, à qui l'on donne quand même le passé du channel. |
152 153
modified docs/fr/reference/raccourcis-clavier.md +1 -1
@@ -33,7 +33,7 @@ La palette liste, dans l'ordre : les channels, une conversation par agent, les f
3333 | --- | --- |
3434 | Entrée | Envoie |
3535 | Maj+Entrée | Nouvelle ligne |
36-| ↑ (zone vide) | Messages précédents |
36+| ↑ (zone vide) | Messages précédents que vous avez écrits dans ce channel ou cette conversation — aussi après un redémarrage, jamais ceux d'un autre channel (issue #118) ; ↓ revient |
3737 | `@`, `/` | Listes des agents et des commandes ; Tab ou Entrée choisit, ↑ ↓ déplacent, Échap ferme |
3838
3939 ## Éditeurs (Settings, fichiers des agents)
@@ -33,7 +33,7 @@ La palette liste, dans l'ordre : les channels, une conversation par agent, les f
33 | --- | --- |33 | --- | --- |
34 | Entrée | Envoie |34 | Entrée | Envoie |
35 | Maj+Entrée | Nouvelle ligne |35 | Maj+Entrée | Nouvelle ligne |
36-| ↑ (zone vide) | Messages précédents |36+| ↑ (zone vide) | Messages précédents que vous avez écrits dans ce channel ou cette conversation — aussi après un redémarrage, jamais ceux d'un autre channel (issue #118) ; ↓ revient |
37 | `@`, `/` | Listes des agents et des commandes ; Tab ou Entrée choisit, ↑ ↓ déplacent, Échap ferme |37 | `@`, `/` | Listes des agents et des commandes ; Tab ou Entrée choisit, ↑ ↓ déplacent, Échap ferme |
38 38
39 ## Éditeurs (Settings, fichiers des agents)39 ## Éditeurs (Settings, fichiers des agents)
modified docs/release-notes/v1.7.0.fr.md +1 -0
@@ -16,4 +16,5 @@ Brouillon — complété au fil des tickets de la 1.7.0.
1616 ### Petits changements
1717
1818 - Le code d'un fichier dont un agent donne le lien dans sa réponse est maintenant coloré dans le panneau à côté de la conversation, comme dans l'onglet Fichiers, en lecture seule (#117).
19+- ↑ dans la zone de saisie rappelle les messages que vous avez écrits dans ce channel ou cette conversation, quel que soit l'agent, même après un changement de channel ou un redémarrage de Sidekicks — jamais ceux d'un autre channel (#118).
1920 - La zone de saisie grandit avec un long message et reprend maintenant sa taille une fois le message envoyé, ou quand ↑ / ↓ rappellent un message plus court (#111).
@@ -16,4 +16,5 @@ Brouillon — complété au fil des tickets de la 1.7.0.
16 ### Petits changements16 ### Petits changements
17 17
18 - Le code d'un fichier dont un agent donne le lien dans sa réponse est maintenant coloré dans le panneau à côté de la conversation, comme dans l'onglet Fichiers, en lecture seule (#117).18 - Le code d'un fichier dont un agent donne le lien dans sa réponse est maintenant coloré dans le panneau à côté de la conversation, comme dans l'onglet Fichiers, en lecture seule (#117).
19+- ↑ dans la zone de saisie rappelle les messages que vous avez écrits dans ce channel ou cette conversation, quel que soit l'agent, même après un changement de channel ou un redémarrage de Sidekicks — jamais ceux d'un autre channel (#118).
19 - La zone de saisie grandit avec un long message et reprend maintenant sa taille une fois le message envoyé, ou quand ↑ / ↓ rappellent un message plus court (#111).20 - La zone de saisie grandit avec un long message et reprend maintenant sa taille une fois le message envoyé, ou quand ↑ / ↓ rappellent un message plus court (#111).
modified docs/release-notes/v1.7.0.md +1 -0
@@ -16,4 +16,5 @@ Draft — completed as the 1.7.0 tickets are done.
1616 ### Smaller changes
1717
1818 - The code of a file an agent links to in its answer is now coloured in the panel beside the conversation, like in the Files tab, read-only (#117).
19+- ↑ in the message box brings back the messages you wrote in this channel or this conversation, whatever the agent, even after switching channels or restarting Sidekicks — never another channel's (#118).
1920 - The message box grows with a long message and now shrinks back once it is sent, or when ↑ / ↓ bring back a shorter message (#111).
@@ -16,4 +16,5 @@ Draft — completed as the 1.7.0 tickets are done.
16 ### Smaller changes16 ### Smaller changes
17 17
18 - The code of a file an agent links to in its answer is now coloured in the panel beside the conversation, like in the Files tab, read-only (#117).18 - The code of a file an agent links to in its answer is now coloured in the panel beside the conversation, like in the Files tab, read-only (#117).
19+- ↑ in the message box brings back the messages you wrote in this channel or this conversation, whatever the agent, even after switching channels or restarting Sidekicks — never another channel's (#118).
19 - The message box grows with a long message and now shrinks back once it is sent, or when ↑ / ↓ bring back a shorter message (#111).20 - The message box grows with a long message and now shrinks back once it is sent, or when ↑ / ↓ bring back a shorter message (#111).
modified frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/channelservice.ts +9 -0
@@ -120,6 +120,15 @@ export function Prepare(id: string): $CancellablePromise<void> {
120120 return $Call.ByID(3873138035, id);
121121 }
122122
123+/**
124+ * Prompts returns the last messages the user wrote in the channel (or the
125+ * direct conversation) id, oldest first: the history of its message box,
126+ * read from the database (issue #118).
127+ */
128+export function Prompts(id: string): $CancellablePromise<string[] | null> {
129+ return $Call.ByID(89568479, id);
130+}
131+
123132 /**
124133 * RemoveMember removes an agent from a channel.
125134 */
@@ -120,6 +120,15 @@ export function Prepare(id: string): $CancellablePromise<void> {
120 return $Call.ByID(3873138035, id);120 return $Call.ByID(3873138035, id);
121 }121 }
122 122
123+/**
124+ * Prompts returns the last messages the user wrote in the channel (or the
125+ * direct conversation) id, oldest first: the history of its message box,
126+ * read from the database (issue #118).
127+ */
128+export function Prompts(id: string): $CancellablePromise<string[] | null> {
129+ return $Call.ByID(89568479, id);
130+}
131+
123 /**132 /**
124 * RemoveMember removes an agent from a channel.133 * RemoveMember removes an agent from a channel.
125 */134 */
modified frontend/src/lib/chat/Composer.svelte +6 -0
@@ -19,6 +19,7 @@
1919 dropTarget,
2020 draft = '',
2121 onDraft = () => {},
22+ loadHistory,
2223 }: {
2324 placeholder: string
2425 busy?: boolean
@@ -39,12 +40,17 @@
3940 draft?: string
4041 /** Called with the text as it changes, to keep it as the draft. */
4142 onDraft?: (text: string) => void
43+ /** The user's earlier messages of this channel, oldest first, for ↑ (issue #118). */
44+ loadHistory?: () => PromiseLike<string[] | null>
4245 } = $props()
4346
4447 let text = $state(untrack(() => draft))
4548 $effect(() => onDraft(text))
4649 let textarea: HTMLTextAreaElement
4750 const history = createHistory()
51+ // ↑ brings back this channel's messages, even from before a restart.
52+ // Without them (an error), ↑ still has what is sent from now on.
53+ untrack(() => loadHistory)?.().then((earlier) => history.seed(earlier ?? []), () => {})
4854
4955 // The popup (issues #22 and #24): open while the caret is in a trigger.
5056 let trigger: Trigger | null = $state(null)
@@ -19,6 +19,7 @@
19 dropTarget,19 dropTarget,
20 draft = '',20 draft = '',
21 onDraft = () => {},21 onDraft = () => {},
22+ loadHistory,
22 }: {23 }: {
23 placeholder: string24 placeholder: string
24 busy?: boolean25 busy?: boolean
@@ -39,12 +40,17 @@
39 draft?: string40 draft?: string
40 /** Called with the text as it changes, to keep it as the draft. */41 /** Called with the text as it changes, to keep it as the draft. */
41 onDraft?: (text: string) => void42 onDraft?: (text: string) => void
43+ /** The user's earlier messages of this channel, oldest first, for ↑ (issue #118). */
44+ loadHistory?: () => PromiseLike<string[] | null>
42 } = $props()45 } = $props()
43 46
44 let text = $state(untrack(() => draft))47 let text = $state(untrack(() => draft))
45 $effect(() => onDraft(text))48 $effect(() => onDraft(text))
46 let textarea: HTMLTextAreaElement49 let textarea: HTMLTextAreaElement
47 const history = createHistory()50 const history = createHistory()
51+ // ↑ brings back this channel's messages, even from before a restart.
52+ // Without them (an error), ↑ still has what is sent from now on.
53+ untrack(() => loadHistory)?.().then((earlier) => history.seed(earlier ?? []), () => {})
48 54
49 // The popup (issues #22 and #24): open while the caret is in a trigger.55 // The popup (issues #22 and #24): open while the caret is in a trigger.
50 let trigger: Trigger | null = $state(null)56 let trigger: Trigger | null = $state(null)
modified frontend/src/lib/composer.test.ts +15 -0
@@ -70,3 +70,18 @@ describe('composerHeight (issue #111)', () => {
7070 })
7171 })
7272
73+describe('history seeded from the channel (issue #118)', () => {
74+ it('brings back the stored messages, then those sent since, without repeats', () => {
75+ const history = createHistory()
76+ history.add('sent now')
77+ history.seed(['first', 'second', 'second', 'sent now'])
78+ expect(history.previous('draft')).toBe('sent now')
79+ expect(history.previous('draft')).toBe('second')
80+ expect(history.previous('draft')).toBe('first')
81+ expect(history.previous('draft')).toBe('first')
82+ expect(history.next()).toBe('second')
83+ expect(history.next()).toBe('sent now')
84+ expect(history.next()).toBe('draft')
85+ })
86+})
87+
@@ -70,3 +70,18 @@ describe('composerHeight (issue #111)', () => {
70 })70 })
71 })71 })
72 72
73+describe('history seeded from the channel (issue #118)', () => {
74+ it('brings back the stored messages, then those sent since, without repeats', () => {
75+ const history = createHistory()
76+ history.add('sent now')
77+ history.seed(['first', 'second', 'second', 'sent now'])
78+ expect(history.previous('draft')).toBe('sent now')
79+ expect(history.previous('draft')).toBe('second')
80+ expect(history.previous('draft')).toBe('first')
81+ expect(history.previous('draft')).toBe('first')
82+ expect(history.next()).toBe('second')
83+ expect(history.next()).toBe('sent now')
84+ expect(history.next()).toBe('draft')
85+ })
86+})
87+
modified frontend/src/lib/composer.ts +11 -0
@@ -70,6 +70,17 @@ export function createHistory() {
7070 if (text && entries[entries.length - 1] !== text) entries.push(text)
7171 position = entries.length
7272 },
73+ /**
74+ * Puts earlier messages first — the user's messages of this channel read
75+ * from the history (issue #118) —, before those sent since it opened.
76+ */
77+ seed(earlier: string[]) {
78+ const sent = entries.splice(0)
79+ for (const text of [...earlier, ...sent]) {
80+ if (text && entries[entries.length - 1] !== text) entries.push(text)
81+ }
82+ position = entries.length
83+ },
7384 previous(current: string): string {
7485 if (position === entries.length) draft = current
7586 if (position > 0) position--
@@ -70,6 +70,17 @@ export function createHistory() {
70 if (text && entries[entries.length - 1] !== text) entries.push(text)70 if (text && entries[entries.length - 1] !== text) entries.push(text)
71 position = entries.length71 position = entries.length
72 },72 },
73+ /**
74+ * Puts earlier messages first — the user's messages of this channel read
75+ * from the history (issue #118) —, before those sent since it opened.
76+ */
77+ seed(earlier: string[]) {
78+ const sent = entries.splice(0)
79+ for (const text of [...earlier, ...sent]) {
80+ if (text && entries[entries.length - 1] !== text) entries.push(text)
81+ }
82+ position = entries.length
83+ },
73 previous(current: string): string {84 previous(current: string): string {
74 if (position === entries.length) draft = current85 if (position === entries.length) draft = current
75 if (position > 0) position--86 if (position > 0) position--
modified frontend/src/lib/panels/ConversationPanel.svelte +2 -1
@@ -21,7 +21,7 @@
2121 import { drafts, isNearBottom, type Trigger } from '../composer'
2222 import { notStreaming, usagePercent } from '../conversation'
2323 import { act, addMember, agentTitle, appState, cancel, channelOf, clearHistory, loadOlder, openAssistant, openCreator, openSbxCreator, prepareCommands, removeMember, send } from '../state.svelte'
24- import { ConfigService, WorkspaceService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app'
24+ import { ChannelService, ConfigService, WorkspaceService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app'
2525 import type { FilesDroppedPayload } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events'
2626 import { FilesDropped } from '../../../bindings/events'
2727 import { fileAgent, fileListState, splitQuery, type FileEntry } from '../attachments'
@@ -328,6 +328,7 @@
328328 onStop={() => cancel(channel.id)}
329329 draft={drafts.of(channel.id)}
330330 onDraft={(text) => drafts.keep(channel.id, text)}
331+ loadHistory={() => ChannelService.Prompts(channel.id)}
331332 />
332333 {/key}
333334 </div>
@@ -21,7 +21,7 @@
21 import { drafts, isNearBottom, type Trigger } from '../composer'21 import { drafts, isNearBottom, type Trigger } from '../composer'
22 import { notStreaming, usagePercent } from '../conversation'22 import { notStreaming, usagePercent } from '../conversation'
23 import { act, addMember, agentTitle, appState, cancel, channelOf, clearHistory, loadOlder, openAssistant, openCreator, openSbxCreator, prepareCommands, removeMember, send } from '../state.svelte'23 import { act, addMember, agentTitle, appState, cancel, channelOf, clearHistory, loadOlder, openAssistant, openCreator, openSbxCreator, prepareCommands, removeMember, send } from '../state.svelte'
24- import { ConfigService, WorkspaceService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app'24+ import { ChannelService, ConfigService, WorkspaceService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app'
25 import type { FilesDroppedPayload } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events'25 import type { FilesDroppedPayload } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events'
26 import { FilesDropped } from '../../../bindings/events'26 import { FilesDropped } from '../../../bindings/events'
27 import { fileAgent, fileListState, splitQuery, type FileEntry } from '../attachments'27 import { fileAgent, fileListState, splitQuery, type FileEntry } from '../attachments'
@@ -328,6 +328,7 @@
328 onStop={() => cancel(channel.id)}328 onStop={() => cancel(channel.id)}
329 draft={drafts.of(channel.id)}329 draft={drafts.of(channel.id)}
330 onDraft={(text) => drafts.keep(channel.id, text)}330 onDraft={(text) => drafts.keep(channel.id, text)}
331+ loadHistory={() => ChannelService.Prompts(channel.id)}
331 />332 />
332 {/key}333 {/key}
333 </div>334 </div>
modified internal/app/services.go +10 -0
@@ -129,6 +129,16 @@ func (s *ChannelService) Older(id, beforeID string) (OlderView, error) {
129129 return OlderView{Messages: messages, More: more}, err
130130 }
131131
132+// promptsKept is how many of the user's last messages ↑ can bring back.
133+const promptsKept = 100
134+
135+// Prompts returns the last messages the user wrote in the channel (or the
136+// direct conversation) id, oldest first: the history of its message box,
137+// read from the database (issue #118).
138+func (s *ChannelService) Prompts(id string) ([]string, error) {
139+ return s.Core.Channels().Prompts(id, promptsKept)
140+}
141+
132142 // Prepare asks the members of a channel whose commands are not known yet
133143 // for them (the user typed "/"): they are started and their session opened,
134144 // without loading a model; the commands arrive as commands:changed events.
@@ -129,6 +129,16 @@ func (s *ChannelService) Older(id, beforeID string) (OlderView, error) {
129 return OlderView{Messages: messages, More: more}, err129 return OlderView{Messages: messages, More: more}, err
130 }130 }
131 131
132+// promptsKept is how many of the user's last messages ↑ can bring back.
133+const promptsKept = 100
134+
135+// Prompts returns the last messages the user wrote in the channel (or the
136+// direct conversation) id, oldest first: the history of its message box,
137+// read from the database (issue #118).
138+func (s *ChannelService) Prompts(id string) ([]string, error) {
139+ return s.Core.Channels().Prompts(id, promptsKept)
140+}
141+
132 // Prepare asks the members of a channel whose commands are not known yet142 // Prepare asks the members of a channel whose commands are not known yet
133 // for them (the user typed "/"): they are started and their session opened,143 // for them (the user typed "/"): they are started and their session opened,
134 // without loading a model; the commands arrive as commands:changed events.144 // without loading a model; the commands arrive as commands:changed events.
modified internal/channels/channels.go +46 -0
@@ -692,6 +692,52 @@ func (m *Manager) Older(id, beforeID string) ([]Message, bool, error) {
692692 return messages, more, nil
693693 }
694694
695+// Prompts returns the last messages the user wrote in a channel — a
696+// direct conversation is a channel too —, at most limit, oldest first and
697+// without consecutive repeats: what ↑ brings back in its message box
698+// (issue #118). They are read from the history, so they outlive a change
699+// of channel and a restart, and never come from another channel.
700+func (m *Manager) Prompts(id string, limit int) ([]string, error) {
701+ m.mu.Lock()
702+ _, err := m.channel(id)
703+ m.mu.Unlock()
704+ if err != nil {
705+ return nil, err
706+ }
707+ var newestFirst []string
708+ before := ""
709+ for len(newestFirst) < limit {
710+ stored, more, err := m.db.Messages(id, before, pageSize)
711+ if err != nil {
712+ return nil, err
713+ }
714+ for i := len(stored) - 1; i >= 0 && len(newestFirst) < limit; i-- {
715+ var message Message
716+ if err := json.Unmarshal(stored[i], &message); err != nil {
717+ return nil, err
718+ }
719+ text := strings.TrimSpace(textOf(&message))
720+ if message.Role != RoleUser || text == "" || (len(newestFirst) > 0 && newestFirst[len(newestFirst)-1] == text) {
721+ continue
722+ }
723+ newestFirst = append(newestFirst, text)
724+ }
725+ if !more || len(stored) == 0 {
726+ break
727+ }
728+ var oldest Message
729+ if err := json.Unmarshal(stored[0], &oldest); err != nil {
730+ return nil, err
731+ }
732+ before = oldest.ID
733+ }
734+ prompts := make([]string, len(newestFirst))
735+ for i, text := range newestFirst {
736+ prompts[len(newestFirst)-1-i] = text
737+ }
738+ return prompts, nil
739+}
740+
695741 // Close stops every answer. The store stays open: its owner closes it.
696742 func (m *Manager) Close() {
697743 m.mu.Lock()
@@ -692,6 +692,52 @@ func (m *Manager) Older(id, beforeID string) ([]Message, bool, error) {
692 return messages, more, nil692 return messages, more, nil
693 }693 }
694 694
695+// Prompts returns the last messages the user wrote in a channel — a
696+// direct conversation is a channel too —, at most limit, oldest first and
697+// without consecutive repeats: what ↑ brings back in its message box
698+// (issue #118). They are read from the history, so they outlive a change
699+// of channel and a restart, and never come from another channel.
700+func (m *Manager) Prompts(id string, limit int) ([]string, error) {
701+ m.mu.Lock()
702+ _, err := m.channel(id)
703+ m.mu.Unlock()
704+ if err != nil {
705+ return nil, err
706+ }
707+ var newestFirst []string
708+ before := ""
709+ for len(newestFirst) < limit {
710+ stored, more, err := m.db.Messages(id, before, pageSize)
711+ if err != nil {
712+ return nil, err
713+ }
714+ for i := len(stored) - 1; i >= 0 && len(newestFirst) < limit; i-- {
715+ var message Message
716+ if err := json.Unmarshal(stored[i], &message); err != nil {
717+ return nil, err
718+ }
719+ text := strings.TrimSpace(textOf(&message))
720+ if message.Role != RoleUser || text == "" || (len(newestFirst) > 0 && newestFirst[len(newestFirst)-1] == text) {
721+ continue
722+ }
723+ newestFirst = append(newestFirst, text)
724+ }
725+ if !more || len(stored) == 0 {
726+ break
727+ }
728+ var oldest Message
729+ if err := json.Unmarshal(stored[0], &oldest); err != nil {
730+ return nil, err
731+ }
732+ before = oldest.ID
733+ }
734+ prompts := make([]string, len(newestFirst))
735+ for i, text := range newestFirst {
736+ prompts[len(newestFirst)-1-i] = text
737+ }
738+ return prompts, nil
739+}
740+
695 // Close stops every answer. The store stays open: its owner closes it.741 // Close stops every answer. The store stays open: its owner closes it.
696 func (m *Manager) Close() {742 func (m *Manager) Close() {
697 m.mu.Lock()743 m.mu.Lock()
modified internal/channels/channels_test.go +30 -0
@@ -600,6 +600,36 @@ func TestOlderMessagesArePaged(t *testing.T) {
600600 }
601601 }
602602
603+// Issue #118: ↑ brings back the user's own messages of this channel only,
604+// from the history — after a restart too, and past a page of messages.
605+func TestPromptsAreTheUsersMessagesOfTheChannel(t *testing.T) {
606+ f := setup(t, nil)
607+ direct, _ := f.manager.Direct("alice")
608+ general := f.channel(t, "general", "alice")
609+ for i := 0; i < 60; i++ {
610+ f.send(t, direct.ID, fmt.Sprint("m", i))
611+ f.idle(t, direct.ID, 2*(i+1))
612+ }
613+ f.send(t, direct.ID, "m59")
614+ f.idle(t, direct.ID, 122)
615+ f.send(t, general.ID, "@alice in general")
616+ f.idle(t, general.ID, 2)
617+ manager := f.reopen(t, false)
618+ prompts, err := manager.Prompts(direct.ID, 100)
619+ if err != nil || len(prompts) != 60 || prompts[0] != "m0" || prompts[59] != "m59" {
620+ t.Fatalf("the user's 60 messages, the repeat once: %d %q… %v", len(prompts), prompts[:min(3, len(prompts))], err)
621+ }
622+ if last, _ := manager.Prompts(direct.ID, 2); len(last) != 2 || last[0] != "m58" || last[1] != "m59" {
623+ t.Fatalf("the last two, oldest first: %q", last)
624+ }
625+ if other, _ := manager.Prompts(general.ID, 100); len(other) != 1 || other[0] != "@alice in general" {
626+ t.Fatalf("never another channel's: %q", other)
627+ }
628+ if _, err := manager.Prompts("nope", 10); err == nil {
629+ t.Fatal("an unknown channel")
630+ }
631+}
632+
603633 func ExampleManager_Send() {
604634 db, _ := store.OpenInMemory()
605635 defer func() { _ = db.Close() }()
@@ -600,6 +600,36 @@ func TestOlderMessagesArePaged(t *testing.T) {
600 }600 }
601 }601 }
602 602
603+// Issue #118: ↑ brings back the user's own messages of this channel only,
604+// from the history — after a restart too, and past a page of messages.
605+func TestPromptsAreTheUsersMessagesOfTheChannel(t *testing.T) {
606+ f := setup(t, nil)
607+ direct, _ := f.manager.Direct("alice")
608+ general := f.channel(t, "general", "alice")
609+ for i := 0; i < 60; i++ {
610+ f.send(t, direct.ID, fmt.Sprint("m", i))
611+ f.idle(t, direct.ID, 2*(i+1))
612+ }
613+ f.send(t, direct.ID, "m59")
614+ f.idle(t, direct.ID, 122)
615+ f.send(t, general.ID, "@alice in general")
616+ f.idle(t, general.ID, 2)
617+ manager := f.reopen(t, false)
618+ prompts, err := manager.Prompts(direct.ID, 100)
619+ if err != nil || len(prompts) != 60 || prompts[0] != "m0" || prompts[59] != "m59" {
620+ t.Fatalf("the user's 60 messages, the repeat once: %d %q… %v", len(prompts), prompts[:min(3, len(prompts))], err)
621+ }
622+ if last, _ := manager.Prompts(direct.ID, 2); len(last) != 2 || last[0] != "m58" || last[1] != "m59" {
623+ t.Fatalf("the last two, oldest first: %q", last)
624+ }
625+ if other, _ := manager.Prompts(general.ID, 100); len(other) != 1 || other[0] != "@alice in general" {
626+ t.Fatalf("never another channel's: %q", other)
627+ }
628+ if _, err := manager.Prompts("nope", 10); err == nil {
629+ t.Fatal("an unknown channel")
630+ }
631+}
632+
603 func ExampleManager_Send() {633 func ExampleManager_Send() {
604 db, _ := store.OpenInMemory()634 db, _ := store.OpenInMemory()
605 defer func() { _ = db.Close() }()635 defer func() { _ = db.Close() }()