diff --git a/plugins/miam/.claude-plugin/plugin.json b/plugins/miam/.claude-plugin/plugin.json index 1785e2a..7b240a9 100644 --- a/plugins/miam/.claude-plugin/plugin.json +++ b/plugins/miam/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "miam", "displayName": "MIAM", - "version": "0.7.0", + "version": "0.7.1", "description": "Délégation de tâches à un modèle local géré par MIAM (Mon IA Manager) : règles de délégation, gains en tokens et usage Claude (5 h, hebdo) en couleur", "author": { "name": "Ange-Marie MAURIN" diff --git a/plugins/miam/README.md b/plugins/miam/README.md index 3dc7e7a..be6ef72 100644 --- a/plugins/miam/README.md +++ b/plugins/miam/README.md @@ -57,7 +57,7 @@ Les subagents ne sont pas concernés. Si MIAM ne répond pas, ou si la sortie ne ## Ligne d'état : gains et usage Claude -Une seule ligne, sans coût en tokens (`🟢 MIAM net ~4k (cumul ~35k) · 5 h 🟩🟩⬛⬛⬛ 42 % (1 h 53) · hebdo 🟩🟩🟩⬛⬛ 53 % (3 j 20 h)`) : +Une seule ligne, sans coût en tokens (`🟢 MIAM net ~4k (cumul ~35k)🟢 · 5 h 🟩🟩⬛⬛⬛ 42 % (1 h 53) · hebdo 🟩🟩🟩⬛⬛ 53 % (3 j 20 h)`) : - le gain net, 🟢 s'il est positif, 🔴 s'il est négatif ; - l'usage Claude sur 5 h et sur la semaine : barre, pourcentage et temps avant la remise à zéro. La barre est verte, orange à partir de 70 %, rouge à partir de 90 %. Ces chiffres viennent de la dernière réponse de l'API : ils n'apparaissent qu'après un premier échange, et seulement avec un abonnement. diff --git a/plugins/miam/hooks/economies.test.ts b/plugins/miam/hooks/economies.test.ts index a5c9d3b..aafd353 100644 --- a/plugins/miam/hooks/economies.test.ts +++ b/plugins/miam/hooks/economies.test.ts @@ -34,18 +34,18 @@ test('affichage', () => { expect(court(-350)).toBe('-350') const cumul = { delegations: 9, evites: 40000, pilotage: 5000, corrections: 0 } expect(ligne({ delegations: 2, evites: 6100, pilotage: 1500, corrections: 0 }, cumul)) - .toBe('🟢 MIAM net ~4,6k (cumul ~35k)') + .toBe('🟢 MIAM net ~4,6k (cumul ~35k)🟢') expect(ligne({ delegations: 2, evites: 6100, pilotage: 1500, corrections: 600 }, cumul)) - .toBe('🟢 MIAM net ~4k (cumul ~35k)') + .toBe('🟢 MIAM net ~4k (cumul ~35k)🟢') expect(ligne({ delegations: 1, evites: 900, pilotage: 0, corrections: 0 }, cumul)) - .toBe('🟢 MIAM net ~900 (cumul ~35k)') + .toBe('🟢 MIAM net ~900 (cumul ~35k)🟢') expect(ligne(VIDE, cumul)).toBe('🟢 MIAM cumul ~35k') expect(ligne(VIDE, VIDE)).toBe('') }) test('rouge si le gain est négatif, vert s’il est positif, rien à zéro', () => { const perte = { delegations: 1, evites: 500, pilotage: 2000, corrections: 0 } - expect(ligne(perte, perte)).toBe('🔴 MIAM net ~-1,5k (cumul ~-1,5k)') + expect(ligne(perte, perte)).toBe('🔴 MIAM net ~-1,5k (cumul ~-1,5k)🔴') expect(ligne(VIDE, perte)).toBe('🔴 MIAM cumul ~-1,5k') expect([1, -1, 0].map(pastille)).toEqual(['🟢 ', '🔴 ', '']) }) diff --git a/plugins/miam/hooks/economies.ts b/plugins/miam/hooks/economies.ts index c5bdcff..be30f90 100644 --- a/plugins/miam/hooks/economies.ts +++ b/plugins/miam/hooks/economies.ts @@ -120,7 +120,7 @@ export function pastille(gain: number): string { // Gain pour la ligne d'état ; vide tant que rien n'a été délégué. export function ligne(session: Totaux, cumul: Totaux): string { if (session.delegations) { - return `${pastille(net(session))}MIAM net ~${court(net(session))} (cumul ~${court(net(cumul))})` + return `${pastille(net(session))}MIAM net ~${court(net(session))} (cumul ~${court(net(cumul))})${pastille(net(cumul)).trimEnd()}` } return cumul.delegations ? `${pastille(net(cumul))}MIAM cumul ~${court(net(cumul))}` : '' } diff --git a/plugins/miam/hooks/register.test.tsx b/plugins/miam/hooks/register.test.tsx index dc5c11a..21d3f5d 100644 --- a/plugins/miam/hooks/register.test.tsx +++ b/plugins/miam/hooks/register.test.tsx @@ -59,7 +59,7 @@ test('une délégation du subagent est comptée, son pilotage aussi, et MIAM les cache_creation_input_tokens: 0, }, } as never) - expect(statuts.at(-1)).toBe('🟢 MIAM net ~2,9k (cumul ~2,9k)') + expect(statuts.at(-1)).toBe('🟢 MIAM net ~2,9k (cumul ~2,9k)🟢') expect(store.get('cumul')).toEqual({ delegations: 1, evites: 4900, pilotage: 2000, corrections: 0 }) await attendre(() => false) // laisse finir le 1er envoi et demander la période suivante @@ -105,7 +105,7 @@ test('les reprises par l’agent principal d’un fichier écrit par MIAM sont d agentId: 'a9', } as never) // par un subagent : dans son pilotage - expect(statuts.at(-1)).toBe('🟢 MIAM net ~2,3k (cumul ~2,3k)') + expect(statuts.at(-1)).toBe('🟢 MIAM net ~2,3k (cumul ~2,3k)🟢') expect(store.get('cumul')).toEqual({ delegations: 1, evites: 2390, pilotage: 0, corrections: 130 }) const attente = store.get('a_envoyer') as { type: string; id: string; cout?: number }[] expect(attente.map(ev => [ev.type, ev.id, ev.cout])).toEqual([ diff --git a/plugins/miam/hooks/register.tsx b/plugins/miam/hooks/register.tsx index 815240e..3b7e93d 100644 --- a/plugins/miam/hooks/register.tsx +++ b/plugins/miam/hooks/register.tsx @@ -45,7 +45,7 @@ async function rafraichir($: EngineInterface, ecran: Ecran): Promise { const usage = fenetres(ecran.limites, await $.clock.now()).map(f => ligneFenetre(f, BARRE)) const texte = [ligne(ecran.session, cumul), ...usage].filter(Boolean).join(' · ') || undefined if (texte !== ecran.affichee) { - ecran.affichee = texte + " MIAMMMM" + ecran.affichee = texte $.ui.status(texte) } }