merge(workstate): intègre le read-model live-state + UX conversations (Lot A) dans develop
Lot A : read-model live-state minimal des conversations/délégations côté backend (module application workstate + surface Tauri) et frontend (port/adapter/mock + feature workstate intégrée à ProjectsView). QA verte, réserve environnementale non bloquante (socket Unix non bindable en sandbox, alternatives skips vertes). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -19,7 +19,7 @@
|
||||
"agentId": "73c853d1-c0fd-463b-ad17-1d24fefa371f",
|
||||
"name": "DevBackend",
|
||||
"mdPath": "agents/devbackend.md",
|
||||
"profileId": "664cc20c-47b8-53ad-9351-dce4c09c3da4",
|
||||
"profileId": "664cc20c-47b8-53ad-9351-dce3c09c0de4",
|
||||
"synchronized": false
|
||||
},
|
||||
{
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
||||
---
|
||||
upTo: 50c3e999-c6a3-4d8b-aef3-b6c273ed9afc
|
||||
upTo: a0b9d44f-2761-4652-b2f3-28222dbc4c62
|
||||
objective: [Ping inter-agent depuis Main] Test du pont MCP inter-agents. Si tu reçois ce message, réponds via idea_reply avec : (1) "DevFrontend OK — pont inter-agent fonctionnel", (2) le résultat de 144 ÷ 12, e
|
||||
---
|
||||
**Objectif :** [Ping inter-agent depuis Main] Test du pont MCP inter-agents. Si tu reçois ce message, réponds via idea_reply avec : (1) "DevFrontend OK — pont inter-agent fonctionnel", (2) le résultat de 144 ÷ 12, e
|
||||
@ -15,4 +15,6 @@ objective: [Ping inter-agent depuis Main] Test du pont MCP inter-agents. Si tu r
|
||||
- **Prompt:** Tâche LS7-front (React/TS) — UI de gestion des limites de session des agents (ARCHITECTURE §21). On est sur la branche `feature/agent-session-limits`. Le backend est terminé et vert (commit 9df5923) : il émet déjà 5 DOMAIN_EVENT vers le front et expose une commande Tauri `cancel_resume(agentId) -> bool`. CONTRAT WIRE (DTO sérialisés camelCase, source = crates/app-tauri/src/events.rs) : - `agentRateLimited` { agentId: string, resetsAt?: number /* epoch-ms, absent si inconnu */ } - `agentResumeScheduled` { agentId: string, fireAt: number /* epoch-ms, échéance du réveil */ } ⚠️ champ wire = `fireAtMs` → vérifie le nom exact sérialisé (camelCase de `fire_at_ms` = `fireAtMs`) ; idem `resetsAtMs` pour les autres. Aligne-toi sur le JSON réel. - `agentResumeCancelled` { agentId: string } - `agentResumed` { agentId: string } - `agentRateLimitSuspected` { agentId: string, resetsAt?: number } (Vérifie les noms de champs exacts dans events.rs : `resets_at_ms`→`resetsAtMs`, `fire_at_ms`→`fireAtMs`. Ne devine pas, lis le fichier.) À FAIRE : 1) Ajouter les 5 variantes au union `DomainEvent` de `src/domain/index.ts` (mêmes noms `type` que le wire), avec les champs exacts. 2) Exposer la commande `cancel_resume` dans le port gateway approprié (cf. `src/ports/index.ts`) + son implémentation dans l'adapter système (`src/adapters/system.ts`) ET le mock (`src/adapters/mock/index.ts`). RÈGLE ARCHI STRICTE : les composants ne touchent JAMAIS `invoke()` ni `@tauri-apps/api` — tout passe par les gateways/ports (hexagonal §1.3). Suis le patron d'une commande existante (ex. `interruptAgent` si elle existe, sinon une autre commande agent). 3) Tracker l'état limite par agent dans `useAgents` (view-model hook). Inspire-toi du patron existant `delegationSourceByRequester` qui se peuple depuis les events. État par agent : { limitedUntil?: number, resumeFireAt?: number, suspected?: bool }. Mises à jour : - `agentRateLimited` → limité (badge « limité jusqu'à HH:MM » si resetsAt connu, sinon « limité »). - `agentResumeScheduled` → arme le compte à rebours jusqu'à fireAt + bouton « Annuler la reprise ». - `agentResumeCancelled` → retire le compte à rebours (reste limité, sans reprise auto). - `agentResumed` → efface tout l'état limite de l'agent. - `agentRateLimitSuspected` → filet humain : signaler que la limite est détectée sans heure fiable et demander à l'utilisateur (au minimum un état/affichage « heure inconnue » ; le formulaire de saisie d'heure peut être un placeholder documenté si le backend n'a pas encore de commande pour l'enregistrer — dans ce cas, expose juste l'état et un TODO clair, NE fabrique pas de commande inexistante). 4) UI : badge limite + compte à rebours + bouton « Annuler la reprise » (appelle `cancel_resume` via le gateway) dans la vue agents/terminal cohérente avec le style existant. Composant testable (gateways mockés). NE PAS committer toi-même (l'agent Git tranche les commits). NE PAS toucher au backend Rust. Reste cohérent avec le style TS/React existant. Quand c'est implémenté, QA écrira/exécutera les tests — donc structure pour la testabilité (logique d'état dans le hook, pas dans le JSX). Rends-moi via idea_reply : la liste des fichiers modifiés/créés, les noms de champs wire exacts que tu as constatés dans events.rs, et tout point de friction (notamment sur le filet humain niveau 3 si aucune commande backend n'existe pour enregistrer l'heure saisie).
|
||||
- **Response:** LS7-front terminé. Typecheck `tsc --noEmit` propre + 39 tests agents existants verts (aucune régression). Non commité (Git tranche). ## Noms de champs wire constatés (lus dans crates/app-tauri/src/events.rs, `DomainEventDto`, serde camelCase + skip_serializing_if sur les Option) - `agentRateLimited` → { `agentId`: string, `resetsAtMs`?: number /* absent si null */ } - `agentResumeScheduled` → { `agentId`: string, `fireAtMs`: number /* toujours présent */ } - `agentResumeCancelled` → { `agentId`: string } - `agentResumed` → { `agentId`: string } - `agentRateLimitSuspected` → { `agentId`: string, `resetsAtMs`?: number /* absent si null */ } ⚠️ Confirmé : ce sont bien `resetsAtMs` / `fireAtMs` (suffixe `Ms`), PAS `resetsAt`/`fireAt` comme l'énoncé du ticket le suggérait. Je me suis aligné sur le JSON réel. Vérifié aussi par le test backend `rate_limited_relays_to_dto_and_wire` qui asserte `json["resetsAtMs"]`. Commande Tauri `cancel_resume` (commands.rs:1381) : signature `cancel_resume(agent_id: String) -> Result<bool, _>` — argument **nu** `agentId` (PAS d'enveloppe `{ request }` contrairement à interrupt_agent/delegation_delivered). Adapter aligné en conséquence. Renvoie `true` ssi une reprise était armée et a été désarmée. ## Fichiers modifiés 1. `frontend/src/domain/index.ts` — 5 variantes ajoutées au union `DomainEvent` (mêmes `type` que le wire, champs exacts `resetsAtMs?`/`fireAtMs`). 2. `frontend/src/ports/index.ts` — `cancelResume(agentId: string): Promise<boolean>` ajouté à `InputGateway` (port choisi : c'est le gateway des contrôles agent hors-bande, cohérent avec `interrupt`). 3. `frontend/src/adapters/input.ts` — `TauriInputGateway.cancelResume` → `invoke("cancel_resume", { agentId })` (arg nu, typé `<boolean>`). 4. `frontend/src/adapters/mock/index.ts` — `MockInputGateway.cancelResume` : enregistre dans `cancelledResumes: string[]`, renvoie `cancelResumeResult` (défaut `true`, flippable par les tests). 5. `frontend/src/features/agents/useAgents.ts` — état `limitByAgent: Record<string, AgentLimitState>` (interface exportée `{ limitedUntil?, resumeFireAt?, suspected? }`), peuplé depuis les 5 events dans l'abonnement `onDomainEvent` existant (même patron que `delegationSourceByRequester`) : - `agentRateLimited` → `{ limitedUntil: resetsAtMs, suspected: false }` (conserve un `resumeFireAt` éventuel). - `agentResumeScheduled` → arme `resumeFireAt = fireAtMs`. - `agentResumeCancelled` → retire `resumeFireAt`, reste limité. - `agentResumed` → supprime l'entrée (efface tout). - `agentRateLimitSuspected` → `{ limitedUntil: resetsAtMs, suspected: true }`. - Action `cancelResume(agentId)` exposée : retrait optimiste du compte à rebours + appel `input.cancelResume`, renvoie le verdict backend. ## Fichier créé 6. `frontend/src/features/agents/AgentLimitBadge.tsx` — composant présentational + 2 helpers purs exportés (`formatResetTime(epochMs)` → `HH:MM`, `formatCountdown(remainingMs)` → `Xm Ys`/`Ys`, clampé à 0). Badge « limité jusqu'à HH:MM » / « limité », compte à rebours vivant (clock locale 1 s armée seulement si `resumeFireAt`), bouton « Annuler la reprise ». Câblé dans `AgentsPanel.tsx` (import + rendu conditionnel sous chaque ligne d'agent quand `vm.limitByAgent[a.id]` existe). ## Point de friction — filet humain niveau 3 (§21.1) Conformément à la consigne, je n'ai **fabriqué aucune commande inexistante**. Le seul point d'entrée backend disponible est `cancel_resume` ; **il n'existe pas de commande pour enregistrer une heure de reprise saisie par l'utilisateur**. Donc pour `agentRateLimitSuspected` sans `resetsAtMs`, le badge affiche l'état « limité · heure inconnue — reprise à préciser » (état + `role="note"`), sans formulaire de saisie. Un `TODO(LS-front)` documenté est posé dans `AgentLimitBadge.tsx` : câbler un formulaire d'heure dès que le backend exposera une commande pour persister l'instant choisi. Si tu veux ce filet pleinement fonctionnel, il faut une tâche backend (ex. `set_resume_at(agentId, epochMs)`) à cadrer avec Architect/DevBackend — je m'y connecterai côté front. Prêt pour QA (logique d'état dans le hook + helpers purs isolés du JSX, mocks en place avec `cancelledResumes`/`cancelResumeResult`).
|
||||
- **Prompt:** Deux livrables distincts sur `feature/agent-session-limits` (Git en fera 2 commits séparés — ne commit pas toi-même). ═══ LIVRABLE 1 — LS8-front : formulaire de saisie d'heure (filet humain niveau 3) ═══ Le backend expose maintenant une commande Tauri `set_resume_at(agentId: string, resetsAtMs: number) -> void` (argument nu `{ agentId, resetsAtMs }`, comme `cancel_resume`). Elle arme la MÊME reprise annulable que l'auto et réémet `agentResumeScheduled` — donc une fois appelée, ton badge bascule TOUT SEUL de « heure inconnue » vers l'état nominal « limité jusqu'à HH:MM » + compte à rebours + bouton Annuler (déjà câblés en LS7). Aucun nouvel événement à consommer. À FAIRE : 1. Port : ajoute `setResumeAt(agentId: string, resetsAtMs: number): Promise<void>` à `InputGateway` (`src/ports/index.ts`), à côté de `cancelResume`. 2. Adapter Tauri (`src/adapters/input.ts`) : `setResumeAt` → `invoke("set_resume_at", { agentId, resetsAtMs })`. 3. Mock (`src/adapters/mock/index.ts`) : `MockInputGateway.setResumeAt` enregistre dans un tableau (ex. `resumeArmings: { agentId, resetsAtMs }[]`) pour les tests ; suis le patron de `cancelledResumes`. 4. Hook `useAgents` : expose une action `setResumeAt(agentId, resetsAtMs)` qui délègue au port (pas de mutation optimiste nécessaire — l'event `agentResumeScheduled` rebasculera l'état). 5. UI `AgentLimitBadge.tsx` : sur l'état SUSPECTED SANS heure (`suspected === true` && pas de `limitedUntil`/`resumeFireAt`), remplace le TODO/placeholder par un petit formulaire : un input heure (type `time` ou `datetime-local`) + bouton « Programmer la reprise ». À la soumission : convertir la saisie en epoch-ms (si input `time` seul = aujourd'hui à HH:MM ; si déjà passé dans la journée, le backend clampe à maintenant ⇒ reprise immédiate, donc pas besoin de validation stricte côté front, mais documente le comportement). Appeler l'action `setResumeAt(agentId, epochMs)`. Garde un helper pur exporté pour la conversion (ex. `timeInputToEpochMs(value, now)`) pour la testabilité. Style cohérent avec le reste du badge ; désactive pendant `busy`. 6. Retire le `TODO(LS-front)` posé en LS7 (le filet est maintenant complet). ═══ LIVRABLE 2 — fix test préexistant (hygiène, commit séparé) ═══ `src/adapters/mock/mock.test.ts:16` asserte « thirteen gateways » mais il y en a 14 (la gateway `permission` existe déjà dans HEAD). Mets le compteur à jour (14, et le libellé texte si présent) pour que `npx vitest run src/adapters/mock/` repasse vert. NE change RIEN d'autre dans ce fichier ; vérifie juste que le compte réel est bien 14 avant de figer le nombre. Lance `npx vitest run src/features/agents/ src/adapters/mock/` + `tsc --noEmit` et RENDS-MOI via idea_reply : fichiers modifiés/créés par livrable, le helper de conversion exact, le résultat des deux commandes (typecheck + tests), et le nombre réel de gateways constaté. Structure pour testabilité (logique dans le hook + helpers purs). NE COMMIT PAS — Git tranche, en 2 commits séparés (LS8-front / fix-test).
|
||||
- **Response:** Les deux livrables sont prêts. NON commité (Git tranche, 2 commits séparés). ## Résultats des commandes - `npx tsc --noEmit` : **propre** (0 erreur). - `npx vitest run src/features/agents/ src/adapters/mock/` : **109 tests / 8 fichiers, tous verts**. ## Nombre réel de gateways constaté : **14** Le `Gateways` (ports/index.ts) en a 14 ; l'array du test en listait 13 — il manquait `permission` (présente dans HEAD). Compteur + libellé + array corrigés. ## Helper de conversion exact (pur, exporté, testé) ```ts // AgentLimitBadge.tsx export function timeInputToEpochMs(value: string, now: number): number | null { const match = /^(\d{1,2}):(\d{2})$/.exec(value.trim()); if (!match) return null; const hours = Number(match[1]); const minutes = Number(match[2]); if (hours > 23 || minutes > 59) return null; const d = new Date(now); d.setHours(hours, minutes, 0, 0); return d.getTime(); } ``` Comportement documenté : input `time` seul ⇒ aujourd'hui à HH:MM (même jour calendaire que `now`). Une heure déjà passée renvoie un instant < now **sans validation stricte** — le backend clampe à maintenant ⇒ reprise immédiate (commenté dans le code et couvert par un test). Empty/malformé/`25:00`/`12:60` ⇒ `null` (saisie incomplète ignorée). ═══ LIVRABLE 1 — LS8-front (commit « LS8-front ») ═══ Fichiers modifiés : 1. `frontend/src/ports/index.ts` — `setResumeAt(agentId, resetsAtMs): Promise<void>` ajouté à `InputGateway`, à côté de `cancelResume`. 2. `frontend/src/adapters/input.ts` — `setResumeAt` → `invoke("set_resume_at", { agentId, resetsAtMs })` (args nus, comme cancel_resume). 3. `frontend/src/adapters/mock/index.ts` — `MockInputGateway.setResumeAt` enregistre dans `resumeArmings: { agentId, resetsAtMs }[]` (patron `cancelledResumes`). 4. `frontend/src/features/agents/useAgents.ts` — action `setResumeAt(agentId, resetsAtMs)` exposée, délègue au port, **aucune mutation optimiste** (l'event `agentResumeScheduled` rebascule l'état via l'abonnement existant). 5. `frontend/src/features/agents/AgentLimitBadge.tsx` — état SUSPECTED sans heure (`suspected===true && !limitedUntil && !resumeFireAt`) : le placeholder/TODO LS7 est remplacé par un **formulaire** (input `type="time"` aria-label `resume time` + bouton `Programmer la reprise` aria-label `schedule resume`, désactivés pendant `busy`/saisie vide). Soumission → `timeInputToEpochMs` → `onSetResumeAt(epochMs)`. Une fois armé, le badge bascule **tout seul** vers « limité jusqu'à HH:MM » + compte à rebours + Annuler (chaîne LS7 inchangée). TODO(LS-front) **retiré**. 6. `frontend/src/features/agents/AgentsPanel.tsx` — passe `onSetResumeAt={(ms) => void vm.setResumeAt(a.id, ms)}` au badge. 7. `frontend/src/features/agents/AgentLimitBadge.test.tsx` — **test QA préexistant (LS7) mis à jour au nouveau contrat** (prop requise `onSetResumeAt`, le cas « suspected sans heure » teste maintenant le formulaire au lieu de l'ancien texte placeholder) + ajout couverture LS8 : `timeInputToEpochMs` (jour calendaire, instant passé, null malformé), soumission du formulaire ⇒ `onSetResumeAt` appelé avec l'epoch-ms attendu, bouton désactivé si vide. *(Sans cette MAJ le typecheck cassait — la prop est devenue obligatoire et le rendu du cas suspected a changé. Aucune logique de prod altérée, seulement l'alignement du test.)* ═══ LIVRABLE 2 — fix test (commit « fix-test » séparé) ═══ Fichier modifié : - `frontend/src/adapters/mock/mock.test.ts` — « thirteen » → « fourteen », `"permission"` inséré dans l'array attendu (ordre alphabétique). **Rien d'autre touché** dans ce fichier. ## Point de friction / note Petit ajustement non listé mais nécessaire : le `<form>` portait initialement le même `aria-label="schedule resume"` que son bouton submit, ce qui faisait matcher 2 éléments avec `getByLabelText`. J'ai renommé le label du form en `"resume time form"` (le bouton garde `schedule resume`). Aucune incidence fonctionnelle. Le filet humain niveau 3 est désormais **complet** : détection → formulaire de saisie → arme la reprise annulable via `set_resume_at` → bascule auto vers l'état nominal. Prêt pour QA (logique d'état dans le hook, helpers purs isolés, mocks instrumentés `resumeArmings`/`cancelledResumes`).
|
||||
- **Response:** Les deux livrables sont prêts. NON commité (Git tranche, 2 commits séparés). ## Résultats des commandes - `npx tsc --noEmit` : **propre** (0 erreur). - `npx vitest run src/features/agents/ src/adapters/mock/` : **109 tests / 8 fichiers, tous verts**. ## Nombre réel de gateways constaté : **14** Le `Gateways` (ports/index.ts) en a 14 ; l'array du test en listait 13 — il manquait `permission` (présente dans HEAD). Compteur + libellé + array corrigés. ## Helper de conversion exact (pur, exporté, testé) ```ts // AgentLimitBadge.tsx export function timeInputToEpochMs(value: string, now: number): number | null { const match = /^(\d{1,2}):(\d{2})$/.exec(value.trim()); if (!match) return null; const hours = Number(match[1]); const minutes = Number(match[2]); if (hours > 23 || minutes > 59) return null; const d = new Date(now); d.setHours(hours, minutes, 0, 0); return d.getTime(); } ``` Comportement documenté : input `time` seul ⇒ aujourd'hui à HH:MM (même jour calendaire que `now`). Une heure déjà passée renvoie un instant < now **sans validation stricte** — le backend clampe à maintenant ⇒ reprise immédiate (commenté dans le code et couvert par un test). Empty/malformé/`25:00`/`12:60` ⇒ `null` (saisie incomplète ignorée). ═══ LIVRABLE 1 — LS8-front (commit « LS8-front ») ═══ Fichiers modifiés : 1. `frontend/src/ports/index.ts` — `setResumeAt(agentId, resetsAtMs): Promise<void>` ajouté à `InputGateway`, à côté de `cancelResume`. 2. `frontend/src/adapters/input.ts` — `setResumeAt` → `invoke("set_resume_at", { agentId, resetsAtMs })` (args nus, comme cancel_resume). 3. `frontend/src/adapters/mock/index.ts` — `MockInputGateway.setResumeAt` enregistre dans `resumeArmings: { agentId, resetsAtMs }[]` (patron `cancelledResumes`). 4. `frontend/src/features/agents/useAgents.ts` — action `setResumeAt(agentId, resetsAtMs)` exposée, délègue au port, **aucune mutation optimiste** (l'event `agentResumeScheduled` rebascule l'état via l'abonnement existant). 5. `frontend/src/features/agents/AgentLimitBadge.tsx` — état SUSPECTED sans heure (`suspected===true && !limitedUntil && !resumeFireAt`) : le placeholder/TODO LS7 est remplacé par un **formulaire** (input `type="time"` aria-label `resume time` + bouton `Programmer la reprise` aria-label `schedule resume`, désactivés pendant `busy`/saisie vide). Soumission → `timeInputToEpochMs` → `onSetResumeAt(epochMs)`. Une fois armé, le badge bascule **tout seul** vers « limité jusqu'à HH:MM » + compte à rebours + Annuler (chaîne LS7 inchangée). TODO(LS-front) **retiré**. 6. `frontend/src/features/agents/AgentsPanel.tsx` — passe `onSetResumeAt={(ms) => void vm.setResumeAt(a.id, ms)}` au badge. 7. `frontend/src/features/agents/AgentLimitBadge.test.tsx` — **test QA préexistant (LS7) mis à jour au nouveau contrat** (prop requise `onSetResumeAt`, le cas « suspected sans heure » teste maintenant le formulaire au lieu de l'ancien texte placeholder) + ajout couverture LS8 : `timeInputToEpochMs` (jour calendaire, instant passé, null malformé), soumission du formulaire ⇒ `onSetResumeAt` appelé avec l'epoch-ms attendu, bouton désactivé si vide. *(Sans cette MAJ le typecheck cassait — la prop est devenue obligatoire et le rendu du cas suspected a changé. Aucune logique de prod altérée, seulement l'alignement du test.)* ═══ LIVRABLE 2 — fix test (commit « fix-test » séparé) ═══ Fichier modifié : - `frontend/src/adapters/mock/mock.test.ts` — « thirteen » → « fourteen », `"permission"` inséré dans l'array attendu (ordre alphabétique). **Rien d'autre touché** dans ce fichier. ## Point de friction / note Petit ajustement non listé mais nécessaire : le `<form>` portait initialement le même `aria-label="schedule resume"` que son bouton submit, ce qui faisait matcher 2 éléments avec `getByLabelText`. J'ai renommé le label du form en `"resume time form"` (le bouton garde `schedule resume`). Aucune incidence fonctionnelle. Le filet humain niveau 3 est désormais **complet** : détection → formulaire de saisie → arme la reprise annulable via `set_resume_at` → bascule auto vers l'état nominal. Prêt pour QA (logique d'état dans le hook, helpers purs isolés, mocks instrumentés `resumeArmings`/`cancelledResumes`).
|
||||
- **Prompt:** Implémente le Lot A frontend du chantier `UX conversations/délégations + read-model live-state minimal`, en consommant le backend/Tauri que DevBackend vient d'ajouter. Contrat backend disponible: - commande Tauri `get_project_work_state(projectId)`. - DTO `ProjectWorkStateDto { agents }` camelCase. - agent: `agentId`, `name`, `profileId`, `live?: { nodeId, sessionId, kind: "pty"|"structured" }`, `busy` taggé `{ state: "idle" }` ou `{ state: "busy", ticket, sinceMs }`. Périmètre frontend strict: - Ajouter types domaine `ProjectWorkState`, `AgentWorkState`, `LiveWorkSession`, `WorkBusyState`. - Ajouter port `WorkStateGateway` et adapter Tauri `workState`. - Ajouter mock gateway. - Ajouter feature `features/workstate`: hook `useProjectWorkState(projectId)` + `ProjectWorkStatePanel`. - Ajouter une surface UI minimale, probablement un onglet/sidebar `Work` dans `ProjectsView`, read-only: ligne par agent, live/offline, idle/busy, ticket court si busy, empty/error/refresh. - Refresh initial + refresh sur events existants pertinents si le système d'events est déjà accessible (`agentLaunched`, `agentExited`, `agentBusyChanged`, `orchestratorRequestProcessed` si disponible). Ne crée pas une grosse architecture event si ce n'est pas déjà le pattern. - Pas d'actions attach/stop/voir conversation dans ce lot. Tests attendus: - panel empty state. - agent idle/offline. - agent live + busy avec ticket court. - refresh déclenché par event si implémenté. - onglet Work visible/rendu dans ProjectsView si raisonnable. Exécute `npx vitest` ciblé et `npx tsc --noEmit`. Ne committe pas. Réponds avec fichiers modifiés, commandes/résultats, et risques.
|
||||
- **Response:** Lot A frontend implémenté, sans commit. Fichiers modifiés/ajoutés frontend: - `frontend/src/domain/index.ts`: types `ProjectWorkState`, `AgentWorkState`, `LiveWorkSession`, `WorkBusyState`. - `frontend/src/ports/index.ts`: port `WorkStateGateway` + ajout dans `Gateways`. - `frontend/src/adapters/workState.ts`: adapter Tauri `get_project_work_state`. - `frontend/src/adapters/index.ts`: câblage `TauriWorkStateGateway`. - `frontend/src/adapters/mock/index.ts`: `MockWorkStateGateway` + helper `_setProjectWorkState` + câblage mock. - `frontend/src/features/workstate/useProjectWorkState.ts`: hook avec refresh initial et refresh sur `agentLaunched`, `agentExited`, `agentBusyChanged`, `orchestratorRequestProcessed`. - `frontend/src/features/workstate/ProjectWorkStatePanel.tsx`: UI read-only, empty/error/refresh, live/offline, idle/busy, ticket court. - `frontend/src/features/workstate/index.ts`: export feature. - `frontend/src/features/workstate/workstate.test.tsx`: tests panel empty, idle/offline, live+busy ticket court, refresh event. - `frontend/src/features/projects/ProjectsView.tsx`: onglet sidebar `Work`. - `frontend/src/features/projects/projects.test.tsx`: injection mock workState + test onglet Work rendu. Commandes exécutées: - `cd frontend && npx vitest run src/features/workstate/workstate.test.tsx src/features/projects/projects.test.tsx` - Résultat: OK, 2 fichiers passés, 13 tests passés. - Vite affiche seulement des warnings existants sur options `esbuild`/`oxc`. - `cd frontend && npx tsc --noEmit` - Résultat: OK, aucune erreur. Risques / limites: - Le refresh event est volontairement large car les events cités ne portent pas tous `projectId`; le hook re-fetch le projet actif sur event pertinent. - UI strictement read-only comme demandé: pas d’attach/stop/voir conversation. - Je n’ai pas lancé tout le `vitest` global, seulement le ciblé demandé. - Le worktree contenait déjà des changements backend et `.ideai/*`; je ne les ai pas touchés.
|
||||
@ -10,3 +10,5 @@
|
||||
{"id":"a37b2aac-87f7-476d-8606-7250d15dd852","conversation":"09b15ec3-ce2f-0af2-2903-ef699df9de41","atMs":1781676130924,"source":{"kind":"agent","agentId":"af7f86da-76bc-48e1-9900-71f45a624800"},"role":"response","text":"LS7-front terminé. Typecheck `tsc --noEmit` propre + 39 tests agents existants verts (aucune régression). Non commité (Git tranche).\n\n## Noms de champs wire constatés (lus dans crates/app-tauri/src/events.rs, `DomainEventDto`, serde camelCase + skip_serializing_if sur les Option)\n- `agentRateLimited` → { `agentId`: string, `resetsAtMs`?: number /* absent si null */ }\n- `agentResumeScheduled` → { `agentId`: string, `fireAtMs`: number /* toujours présent */ }\n- `agentResumeCancelled` → { `agentId`: string }\n- `agentResumed` → { `agentId`: string }\n- `agentRateLimitSuspected` → { `agentId`: string, `resetsAtMs`?: number /* absent si null */ }\n\n⚠️ Confirmé : ce sont bien `resetsAtMs` / `fireAtMs` (suffixe `Ms`), PAS `resetsAt`/`fireAt` comme l'énoncé du ticket le suggérait. Je me suis aligné sur le JSON réel. Vérifié aussi par le test backend `rate_limited_relays_to_dto_and_wire` qui asserte `json[\"resetsAtMs\"]`.\n\nCommande Tauri `cancel_resume` (commands.rs:1381) : signature `cancel_resume(agent_id: String) -> Result<bool, _>` — argument **nu** `agentId` (PAS d'enveloppe `{ request }` contrairement à interrupt_agent/delegation_delivered). Adapter aligné en conséquence. Renvoie `true` ssi une reprise était armée et a été désarmée.\n\n## Fichiers modifiés\n1. `frontend/src/domain/index.ts` — 5 variantes ajoutées au union `DomainEvent` (mêmes `type` que le wire, champs exacts `resetsAtMs?`/`fireAtMs`).\n2. `frontend/src/ports/index.ts` — `cancelResume(agentId: string): Promise<boolean>` ajouté à `InputGateway` (port choisi : c'est le gateway des contrôles agent hors-bande, cohérent avec `interrupt`).\n3. `frontend/src/adapters/input.ts` — `TauriInputGateway.cancelResume` → `invoke(\"cancel_resume\", { agentId })` (arg nu, typé `<boolean>`).\n4. `frontend/src/adapters/mock/index.ts` — `MockInputGateway.cancelResume` : enregistre dans `cancelledResumes: string[]`, renvoie `cancelResumeResult` (défaut `true`, flippable par les tests).\n5. `frontend/src/features/agents/useAgents.ts` — état `limitByAgent: Record<string, AgentLimitState>` (interface exportée `{ limitedUntil?, resumeFireAt?, suspected? }`), peuplé depuis les 5 events dans l'abonnement `onDomainEvent` existant (même patron que `delegationSourceByRequester`) :\n - `agentRateLimited` → `{ limitedUntil: resetsAtMs, suspected: false }` (conserve un `resumeFireAt` éventuel).\n - `agentResumeScheduled` → arme `resumeFireAt = fireAtMs`.\n - `agentResumeCancelled` → retire `resumeFireAt`, reste limité.\n - `agentResumed` → supprime l'entrée (efface tout).\n - `agentRateLimitSuspected` → `{ limitedUntil: resetsAtMs, suspected: true }`.\n - Action `cancelResume(agentId)` exposée : retrait optimiste du compte à rebours + appel `input.cancelResume`, renvoie le verdict backend.\n\n## Fichier créé\n6. `frontend/src/features/agents/AgentLimitBadge.tsx` — composant présentational + 2 helpers purs exportés (`formatResetTime(epochMs)` → `HH:MM`, `formatCountdown(remainingMs)` → `Xm Ys`/`Ys`, clampé à 0). Badge « limité jusqu'à HH:MM » / « limité », compte à rebours vivant (clock locale 1 s armée seulement si `resumeFireAt`), bouton « Annuler la reprise ». Câblé dans `AgentsPanel.tsx` (import + rendu conditionnel sous chaque ligne d'agent quand `vm.limitByAgent[a.id]` existe).\n\n## Point de friction — filet humain niveau 3 (§21.1)\nConformément à la consigne, je n'ai **fabriqué aucune commande inexistante**. Le seul point d'entrée backend disponible est `cancel_resume` ; **il n'existe pas de commande pour enregistrer une heure de reprise saisie par l'utilisateur**. Donc pour `agentRateLimitSuspected` sans `resetsAtMs`, le badge affiche l'état « limité · heure inconnue — reprise à préciser » (état + `role=\"note\"`), sans formulaire de saisie. Un `TODO(LS-front)` documenté est posé dans `AgentLimitBadge.tsx` : câbler un formulaire d'heure dès que le backend exposera une commande pour persister l'instant choisi. Si tu veux ce filet pleinement fonctionnel, il faut une tâche backend (ex. `set_resume_at(agentId, epochMs)`) à cadrer avec Architect/DevBackend — je m'y connecterai côté front.\n\nPrêt pour QA (logique d'état dans le hook + helpers purs isolés du JSX, mocks en place avec `cancelledResumes`/`cancelResumeResult`)."}
|
||||
{"id":"f21219de-033a-4b3e-8e8b-366534112a95","conversation":"09b15ec3-ce2f-0af2-2903-ef699df9de41","atMs":1781676945137,"source":{"kind":"agent","agentId":"a6ced819-b893-4213-b003-9e9dc79b9641"},"role":"prompt","text":"Deux livrables distincts sur `feature/agent-session-limits` (Git en fera 2 commits séparés — ne commit pas toi-même).\n\n═══ LIVRABLE 1 — LS8-front : formulaire de saisie d'heure (filet humain niveau 3) ═══\nLe backend expose maintenant une commande Tauri `set_resume_at(agentId: string, resetsAtMs: number) -> void` (argument nu `{ agentId, resetsAtMs }`, comme `cancel_resume`). Elle arme la MÊME reprise annulable que l'auto et réémet `agentResumeScheduled` — donc une fois appelée, ton badge bascule TOUT SEUL de « heure inconnue » vers l'état nominal « limité jusqu'à HH:MM » + compte à rebours + bouton Annuler (déjà câblés en LS7). Aucun nouvel événement à consommer.\n\nÀ FAIRE :\n1. Port : ajoute `setResumeAt(agentId: string, resetsAtMs: number): Promise<void>` à `InputGateway` (`src/ports/index.ts`), à côté de `cancelResume`.\n2. Adapter Tauri (`src/adapters/input.ts`) : `setResumeAt` → `invoke(\"set_resume_at\", { agentId, resetsAtMs })`.\n3. Mock (`src/adapters/mock/index.ts`) : `MockInputGateway.setResumeAt` enregistre dans un tableau (ex. `resumeArmings: { agentId, resetsAtMs }[]`) pour les tests ; suis le patron de `cancelledResumes`.\n4. Hook `useAgents` : expose une action `setResumeAt(agentId, resetsAtMs)` qui délègue au port (pas de mutation optimiste nécessaire — l'event `agentResumeScheduled` rebasculera l'état). \n5. UI `AgentLimitBadge.tsx` : sur l'état SUSPECTED SANS heure (`suspected === true` && pas de `limitedUntil`/`resumeFireAt`), remplace le TODO/placeholder par un petit formulaire : un input heure (type `time` ou `datetime-local`) + bouton « Programmer la reprise ». À la soumission : convertir la saisie en epoch-ms (si input `time` seul = aujourd'hui à HH:MM ; si déjà passé dans la journée, le backend clampe à maintenant ⇒ reprise immédiate, donc pas besoin de validation stricte côté front, mais documente le comportement). Appeler l'action `setResumeAt(agentId, epochMs)`. Garde un helper pur exporté pour la conversion (ex. `timeInputToEpochMs(value, now)`) pour la testabilité. Style cohérent avec le reste du badge ; désactive pendant `busy`.\n6. Retire le `TODO(LS-front)` posé en LS7 (le filet est maintenant complet).\n\n═══ LIVRABLE 2 — fix test préexistant (hygiène, commit séparé) ═══\n`src/adapters/mock/mock.test.ts:16` asserte « thirteen gateways » mais il y en a 14 (la gateway `permission` existe déjà dans HEAD). Mets le compteur à jour (14, et le libellé texte si présent) pour que `npx vitest run src/adapters/mock/` repasse vert. NE change RIEN d'autre dans ce fichier ; vérifie juste que le compte réel est bien 14 avant de figer le nombre.\n\nLance `npx vitest run src/features/agents/ src/adapters/mock/` + `tsc --noEmit` et RENDS-MOI via idea_reply : fichiers modifiés/créés par livrable, le helper de conversion exact, le résultat des deux commandes (typecheck + tests), et le nombre réel de gateways constaté. Structure pour testabilité (logique dans le hook + helpers purs). NE COMMIT PAS — Git tranche, en 2 commits séparés (LS8-front / fix-test)."}
|
||||
{"id":"50c3e999-c6a3-4d8b-aef3-b6c273ed9afc","conversation":"09b15ec3-ce2f-0af2-2903-ef699df9de41","atMs":1781677152871,"source":{"kind":"agent","agentId":"af7f86da-76bc-48e1-9900-71f45a624800"},"role":"response","text":"Les deux livrables sont prêts. NON commité (Git tranche, 2 commits séparés).\n\n## Résultats des commandes\n- `npx tsc --noEmit` : **propre** (0 erreur).\n- `npx vitest run src/features/agents/ src/adapters/mock/` : **109 tests / 8 fichiers, tous verts**.\n\n## Nombre réel de gateways constaté : **14**\nLe `Gateways` (ports/index.ts) en a 14 ; l'array du test en listait 13 — il manquait `permission` (présente dans HEAD). Compteur + libellé + array corrigés.\n\n## Helper de conversion exact (pur, exporté, testé)\n```ts\n// AgentLimitBadge.tsx\nexport function timeInputToEpochMs(value: string, now: number): number | null {\n const match = /^(\\d{1,2}):(\\d{2})$/.exec(value.trim());\n if (!match) return null;\n const hours = Number(match[1]);\n const minutes = Number(match[2]);\n if (hours > 23 || minutes > 59) return null;\n const d = new Date(now);\n d.setHours(hours, minutes, 0, 0);\n return d.getTime();\n}\n```\nComportement documenté : input `time` seul ⇒ aujourd'hui à HH:MM (même jour calendaire que `now`). Une heure déjà passée renvoie un instant < now **sans validation stricte** — le backend clampe à maintenant ⇒ reprise immédiate (commenté dans le code et couvert par un test). Empty/malformé/`25:00`/`12:60` ⇒ `null` (saisie incomplète ignorée).\n\n═══ LIVRABLE 1 — LS8-front (commit « LS8-front ») ═══\nFichiers modifiés :\n1. `frontend/src/ports/index.ts` — `setResumeAt(agentId, resetsAtMs): Promise<void>` ajouté à `InputGateway`, à côté de `cancelResume`.\n2. `frontend/src/adapters/input.ts` — `setResumeAt` → `invoke(\"set_resume_at\", { agentId, resetsAtMs })` (args nus, comme cancel_resume).\n3. `frontend/src/adapters/mock/index.ts` — `MockInputGateway.setResumeAt` enregistre dans `resumeArmings: { agentId, resetsAtMs }[]` (patron `cancelledResumes`).\n4. `frontend/src/features/agents/useAgents.ts` — action `setResumeAt(agentId, resetsAtMs)` exposée, délègue au port, **aucune mutation optimiste** (l'event `agentResumeScheduled` rebascule l'état via l'abonnement existant).\n5. `frontend/src/features/agents/AgentLimitBadge.tsx` — état SUSPECTED sans heure (`suspected===true && !limitedUntil && !resumeFireAt`) : le placeholder/TODO LS7 est remplacé par un **formulaire** (input `type=\"time\"` aria-label `resume time` + bouton `Programmer la reprise` aria-label `schedule resume`, désactivés pendant `busy`/saisie vide). Soumission → `timeInputToEpochMs` → `onSetResumeAt(epochMs)`. Une fois armé, le badge bascule **tout seul** vers « limité jusqu'à HH:MM » + compte à rebours + Annuler (chaîne LS7 inchangée). TODO(LS-front) **retiré**.\n6. `frontend/src/features/agents/AgentsPanel.tsx` — passe `onSetResumeAt={(ms) => void vm.setResumeAt(a.id, ms)}` au badge.\n7. `frontend/src/features/agents/AgentLimitBadge.test.tsx` — **test QA préexistant (LS7) mis à jour au nouveau contrat** (prop requise `onSetResumeAt`, le cas « suspected sans heure » teste maintenant le formulaire au lieu de l'ancien texte placeholder) + ajout couverture LS8 : `timeInputToEpochMs` (jour calendaire, instant passé, null malformé), soumission du formulaire ⇒ `onSetResumeAt` appelé avec l'epoch-ms attendu, bouton désactivé si vide. *(Sans cette MAJ le typecheck cassait — la prop est devenue obligatoire et le rendu du cas suspected a changé. Aucune logique de prod altérée, seulement l'alignement du test.)*\n\n═══ LIVRABLE 2 — fix test (commit « fix-test » séparé) ═══\nFichier modifié :\n- `frontend/src/adapters/mock/mock.test.ts` — « thirteen » → « fourteen », `\"permission\"` inséré dans l'array attendu (ordre alphabétique). **Rien d'autre touché** dans ce fichier.\n\n## Point de friction / note\nPetit ajustement non listé mais nécessaire : le `<form>` portait initialement le même `aria-label=\"schedule resume\"` que son bouton submit, ce qui faisait matcher 2 éléments avec `getByLabelText`. J'ai renommé le label du form en `\"resume time form\"` (le bouton garde `schedule resume`). Aucune incidence fonctionnelle.\n\nLe filet humain niveau 3 est désormais **complet** : détection → formulaire de saisie → arme la reprise annulable via `set_resume_at` → bascule auto vers l'état nominal. Prêt pour QA (logique d'état dans le hook, helpers purs isolés, mocks instrumentés `resumeArmings`/`cancelledResumes`)."}
|
||||
{"id":"b84fc73b-74fc-465f-a9b2-e4b79651e0f0","conversation":"09b15ec3-ce2f-0af2-2903-ef699df9de41","atMs":1781971246800,"source":{"kind":"agent","agentId":"a6ced819-b893-4213-b003-9e9dc79b9641"},"role":"prompt","text":"Implémente le Lot A frontend du chantier `UX conversations/délégations + read-model live-state minimal`, en consommant le backend/Tauri que DevBackend vient d'ajouter.\n\nContrat backend disponible:\n- commande Tauri `get_project_work_state(projectId)`.\n- DTO `ProjectWorkStateDto { agents }` camelCase.\n- agent: `agentId`, `name`, `profileId`, `live?: { nodeId, sessionId, kind: \"pty\"|\"structured\" }`, `busy` taggé `{ state: \"idle\" }` ou `{ state: \"busy\", ticket, sinceMs }`.\n\nPérimètre frontend strict:\n- Ajouter types domaine `ProjectWorkState`, `AgentWorkState`, `LiveWorkSession`, `WorkBusyState`.\n- Ajouter port `WorkStateGateway` et adapter Tauri `workState`.\n- Ajouter mock gateway.\n- Ajouter feature `features/workstate`: hook `useProjectWorkState(projectId)` + `ProjectWorkStatePanel`.\n- Ajouter une surface UI minimale, probablement un onglet/sidebar `Work` dans `ProjectsView`, read-only: ligne par agent, live/offline, idle/busy, ticket court si busy, empty/error/refresh.\n- Refresh initial + refresh sur events existants pertinents si le système d'events est déjà accessible (`agentLaunched`, `agentExited`, `agentBusyChanged`, `orchestratorRequestProcessed` si disponible). Ne crée pas une grosse architecture event si ce n'est pas déjà le pattern.\n- Pas d'actions attach/stop/voir conversation dans ce lot.\n\nTests attendus:\n- panel empty state.\n- agent idle/offline.\n- agent live + busy avec ticket court.\n- refresh déclenché par event si implémenté.\n- onglet Work visible/rendu dans ProjectsView si raisonnable.\n\nExécute `npx vitest` ciblé et `npx tsc --noEmit`. Ne committe pas. Réponds avec fichiers modifiés, commandes/résultats, et risques."}
|
||||
{"id":"a0b9d44f-2761-4652-b2f3-28222dbc4c62","conversation":"09b15ec3-ce2f-0af2-2903-ef699df9de41","atMs":1781971459114,"source":{"kind":"agent","agentId":"af7f86da-76bc-48e1-9900-71f45a624800"},"role":"response","text":"Lot A frontend implémenté, sans commit.\n\nFichiers modifiés/ajoutés frontend:\n- `frontend/src/domain/index.ts`: types `ProjectWorkState`, `AgentWorkState`, `LiveWorkSession`, `WorkBusyState`.\n- `frontend/src/ports/index.ts`: port `WorkStateGateway` + ajout dans `Gateways`.\n- `frontend/src/adapters/workState.ts`: adapter Tauri `get_project_work_state`.\n- `frontend/src/adapters/index.ts`: câblage `TauriWorkStateGateway`.\n- `frontend/src/adapters/mock/index.ts`: `MockWorkStateGateway` + helper `_setProjectWorkState` + câblage mock.\n- `frontend/src/features/workstate/useProjectWorkState.ts`: hook avec refresh initial et refresh sur `agentLaunched`, `agentExited`, `agentBusyChanged`, `orchestratorRequestProcessed`.\n- `frontend/src/features/workstate/ProjectWorkStatePanel.tsx`: UI read-only, empty/error/refresh, live/offline, idle/busy, ticket court.\n- `frontend/src/features/workstate/index.ts`: export feature.\n- `frontend/src/features/workstate/workstate.test.tsx`: tests panel empty, idle/offline, live+busy ticket court, refresh event.\n- `frontend/src/features/projects/ProjectsView.tsx`: onglet sidebar `Work`.\n- `frontend/src/features/projects/projects.test.tsx`: injection mock workState + test onglet Work rendu.\n\nCommandes exécutées:\n- `cd frontend && npx vitest run src/features/workstate/workstate.test.tsx src/features/projects/projects.test.tsx`\n - Résultat: OK, 2 fichiers passés, 13 tests passés.\n - Vite affiche seulement des warnings existants sur options `esbuild`/`oxc`.\n- `cd frontend && npx tsc --noEmit`\n - Résultat: OK, aucune erreur.\n\nRisques / limites:\n- Le refresh event est volontairement large car les events cités ne portent pas tous `projectId`; le hook re-fetch le projet actif sur event pertinent.\n- UI strictement read-only comme demandé: pas d’attach/stop/voir conversation.\n- Je n’ai pas lancé tout le `vitest` global, seulement le ciblé demandé.\n- Le worktree contenait déjà des changements backend et `.ideai/*`; je ne les ai pas touchés."}
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
---
|
||||
upTo: 47deb70a-ada1-42a2-bdae-e23b635cf4e5
|
||||
upTo: 93ed87f6-8dc6-4ff8-85d9-81aa30d30bed
|
||||
objective: Nouvelle feature cadrée par Architect, prête à démarrer le développement : « Gestion des limites de session des agents » (détection hiérarchique des limites de session + reprise auto annulable). C'est
|
||||
---
|
||||
**Objectif :** Nouvelle feature cadrée par Architect, prête à démarrer le développement : « Gestion des limites de session des agents » (détection hiérarchique des limites de session + reprise auto annulable). C'est
|
||||
|
||||
- **Response:** Décision Git — stratégie de branches pour la suite. ## État constaté (réel) - Branche courante : `feature/orchestrator-designation` @ `8452333`. Elle n'a **aucun commit propre** par rapport à `develop` ; `develop` n'a qu'1 commit de plus = `40982d4 chore(release): passe la version à 0.3.0`. - Worktree dirty = **73 fichiers trackés modifiés + 2 non suivis** (`crates/application/src/diag.rs`, `.ideai/memory/conversation-rotation-safety-design.md`). - Analyse du diff : il est **massivement mono-thème = chantier orchestrateur/designation** (orchestrat ×164, designation ×47) + nouveau sink de diagnostic `diag.rs` pour le rendez-vous inter-agents. Les autres mots-clés (sandbox, fileguard, ratelimit…) sont du bruit de fichiers de test touchés, pas un 2e chantier. - `main` = `29232dd` release 0.3.0 (local, non poussé). `develop` = `40982d4`. ## Audit des branches existantes (vs develop) - `feature/agent-session-limits` → **intégrée dans develop, supprimable** (cohérent avec la mémoire « feature terminée et mergée »). - `feature/agent-skills` → 1 commit non intégré. - `feature/agent-skill-awareness` → 5 commits non intégrés (inclut la lignée skill-awareness + le fix cold-start). - `fix/cold-start-delivery-race` → 3 commits non intégrés (sous-ensemble probable de skill-awareness). ## Ma décision **1. Le worktree dirty est DÉJÀ sur la bonne branche. On n'y touche pas, on ne stashe pas, on ne switche pas.** Ce WIP EST le chantier orchestrateur-designation en cours. Le déplacer ou ouvrir une autre branche par-dessus mélangerait/perdrait ~73 fichiers. Tant qu'il n'est pas figé, `feature/orchestrator-designation` est verrouillée sur ce chantier. **2. Premier chantier logique = FINIR celui-ci (orchestrateur : diag sink + designation), pas en ouvrir un nouveau.** Raison Git : on ne peut pas créer proprement une nouvelle `feature/*` depuis `develop` avec autant de non-commité sur le worktree. Le chemin critique est donc : - Dev finalise sur `feature/orchestrator-designation` → QA verte → **je commit** (commits atomiques : je sépare le code source `crates/` des fichiers runtime `.ideai/*` et de `CLAUDE.md`, qui partent dans un commit `chore` distinct). - Puis **rebase trivial** de la branche sur `develop` (un seul commit d'écart, le bump 0.3.0, aucun conflit attendu) et **merge `--no-ff` → develop**. - Ensuite seulement `develop` redevient une base propre pour la suite. **3. Pour Main, tout de suite :** travaille le **premier chantier sur `feature/orchestrator-designation`** (branche courante, ne rien changer). Confie à Architect le cadrage du périmètre exact « orchestrateur-designation + diag », puis Dev/QA. Quand c'est vert, reviens vers moi pour commit + merge. **4. Ensuite (une fois develop à jour) :** chaque chantier restant indépendant = **une `feature/* dédiée créée depuis develop`** — donc plusieurs branches, une par sujet (persistance conversationnelle, handoff cross-profile, live-state partagé, refresh mémoire/contexte à chaud, UX délégations, resync doc archi). Je créerai chacune au moment où Main me l'annoncera, jamais toutes d'avance. **5. Nettoyage que je propose AVANT d'ouvrir de nouvelles branches** (pour éviter la prolifération) : supprimer `feature/agent-session-limits` (intégrée). Et statuer avec toi sur `feature/agent-skills` / `feature/agent-skill-awareness` / `fix/cold-start-delivery-race` : soit on les intègre dans develop via le cycle (si vivantes et vertes), soit on les abandonne. Dis-moi le sort de chacune ; je n'efface rien sans ton feu vert. Aucune action sortante effectuée. Aucun push, aucun tag, aucune suppression de branche pour l'instant.
|
||||
- **Prompt:** Retour Git pour fermeture du chantier `orchestrator-designation`. Contexte: - Branche courante: `feature/orchestrator-designation`. - Ta décision initiale: finir ce WIP sur cette branche, puis commit atomique(s), rebase/merge local vers develop si tests verts ou résidu qualifié. - Ne push pas. Aucune action sortante. Travail réalisé: - DevBackend a corrigé `crates/application/src/orchestrator/context_guard.rs` pour compiler avec le nouveau modèle `AgentManifest { version, entries, orchestrator }` et `may_write_directly(..., &OrchestratorDesignation)`. - Main a écrit des checkpoints mémoire: `checkpoint-orchestrator-designation-restart`, `checkpoint-orchestrator-designation-backend-compile-fix`, `checkpoint-orchestrator-designation-qa-verdict`. Validation QA: Commandes vertes: - `cargo fmt --all -- --check`: OK. - `cargo test -p application --test orchestrator_service`: OK, 45 passed. - `cargo test -p application`: OK, suite application complète verte. - `cargo test -p infrastructure input --lib`: OK, 35 passed. - `cd frontend && npx vitest run`: OK, 41 files / 384 tests passed. - `cd frontend && npx tsc --noEmit`: OK. Résidu: - `cargo test -p app-tauri --lib` et `cargo test --workspace` restent rouges uniquement sur 8 tests app-tauri qui bindent un vrai Unix socket (`mcp_bridge` loopback + `state::mcp_e2e_loopback_tests`). - QA qualifie comme contrainte sandbox/environnement: même une sonde Node minimale échoue à `listen()` sur Unix socket avec `EPERM` sous `/run/user/1000` et `/tmp`. Ta mission: 1. Inspecte le diff/status actuel. 2. Crée les commits atomiques appropriés. Attention: le worktree contient aussi des fichiers runtime `.ideai/*`, `CLAUDE.md`, mémoire/checkpoints; décide quoi committer, quoi laisser non committé, quoi inclure dans un commit séparé si c'est pertinent. 3. Décide et exécute le merge local éventuel vers `develop` si tu juges le chantier terminé selon QA. 4. Rends compte clairement: commits créés (hash + message), merge/rebase effectué ou non, branche finale, fichiers laissés dirty, et prochaine recommandation. Réponds via `idea_reply`.
|
||||
- **Response:** Chantier `orchestrator-designation` clôturé et intégré dans `develop`. Tout est local, aucune action sortante. ## Commits créés (4 atomiques, sur feature/orchestrator-designation puis rebasés sur develop) - `287681c` **feat(orchestrator)** : modèle de désignation (AgentManifest { version, entries, orchestrator } + may_write_directly(&OrchestratorDesignation)) câblé domain→application→infrastructure→app-tauri, + nouveau `crates/application/src/diag.rs` (sink de diagnostic best-effort du rendez-vous inter-agents). → tout `crates/`. - `e462136` **feat(terminals)** : durcissement du portail d'écriture de délégation (writes UTF-8 chunkés 512 o / 8 ms, réconciliation `frontAttachedAgentRef`) + tests vitest. → `frontend/`. - `09f5362` **docs** : resynchronisation de `CLAUDE.md` (rôle, méthode, cycle, vision). - `5ef001e` **chore(wip)** : état runtime `.ideai/` (agents, layouts, permissions, conversations, MEMORY.md) + les 3 checkpoints mémoire que tu as écrits + note conversation-rotation-safety-design. Découpage : code de feature / frontend / doc / runtime strictement séparés, conformément à ma règle d'atomicité. ## Rebase + merge - **Rebase** de la branche sur `develop` (qui portait le bump 0.3.0) : trivial, aucun conflit (aucun fichier en commun avec le bump). Historique linéaire. - **Merge `--no-ff`** dans `develop` : `55d887f merge(orchestrator): intègre le chantier orchestrator-designation dans develop`. 78 fichiers, +2410/−882. - **Branche `feature/orchestrator-designation` supprimée** (entièrement mergée). ## État final - Branche courante : **`develop`** @ `55d887f` (en avance de 8 sur `origin/develop`, non poussé). - `main` inchangé @ `29232dd` (release 0.3.0, non poussé). - Worktree : **propre (0 fichier dirty)**. - Rien laissé dirty. ## Jugement sur le « rouge » résiduel J'ai mergé **malgré les 8 tests app-tauri rouges** parce que QA les a qualifiés comme **contrainte d'environnement, pas défaut de code** : ils bindent un vrai socket Unix et échouent en `EPERM`, reproduit même avec une sonde Node minimale sous `/run/user/1000` et `/tmp`. Tout le reste est vert (application complète, orchestrator_service 45, infra input 35, vitest 384, tsc). La règle d'or « pas de merge d'une feature rouge » vise les défauts de feature ; ici le code est validé, la sandbox bloque juste le binding socket. **Recommandation** : rejouer `cargo test -p app-tauri --lib` (les 8 e2e socket : mcp_bridge loopback + state::mcp_e2e_loopback_tests) hors sandbox (host réel / AppImage) avant toute release, pour lever ce résidu. ## Prochaine recommandation `develop` est de nouveau une base propre. Pour le chantier suivant, dis-moi le sujet : je créerai une `feature/* dédiée depuis develop`. Avant d'en ouvrir de nouvelles, je rappelle le ménage de branches en attente de ta décision : - `feature/agent-session-limits` : intégrée → je peux la supprimer. - `feature/agent-skills` (1 commit), `feature/agent-skill-awareness` (5 commits), `fix/cold-start-delivery-race` (3 commits) : non intégrées — à passer par le cycle (Architect→Dev→QA) pour merge dans develop, ou à abandonner. Indique-moi le sort de chacune ; je n'efface rien sans ton feu vert.
|
||||
- **Prompt:** Etat après rebuild AppImage du chantier `orchestrator-designation`. Contexte: - Tu as intégré `orchestrator-designation` dans `develop` (`55d887f`) et supprimé la branche feature. - Main a reconstruit l'AppImage localement. - Artefact produit: `/home/anthony/Documents/Projects/IdeA/target/release/bundle/appimage/IdeA_0.3.0_amd64.AppImage`. - La commande Tauri a échoué sur `linuxdeploy`, puis Main a contourné avec `appimagetool --runtime-file` extrait de `/home/anthony/Documents/IdeA_0.2.0_amd64.AppImage`. Checkpoint mémoire écrit: `checkpoint-orchestrator-designation-appimage-build`. Etat git observé après build: ```text ## develop...origin/develop [ahead 8] M .ideai/conversations/6bc594e8-a37c-0dbd-1de6-6e3b73002cb4/handoff.md M .ideai/conversations/6bc594e8-a37c-0dbd-1de6-6e3b73002cb4/log.jsonl M .ideai/layouts.json ``` Ta mission Git: 1. Inspecte ces modifications runtime. 2. Décide quoi faire pour revenir à une base propre avant le prochain chantier: commit runtime, laisser dirty, ou autre action non destructive appropriée. 3. Ne push pas. Ne supprime rien sans raison solide. Ne touche pas aux artefacts build si hors git. 4. Rends compte: décision, action, branche finale, status final. Réponds via `idea_reply`.
|
||||
- **Response:** Base remise au propre après le rebuild AppImage. Aucune action sortante, aucune suppression. ## Inspection Les modifications observées (3 affichées + 2 autres détectées) sont **100 % de l'état runtime/mémoire `.ideai/`**, zéro ligne de code source : - `.ideai/conversations/6bc594e8…/handoff.md` + `log.jsonl` : dérive de conversation. - `.ideai/layouts.json` : état de layout UI. - `.ideai/memory/MEMORY.md` : +1 ligne d'index. - `.ideai/memory/checkpoint-orchestrator-designation-appimage-build.md` (non suivi) : ton checkpoint de build. Vérifié : l'artefact `target/release/bundle/appimage/IdeA_0.3.0_amd64.AppImage` est **git-ignored (hors git)** → je n'y touche pas, comme demandé. ## Décision & action Pur runtime → **un seul commit `chore(wip)` sur `develop`**, directement (ce n'est pas une feature, pas de cycle Architect→Dev→QA requis), pour repartir d'une base propre sans rien laisser dirty ni perdre ton checkpoint : - `9c71a5b` **chore(wip): état runtime .ideai post-build AppImage 0.3.0** (conversation 6bc594e8 handoff+log, layouts, checkpoint de build + son index MEMORY.md). ## État final - Branche courante : **`develop`** @ `9c71a5b` (en avance de 9 sur `origin/develop`, non poussé). - `main` inchangé @ `29232dd`. - Worktree : **propre (0 dirty)**. `develop` est de nouveau une base saine pour le prochain chantier. Quand tu me l'annonces, je crée une `feature/* dédiée depuis develop`. Rappel : décision toujours en attente sur le ménage des branches `feature/agent-session-limits` (intégrée, supprimable), `feature/agent-skills`, `feature/agent-skill-awareness`, `fix/cold-start-delivery-race`.
|
||||
@ -23,4 +21,6 @@ objective: Nouvelle feature cadrée par Architect, prête à démarrer le dével
|
||||
- **Response:** Inventaire repo après merge `agent-skill-awareness-v2` → `develop` (`63eb49a`). **Aucune suppression / commit / merge fait** (lecture seule). Méthode : `git cherry` (patch-id) **+** vérification du contenu réel dans `develop`, car les branches sont anciennes et leurs patches ont été re-landés différemment (les patch-ids diffèrent même quand le contenu est présent). ## Statut par branche **`feature/agent-skill-awareness-v2`** — ✅ INTÉGRÉE (mergée à l'instant, `63eb49a`). Conserver tant que reprise possible, sinon supprimable. **`feature/agent-skill-awareness` (v1)** — 🟠 SUPERSEDED par v2. Ses commits uniques portent une **autre approche** : outil MCP `idea_skill_read` + manifeste de skills + brief « capacités IdeA » inconditionnel (`ab34363`, `566bff4`, `1a10d67`). Vérif : `idea_skill_read` **absent de develop** → v2 a délibérément retenu une autre voie (injection des corps de skills dans le fichier de convention + paragraphe d'awareness via `lifecycle.rs`). Son fix cold-start (`e93a2c1`) est déjà couvert par develop. ⇒ rien à récupérer sauf si tu veux ressusciter l'approche `idea_skill_read` (non recommandé, v2 a tranché). **À archiver/supprimer.** **`feature/agent-skills` (L12, `ef101db`)** — 🟢 INTÉGRÉE PAR ÉQUIVALENT. Le domaine skills est présent dans develop : `crates/domain/src/skill.rs`, `crates/application/src/skill/{mod,usecases}.rs`, `crates/infrastructure/src/store/skill.rs` (+ tests). Re-landé via un autre chemin. **Superseded en tant que branche.** **`fix/cold-start-delivery-race` (`9590eac`)** — 🟢 INTÉGRÉE PAR ÉQUIVALENT. La logique cold-start (`release_cold_start`, gate armé) est dans develop : `crates/infrastructure/src/input/mod.rs:341,895`. La branche traîne en plus de vieux `release(0.1.0)/(0.2.0)` → elle a divergé d'un vieux `main`. **Stale, supprimable.** **`origin/feature/agent-session-limits` (`3f3504e`)** — 🟢 MERGÉE (ancêtre de develop). Branche distante stale ; le feature session-limits est dans develop. **`origin/wip/p8c-checkpoint-before-codex`** — branche distante WIP fondations enforcement OS (permissions), non rattachée localement ; à clarifier si encore vivante (probablement absorbée par le chantier permissions/sandbox déjà livré en code). ## État publication (local-only, conforme « pas de push ») - `develop` : **ahead origin/develop de 15** (contient tout ce qui précède). - `main` : **ahead origin/main de 4** = `release(0.3.0)` mergée localement, jamais poussée. origin/main = encore 0.2.0. ## Chantiers applicatifs réellement restants (vs branches mortes) Les 4 branches non-mergées ne portent **aucun chantier vivant** : tout est soit intégré, soit superseded. Le travail restant est ailleurs (cf. mémoire projet, pas dans des branches) : 1. **Validation e2e réelle sur AppImage** — nombreux items « ✓ RÉSOLU EN CODE … valid. e2e restante » (socket MCP, MCP inter-agents au restart, MCP natif en structuré, modèle terminal natif). Bloqueur connu : `checkpoint-blocked-until-appimage-030` / blocage build AppImage 0.3.0. 2. **Enforcement permissions/sandbox** : résiduel `$HOME`/résume du chemin structuré (memory `permissions-sandbox-system-state`). 3. Optionnels persistance : P9 FileGuard, P10 résumé LLM. ## Stratégie repo recommandée avant le prochain chantier - **Nettoyage différé** (sur ton GO, étape suivante) : supprimer en local `feature/agent-skill-awareness`, `feature/agent-skills`, `fix/cold-start-delivery-race` (toutes superseded/intégrées) ; idem branches distantes stale `origin/feature/agent-session-limits` (suppression distante = action sortante → validation explicite requise). - **Prochaine branche** : repartir **de `develop`** (`63eb49a`) avec un `feature/<sujet>` neuf pour le prochain chantier (probablement la **validation e2e AppImage 0.3.0**, qui est le vrai bloqueur courant). - **Push** : `develop` (+15) et `main` (+4 / release 0.3.0) attendent une validation explicite avant publication — je ne pousse rien sans ton accord. Dis-moi quel chantier on reprend : je crée la branche adéquate depuis `develop`.
|
||||
- **Prompt:** Démarrage du prochain chantier applicatif recommandé par Architect: `UX conversations/délégations + read-model live-state minimal`. Branche courante attendue `develop` à `63eb49a`, mais des fichiers runtime `.ideai/conversations/6bc594e8...` peuvent être dirty à cause du live. Merci de décider et exécuter la gestion repo locale avant implémentation: créer/basculer sur une branche de feature depuis develop, gérer proprement le dirty runtime sans perdre de données, et retourner branche courante + état. Ne supprime pas les branches obsolètes pour l'instant, ne push pas.
|
||||
- **Response:** Gestion repo locale faite pour démarrer le chantier « UX conversations/délégations + read-model live-state minimal ». ## Décisions & exécution 1. **Dirty runtime géré sans perte** : 4 fichiers `.ideai/conversations/*` (handoff + log.jsonl, flux live append-only) étaient modifiés sur `develop`. Je les ai **committés sur develop** (leur place naturelle, develop accumule déjà l'état runtime) plutôt que de les stash/jeter → zéro perte. - `338051e` — chore(wip): état runtime .ideai (flux conversation live) 2. **Nouvelle branche de feature créée depuis un `develop` propre** : - `git checkout -b feature/conversation-ux-live-state` (depuis `develop` @ `338051e`). - Nom dérivé du sujet Architect (kebab-case). ## État final - **Branche courante : `feature/conversation-ux-live-state`** (tip `338051e`). - Base : `develop` (`338051e` = `63eb49a` + le chore runtime), historique linéaire, prête pour l'implémentation. - Working tree : propre au moment de la bascule (le flux live peut le re-salir, c'est attendu ; je re-figerai au moment de committer le code de la feature en séparant code / runtime). - `develop` désormais ahead origin/develop de **16** (local only). Aucune branche obsolète supprimée. **Aucun push.** DevBackend/DevFrontend peuvent implémenter sur `feature/conversation-ux-live-state`. Reviens vers moi à l'implémentation terminée (tests verts) pour les commits atomiques et la décision de merge.
|
||||
- **Prompt:** Reprise après interruption utilisateur. On démarre maintenant l'implémentation du chantier `UX conversations/délégations + read-model live-state minimal`. Vérifie l'état repo actuel, décide et applique la stratégie locale: partir de `develop`, créer/basculer sur une branche feature appropriée, gérer proprement les éventuels fichiers runtime `.ideai/*` dirty sans perte, ne pas push, ne pas supprimer les branches obsolètes. Retourne branche courante + état final. Si l'appel précédent a partiellement fait quelque chose, tiens-en compte.
|
||||
- **Prompt:** Reprise après interruption utilisateur. On démarre maintenant l'implémentation du chantier `UX conversations/délégations + read-model live-state minimal`. Vérifie l'état repo actuel, décide et applique la stratégie locale: partir de `develop`, créer/basculer sur une branche feature appropriée, gérer proprement les éventuels fichiers runtime `.ideai/*` dirty sans perte, ne pas push, ne pas supprimer les branches obsolètes. Retourne branche courante + état final. Si l'appel précédent a partiellement fait quelque chose, tiens-en compte.
|
||||
- **Response:** État repo vérifié et stratégie locale appliquée — en tenant compte du travail partiel du ticket précédent. ## Constat (travail antérieur pris en compte) - La branche **`feature/conversation-ux-live-state`** existait déjà (créée au ticket précédent depuis `develop`), j'étais dessus. Pas besoin de la recréer. - Elle était à jour sur `develop` (tip commun `338051e`, develop ancêtre). - Seul dirty : 1 conversation runtime live (`.ideai/conversations/6bc594e8…` handoff + log.jsonl), append-only. ## Actions 1. Runtime live figé **sur `develop`** (sa place : baseline runtime partagée), sans perte : - `6cfa0b0` — chore(wip): état runtime .ideai (flux conversation live). 2. **`feature/conversation-ux-live-state` réalignée** en fast-forward sur `develop` → la feature reste **propre, sans commit runtime parasite**, prête à recevoir le code. ## État final - **Branche courante : `feature/conversation-ux-live-state`** (tip `6cfa0b0`, = `develop`). - Working tree **propre**. - `develop` ahead origin/develop de **17** (local only). Aucune branche obsolète supprimée. **Aucun push.** La branche est prête : DevBackend/DevFrontend peuvent implémenter le chantier « UX conversations/délégations + read-model live-state minimal ». Je reprends la main à l'implémentation terminée (tests verts) pour les commits atomiques (code séparé du runtime) et la décision de merge.
|
||||
- **Prompt:** QA verte pour `feature/conversation-ux-live-state` Lot A, réserve environnementale non bloquante socket Unix. Merci de committer localement de façon atomique puis décider le merge local vers `develop` selon les règles projet. Changements code attendus: Backend/Tauri: `crates/application/src/workstate/`, `crates/application/tests/workstate.rs`, exports terminal/lib, snapshots live, Tauri DTO/command/state/lib/tests. Frontend: domain/ports/adapters/mock/workState, feature workstate, ProjectsView/tests. Runtime dirty `.ideai/*` aussi présent suite aux conversations live. Stratégie demandée: séparer code backend/frontend si pertinent, séparer runtime `.ideai` en chore wip si tu le gardes, ne pas push, ne pas supprimer les branches obsolètes. Après commit, décide toi-même merge ou différer; si merge, fais-le localement. Retourne hashes, messages, fichiers inclus/exclus, branche finale et status.
|
||||
@ -43,3 +43,5 @@
|
||||
{"id":"029988ad-89d3-4a24-8453-f3e0fce922a0","conversation":"6bc594e8-a37c-0dbd-1de6-6e3b73002cb4","atMs":1781946459657,"source":{"kind":"agent","agentId":"a6ced819-b893-4213-b003-9e9dc79b9641"},"role":"prompt","text":"Démarrage du prochain chantier applicatif recommandé par Architect: `UX conversations/délégations + read-model live-state minimal`. Branche courante attendue `develop` à `63eb49a`, mais des fichiers runtime `.ideai/conversations/6bc594e8...` peuvent être dirty à cause du live. Merci de décider et exécuter la gestion repo locale avant implémentation: créer/basculer sur une branche de feature depuis develop, gérer proprement le dirty runtime sans perdre de données, et retourner branche courante + état. Ne supprime pas les branches obsolètes pour l'instant, ne push pas."}
|
||||
{"id":"a047edb0-00f7-44cd-a6e9-f2c1ffe8c828","conversation":"6bc594e8-a37c-0dbd-1de6-6e3b73002cb4","atMs":1781946485791,"source":{"kind":"agent","agentId":"cd0b4cf1-1bef-4fae-ade5-f0a6b49bbaf5"},"role":"response","text":"Gestion repo locale faite pour démarrer le chantier « UX conversations/délégations + read-model live-state minimal ».\n\n## Décisions & exécution\n1. **Dirty runtime géré sans perte** : 4 fichiers `.ideai/conversations/*` (handoff + log.jsonl, flux live append-only) étaient modifiés sur `develop`. Je les ai **committés sur develop** (leur place naturelle, develop accumule déjà l'état runtime) plutôt que de les stash/jeter → zéro perte.\n - `338051e` — chore(wip): état runtime .ideai (flux conversation live)\n2. **Nouvelle branche de feature créée depuis un `develop` propre** :\n - `git checkout -b feature/conversation-ux-live-state` (depuis `develop` @ `338051e`).\n - Nom dérivé du sujet Architect (kebab-case).\n\n## État final\n- **Branche courante : `feature/conversation-ux-live-state`** (tip `338051e`).\n- Base : `develop` (`338051e` = `63eb49a` + le chore runtime), historique linéaire, prête pour l'implémentation.\n- Working tree : propre au moment de la bascule (le flux live peut le re-salir, c'est attendu ; je re-figerai au moment de committer le code de la feature en séparant code / runtime).\n- `develop` désormais ahead origin/develop de **16** (local only). Aucune branche obsolète supprimée. **Aucun push.**\n\nDevBackend/DevFrontend peuvent implémenter sur `feature/conversation-ux-live-state`. Reviens vers moi à l'implémentation terminée (tests verts) pour les commits atomiques et la décision de merge."}
|
||||
{"id":"47deb70a-ada1-42a2-bdae-e23b635cf4e5","conversation":"6bc594e8-a37c-0dbd-1de6-6e3b73002cb4","atMs":1781946599405,"source":{"kind":"agent","agentId":"a6ced819-b893-4213-b003-9e9dc79b9641"},"role":"prompt","text":"Reprise après interruption utilisateur. On démarre maintenant l'implémentation du chantier `UX conversations/délégations + read-model live-state minimal`. Vérifie l'état repo actuel, décide et applique la stratégie locale: partir de `develop`, créer/basculer sur une branche feature appropriée, gérer proprement les éventuels fichiers runtime `.ideai/*` dirty sans perte, ne pas push, ne pas supprimer les branches obsolètes. Retourne branche courante + état final. Si l'appel précédent a partiellement fait quelque chose, tiens-en compte."}
|
||||
{"id":"e77d94b0-05cd-42f0-9d3f-bb6418e521e7","conversation":"6bc594e8-a37c-0dbd-1de6-6e3b73002cb4","atMs":1781946633041,"source":{"kind":"agent","agentId":"cd0b4cf1-1bef-4fae-ade5-f0a6b49bbaf5"},"role":"response","text":"État repo vérifié et stratégie locale appliquée — en tenant compte du travail partiel du ticket précédent.\n\n## Constat (travail antérieur pris en compte)\n- La branche **`feature/conversation-ux-live-state`** existait déjà (créée au ticket précédent depuis `develop`), j'étais dessus. Pas besoin de la recréer.\n- Elle était à jour sur `develop` (tip commun `338051e`, develop ancêtre).\n- Seul dirty : 1 conversation runtime live (`.ideai/conversations/6bc594e8…` handoff + log.jsonl), append-only.\n\n## Actions\n1. Runtime live figé **sur `develop`** (sa place : baseline runtime partagée), sans perte :\n - `6cfa0b0` — chore(wip): état runtime .ideai (flux conversation live).\n2. **`feature/conversation-ux-live-state` réalignée** en fast-forward sur `develop` → la feature reste **propre, sans commit runtime parasite**, prête à recevoir le code.\n\n## État final\n- **Branche courante : `feature/conversation-ux-live-state`** (tip `6cfa0b0`, = `develop`).\n- Working tree **propre**.\n- `develop` ahead origin/develop de **17** (local only). Aucune branche obsolète supprimée. **Aucun push.**\n\nLa branche est prête : DevBackend/DevFrontend peuvent implémenter le chantier « UX conversations/délégations + read-model live-state minimal ». Je reprends la main à l'implémentation terminée (tests verts) pour les commits atomiques (code séparé du runtime) et la décision de merge."}
|
||||
{"id":"93ed87f6-8dc6-4ff8-85d9-81aa30d30bed","conversation":"6bc594e8-a37c-0dbd-1de6-6e3b73002cb4","atMs":1781971560322,"source":{"kind":"agent","agentId":"a6ced819-b893-4213-b003-9e9dc79b9641"},"role":"prompt","text":"QA verte pour `feature/conversation-ux-live-state` Lot A, réserve environnementale non bloquante socket Unix. Merci de committer localement de façon atomique puis décider le merge local vers `develop` selon les règles projet.\n\nChangements code attendus:\nBackend/Tauri: `crates/application/src/workstate/`, `crates/application/tests/workstate.rs`, exports terminal/lib, snapshots live, Tauri DTO/command/state/lib/tests.\nFrontend: domain/ports/adapters/mock/workState, feature workstate, ProjectsView/tests.\nRuntime dirty `.ideai/*` aussi présent suite aux conversations live.\n\nStratégie demandée: séparer code backend/frontend si pertinent, séparer runtime `.ideai` en chore wip si tu le gardes, ne pas push, ne pas supprimer les branches obsolètes. Après commit, décide toi-même merge ou différer; si merge, fais-le localement. Retourne hashes, messages, fichiers inclus/exclus, branche finale et status."}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -67,3 +67,5 @@
|
||||
{"id":"812e96b5-8340-48c7-bbff-a0466d84eacd","conversation":"d5068bc8-786e-0428-1d14-83b93961a15e","atMs":1781945488377,"source":{"kind":"agent","agentId":"73c853d1-c0fd-463b-ad17-1d24fefa371f"},"role":"response","text":"Implémentation MVP `agent-skill-awareness-v2` faite, sans commit.\n\nFichier code modifié :\n- `crates/application/src/agent/lifecycle.rs`\n\nChangements :\n- Ajout d’un helper pur `skill_awareness(mcp_enabled)` injecté dans `compose_convention_file(...)` dans le bloc orchestration/awareness, avant `# Contexte projet`, persona, skills, mémoire et handoff.\n- Awareness toujours présente à l’activation, sans ouvrir de section `# Skills` quand aucun skill n’est assigné.\n- Variante MCP : mention de `idea_create_skill`.\n- Variante fichier : mention du protocole `skill.create`.\n- Les bodies des skills assignés restent injectés sous `# Skills`, dans l’ordre existant fourni par l’appelant.\n- Aucun port/DTO/store/frontend ajouté ou modifié.\n\nTests/format exécutés :\n- `cargo test -p application compose_convention_file --no-fail-fast` : OK, 15 passed.\n- `cargo fmt -p application` : OK.\n- `cargo test -p application` : OK, toute la crate application verte. Seule alerte observée, préexistante/non liée : `method writes is never used` dans `crates/application/tests/orchestrator_service.rs:1642`.\n\nValidation QA : vert. QA a relu le diff ciblé et réexécuté :\n- `cargo test -p application compose_convention_file --no-fail-fast` : OK.\n- `cargo test -p application` : OK.\n\nNote état repo : `git status` contient d’autres fichiers déjà modifiés/non liés au périmètre (`.ideai/*`, app-tauri, infrastructure, frontend, etc.). Je ne les ai pas revert ni intégrés au changement backend demandé."}
|
||||
{"id":"e9caa4cd-a4ca-4aef-9ecb-74be3a95df26","conversation":"d5068bc8-786e-0428-1d14-83b93961a15e","atMs":1781945649980,"source":{"kind":"agent","agentId":"a6ced819-b893-4213-b003-9e9dc79b9641"},"role":"prompt","text":"QA bloque sur `cargo test -p app-tauri --test orchestrator_wiring`: 4 tests loopback socket échouent car socket `/run/user/1000/idea-mcp/<project>.sock` non bindé. Compléments QA: `cargo test -p app-tauri bind_endpoint -- --nocapture` échoue avec `PermissionDenied` sur `lay corpse socket`; `cargo test -p app-tauri mcp_e2e_loopback_tests -- --nocapture` échoue car `bind_endpoint returned None`. Merci de diagnostiquer si c'est une contrainte d'environnement/sandbox ou une régression code liée aux changements récents. Si correction applicative/test nécessaire, implémente-la sans toucher aux fichiers runtime `.ideai`. Sinon, fournis une justification précise et une commande de vérification alternative. Ne committe pas."}
|
||||
{"id":"00aa406e-b715-4f9b-9978-f52b9a37e27f","conversation":"d5068bc8-786e-0428-1d14-83b93961a15e","atMs":1781945759965,"source":{"kind":"agent","agentId":"73c853d1-c0fd-463b-ad17-1d24fefa371f"},"role":"response","text":"Diagnostic : blocage environnement/sandbox, pas régression applicative liée au MVP `agent-skill-awareness-v2` ni aux changements récents.\n\nConstats :\n- `cargo test -p app-tauri bind_endpoint -- --nocapture` échoue exactement comme QA : `lay corpse socket: Os { code: 1, kind: PermissionDenied, message: \"Operation not permitted\" }` sur `std::os::unix::net::UnixListener::bind`.\n- `cargo test -p app-tauri mcp_e2e_loopback_tests -- --nocapture` échoue car `bind_endpoint` retourne `None` pour `/run/user/1000/idea-mcp/<project>.sock`.\n- Même en forçant `XDG_RUNTIME_DIR=/tmp`, les tests loopback échouent : `bind_endpoint returned None for \"/tmp/idea-mcp/<project>.sock\"`.\n- Smoke test Rust minimal hors repo, compilé dans `/tmp`, confirme que le sandbox interdit `AF_UNIX` path sockets partout :\n - `/tmp/idea-socket-smoke-*.sock` => `PermissionDenied / Operation not permitted`\n - `/run/user/1000/idea-socket-smoke-*.sock` => `PermissionDenied / Operation not permitted`\n\nInterprétation :\n- Les tests qui échouent nécessitent un vrai listener Unix domain socket. L’échec se produit avant la logique IdeA, au niveau syscall de bind socket.\n- Le code récent `agent-skill-awareness-v2` ne touche pas `app-tauri`, `state.rs`, `mcp_endpoint.rs`, `mcp_bridge.rs`, ni la dérivation/binding des endpoints.\n- `mcp_endpoint` choisit correctement `$XDG_RUNTIME_DIR` puis `/tmp`; le fait que `/tmp` échoue aussi exclut un simple problème de permissions de `/run/user/1000`.\n\nCommandes de vérification exécutées :\n- `cargo test -p app-tauri bind_endpoint -- --nocapture` => échoue `PermissionDenied`, reproduit QA.\n- `cargo test -p app-tauri mcp_e2e_loopback_tests -- --nocapture` => échoue `bind_endpoint returned None`, reproduit QA.\n- `XDG_RUNTIME_DIR=/tmp cargo test -p app-tauri bind_endpoint -- --nocapture` => échoue aussi `PermissionDenied`.\n- `XDG_RUNTIME_DIR=/tmp cargo test -p app-tauri mcp_e2e_loopback_tests -- --nocapture` => échoue aussi `bind_endpoint returned None`.\n- Smoke Rust minimal avec `UnixListener::bind` dans `/tmp` et `/run/user/1000` => échoue `PermissionDenied` dans les deux cas.\n\nCommandes alternatives vertes dans ce sandbox, en excluant uniquement les tests qui nécessitent un vrai socket Unix :\n```text\ncargo test -p app-tauri --test orchestrator_wiring -- --skip open_binds_the_project_loopback_endpoint --skip double_open_keeps_a_single_endpoint_no_address_in_use --skip close_cleans_up_the_endpoint_socket_file --skip file_watcher_and_loopback_endpoint_live_together\n```\nRésultat : OK, 9 passed, 4 filtered out.\n\n```text\ncargo test -p app-tauri --lib -- --skip state::mcp_e2e_loopback_tests --skip state::bind_endpoint_d1_tests --skip mcp_bridge::tests::end_to_end_over_real_loopback\n```\nRésultat : OK, 39 passed, 8 filtered out.\n\nAucune correction code/test appliquée. Je n’ai pas touché aux fichiers runtime `.ideai`."}
|
||||
{"id":"bd1d1082-e11d-4754-a83f-ba89233b25e4","conversation":"d5068bc8-786e-0428-1d14-83b93961a15e","atMs":1781946742079,"source":{"kind":"agent","agentId":"a6ced819-b893-4213-b003-9e9dc79b9641"},"role":"prompt","text":"Implémente le Lot A backend/Tauri du chantier `UX conversations/délégations + read-model live-state minimal` sur la branche `feature/conversation-ux-live-state`. Respecte le cadrage Architect: read-only, sans nouvelle persistance durable, pas de lecture log/handoff, pas de FIFO complète.\n\nObjectif backend:\n- Ajouter un read-model `ProjectWorkState` qui liste les agents du manifeste avec leur état live et busy.\n- Agréger depuis les stores/registres existants: manifeste agents via context store, `LiveSessions`/registries existants, `InputMediator::busy_state`.\n- Conserver l'ordre manifeste.\n- Ignorer les agents live absents du manifeste.\n- Exposer une commande Tauri `get_project_work_state(projectId)`.\n\nContrats recommandés par Architect:\n- `ProjectWorkState { agents: Vec<AgentWorkState> }`\n- `AgentWorkState { agent_id, name, profile_id, live: Option<LiveWorkSession>, busy }`\n- `LiveWorkSession { node_id, session_id, kind: Pty|Structured }` si raisonnable; sinon explique pourquoi tu omets `kind`.\n- Busy DTO camelCase/tag `state`: `idle` ou `busy { ticket, sinceMs }` selon les types existants.\n\nFichiers probables: `crates/application/src/workstate/mod.rs`, `crates/application/src/lib.rs`, peut-être `crates/application/src/terminal/registry.rs`; Tauri `dto.rs`, `commands.rs`, `state.rs`, `lib.rs`.\n\nTests attendus:\n- tests application `workstate`: aucun live/busy; live PTY ou structured; busy; agent live hors manifeste ignoré.\n- tests DTO/commande si conventions existantes.\n- Exécute au minimum `cargo test -p application workstate`, `cargo check -p app-tauri`, et les tests app-tauri pertinents que tu peux lancer dans ce sandbox. Ne committe pas. Réponds avec fichiers modifiés, commandes/résultats, et risques."}
|
||||
{"id":"5d78a64e-ce73-4fca-b62d-7af302dbac90","conversation":"d5068bc8-786e-0428-1d14-83b93961a15e","atMs":1781971233449,"source":{"kind":"agent","agentId":"73c853d1-c0fd-463b-ad17-1d24fefa371f"},"role":"response","text":"Lot A backend/Tauri implémenté sur `feature/conversation-ux-live-state`, sans commit.\n\nFichiers modifiés pour le lot :\n- `crates/application/src/workstate/mod.rs` (nouveau) : read-model `GetProjectWorkState`, `ProjectWorkState`, `AgentWorkState`, `LiveWorkSession`.\n- `crates/application/src/lib.rs` : exports du module workstate et des snapshots live typés.\n- `crates/application/src/terminal/mod.rs` : exports `LiveSessionKind` / `LiveSessionSnapshot`.\n- `crates/application/src/terminal/registry.rs` : ajout de `LiveSessionKind`, `LiveSessionSnapshot`, `LiveSessions::live_agent_snapshots()` ; `live_agents()` existant inchangé.\n- `crates/application/tests/workstate.rs` (nouveau) : tests du read-model.\n- `crates/app-tauri/src/state.rs` : construction/câblage du use case dans `AppState` avec `AgentContextStore`, `LiveSessions`, `InputMediator`.\n- `crates/app-tauri/src/commands.rs` : commande `get_project_work_state(projectId)`.\n- `crates/app-tauri/src/dto.rs` : DTO `ProjectWorkStateDto`, `AgentWorkStateDto`, `LiveWorkSessionDto`, `LiveWorkSessionKindDto` ; `busy` réutilise `domain::AgentBusyState` (`state: idle|busy`, `sinceMs`).\n- `crates/app-tauri/src/lib.rs` : enregistrement Tauri command.\n- `crates/app-tauri/tests/dto_agents.rs` : test DTO camelCase/live/busy.\n\nComportement :\n- Read-only, aucune nouvelle persistance durable.\n- Aucune lecture log/handoff, aucune FIFO complète exposée.\n- Agents listés dans l’ordre du manifeste.\n- Agents live absents du manifeste ignorés.\n- Live session expose `nodeId`, `sessionId`, `kind: pty|structured`.\n\nCommandes exécutées côté DevBackend :\n- `cargo fmt -p application -p app-tauri` : OK.\n- `cargo test -p application workstate` : OK, 5 tests workstate passés.\n- `cargo check -p app-tauri` : OK.\n- `cargo test -p app-tauri --test dto_agents project_work_state -- --nocapture` : OK, 1 passed.\n- `cargo test -p app-tauri --test dto_agents` : OK, 19 passed.\n- `cargo test -p app-tauri --test list_live_agents_r0b` : OK, 5 passed.\n- `cargo test -p app-tauri --lib -- --skip state::mcp_e2e_loopback_tests --skip state::bind_endpoint_d1_tests --skip mcp_bridge::tests::end_to_end_over_real_loopback` : OK, 39 passed, 8 filtered out.\n- `cargo test -p application` : OK, application complète verte. Warning existant/non lié : `CapturingFs::writes` unused dans `crates/application/tests/orchestrator_service.rs:1642`.\n\nValidation QA : vert. QA a relu le périmètre, confirmé read-only / ordre manifeste / absence log-handoff-persistance, et réexécuté les commandes clés avec succès. Même réserve non bloquante que précédemment : les 8 tests app-tauri filtrés exigent un vrai socket Unix loopback, bloqué dans ce sandbox par `UnixListener::bind` `PermissionDenied`; à exécuter hors sandbox permissif socket Unix.\n\nRisques / notes :\n- `kind` est inclus car l’agrégateur sait distinguer PTY vs structured via les deux registres.\n- Le read-model retourne un instantané live/busy au moment de l’appel ; pas de garantie transactionnelle entre registre live et busy state, ce qui est cohérent avec un read-model live minimal.\n- `git status` montre aussi des fichiers `.ideai/*` runtime modifiés par l’orchestration/conversation ; je ne les ai pas édités pour ce lot et ils ne font pas partie du livrable."}
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
---
|
||||
upTo: 49eb022e-28c5-4704-a629-9a28aa8901ea
|
||||
upTo: 8c1fcc3e-1c86-4732-b2eb-993ecb4a6f77
|
||||
objective: Ping de test inter-agent depuis DevBackend — réponds avec un court PONG et l'heure que tu vois.
|
||||
---
|
||||
**Objectif :** Ping de test inter-agent depuis DevBackend — réponds avec un court PONG et l'heure que tu vois.
|
||||
|
||||
- **Prompt:** Ping de test inter-agent depuis DevBackend — réponds avec un court PONG et l'heure que tu vois.
|
||||
- **Prompt:** Validation ciblée du MVP `agent-skill-awareness-v2` côté application Rust. Périmètre modifié: uniquement `crates/application/src/agent/lifecycle.rs`, dans `compose_convention_file(...)` + helper pur `skill_awareness`. Changement: injection d'un paragraphe `**Skills IdeA**` dans le bloc orchestration/awareness à chaque activation, avant contexte projet/persona; variante MCP mentionne `idea_create_skill`, variante non-MCP mentionne protocole fichier `skill.create`; aucun `# Skills` section ajouté quand aucun skill assigné; bodies de skills assignés restent sous `# Skills` dans l'ordre existant. Tests ajoutés/ajustés dans les tests unitaires internes de `lifecycle.rs`: awareness présente sans section Skills, awareness avant contexte projet/persona, bodies sous `# Skills` dans l'ordre, variantes MCP/fichier. Commandes déjà exécutées par DevBackend: - `cargo test -p application compose_convention_file --no-fail-fast` => 15 tests passés - `cargo fmt -p application` => OK - `cargo test -p application` => OK, 43 unit + tous tests intégration application + doctests, seule alerte existante `method writes is never used` dans `tests/orchestrator_service.rs`. Merci de relire/exécuter ce que tu juges nécessaire et répondre verdict QA: vert ou corrections requises.
|
||||
- **Response:** Verdict QA : vert. Relu le diff ciblé de `crates/application/src/agent/lifecycle.rs` : l’injection `**Skills IdeA**` est placée dans le bloc orchestration avant le contexte projet/persona, les variantes MCP/fichier pointent respectivement vers `idea_create_skill` et `skill.create`, aucun `# Skills` n’est ouvert sans skill assigné, et les bodies assignés restent sous `# Skills` dans l’ordre. Commandes exécutées : ```text cargo test -p application compose_convention_file --no-fail-fast ``` Sortie pertinente : ```text running 15 tests ... test result: ok. 15 passed; 0 failed; 0 ignored; 0 measured; 28 filtered out; finished in 0.00s ``` Alerte existante observée : ```text warning: method `writes` is never used --> crates/application/tests/orchestrator_service.rs:1642:8 ``` Commande de régression crate : ```text cargo test -p application ``` Sortie pertinente : ```text running 43 tests ... test result: ok. 43 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.10s ... Doc-tests application running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s ``` Tous les tests d’intégration `application` listés dans la suite sont passés également. Aucune correction requise pour ce MVP.
|
||||
- **Response:** Verdict QA : vert. Relu le diff ciblé de `crates/application/src/agent/lifecycle.rs` : l’injection `**Skills IdeA**` est placée dans le bloc orchestration avant le contexte projet/persona, les variantes MCP/fichier pointent respectivement vers `idea_create_skill` et `skill.create`, aucun `# Skills` n’est ouvert sans skill assigné, et les bodies assignés restent sous `# Skills` dans l’ordre. Commandes exécutées : ```text cargo test -p application compose_convention_file --no-fail-fast ``` Sortie pertinente : ```text running 15 tests ... test result: ok. 15 passed; 0 failed; 0 ignored; 0 measured; 28 filtered out; finished in 0.00s ``` Alerte existante observée : ```text warning: method `writes` is never used --> crates/application/tests/orchestrator_service.rs:1642:8 ``` Commande de régression crate : ```text cargo test -p application ``` Sortie pertinente : ```text running 43 tests ... test result: ok. 43 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.10s ... Doc-tests application running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s ``` Tous les tests d’intégration `application` listés dans la suite sont passés également. Aucune correction requise pour ce MVP.
|
||||
- **Prompt:** Validation QA ciblée du Lot A backend/Tauri `UX conversations/délégations + read-model live-state minimal` sur branche `feature/conversation-ux-live-state`. Implémentation résumée : - Application : nouveau module `crates/application/src/workstate/mod.rs` avec `GetProjectWorkState`, `ProjectWorkState`, `AgentWorkState`, `LiveWorkSession`. - Agrégation read-only depuis manifest `AgentContextStore::load_manifest`, `LiveSessions::live_agent_snapshots()` et `InputMediator::busy_state`. - Ordre manifeste conservé, agents live absents du manifeste ignorés, pas de lecture log/handoff, pas de nouvelle persistance. - `crates/application/src/terminal/registry.rs` expose `LiveSessionKind` + `LiveSessionSnapshot` via un snapshot typé, sans changer `live_agents()` existant. - Tauri : `get_project_work_state(projectId)` ajouté dans `commands.rs`, enregistré dans `lib.rs`, câblé dans `state.rs`. - DTO : `ProjectWorkStateDto`, `AgentWorkStateDto`, `LiveWorkSessionDto`, `LiveWorkSessionKindDto`; `busy` réutilise `domain::AgentBusyState` sérialisé avec tag `state` (`idle` / `busy { ticket, sinceMs }`). Tests ajoutés : - `crates/application/tests/workstate.rs` : aucun live/busy, live PTY, live structured, busy, live hors manifeste ignoré. - `crates/app-tauri/tests/dto_agents.rs` : sérialisation camelCase du read-model, `live.kind`, `busy.state`, `sinceMs`. Commandes déjà exécutées : - `cargo fmt -p application -p app-tauri` OK - `cargo test -p application workstate` OK (5 tests workstate passés) - `cargo check -p app-tauri` OK - `cargo test -p app-tauri --test dto_agents` OK (19 passed) - `cargo test -p app-tauri --test list_live_agents_r0b` OK (5 passed) - `cargo test -p app-tauri --lib -- --skip state::mcp_e2e_loopback_tests --skip state::bind_endpoint_d1_tests --skip mcp_bridge::tests::end_to_end_over_real_loopback` OK (39 passed, 8 filtered out; exclusions = sockets Unix réels bloqués par sandbox déjà diagnostiqué) - `cargo test -p application` OK (application complète verte; warning existant `CapturingFs::writes` unused) Merci de relire/exécuter ce que tu juges nécessaire et répondre verdict QA : vert ou corrections requises.
|
||||
- **Response:** Verdict QA : vert. Relu le périmètre backend/Tauri du Lot A `UX conversations/délégations + read-model live-state minimal` : - `crates/application/src/workstate/mod.rs` agrège bien en read-only depuis `AgentContextStore::load_manifest`, `LiveSessions::live_agent_snapshots()` et `InputMediator::busy_state`. - L’ordre manifeste est conservé par itération sur `manifest.entries`. - Les sessions live hors manifeste sont ignorées par construction, car seules les entrées manifeste sont mappées. - Pas de lecture log/handoff ni de nouvelle persistance observée dans le use case. - `LiveSessionKind` / `LiveSessionSnapshot` ajoutent un snapshot typé sans modifier `live_agents()` existant. - La commande Tauri `get_project_work_state(projectId)` est câblée dans `commands.rs`, `state.rs`, `lib.rs`. - Les DTO sérialisent le read-model en camelCase, avec `busy` porté comme `domain::AgentBusyState`. Commandes exécutées par QA : ```text cargo fmt -p application -p app-tauri -- --check ``` Résultat : OK, aucune sortie. ```text cargo test -p application workstate ``` Résultat réel : ```text running 5 tests test workstate_includes_busy_state_from_input_mediator ... ok test workstate_ignores_live_agents_absent_from_manifest ... ok test workstate_lists_manifest_agents_idle_without_live_sessions ... ok test workstate_attaches_live_pty_session_to_manifest_agent ... ok test workstate_attaches_live_structured_session_to_manifest_agent ... ok test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s ``` Warning existant observé pendant la commande : ```text warning: method `writes` is never used --> crates/application/tests/orchestrator_service.rs:1642:8 ``` ```text cargo test -p app-tauri --test dto_agents ``` Résultat réel : ```text running 19 tests ... test project_work_state_dto_serialises_live_and_busy_camelcase ... ok ... test result: ok. 19 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s ``` ```text cargo test -p app-tauri --test list_live_agents_r0b ``` Résultat réel : ```text running 5 tests test no_sessions_yields_empty_list ... ok test both_kinds_live_listed_without_duplicates ... ok test pty_live_agent_is_listed ... ok test same_agent_in_both_registries_is_deduplicated ... ok test structured_live_agent_is_listed ... ok test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s ``` ```text cargo check -p app-tauri ``` Résultat réel : ```text Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.21s ``` ```text cargo test -p application ``` Résultat réel : ```text running 43 tests ... test result: ok. 43 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.10s ... Running tests/workstate.rs running 5 tests ... test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s Doc-tests application running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s ``` La suite application complète est verte ; seul warning existant : `CapturingFs::writes` unused dans `crates/application/tests/orchestrator_service.rs:1642`. ```text cargo test -p app-tauri --lib -- --skip state::mcp_e2e_loopback_tests --skip state::bind_endpoint_d1_tests --skip mcp_bridge::tests::end_to_end_over_real_loopback ``` Résultat réel : ```text running 39 tests ... test result: ok. 39 passed; 0 failed; 0 ignored; 0 measured; 8 filtered out; finished in 0.01s ``` Réserve maintenue mais non bloquante : les 8 tests filtrés exigent un vrai socket Unix loopback ; ce sandbox refuse `UnixListener::bind` avec `PermissionDenied`, diagnostic déjà établi. Ils restent à exécuter hors sandbox permissif socket Unix, mais ils ne remettent pas en cause ce Lot A read-model. Aucune correction requise. Je n’ai modifié aucun fichier.
|
||||
@ -1,3 +1,5 @@
|
||||
{"id":"419c60a5-2aca-4711-ad83-0a185bb3214e","conversation":"dd35eeb0-2329-0dfa-3255-df7dba90a0aa","atMs":1781427081894,"source":{"kind":"agent","agentId":"73c853d1-c0fd-463b-ad17-1d24fefa371f"},"role":"prompt","text":"Ping de test inter-agent depuis DevBackend — réponds avec un court PONG et l'heure que tu vois."}
|
||||
{"id":"558b7648-c032-4f11-b2cf-dc763888fb1c","conversation":"dd35eeb0-2329-0dfa-3255-df7dba90a0aa","atMs":1781945435488,"source":{"kind":"agent","agentId":"73c853d1-c0fd-463b-ad17-1d24fefa371f"},"role":"prompt","text":"Validation ciblée du MVP `agent-skill-awareness-v2` côté application Rust. Périmètre modifié: uniquement `crates/application/src/agent/lifecycle.rs`, dans `compose_convention_file(...)` + helper pur `skill_awareness`. Changement: injection d'un paragraphe `**Skills IdeA**` dans le bloc orchestration/awareness à chaque activation, avant contexte projet/persona; variante MCP mentionne `idea_create_skill`, variante non-MCP mentionne protocole fichier `skill.create`; aucun `# Skills` section ajouté quand aucun skill assigné; bodies de skills assignés restent sous `# Skills` dans l'ordre existant.\n\nTests ajoutés/ajustés dans les tests unitaires internes de `lifecycle.rs`: awareness présente sans section Skills, awareness avant contexte projet/persona, bodies sous `# Skills` dans l'ordre, variantes MCP/fichier.\n\nCommandes déjà exécutées par DevBackend:\n- `cargo test -p application compose_convention_file --no-fail-fast` => 15 tests passés\n- `cargo fmt -p application` => OK\n- `cargo test -p application` => OK, 43 unit + tous tests intégration application + doctests, seule alerte existante `method writes is never used` dans `tests/orchestrator_service.rs`.\n\nMerci de relire/exécuter ce que tu juges nécessaire et répondre verdict QA: vert ou corrections requises."}
|
||||
{"id":"49eb022e-28c5-4704-a629-9a28aa8901ea","conversation":"dd35eeb0-2329-0dfa-3255-df7dba90a0aa","atMs":1781945461642,"source":{"kind":"agent","agentId":"aefdbd61-e3d4-4bc1-9f42-c259446a97b5"},"role":"response","text":"Verdict QA : vert.\n\nRelu le diff ciblé de `crates/application/src/agent/lifecycle.rs` : l’injection `**Skills IdeA**` est placée dans le bloc orchestration avant le contexte projet/persona, les variantes MCP/fichier pointent respectivement vers `idea_create_skill` et `skill.create`, aucun `# Skills` n’est ouvert sans skill assigné, et les bodies assignés restent sous `# Skills` dans l’ordre.\n\nCommandes exécutées :\n\n```text\ncargo test -p application compose_convention_file --no-fail-fast\n```\n\nSortie pertinente :\n\n```text\nrunning 15 tests\n...\ntest result: ok. 15 passed; 0 failed; 0 ignored; 0 measured; 28 filtered out; finished in 0.00s\n```\n\nAlerte existante observée :\n\n```text\nwarning: method `writes` is never used\n --> crates/application/tests/orchestrator_service.rs:1642:8\n```\n\nCommande de régression crate :\n\n```text\ncargo test -p application\n```\n\nSortie pertinente :\n\n```text\nrunning 43 tests\n...\ntest result: ok. 43 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.10s\n...\nDoc-tests application\nrunning 0 tests\n\ntest result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s\n```\n\nTous les tests d’intégration `application` listés dans la suite sont passés également. Aucune correction requise pour ce MVP."}
|
||||
{"id":"3c8bd3a7-455d-4df5-ae3d-4ed8f39e8b8b","conversation":"dd35eeb0-2329-0dfa-3255-df7dba90a0aa","atMs":1781947300049,"source":{"kind":"agent","agentId":"73c853d1-c0fd-463b-ad17-1d24fefa371f"},"role":"prompt","text":"Validation QA ciblée du Lot A backend/Tauri `UX conversations/délégations + read-model live-state minimal` sur branche `feature/conversation-ux-live-state`.\n\nImplémentation résumée :\n- Application : nouveau module `crates/application/src/workstate/mod.rs` avec `GetProjectWorkState`, `ProjectWorkState`, `AgentWorkState`, `LiveWorkSession`.\n- Agrégation read-only depuis manifest `AgentContextStore::load_manifest`, `LiveSessions::live_agent_snapshots()` et `InputMediator::busy_state`.\n- Ordre manifeste conservé, agents live absents du manifeste ignorés, pas de lecture log/handoff, pas de nouvelle persistance.\n- `crates/application/src/terminal/registry.rs` expose `LiveSessionKind` + `LiveSessionSnapshot` via un snapshot typé, sans changer `live_agents()` existant.\n- Tauri : `get_project_work_state(projectId)` ajouté dans `commands.rs`, enregistré dans `lib.rs`, câblé dans `state.rs`.\n- DTO : `ProjectWorkStateDto`, `AgentWorkStateDto`, `LiveWorkSessionDto`, `LiveWorkSessionKindDto`; `busy` réutilise `domain::AgentBusyState` sérialisé avec tag `state` (`idle` / `busy { ticket, sinceMs }`).\n\nTests ajoutés :\n- `crates/application/tests/workstate.rs` : aucun live/busy, live PTY, live structured, busy, live hors manifeste ignoré.\n- `crates/app-tauri/tests/dto_agents.rs` : sérialisation camelCase du read-model, `live.kind`, `busy.state`, `sinceMs`.\n\nCommandes déjà exécutées :\n- `cargo fmt -p application -p app-tauri` OK\n- `cargo test -p application workstate` OK (5 tests workstate passés)\n- `cargo check -p app-tauri` OK\n- `cargo test -p app-tauri --test dto_agents` OK (19 passed)\n- `cargo test -p app-tauri --test list_live_agents_r0b` OK (5 passed)\n- `cargo test -p app-tauri --lib -- --skip state::mcp_e2e_loopback_tests --skip state::bind_endpoint_d1_tests --skip mcp_bridge::tests::end_to_end_over_real_loopback` OK (39 passed, 8 filtered out; exclusions = sockets Unix réels bloqués par sandbox déjà diagnostiqué)\n- `cargo test -p application` OK (application complète verte; warning existant `CapturingFs::writes` unused)\n\nMerci de relire/exécuter ce que tu juges nécessaire et répondre verdict QA : vert ou corrections requises."}
|
||||
{"id":"8c1fcc3e-1c86-4732-b2eb-993ecb4a6f77","conversation":"dd35eeb0-2329-0dfa-3255-df7dba90a0aa","atMs":1781971201017,"source":{"kind":"agent","agentId":"aefdbd61-e3d4-4bc1-9f42-c259446a97b5"},"role":"response","text":"Verdict QA : vert.\n\nRelu le périmètre backend/Tauri du Lot A `UX conversations/délégations + read-model live-state minimal` :\n- `crates/application/src/workstate/mod.rs` agrège bien en read-only depuis `AgentContextStore::load_manifest`, `LiveSessions::live_agent_snapshots()` et `InputMediator::busy_state`.\n- L’ordre manifeste est conservé par itération sur `manifest.entries`.\n- Les sessions live hors manifeste sont ignorées par construction, car seules les entrées manifeste sont mappées.\n- Pas de lecture log/handoff ni de nouvelle persistance observée dans le use case.\n- `LiveSessionKind` / `LiveSessionSnapshot` ajoutent un snapshot typé sans modifier `live_agents()` existant.\n- La commande Tauri `get_project_work_state(projectId)` est câblée dans `commands.rs`, `state.rs`, `lib.rs`.\n- Les DTO sérialisent le read-model en camelCase, avec `busy` porté comme `domain::AgentBusyState`.\n\nCommandes exécutées par QA :\n\n```text\ncargo fmt -p application -p app-tauri -- --check\n```\nRésultat : OK, aucune sortie.\n\n```text\ncargo test -p application workstate\n```\nRésultat réel :\n```text\nrunning 5 tests\ntest workstate_includes_busy_state_from_input_mediator ... ok\ntest workstate_ignores_live_agents_absent_from_manifest ... ok\ntest workstate_lists_manifest_agents_idle_without_live_sessions ... ok\ntest workstate_attaches_live_pty_session_to_manifest_agent ... ok\ntest workstate_attaches_live_structured_session_to_manifest_agent ... ok\n\ntest result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s\n```\nWarning existant observé pendant la commande :\n```text\nwarning: method `writes` is never used\n --> crates/application/tests/orchestrator_service.rs:1642:8\n```\n\n```text\ncargo test -p app-tauri --test dto_agents\n```\nRésultat réel :\n```text\nrunning 19 tests\n...\ntest project_work_state_dto_serialises_live_and_busy_camelcase ... ok\n...\ntest result: ok. 19 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s\n```\n\n```text\ncargo test -p app-tauri --test list_live_agents_r0b\n```\nRésultat réel :\n```text\nrunning 5 tests\ntest no_sessions_yields_empty_list ... ok\ntest both_kinds_live_listed_without_duplicates ... ok\ntest pty_live_agent_is_listed ... ok\ntest same_agent_in_both_registries_is_deduplicated ... ok\ntest structured_live_agent_is_listed ... ok\n\ntest result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s\n```\n\n```text\ncargo check -p app-tauri\n```\nRésultat réel :\n```text\nFinished `dev` profile [unoptimized + debuginfo] target(s) in 0.21s\n```\n\n```text\ncargo test -p application\n```\nRésultat réel :\n```text\nrunning 43 tests\n...\ntest result: ok. 43 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.10s\n...\nRunning tests/workstate.rs\nrunning 5 tests\n...\ntest result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s\n\nDoc-tests application\nrunning 0 tests\n\ntest result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s\n```\nLa suite application complète est verte ; seul warning existant : `CapturingFs::writes` unused dans `crates/application/tests/orchestrator_service.rs:1642`.\n\n```text\ncargo test -p app-tauri --lib -- --skip state::mcp_e2e_loopback_tests --skip state::bind_endpoint_d1_tests --skip mcp_bridge::tests::end_to_end_over_real_loopback\n```\nRésultat réel :\n```text\nrunning 39 tests\n...\ntest result: ok. 39 passed; 0 failed; 0 ignored; 0 measured; 8 filtered out; finished in 0.01s\n```\n\nRéserve maintenue mais non bloquante : les 8 tests filtrés exigent un vrai socket Unix loopback ; ce sandbox refuse `UnixListener::bind` avec `PermissionDenied`, diagnostic déjà établi. Ils restent à exécuter hors sandbox permissif socket Unix, mais ils ne remettent pas en cause ce Lot A read-model.\n\nAucune correction requise. Je n’ai modifié aucun fichier."}
|
||||
|
||||
@ -8,11 +8,56 @@
|
||||
"kind": "terminal",
|
||||
"tree": {
|
||||
"root": {
|
||||
"type": "leaf",
|
||||
"type": "split",
|
||||
"node": {
|
||||
"id": "d4b8c0d1-a44a-4c45-bbe9-26991f79b465",
|
||||
"session": "d5e00a5c-591e-4061-9104-c9ea7c9e01c3",
|
||||
"agent": "a6ced819-b893-4213-b003-9e9dc79b9641"
|
||||
"id": "35174b5f-0c29-4025-a389-e609ff219f39",
|
||||
"direction": "row",
|
||||
"children": [
|
||||
{
|
||||
"node": {
|
||||
"type": "leaf",
|
||||
"node": {
|
||||
"id": "d4b8c0d1-a44a-4c45-bbe9-26991f79b465",
|
||||
"session": "d5e00a5c-591e-4061-9104-c9ea7c9e01c3",
|
||||
"agent": "a6ced819-b893-4213-b003-9e9dc79b9641"
|
||||
}
|
||||
},
|
||||
"weight": 1.0
|
||||
},
|
||||
{
|
||||
"node": {
|
||||
"type": "split",
|
||||
"node": {
|
||||
"id": "31597147-d927-4d03-b76c-8d2b22f8b816",
|
||||
"direction": "column",
|
||||
"children": [
|
||||
{
|
||||
"node": {
|
||||
"type": "leaf",
|
||||
"node": {
|
||||
"id": "71564af2-673a-46c7-a0c0-877f89f6e49e",
|
||||
"session": "cadc1432-ccc3-4849-94bb-5cf342a85fe1",
|
||||
"agent": "aefdbd61-e3d4-4bc1-9f42-c259446a97b5"
|
||||
}
|
||||
},
|
||||
"weight": 1.0
|
||||
},
|
||||
{
|
||||
"node": {
|
||||
"type": "leaf",
|
||||
"node": {
|
||||
"id": "8529e97f-ce06-490c-b3d0-531c3dfee442",
|
||||
"session": "b7e0ab21-25bf-4158-8fcc-e2c67d49868e"
|
||||
}
|
||||
},
|
||||
"weight": 1.0
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"weight": 1.0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,13 +12,13 @@ use application::{
|
||||
AppError, AssignSkillToAgentInput, ChangeAgentProfileInput, CloseProjectInput,
|
||||
CreateAgentInput, CreateLayoutInput, CreateMemoryInput, CreateSkillInput, DeleteAgentInput,
|
||||
DeleteEmbedderProfileInput, DeleteLayoutInput, DeleteMemoryInput, DeleteSkillInput,
|
||||
DeleteTemplateInput, DetectAgentDriftInput, GetMemoryInput, GitBranchesInput, GitCheckoutInput,
|
||||
GitCommitInput, GitGraphInput, GitInitInput, GitLogInput, GitStagePathInput, GitStatusInput,
|
||||
InspectConversationInput, LaunchAgentInput, ListAgentsInput, ListLayoutsInput,
|
||||
ListMemoriesInput, ListResumableAgentsInput, ListSkillsInput, LiveSessions, LoadLayoutInput,
|
||||
McpRuntime, MutateLayoutInput, OpenProjectInput, ReadAgentContextInput, ReadMemoryIndexInput,
|
||||
ReadProjectContextInput, RecallMemoryInput, ReconcileLayoutsInput, RenameLayoutInput,
|
||||
ResolveAgentPermissionsInput, ResolveMemoryLinksInput, SetActiveLayoutInput,
|
||||
DeleteTemplateInput, DetectAgentDriftInput, GetMemoryInput, GetProjectWorkStateInput,
|
||||
GitBranchesInput, GitCheckoutInput, GitCommitInput, GitGraphInput, GitInitInput, GitLogInput,
|
||||
GitStagePathInput, GitStatusInput, InspectConversationInput, LaunchAgentInput, ListAgentsInput,
|
||||
ListLayoutsInput, ListMemoriesInput, ListResumableAgentsInput, ListSkillsInput, LiveSessions,
|
||||
LoadLayoutInput, McpRuntime, MutateLayoutInput, OpenProjectInput, ReadAgentContextInput,
|
||||
ReadMemoryIndexInput, ReadProjectContextInput, RecallMemoryInput, ReconcileLayoutsInput,
|
||||
RenameLayoutInput, ResolveAgentPermissionsInput, ResolveMemoryLinksInput, SetActiveLayoutInput,
|
||||
SnapshotRunningAgentsInput, SyncAgentWithTemplateInput, UnassignSkillFromAgentInput,
|
||||
UpdateAgentContextInput, UpdateAgentPermissionsInput, UpdateMemoryInput,
|
||||
UpdateProjectContextInput, UpdateProjectPermissionsInput, UpdateSkillInput,
|
||||
@ -42,11 +42,11 @@ use crate::dto::{
|
||||
InterruptAgentRequestDto, LaunchAgentRequestDto, LayoutDto, LayoutOperationDto, ListLayoutsDto,
|
||||
LiveAgentListDto, MemoryDto, MemoryIndexDto, MemoryLinksDto, MemoryListDto,
|
||||
OpenTerminalRequestDto, ProfileDto, ProfileListDto, ProjectDto, ProjectListDto,
|
||||
ProjectPermissionsDto, ReadAgentContextResponseDto, ReattachChatDto, ReattachResultDto,
|
||||
RecallMemoryRequestDto, RenameLayoutRequestDto, ReplyChunk, ResizeTerminalRequestDto,
|
||||
ResolveAgentPermissionsRequestDto, ResumableAgentListDto, SaveEmbedderProfileRequestDto,
|
||||
SaveProfileRequestDto, SetActiveLayoutRequestDto, SkillDto, SkillListDto,
|
||||
SyncAgentWithTemplateRequestDto, SyncResultDto, TemplateDto, TemplateListDto,
|
||||
ProjectPermissionsDto, ProjectWorkStateDto, ReadAgentContextResponseDto, ReattachChatDto,
|
||||
ReattachResultDto, RecallMemoryRequestDto, RenameLayoutRequestDto, ReplyChunk,
|
||||
ResizeTerminalRequestDto, ResolveAgentPermissionsRequestDto, ResumableAgentListDto,
|
||||
SaveEmbedderProfileRequestDto, SaveProfileRequestDto, SetActiveLayoutRequestDto, SkillDto,
|
||||
SkillListDto, SyncAgentWithTemplateRequestDto, SyncResultDto, TemplateDto, TemplateListDto,
|
||||
TerminalClosedDto, TerminalSessionDto, UnassignSkillRequestDto, UpdateAgentContextRequestDto,
|
||||
UpdateAgentPermissionsRequestDto, UpdateMemoryRequestDto, UpdateProjectContextRequestDto,
|
||||
UpdateProjectPermissionsRequestDto, UpdateSkillRequestDto, UpdateTemplateRequestDto,
|
||||
@ -968,6 +968,25 @@ pub async fn list_agents(
|
||||
.map_err(ErrorDto::from)
|
||||
}
|
||||
|
||||
/// `get_project_work_state` — read-only live/busy state for manifest agents.
|
||||
///
|
||||
/// # Errors
|
||||
/// Returns an [`ErrorDto`] (`INVALID` for a malformed id, `NOT_FOUND` if the
|
||||
/// project is unknown, `STORE` on manifest I/O failure).
|
||||
#[tauri::command]
|
||||
pub async fn get_project_work_state(
|
||||
project_id: String,
|
||||
state: State<'_, AppState>,
|
||||
) -> Result<ProjectWorkStateDto, ErrorDto> {
|
||||
let project = resolve_project(&project_id, &state).await?;
|
||||
state
|
||||
.get_project_work_state
|
||||
.execute(GetProjectWorkStateInput { project })
|
||||
.await
|
||||
.map(ProjectWorkStateDto::from)
|
||||
.map_err(ErrorDto::from)
|
||||
}
|
||||
|
||||
/// `list_live_agents` — list every agent that currently owns a live session
|
||||
/// (raw PTY **or** structured/chat) and the cell hosting each, so the UI can
|
||||
/// disable an agent already running in another cell (the "one live session per
|
||||
|
||||
@ -10,9 +10,9 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
use application::{
|
||||
AppError, CreateProjectInput, CreateProjectOutput, GitGraphOutput, HealthInput, HealthReport,
|
||||
LayoutKind, ListProjectsOutput, OpenProjectOutput,
|
||||
LayoutKind, ListProjectsOutput, LiveSessionKind, OpenProjectOutput, ProjectWorkState,
|
||||
};
|
||||
use domain::{Project, ProjectId};
|
||||
use domain::{AgentBusyState, Project, ProjectId};
|
||||
|
||||
/// Request DTO for the `health` command.
|
||||
#[derive(Debug, Clone, Default, Deserialize)]
|
||||
@ -1472,6 +1472,83 @@ impl LiveAgentListDto {
|
||||
}
|
||||
}
|
||||
|
||||
/// Runtime family of a live work-state session.
|
||||
#[derive(Debug, Clone, Copy, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum LiveWorkSessionKindDto {
|
||||
/// Raw PTY-backed CLI session.
|
||||
Pty,
|
||||
/// Structured agent-session backend.
|
||||
Structured,
|
||||
}
|
||||
|
||||
impl From<LiveSessionKind> for LiveWorkSessionKindDto {
|
||||
fn from(kind: LiveSessionKind) -> Self {
|
||||
match kind {
|
||||
LiveSessionKind::Pty => Self::Pty,
|
||||
LiveSessionKind::Structured => Self::Structured,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Live session coordinates in the project work-state read model.
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct LiveWorkSessionDto {
|
||||
/// The layout node currently hosting the session view.
|
||||
pub node_id: String,
|
||||
/// The live session id.
|
||||
pub session_id: String,
|
||||
/// Runtime family that owns the session.
|
||||
pub kind: LiveWorkSessionKindDto,
|
||||
}
|
||||
|
||||
/// One manifest agent's current live/busy state.
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AgentWorkStateDto {
|
||||
/// Agent id.
|
||||
pub agent_id: String,
|
||||
/// Agent display name.
|
||||
pub name: String,
|
||||
/// Runtime profile id assigned to the agent.
|
||||
pub profile_id: String,
|
||||
/// Live session, if any.
|
||||
pub live: Option<LiveWorkSessionDto>,
|
||||
/// Current mediated-input busy state.
|
||||
pub busy: AgentBusyState,
|
||||
}
|
||||
|
||||
/// Project-level read model for conversation/delegation UX.
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ProjectWorkStateDto {
|
||||
/// Manifest agents in manifest order, enriched with live/busy state.
|
||||
pub agents: Vec<AgentWorkStateDto>,
|
||||
}
|
||||
|
||||
impl From<ProjectWorkState> for ProjectWorkStateDto {
|
||||
fn from(state: ProjectWorkState) -> Self {
|
||||
Self {
|
||||
agents: state
|
||||
.agents
|
||||
.into_iter()
|
||||
.map(|agent| AgentWorkStateDto {
|
||||
agent_id: agent.agent_id.to_string(),
|
||||
name: agent.name,
|
||||
profile_id: agent.profile_id.to_string(),
|
||||
live: agent.live.map(|live| LiveWorkSessionDto {
|
||||
node_id: live.node_id.to_string(),
|
||||
session_id: live.session_id.to_string(),
|
||||
kind: live.kind.into(),
|
||||
}),
|
||||
busy: agent.busy,
|
||||
})
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Request DTO for `attach_live_agent`: bind an already-running agent session to
|
||||
/// a visible layout cell without spawning a new process.
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
|
||||
@ -163,6 +163,7 @@ pub fn run() {
|
||||
commands::dismiss_embedder_suggestion,
|
||||
commands::create_agent,
|
||||
commands::list_agents,
|
||||
commands::get_project_work_state,
|
||||
commands::list_live_agents,
|
||||
commands::attach_live_agent,
|
||||
commands::read_agent_context,
|
||||
|
||||
@ -18,15 +18,15 @@ use application::{
|
||||
CreateSkill, CreateTemplate, DeleteAgent, DeleteEmbedderProfile, DeleteLayout, DeleteMemory,
|
||||
DeleteProfile, DeleteSkill, DeleteTemplate, DescribeEmbedderEngines, DetectAgentDrift,
|
||||
DetectProfiles, DismissEmbedderSuggestion, FirstRunState, GetMemory, GetProjectPermissions,
|
||||
GitBranches, GitCheckout, GitCommit, GitGraph, GitInit, GitLog, GitStage, GitStatus,
|
||||
GitUnstage, HealthUseCase, InspectConversation, LaunchAgent, LaunchAgentInput, ListAgents,
|
||||
ListAgentsInput, ListEmbedderProfiles, ListLayouts, ListMemories, ListProfiles, ListProjects,
|
||||
ListResumableAgents, ListSkills, ListTemplates, LiveAgentRegistry, LoadLayout, McpRuntime,
|
||||
MoveTabToNewWindow, MutateLayout, OnnxModelView, OpenProject, OpenTerminal,
|
||||
OrchestratorService, PermissionProjectorRegistry, ProposeContext, ReadAgentContext,
|
||||
ReadContext, ReadMemory, ReadMemoryIndex, ReadProjectContext, RecallMemory, ReconcileLayouts,
|
||||
RecordTurn, RecordTurnProvider, ReferenceProfiles, RenameLayout, ResizeTerminal,
|
||||
ResolveAgentPermissions, ResolveMemoryLinks, SaveEmbedderProfile, SaveProfile,
|
||||
GetProjectWorkState, GitBranches, GitCheckout, GitCommit, GitGraph, GitInit, GitLog, GitStage,
|
||||
GitStatus, GitUnstage, HealthUseCase, InspectConversation, LaunchAgent, LaunchAgentInput,
|
||||
ListAgents, ListAgentsInput, ListEmbedderProfiles, ListLayouts, ListMemories, ListProfiles,
|
||||
ListProjects, ListResumableAgents, ListSkills, ListTemplates, LiveAgentRegistry, LiveSessions,
|
||||
LoadLayout, McpRuntime, MoveTabToNewWindow, MutateLayout, OnnxModelView, OpenProject,
|
||||
OpenTerminal, OrchestratorService, PermissionProjectorRegistry, ProposeContext,
|
||||
ReadAgentContext, ReadContext, ReadMemory, ReadMemoryIndex, ReadProjectContext, RecallMemory,
|
||||
ReconcileLayouts, RecordTurn, RecordTurnProvider, ReferenceProfiles, RenameLayout,
|
||||
ResizeTerminal, ResolveAgentPermissions, ResolveMemoryLinks, SaveEmbedderProfile, SaveProfile,
|
||||
SessionLimitService, SetActiveLayout, SnapshotRunningAgents, StructuredSessions,
|
||||
SuggestedThisSession, SyncAgentWithTemplate, TerminalSessions, UnassignSkillFromAgent,
|
||||
UpdateAgentContext, UpdateAgentPermissions, UpdateMemory, UpdateProjectContext,
|
||||
@ -330,6 +330,8 @@ pub struct AppState {
|
||||
/// Read-only inventory of a project's resumable agent cells, for the reopen
|
||||
/// panel (§15.2).
|
||||
pub list_resumable_agents: Arc<ListResumableAgents>,
|
||||
/// Read-only live/busy state for the project's manifest agents.
|
||||
pub get_project_work_state: Arc<GetProjectWorkState>,
|
||||
/// Best-effort inspection of a conversation (last topic + token indicator)
|
||||
/// for the resume popup (T7). Optional/extensible: backed by a `Vec` of
|
||||
/// [`domain::ports::SessionInspector`]s; an empty/missing match yields empty
|
||||
@ -1021,6 +1023,15 @@ impl AppState {
|
||||
});
|
||||
}
|
||||
let input_mediator = Arc::clone(&mediated_inbox) as Arc<dyn domain::input::InputMediator>;
|
||||
let live_sessions = Arc::new(LiveSessions::new(
|
||||
Arc::clone(&terminal_sessions),
|
||||
Arc::clone(&structured_sessions),
|
||||
));
|
||||
let get_project_work_state = Arc::new(GetProjectWorkState::new(
|
||||
Arc::clone(&contexts_port),
|
||||
Arc::clone(&live_sessions),
|
||||
Arc::clone(&input_mediator),
|
||||
));
|
||||
|
||||
// --- Limites de session des agents (ARCHITECTURE §21, LS7) ---
|
||||
// Service pur-ports « détecter → planifier → reprendre » câblé sur l'existant :
|
||||
@ -1187,6 +1198,7 @@ impl AppState {
|
||||
launch_agent,
|
||||
change_agent_profile,
|
||||
list_resumable_agents,
|
||||
get_project_work_state,
|
||||
inspect_conversation,
|
||||
project_store,
|
||||
get_project_permissions,
|
||||
|
||||
@ -9,7 +9,8 @@ use app_tauri_lib::dto::{
|
||||
};
|
||||
use application::AppError;
|
||||
use application::{
|
||||
CreateAgentOutput, InspectConversationOutput, LaunchAgentOutput, ListAgentsOutput,
|
||||
AgentWorkState, CreateAgentOutput, InspectConversationOutput, LaunchAgentOutput,
|
||||
ListAgentsOutput, LiveSessionKind, LiveWorkSession, ProjectWorkState,
|
||||
};
|
||||
use domain::ids::{AgentId, NodeId, ProfileId, SessionId};
|
||||
use domain::ports::ConversationDetails;
|
||||
@ -197,6 +198,44 @@ fn live_agent_list_dto_serialises_camelcase_array() {
|
||||
assert!(arr[0].get("node_id").is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn project_work_state_dto_serialises_live_and_busy_camelcase() {
|
||||
let agent = AgentId::from_uuid(Uuid::from_u128(11));
|
||||
let profile = ProfileId::from_uuid(Uuid::from_u128(12));
|
||||
let node = NodeId::from_uuid(Uuid::from_u128(13));
|
||||
let session = SessionId::from_uuid(Uuid::from_u128(14));
|
||||
let ticket = domain::TicketId::from_uuid(Uuid::from_u128(15));
|
||||
let dto = app_tauri_lib::dto::ProjectWorkStateDto::from(ProjectWorkState {
|
||||
agents: vec![AgentWorkState {
|
||||
agent_id: agent,
|
||||
name: "Worker".to_owned(),
|
||||
profile_id: profile,
|
||||
live: Some(LiveWorkSession {
|
||||
node_id: node,
|
||||
session_id: session,
|
||||
kind: LiveSessionKind::Structured,
|
||||
}),
|
||||
busy: domain::AgentBusyState::Busy {
|
||||
ticket,
|
||||
since_ms: 1_234,
|
||||
},
|
||||
}],
|
||||
});
|
||||
|
||||
let v = serde_json::to_value(&dto).unwrap();
|
||||
assert_eq!(v["agents"][0]["agentId"], agent.to_string());
|
||||
assert_eq!(v["agents"][0]["profileId"], profile.to_string());
|
||||
assert_eq!(v["agents"][0]["live"]["nodeId"], node.to_string());
|
||||
assert_eq!(v["agents"][0]["live"]["sessionId"], session.to_string());
|
||||
assert_eq!(v["agents"][0]["live"]["kind"], "structured");
|
||||
assert_eq!(v["agents"][0]["busy"]["state"], "busy");
|
||||
assert_eq!(v["agents"][0]["busy"]["ticket"], ticket.to_string());
|
||||
assert_eq!(v["agents"][0]["busy"]["sinceMs"], 1_234);
|
||||
assert!(v["agents"][0].get("agent_id").is_none());
|
||||
assert!(v["agents"][0]["live"].get("session_id").is_none());
|
||||
assert!(v["agents"][0]["busy"].get("since_ms").is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn launch_agent_request_carries_conversation_id_for_resume() {
|
||||
let raw = json!({
|
||||
|
||||
@ -28,6 +28,7 @@ pub mod skill;
|
||||
pub mod template;
|
||||
pub mod terminal;
|
||||
pub mod window;
|
||||
pub mod workstate;
|
||||
|
||||
pub use agent::{
|
||||
drain_with_readiness, drain_with_readiness_outcome, reference_profile_id, reference_profiles,
|
||||
@ -111,8 +112,13 @@ pub use template::{
|
||||
UpdateTemplateOutput,
|
||||
};
|
||||
pub use terminal::{
|
||||
CloseTerminal, CloseTerminalInput, CloseTerminalOutput, LiveAgentRegistry, LiveSessions,
|
||||
OpenTerminal, OpenTerminalInput, OpenTerminalOutput, ResizeTerminal, ResizeTerminalInput,
|
||||
StructuredSessions, TerminalSessions, WriteToTerminal, WriteToTerminalInput,
|
||||
CloseTerminal, CloseTerminalInput, CloseTerminalOutput, LiveAgentRegistry, LiveSessionKind,
|
||||
LiveSessionSnapshot, LiveSessions, OpenTerminal, OpenTerminalInput, OpenTerminalOutput,
|
||||
ResizeTerminal, ResizeTerminalInput, StructuredSessions, TerminalSessions, WriteToTerminal,
|
||||
WriteToTerminalInput,
|
||||
};
|
||||
pub use window::{MoveTabToNewWindow, MoveTabToNewWindowInput, MoveTabToNewWindowOutput};
|
||||
pub use workstate::{
|
||||
AgentWorkState, GetProjectWorkState, GetProjectWorkStateInput, LiveWorkSession,
|
||||
ProjectWorkState,
|
||||
};
|
||||
|
||||
@ -28,7 +28,10 @@
|
||||
mod registry;
|
||||
mod usecases;
|
||||
|
||||
pub use registry::{LiveAgentRegistry, LiveSessions, StructuredSessions, TerminalSessions};
|
||||
pub use registry::{
|
||||
LiveAgentRegistry, LiveSessionKind, LiveSessionSnapshot, LiveSessions, StructuredSessions,
|
||||
TerminalSessions,
|
||||
};
|
||||
pub use usecases::{
|
||||
CloseTerminal, CloseTerminalInput, CloseTerminalOutput, OpenTerminal, OpenTerminalInput,
|
||||
OpenTerminalOutput, ResizeTerminal, ResizeTerminalInput, WriteToTerminal, WriteToTerminalInput,
|
||||
|
||||
@ -13,6 +13,28 @@ use domain::conversation::ConversationId;
|
||||
use domain::ports::{AgentSession, PtyHandle};
|
||||
use domain::{AgentId, NodeId, SessionId, SessionKind, TerminalSession};
|
||||
|
||||
/// Runtime family of a live agent session.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum LiveSessionKind {
|
||||
/// Raw PTY-backed CLI session.
|
||||
Pty,
|
||||
/// Structured agent-session backend.
|
||||
Structured,
|
||||
}
|
||||
|
||||
/// Read-only coordinates of one live agent session.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct LiveSessionSnapshot {
|
||||
/// The agent owning the live session.
|
||||
pub agent_id: AgentId,
|
||||
/// The layout node currently hosting the session view.
|
||||
pub node_id: NodeId,
|
||||
/// The live session id.
|
||||
pub session_id: SessionId,
|
||||
/// Which runtime registry owns the session.
|
||||
pub kind: LiveSessionKind,
|
||||
}
|
||||
|
||||
/// A registered, live terminal: its PTY handle plus the domain snapshot.
|
||||
#[derive(Debug, Clone)]
|
||||
struct Entry {
|
||||
@ -516,6 +538,31 @@ impl LiveSessions {
|
||||
all.extend(self.structured.live_agents());
|
||||
all
|
||||
}
|
||||
|
||||
/// Tous les agents vivants avec le type de registre source (PTY puis structuré).
|
||||
#[must_use]
|
||||
pub fn live_agent_snapshots(&self) -> Vec<LiveSessionSnapshot> {
|
||||
let mut all: Vec<LiveSessionSnapshot> = self
|
||||
.pty
|
||||
.live_agents()
|
||||
.into_iter()
|
||||
.map(|(agent_id, node_id, session_id)| LiveSessionSnapshot {
|
||||
agent_id,
|
||||
node_id,
|
||||
session_id,
|
||||
kind: LiveSessionKind::Pty,
|
||||
})
|
||||
.collect();
|
||||
all.extend(self.structured.live_agents().into_iter().map(
|
||||
|(agent_id, node_id, session_id)| LiveSessionSnapshot {
|
||||
agent_id,
|
||||
node_id,
|
||||
session_id,
|
||||
kind: LiveSessionKind::Structured,
|
||||
},
|
||||
));
|
||||
all
|
||||
}
|
||||
}
|
||||
|
||||
impl LiveAgentRegistry for LiveSessions {
|
||||
|
||||
124
crates/application/src/workstate/mod.rs
Normal file
124
crates/application/src/workstate/mod.rs
Normal file
@ -0,0 +1,124 @@
|
||||
//! Read-only project work-state read model.
|
||||
//!
|
||||
//! This module composes existing runtime state only: the project agent manifest,
|
||||
//! live session registries and the input mediator busy state. It performs no I/O
|
||||
//! beyond loading the manifest through the existing context store and creates no
|
||||
//! durable projection.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use domain::input::AgentBusyState;
|
||||
use domain::ports::AgentContextStore;
|
||||
use domain::{AgentId, InputMediator, NodeId, ProfileId, Project, SessionId};
|
||||
|
||||
use crate::error::AppError;
|
||||
use crate::terminal::{LiveSessionKind, LiveSessionSnapshot, LiveSessions};
|
||||
|
||||
/// Input for [`GetProjectWorkState::execute`].
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct GetProjectWorkStateInput {
|
||||
/// Project whose manifest provides the agent order and boundary.
|
||||
pub project: Project,
|
||||
}
|
||||
|
||||
/// Read model for a project's current agent work state.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct ProjectWorkState {
|
||||
/// Agents in manifest order.
|
||||
pub agents: Vec<AgentWorkState>,
|
||||
}
|
||||
|
||||
/// Read model for one manifest agent.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct AgentWorkState {
|
||||
/// Agent id.
|
||||
pub agent_id: AgentId,
|
||||
/// Agent display name.
|
||||
pub name: String,
|
||||
/// Runtime profile id currently assigned to the agent.
|
||||
pub profile_id: ProfileId,
|
||||
/// Current live session, if the agent is live.
|
||||
pub live: Option<LiveWorkSession>,
|
||||
/// Current FIFO/busy state.
|
||||
pub busy: AgentBusyState,
|
||||
}
|
||||
|
||||
/// Live session coordinates exposed by the work-state read model.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct LiveWorkSession {
|
||||
/// The layout node currently hosting the session view.
|
||||
pub node_id: NodeId,
|
||||
/// The live session id.
|
||||
pub session_id: SessionId,
|
||||
/// Runtime family that owns the session.
|
||||
pub kind: LiveSessionKind,
|
||||
}
|
||||
|
||||
/// Read-only use case aggregating manifest agents with live and busy state.
|
||||
pub struct GetProjectWorkState {
|
||||
contexts: Arc<dyn AgentContextStore>,
|
||||
live: Arc<LiveSessions>,
|
||||
input: Arc<dyn InputMediator>,
|
||||
}
|
||||
|
||||
impl GetProjectWorkState {
|
||||
/// Builds the read-model use case from existing stores/registries.
|
||||
#[must_use]
|
||||
pub fn new(
|
||||
contexts: Arc<dyn AgentContextStore>,
|
||||
live: Arc<LiveSessions>,
|
||||
input: Arc<dyn InputMediator>,
|
||||
) -> Self {
|
||||
Self {
|
||||
contexts,
|
||||
live,
|
||||
input,
|
||||
}
|
||||
}
|
||||
|
||||
/// Executes the read-only aggregation.
|
||||
///
|
||||
/// # Errors
|
||||
/// - [`AppError::Store`] when the manifest cannot be loaded,
|
||||
/// - [`AppError::Invalid`] if a manifest entry violates agent invariants.
|
||||
pub async fn execute(
|
||||
&self,
|
||||
input: GetProjectWorkStateInput,
|
||||
) -> Result<ProjectWorkState, AppError> {
|
||||
let manifest = self.contexts.load_manifest(&input.project).await?;
|
||||
let live_by_agent = live_by_agent(self.live.live_agent_snapshots());
|
||||
let agents = manifest
|
||||
.entries
|
||||
.iter()
|
||||
.map(|entry| {
|
||||
let agent = entry
|
||||
.to_agent()
|
||||
.map_err(|err| AppError::Invalid(err.to_string()))?;
|
||||
let live = live_by_agent
|
||||
.get(&agent.id)
|
||||
.map(|snapshot| LiveWorkSession {
|
||||
node_id: snapshot.node_id,
|
||||
session_id: snapshot.session_id,
|
||||
kind: snapshot.kind,
|
||||
});
|
||||
Ok(AgentWorkState {
|
||||
agent_id: agent.id,
|
||||
name: agent.name,
|
||||
profile_id: agent.profile_id,
|
||||
live,
|
||||
busy: self.input.busy_state(agent.id),
|
||||
})
|
||||
})
|
||||
.collect::<Result<Vec<_>, AppError>>()?;
|
||||
Ok(ProjectWorkState { agents })
|
||||
}
|
||||
}
|
||||
|
||||
fn live_by_agent(snapshots: Vec<LiveSessionSnapshot>) -> HashMap<AgentId, LiveSessionSnapshot> {
|
||||
let mut out = HashMap::new();
|
||||
for snapshot in snapshots {
|
||||
out.entry(snapshot.agent_id).or_insert(snapshot);
|
||||
}
|
||||
out
|
||||
}
|
||||
307
crates/application/tests/workstate.rs
Normal file
307
crates/application/tests/workstate.rs
Normal file
@ -0,0 +1,307 @@
|
||||
//! Tests for the project work-state read model.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use async_trait::async_trait;
|
||||
|
||||
use application::{
|
||||
GetProjectWorkState, GetProjectWorkStateInput, LiveSessionKind, LiveSessions,
|
||||
StructuredSessions, TerminalSessions,
|
||||
};
|
||||
use domain::mailbox::{MailboxError, PendingReply, Ticket};
|
||||
use domain::ports::{
|
||||
AgentContextStore, AgentSession, AgentSessionError, PtyHandle, ReplyStream, StoreError,
|
||||
};
|
||||
use domain::{
|
||||
Agent, AgentBusyState, AgentId, AgentManifest, AgentOrigin, InputMediator, ManifestEntry,
|
||||
MarkdownDoc, NodeId, ProfileId, Project, ProjectId, ProjectPath, PtySize, RemoteRef, SessionId,
|
||||
SessionKind, TerminalSession,
|
||||
};
|
||||
use uuid::Uuid;
|
||||
|
||||
fn aid(n: u128) -> AgentId {
|
||||
AgentId::from_uuid(Uuid::from_u128(n))
|
||||
}
|
||||
|
||||
fn pid(n: u128) -> ProfileId {
|
||||
ProfileId::from_uuid(Uuid::from_u128(n))
|
||||
}
|
||||
|
||||
fn sid(n: u128) -> SessionId {
|
||||
SessionId::from_uuid(Uuid::from_u128(n))
|
||||
}
|
||||
|
||||
fn nid(n: u128) -> NodeId {
|
||||
NodeId::from_uuid(Uuid::from_u128(n))
|
||||
}
|
||||
|
||||
fn ticket_id(n: u128) -> domain::TicketId {
|
||||
domain::TicketId::from_uuid(Uuid::from_u128(n))
|
||||
}
|
||||
|
||||
fn project() -> Project {
|
||||
Project::new(
|
||||
ProjectId::from_uuid(Uuid::from_u128(1)),
|
||||
"demo",
|
||||
ProjectPath::new("/tmp/idea-workstate-test").unwrap(),
|
||||
RemoteRef::local(),
|
||||
1_700_000_000_000,
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn agent(n: u128, name: &str) -> Agent {
|
||||
Agent::new(
|
||||
aid(n),
|
||||
name,
|
||||
format!("agents/{name}.md"),
|
||||
pid(100 + n),
|
||||
AgentOrigin::Scratch,
|
||||
false,
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn manifest(agents: &[Agent]) -> AgentManifest {
|
||||
AgentManifest::new(1, agents.iter().map(ManifestEntry::from_agent).collect()).unwrap()
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct FakeContexts {
|
||||
manifest: AgentManifest,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl AgentContextStore for FakeContexts {
|
||||
async fn read_context(
|
||||
&self,
|
||||
_project: &Project,
|
||||
_agent: &AgentId,
|
||||
) -> Result<MarkdownDoc, StoreError> {
|
||||
Err(StoreError::NotFound)
|
||||
}
|
||||
|
||||
async fn write_context(
|
||||
&self,
|
||||
_project: &Project,
|
||||
_agent: &AgentId,
|
||||
_md: &MarkdownDoc,
|
||||
) -> Result<(), StoreError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn load_manifest(&self, _project: &Project) -> Result<AgentManifest, StoreError> {
|
||||
Ok(self.manifest.clone())
|
||||
}
|
||||
|
||||
async fn save_manifest(
|
||||
&self,
|
||||
_project: &Project,
|
||||
_manifest: &AgentManifest,
|
||||
) -> Result<(), StoreError> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct FakeInput {
|
||||
busy: Mutex<HashMap<AgentId, AgentBusyState>>,
|
||||
}
|
||||
|
||||
impl FakeInput {
|
||||
fn set_busy(&self, agent: AgentId, busy: AgentBusyState) {
|
||||
self.busy.lock().unwrap().insert(agent, busy);
|
||||
}
|
||||
}
|
||||
|
||||
impl InputMediator for FakeInput {
|
||||
fn enqueue(&self, _agent: AgentId, _ticket: Ticket) -> PendingReply {
|
||||
let fut: Pin<Box<dyn Future<Output = Result<String, MailboxError>> + Send>> =
|
||||
Box::pin(async { Err(MailboxError::Cancelled) });
|
||||
PendingReply::new(fut)
|
||||
}
|
||||
|
||||
fn preempt(&self, _agent: AgentId) {}
|
||||
|
||||
fn mark_idle(&self, _agent: AgentId) {}
|
||||
|
||||
fn busy_state(&self, agent: AgentId) -> AgentBusyState {
|
||||
self.busy
|
||||
.lock()
|
||||
.unwrap()
|
||||
.get(&agent)
|
||||
.copied()
|
||||
.unwrap_or(AgentBusyState::Idle)
|
||||
}
|
||||
}
|
||||
|
||||
struct FakeSession {
|
||||
id: SessionId,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl AgentSession for FakeSession {
|
||||
fn id(&self) -> SessionId {
|
||||
self.id
|
||||
}
|
||||
|
||||
fn conversation_id(&self) -> Option<String> {
|
||||
None
|
||||
}
|
||||
|
||||
async fn send(&self, _prompt: &str) -> Result<ReplyStream, AgentSessionError> {
|
||||
Ok(Box::new(std::iter::empty()))
|
||||
}
|
||||
|
||||
async fn shutdown(&self) -> Result<(), AgentSessionError> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn fake_session(id: SessionId) -> Arc<dyn AgentSession> {
|
||||
Arc::new(FakeSession { id })
|
||||
}
|
||||
|
||||
fn insert_pty(
|
||||
sessions: &TerminalSessions,
|
||||
session_id: SessionId,
|
||||
agent_id: AgentId,
|
||||
node_id: NodeId,
|
||||
) {
|
||||
sessions.insert(
|
||||
PtyHandle { session_id },
|
||||
TerminalSession::starting(
|
||||
session_id,
|
||||
node_id,
|
||||
ProjectPath::new("/tmp/idea-workstate-test").unwrap(),
|
||||
SessionKind::Agent { agent_id },
|
||||
PtySize { rows: 24, cols: 80 },
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
struct Fixture {
|
||||
usecase: GetProjectWorkState,
|
||||
pty: Arc<TerminalSessions>,
|
||||
structured: Arc<StructuredSessions>,
|
||||
input: Arc<FakeInput>,
|
||||
project: Project,
|
||||
}
|
||||
|
||||
fn fixture(agents: &[Agent]) -> Fixture {
|
||||
let pty = Arc::new(TerminalSessions::new());
|
||||
let structured = Arc::new(StructuredSessions::new());
|
||||
let live = Arc::new(LiveSessions::new(Arc::clone(&pty), Arc::clone(&structured)));
|
||||
let input = Arc::new(FakeInput::default());
|
||||
let input_port = Arc::clone(&input) as Arc<dyn InputMediator>;
|
||||
let usecase = GetProjectWorkState::new(
|
||||
Arc::new(FakeContexts {
|
||||
manifest: manifest(agents),
|
||||
}),
|
||||
live,
|
||||
input_port,
|
||||
);
|
||||
Fixture {
|
||||
usecase,
|
||||
pty,
|
||||
structured,
|
||||
input,
|
||||
project: project(),
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn workstate_lists_manifest_agents_idle_without_live_sessions() {
|
||||
let a = agent(10, "alpha");
|
||||
let b = agent(20, "beta");
|
||||
let f = fixture(&[a.clone(), b.clone()]);
|
||||
|
||||
let out = f
|
||||
.usecase
|
||||
.execute(GetProjectWorkStateInput { project: f.project })
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(out.agents.len(), 2);
|
||||
assert_eq!(out.agents[0].agent_id, a.id);
|
||||
assert_eq!(out.agents[0].name, "alpha");
|
||||
assert_eq!(out.agents[0].profile_id, a.profile_id);
|
||||
assert_eq!(out.agents[0].live, None);
|
||||
assert_eq!(out.agents[0].busy, AgentBusyState::Idle);
|
||||
assert_eq!(out.agents[1].agent_id, b.id);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn workstate_attaches_live_pty_session_to_manifest_agent() {
|
||||
let a = agent(10, "alpha");
|
||||
let f = fixture(std::slice::from_ref(&a));
|
||||
insert_pty(&f.pty, sid(1), a.id, nid(100));
|
||||
|
||||
let out = f
|
||||
.usecase
|
||||
.execute(GetProjectWorkStateInput { project: f.project })
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let live = out.agents[0].live.unwrap();
|
||||
assert_eq!(live.session_id, sid(1));
|
||||
assert_eq!(live.node_id, nid(100));
|
||||
assert_eq!(live.kind, LiveSessionKind::Pty);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn workstate_attaches_live_structured_session_to_manifest_agent() {
|
||||
let a = agent(10, "alpha");
|
||||
let f = fixture(std::slice::from_ref(&a));
|
||||
f.structured.insert(fake_session(sid(2)), a.id, nid(200));
|
||||
|
||||
let out = f
|
||||
.usecase
|
||||
.execute(GetProjectWorkStateInput { project: f.project })
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let live = out.agents[0].live.unwrap();
|
||||
assert_eq!(live.session_id, sid(2));
|
||||
assert_eq!(live.node_id, nid(200));
|
||||
assert_eq!(live.kind, LiveSessionKind::Structured);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn workstate_includes_busy_state_from_input_mediator() {
|
||||
let a = agent(10, "alpha");
|
||||
let f = fixture(std::slice::from_ref(&a));
|
||||
let busy = AgentBusyState::Busy {
|
||||
ticket: ticket_id(7),
|
||||
since_ms: 1_234,
|
||||
};
|
||||
f.input.set_busy(a.id, busy);
|
||||
|
||||
let out = f
|
||||
.usecase
|
||||
.execute(GetProjectWorkStateInput { project: f.project })
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(out.agents[0].busy, busy);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn workstate_ignores_live_agents_absent_from_manifest() {
|
||||
let a = agent(10, "alpha");
|
||||
let f = fixture(std::slice::from_ref(&a));
|
||||
insert_pty(&f.pty, sid(99), aid(999), nid(999));
|
||||
|
||||
let out = f
|
||||
.usecase
|
||||
.execute(GetProjectWorkStateInput { project: f.project })
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(out.agents.len(), 1);
|
||||
assert_eq!(out.agents[0].agent_id, a.id);
|
||||
assert_eq!(out.agents[0].live, None);
|
||||
}
|
||||
@ -25,6 +25,7 @@ import { TauriMemoryGateway } from "./memory";
|
||||
import { TauriEmbedderGateway } from "./embedder";
|
||||
import { TauriGitGateway } from "./git";
|
||||
import { TauriPermissionGateway } from "./permission";
|
||||
import { TauriWorkStateGateway } from "./workState";
|
||||
|
||||
function notImplemented(what: string): never {
|
||||
const err: GatewayError = {
|
||||
@ -57,6 +58,7 @@ export function createTauriGateways(): Gateways {
|
||||
memory: new TauriMemoryGateway(),
|
||||
embedder: new TauriEmbedderGateway(),
|
||||
permission: new TauriPermissionGateway(),
|
||||
workState: new TauriWorkStateGateway(),
|
||||
};
|
||||
}
|
||||
|
||||
@ -74,4 +76,5 @@ export {
|
||||
TauriEmbedderGateway,
|
||||
TauriGitGateway,
|
||||
TauriPermissionGateway,
|
||||
TauriWorkStateGateway,
|
||||
};
|
||||
|
||||
@ -31,6 +31,7 @@ import type {
|
||||
PermissionSet,
|
||||
Project,
|
||||
ProjectPermissions,
|
||||
ProjectWorkState,
|
||||
ProfileAvailability,
|
||||
ResumableAgent,
|
||||
Skill,
|
||||
@ -64,6 +65,7 @@ import type {
|
||||
TemplateGateway,
|
||||
TerminalGateway,
|
||||
TerminalHandle,
|
||||
WorkStateGateway,
|
||||
} from "@/ports";
|
||||
import { applyOperation, singleLeafTree } from "@/features/layout/layout";
|
||||
|
||||
@ -1648,6 +1650,19 @@ export class MockPermissionGateway implements PermissionGateway {
|
||||
}
|
||||
}
|
||||
|
||||
export class MockWorkStateGateway implements WorkStateGateway {
|
||||
private states = new Map<string, ProjectWorkState>();
|
||||
|
||||
/** Seeds the read-model returned for a project (deterministic tests/dev). */
|
||||
_setProjectWorkState(projectId: string, state: ProjectWorkState): void {
|
||||
this.states.set(projectId, structuredClone(state));
|
||||
}
|
||||
|
||||
async getProjectWorkState(projectId: string): Promise<ProjectWorkState> {
|
||||
return structuredClone(this.states.get(projectId) ?? { agents: [] });
|
||||
}
|
||||
}
|
||||
|
||||
function mostRestrictive(
|
||||
project?: PermissionSet["fallback"],
|
||||
agent?: PermissionSet["fallback"],
|
||||
@ -1676,6 +1691,7 @@ export function createMockGateways(): Gateways {
|
||||
memory: new MockMemoryGateway(),
|
||||
embedder: new MockEmbedderGateway(),
|
||||
permission: new MockPermissionGateway(),
|
||||
workState: new MockWorkStateGateway(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
17
frontend/src/adapters/workState.ts
Normal file
17
frontend/src/adapters/workState.ts
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Tauri adapter for {@link WorkStateGateway}.
|
||||
*
|
||||
* This is the only frontend place that knows the `get_project_work_state`
|
||||
* command name; features consume the gateway port through DI.
|
||||
*/
|
||||
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
|
||||
import type { ProjectWorkState } from "@/domain";
|
||||
import type { WorkStateGateway } from "@/ports";
|
||||
|
||||
export class TauriWorkStateGateway implements WorkStateGateway {
|
||||
getProjectWorkState(projectId: string): Promise<ProjectWorkState> {
|
||||
return invoke<ProjectWorkState>("get_project_work_state", { projectId });
|
||||
}
|
||||
}
|
||||
@ -133,6 +133,36 @@ export interface GatewayError {
|
||||
message: string;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Work state (UX conversations/delegations live read-model)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/** Live session currently associated with an agent in the work-state read-model. */
|
||||
export interface LiveWorkSession {
|
||||
nodeId: string;
|
||||
sessionId: string;
|
||||
kind: "pty" | "structured";
|
||||
}
|
||||
|
||||
/** Busy/idle status for an agent in the work-state read-model. */
|
||||
export type WorkBusyState =
|
||||
| { state: "idle" }
|
||||
| { state: "busy"; ticket: string; sinceMs: number };
|
||||
|
||||
/** One agent row in the project work-state read-model. */
|
||||
export interface AgentWorkState {
|
||||
agentId: string;
|
||||
name: string;
|
||||
profileId: string;
|
||||
live?: LiveWorkSession;
|
||||
busy: WorkBusyState;
|
||||
}
|
||||
|
||||
/** Minimal read-only live-state surface for a project. */
|
||||
export interface ProjectWorkState {
|
||||
agents: AgentWorkState[];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Permissions (LP1)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@ -38,6 +38,7 @@ import { SkillsPanel } from "@/features/skills";
|
||||
import { MemoryPanel } from "@/features/memory";
|
||||
import { EmbedderSettings } from "@/features/embedder";
|
||||
import { PermissionsPanel } from "@/features/permissions";
|
||||
import { ProjectWorkStatePanel } from "@/features/workstate";
|
||||
import { GitPanel, GitGraphView } from "@/features/git";
|
||||
import { Button, Input, Panel, Tabs, cn } from "@/shared";
|
||||
import { useGateways } from "@/app/di";
|
||||
@ -47,6 +48,7 @@ import { useProjects } from "./useProjects";
|
||||
type SidebarTab =
|
||||
| "projects"
|
||||
| "context"
|
||||
| "work"
|
||||
| "agents"
|
||||
| "templates"
|
||||
| "skills"
|
||||
@ -57,6 +59,7 @@ type SidebarTab =
|
||||
const SIDEBAR_TABS: { id: SidebarTab; label: string }[] = [
|
||||
{ id: "projects", label: "Projects" },
|
||||
{ id: "context", label: "Context" },
|
||||
{ id: "work", label: "Work" },
|
||||
{ id: "agents", label: "Agents" },
|
||||
{ id: "templates", label: "Templates" },
|
||||
{ id: "skills", label: "Skills" },
|
||||
@ -282,6 +285,14 @@ export function ProjectsView() {
|
||||
<p className="text-sm text-muted">Open a project to edit context.</p>
|
||||
)}
|
||||
|
||||
{/* Work-state panel */}
|
||||
{sidebarTab === "work" && active && (
|
||||
<ProjectWorkStatePanel projectId={active.id} />
|
||||
)}
|
||||
{sidebarTab === "work" && !active && (
|
||||
<p className="text-sm text-muted">Open a project to view work state.</p>
|
||||
)}
|
||||
|
||||
{/* Agents panel — only rendered when active project exists */}
|
||||
{sidebarTab === "agents" && active && (
|
||||
<AgentsPanel projectId={active.id} projectRoot={active.root} />
|
||||
|
||||
@ -12,7 +12,7 @@ import {
|
||||
fireEvent,
|
||||
} from "@testing-library/react";
|
||||
|
||||
import { MockAgentGateway, MockGitGateway, MockProfileGateway, MockProjectGateway, MockSystemGateway, MockTemplateGateway } from "@/adapters/mock";
|
||||
import { MockAgentGateway, MockGitGateway, MockProfileGateway, MockProjectGateway, MockSystemGateway, MockTemplateGateway, MockWorkStateGateway } from "@/adapters/mock";
|
||||
import type { Gateways } from "@/ports";
|
||||
import { DIProvider } from "@/app/di";
|
||||
import { ProjectsView } from "./ProjectsView";
|
||||
@ -33,6 +33,7 @@ function renderView(
|
||||
profile: new MockProfileGateway(),
|
||||
template: new MockTemplateGateway(agentGateway),
|
||||
git: new MockGitGateway(),
|
||||
workState: new MockWorkStateGateway(),
|
||||
} as unknown as Gateways;
|
||||
return {
|
||||
project,
|
||||
@ -130,6 +131,20 @@ describe("ProjectsView (with MockProjectGateway)", () => {
|
||||
expect([a.id, b.id]).toHaveLength(2);
|
||||
});
|
||||
|
||||
it("shows and renders the Work sidebar tab for an active project", async () => {
|
||||
const project = new MockProjectGateway();
|
||||
await project.createProject("alpha", "/p/a");
|
||||
renderView(project);
|
||||
|
||||
await screen.findByText("/p/a");
|
||||
fireEvent.click(screen.getByRole("button", { name: "Open" }));
|
||||
await screen.findByRole("tab", { name: "alpha" });
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "Work" }));
|
||||
|
||||
expect(await screen.findByText("No agent work state.")).toBeTruthy();
|
||||
});
|
||||
|
||||
it("closing a tab removes it from the tab bar", async () => {
|
||||
renderView();
|
||||
await createProject("alpha", "/home/me/alpha");
|
||||
|
||||
106
frontend/src/features/workstate/ProjectWorkStatePanel.tsx
Normal file
106
frontend/src/features/workstate/ProjectWorkStatePanel.tsx
Normal file
@ -0,0 +1,106 @@
|
||||
/**
|
||||
* Read-only project work-state panel: one row per agent, showing live/offline
|
||||
* and idle/busy state from the backend read-model.
|
||||
*/
|
||||
|
||||
import type { AgentWorkState } from "@/domain";
|
||||
import { Button, Panel, Spinner, cn } from "@/shared";
|
||||
import { useProjectWorkState } from "./useProjectWorkState";
|
||||
|
||||
export interface ProjectWorkStatePanelProps {
|
||||
projectId: string;
|
||||
}
|
||||
|
||||
function shortTicket(ticket: string): string {
|
||||
return ticket.length <= 8 ? ticket : ticket.slice(0, 8);
|
||||
}
|
||||
|
||||
function AgentRow({ agent }: { agent: AgentWorkState }) {
|
||||
const live = agent.live !== undefined;
|
||||
const busy = agent.busy.state === "busy";
|
||||
return (
|
||||
<li className="flex items-center justify-between gap-3 py-2 first:pt-0 last:pb-0">
|
||||
<span className="flex min-w-0 flex-col gap-0.5">
|
||||
<span className="truncate text-sm font-medium text-content">
|
||||
{agent.name}
|
||||
</span>
|
||||
<code className="truncate text-xs text-muted">{agent.profileId}</code>
|
||||
</span>
|
||||
<span className="flex shrink-0 items-center gap-1.5">
|
||||
<span
|
||||
className={cn(
|
||||
"rounded-full px-2 py-0.5 text-xs font-medium",
|
||||
live
|
||||
? "bg-success/15 text-success"
|
||||
: "bg-raised text-muted",
|
||||
)}
|
||||
>
|
||||
{live ? "Live" : "Offline"}
|
||||
</span>
|
||||
<span
|
||||
className={cn(
|
||||
"rounded-full px-2 py-0.5 text-xs font-medium",
|
||||
busy
|
||||
? "bg-warning/15 text-warning"
|
||||
: "bg-raised text-muted",
|
||||
)}
|
||||
>
|
||||
{busy ? "Busy" : "Idle"}
|
||||
</span>
|
||||
{agent.busy.state === "busy" && (
|
||||
<code
|
||||
aria-label={`busy ticket ${shortTicket(agent.busy.ticket)}`}
|
||||
title={agent.busy.ticket}
|
||||
className="rounded bg-raised px-1.5 py-0.5 text-xs text-muted"
|
||||
>
|
||||
{shortTicket(agent.busy.ticket)}
|
||||
</code>
|
||||
)}
|
||||
</span>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
export function ProjectWorkStatePanel({ projectId }: ProjectWorkStatePanelProps) {
|
||||
const vm = useProjectWorkState(projectId);
|
||||
const agents = vm.state?.agents ?? [];
|
||||
|
||||
return (
|
||||
<Panel
|
||||
title="Work"
|
||||
actions={
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={() => void vm.refresh()}
|
||||
loading={vm.busy}
|
||||
>
|
||||
Refresh
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
{vm.error && (
|
||||
<p
|
||||
role="alert"
|
||||
className="mb-3 rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-sm text-danger"
|
||||
>
|
||||
{vm.error}
|
||||
</p>
|
||||
)}
|
||||
{vm.busy && vm.state === null ? (
|
||||
<div className="flex items-center gap-2 text-sm text-muted">
|
||||
<Spinner size={14} />
|
||||
<span>Loading work state…</span>
|
||||
</div>
|
||||
) : agents.length === 0 ? (
|
||||
<p className="text-sm text-muted">No agent work state.</p>
|
||||
) : (
|
||||
<ul className="flex flex-col divide-y divide-border">
|
||||
{agents.map((agent) => (
|
||||
<AgentRow key={agent.agentId} agent={agent} />
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</Panel>
|
||||
);
|
||||
}
|
||||
6
frontend/src/features/workstate/index.ts
Normal file
6
frontend/src/features/workstate/index.ts
Normal file
@ -0,0 +1,6 @@
|
||||
/** Work-state feature: read-only live/busy read-model for a project. */
|
||||
|
||||
export { ProjectWorkStatePanel } from "./ProjectWorkStatePanel";
|
||||
export type { ProjectWorkStatePanelProps } from "./ProjectWorkStatePanel";
|
||||
export { useProjectWorkState } from "./useProjectWorkState";
|
||||
export type { ProjectWorkStateViewModel } from "./useProjectWorkState";
|
||||
73
frontend/src/features/workstate/useProjectWorkState.ts
Normal file
73
frontend/src/features/workstate/useProjectWorkState.ts
Normal file
@ -0,0 +1,73 @@
|
||||
/**
|
||||
* View-model hook for the project work-state read-model.
|
||||
*
|
||||
* It consumes the WorkStateGateway only, and optionally subscribes to existing
|
||||
* domain events through SystemGateway to refresh the read-only snapshot.
|
||||
*/
|
||||
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
|
||||
import type { GatewayError, ProjectWorkState } from "@/domain";
|
||||
import { useGateways } from "@/app/di";
|
||||
|
||||
export interface ProjectWorkStateViewModel {
|
||||
state: ProjectWorkState | null;
|
||||
error: string | null;
|
||||
busy: boolean;
|
||||
refresh: () => Promise<void>;
|
||||
}
|
||||
|
||||
function describe(e: unknown): string {
|
||||
if (e && typeof e === "object" && "message" in e) {
|
||||
return String((e as GatewayError).message);
|
||||
}
|
||||
return String(e);
|
||||
}
|
||||
|
||||
export function useProjectWorkState(projectId: string): ProjectWorkStateViewModel {
|
||||
const { workState, system } = useGateways();
|
||||
const [state, setState] = useState<ProjectWorkState | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [busy, setBusy] = useState(false);
|
||||
|
||||
const refresh = useCallback(async () => {
|
||||
setBusy(true);
|
||||
setError(null);
|
||||
try {
|
||||
setState(await workState.getProjectWorkState(projectId));
|
||||
} catch (e) {
|
||||
setError(describe(e));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}, [projectId, workState]);
|
||||
|
||||
useEffect(() => {
|
||||
void refresh();
|
||||
}, [refresh]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!system) return;
|
||||
let unsubscribe: (() => void) | undefined;
|
||||
let cancelled = false;
|
||||
void system.onDomainEvent((event) => {
|
||||
if (
|
||||
event.type === "agentLaunched" ||
|
||||
event.type === "agentExited" ||
|
||||
event.type === "agentBusyChanged" ||
|
||||
event.type === "orchestratorRequestProcessed"
|
||||
) {
|
||||
void refresh();
|
||||
}
|
||||
}).then((u) => {
|
||||
if (cancelled) u();
|
||||
else unsubscribe = u;
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
unsubscribe?.();
|
||||
};
|
||||
}, [refresh, system]);
|
||||
|
||||
return { state, error, busy, refresh };
|
||||
}
|
||||
111
frontend/src/features/workstate/workstate.test.tsx
Normal file
111
frontend/src/features/workstate/workstate.test.tsx
Normal file
@ -0,0 +1,111 @@
|
||||
import { describe, it, expect, vi } from "vitest";
|
||||
import { render, screen, waitFor } from "@testing-library/react";
|
||||
|
||||
import { DIProvider } from "@/app/di";
|
||||
import { MockSystemGateway, MockWorkStateGateway } from "@/adapters/mock";
|
||||
import type { Gateways } from "@/ports";
|
||||
import { ProjectWorkStatePanel } from "./ProjectWorkStatePanel";
|
||||
|
||||
const PROJECT_ID = "project-work-state-test";
|
||||
|
||||
function renderPanel(
|
||||
workState: MockWorkStateGateway = new MockWorkStateGateway(),
|
||||
system: MockSystemGateway = new MockSystemGateway(),
|
||||
) {
|
||||
const gateways = { workState, system } as unknown as Gateways;
|
||||
return {
|
||||
workState,
|
||||
system,
|
||||
...render(
|
||||
<DIProvider gateways={gateways}>
|
||||
<ProjectWorkStatePanel projectId={PROJECT_ID} />
|
||||
</DIProvider>,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
describe("ProjectWorkStatePanel", () => {
|
||||
it("renders the empty state", async () => {
|
||||
renderPanel();
|
||||
|
||||
expect(await screen.findByText("No agent work state.")).toBeTruthy();
|
||||
});
|
||||
|
||||
it("renders an idle offline agent", async () => {
|
||||
const workState = new MockWorkStateGateway();
|
||||
workState._setProjectWorkState(PROJECT_ID, {
|
||||
agents: [
|
||||
{
|
||||
agentId: "agent-1",
|
||||
name: "Planner",
|
||||
profileId: "codex",
|
||||
busy: { state: "idle" },
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
renderPanel(workState);
|
||||
|
||||
expect(await screen.findByText("Planner")).toBeTruthy();
|
||||
expect(screen.getByText("Offline")).toBeTruthy();
|
||||
expect(screen.getByText("Idle")).toBeTruthy();
|
||||
});
|
||||
|
||||
it("renders a live busy agent with a short ticket", async () => {
|
||||
const workState = new MockWorkStateGateway();
|
||||
workState._setProjectWorkState(PROJECT_ID, {
|
||||
agents: [
|
||||
{
|
||||
agentId: "agent-2",
|
||||
name: "Builder",
|
||||
profileId: "claude",
|
||||
live: {
|
||||
nodeId: "node-a",
|
||||
sessionId: "session-a",
|
||||
kind: "pty",
|
||||
},
|
||||
busy: {
|
||||
state: "busy",
|
||||
ticket: "4c65d981-da5e-412d-85ed-3b9779b670fa",
|
||||
sinceMs: 123,
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
renderPanel(workState);
|
||||
|
||||
expect(await screen.findByText("Builder")).toBeTruthy();
|
||||
expect(screen.getByText("Live")).toBeTruthy();
|
||||
expect(screen.getByText("Busy")).toBeTruthy();
|
||||
expect(screen.getByLabelText("busy ticket 4c65d981")).toBeTruthy();
|
||||
});
|
||||
|
||||
it("refreshes when a relevant domain event fires", async () => {
|
||||
const workState = new MockWorkStateGateway();
|
||||
const system = new MockSystemGateway();
|
||||
renderPanel(workState, system);
|
||||
|
||||
await screen.findByText("No agent work state.");
|
||||
const spy = vi.spyOn(workState, "getProjectWorkState");
|
||||
workState._setProjectWorkState(PROJECT_ID, {
|
||||
agents: [
|
||||
{
|
||||
agentId: "agent-3",
|
||||
name: "Responder",
|
||||
profileId: "gemini",
|
||||
busy: { state: "busy", ticket: "ticket-123456789", sinceMs: 456 },
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
system.emit({
|
||||
type: "agentBusyChanged",
|
||||
agentId: "agent-3",
|
||||
busy: true,
|
||||
});
|
||||
|
||||
expect(await screen.findByText("Responder")).toBeTruthy();
|
||||
await waitFor(() => expect(spy).toHaveBeenCalled());
|
||||
});
|
||||
});
|
||||
@ -33,6 +33,7 @@ import type {
|
||||
PermissionSet,
|
||||
Project,
|
||||
ProjectPermissions,
|
||||
ProjectWorkState,
|
||||
ProfileAvailability,
|
||||
ResumableAgent,
|
||||
Skill,
|
||||
@ -639,6 +640,12 @@ export interface PermissionGateway {
|
||||
): Promise<EffectivePermissions | null>;
|
||||
}
|
||||
|
||||
/** Read-only live work-state read-model for conversations/delegations. */
|
||||
export interface WorkStateGateway {
|
||||
/** Reads the current per-agent live/offline and idle/busy state for a project. */
|
||||
getProjectWorkState(projectId: string): Promise<ProjectWorkState>;
|
||||
}
|
||||
|
||||
/**
|
||||
* The full set of gateways the app depends on, injected via the DI provider.
|
||||
* The composition (real vs mock) is chosen in `app/`.
|
||||
@ -658,4 +665,5 @@ export interface Gateways {
|
||||
memory: MemoryGateway;
|
||||
embedder: EmbedderGateway;
|
||||
permission: PermissionGateway;
|
||||
workState: WorkStateGateway;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user