@roomi-fields/grillhouse 0.48.0 → 0.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +68 -0
  3. package/agents/direct.md +9 -0
  4. package/cadre/templates/projet/.github/workflows/ci.yml +6 -0
  5. package/cadre/templates/projet/.github/workflows/nuit.yml +9 -2
  6. package/cadre/templates/projet/CLAUDE.md +9 -5
  7. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  8. package/cadre/templates/turbo/paquets.json +3 -1
  9. package/cadre/templates/turbo/sans-paquets.json +3 -1
  10. package/charte.md +40 -14
  11. package/dist/temporal/circuit/appel.d.ts +4 -1
  12. package/dist/temporal/circuit/appel.js +15 -1
  13. package/dist/temporal/circuit/appel.js.map +1 -1
  14. package/dist/temporal/circuit/client.d.ts +7 -1
  15. package/dist/temporal/circuit/client.js +54 -1
  16. package/dist/temporal/circuit/client.js.map +1 -1
  17. package/dist/temporal/circuit/commande.js +30 -57
  18. package/dist/temporal/circuit/commande.js.map +1 -1
  19. package/dist/temporal/circuit/contrat.d.ts +2 -1
  20. package/dist/temporal/circuit/contrat.js +2 -1
  21. package/dist/temporal/circuit/contrat.js.map +1 -1
  22. package/dist/temporal/circuit/deroule.js +9 -2
  23. package/dist/temporal/circuit/deroule.js.map +1 -1
  24. package/dist/temporal/file/contrat.d.ts +16 -2
  25. package/dist/temporal/file/contrat.js +27 -3
  26. package/dist/temporal/file/contrat.js.map +1 -1
  27. package/dist/temporal/file/deroule.js +4 -4
  28. package/dist/temporal/file/deroule.js.map +1 -1
  29. package/dist/temporal/nuits/activites.d.ts +1 -15
  30. package/dist/temporal/nuits/activites.js +3 -62
  31. package/dist/temporal/nuits/activites.js.map +1 -1
  32. package/dist/temporal/nuits/contrat.d.ts +3 -21
  33. package/dist/temporal/nuits/deroule.js +38 -74
  34. package/dist/temporal/nuits/deroule.js.map +1 -1
  35. package/dist/temporal/places/client.d.ts +3 -16
  36. package/dist/temporal/places/client.js +3 -26
  37. package/dist/temporal/places/client.js.map +1 -1
  38. package/dist/temporal/places/contrat.d.ts +15 -51
  39. package/dist/temporal/places/contrat.js +3 -13
  40. package/dist/temporal/places/contrat.js.map +1 -1
  41. package/dist/temporal/places/deroule.js +11 -61
  42. package/dist/temporal/places/deroule.js.map +1 -1
  43. package/dist/temporal/tickets/activites.js +4 -2
  44. package/dist/temporal/tickets/activites.js.map +1 -1
  45. package/dist/temporal/tickets/contrat.d.ts +2 -1
  46. package/docs/ARCHITECTURE.md +310 -115
  47. package/docs/CADRE.md +16 -13
  48. package/docs/INTERFACE.md +90 -25
  49. package/hooks/hooks.json +9 -0
  50. package/hooks/register.tsx +59 -5
  51. package/package.json +1 -1
  52. package/scripts/activites.mjs +271 -42
  53. package/scripts/aiguillage.mjs +4 -1
  54. package/scripts/bilan.mjs +125 -2
  55. package/scripts/circuit.mjs +233 -159
  56. package/scripts/circuits-cles.d.mts +3 -3
  57. package/scripts/circuits-cles.mjs +6 -5
  58. package/scripts/coeurs-dedies.mjs +4 -4
  59. package/scripts/commandes-composees.mjs +12 -5
  60. package/scripts/dette.d.ts +2 -1
  61. package/scripts/dette.mjs +49 -6
  62. package/scripts/direct.mjs +343 -0
  63. package/scripts/droits.mjs +19 -0
  64. package/scripts/effets.mjs +4 -4
  65. package/scripts/engendres.mjs +2 -1
  66. package/scripts/enveloppe/enveloppe.mjs +67 -13
  67. package/scripts/enveloppe/lancer.sh +14 -3
  68. package/scripts/enveloppe/paquets-du-plan.mjs +9 -0
  69. package/scripts/enveloppe/travail-de-la-copie.mjs +119 -21
  70. package/scripts/etapes.mjs +3 -3
  71. package/scripts/faits-du-circuit.mjs +12 -11
  72. package/scripts/fermeture-de-la-machine.d.mts +4 -4
  73. package/scripts/fermeture-de-la-machine.mjs +10 -20
  74. package/scripts/fichiers-nommes.mjs +27 -1
  75. package/scripts/file-des-tickets.d.mts +18 -1
  76. package/scripts/file-des-tickets.mjs +63 -15
  77. package/scripts/grillhouse-maj.mjs +13 -25
  78. package/scripts/groupe-cles.d.mts +6 -0
  79. package/scripts/groupe-cles.mjs +29 -1
  80. package/scripts/integration/file.mjs +148 -37
  81. package/scripts/jointure.d.ts +17 -3
  82. package/scripts/journal-des-etats.d.mts +16 -0
  83. package/scripts/journal-des-etats.mjs +44 -2
  84. package/scripts/journal.mjs +3 -0
  85. package/scripts/langages/c/commandes.mjs +5 -5
  86. package/scripts/langages/c/composants.mjs +13 -5
  87. package/scripts/langages/cargo/commandes.mjs +5 -6
  88. package/scripts/langages/python/commandes.mjs +5 -5
  89. package/scripts/langages/python/composants.mjs +10 -2
  90. package/scripts/langages/typescript/composants.mjs +10 -3
  91. package/scripts/langages/typescript/construire.mjs +2 -0
  92. package/scripts/langages/typescript/exemples.mjs +33 -1
  93. package/scripts/langages/typescript/index.mjs +19 -0
  94. package/scripts/langages/typescript/migrations/0.49.0-tests-equipes.mjs +32 -0
  95. package/scripts/langages/typescript/tests-de-nuit.mjs +152 -32
  96. package/scripts/langages/typescript/tests-du-poste.mjs +65 -23
  97. package/scripts/langages/typescript/titres-de-tests.mjs +11 -7
  98. package/scripts/langages/typescript/turbo-des-paquets.mjs +21 -4
  99. package/scripts/langages/typescript/verifier.mjs +3 -5
  100. package/scripts/langages/typescript/verrou-des-dependances.mjs +161 -0
  101. package/scripts/langages/typescript/vitest-config/cibles.mjs +57 -6
  102. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +11 -5
  103. package/scripts/langages/typescript/vitest.nuit.config.mjs +53 -5
  104. package/scripts/machine.mjs +1 -1
  105. package/scripts/mesure/base-de-passe.mjs +2 -1
  106. package/scripts/migrations/0.49.0-reservation-de-trois-coeurs.mjs +30 -0
  107. package/scripts/migrations.mjs +2 -0
  108. package/scripts/nuit.sh +97 -2
  109. package/scripts/paquet.mjs +16 -5
  110. package/scripts/paquets.d.ts +4 -0
  111. package/scripts/paquets.mjs +57 -0
  112. package/scripts/passe-de-la-machine.mjs +4 -7
  113. package/scripts/places-de-la-machine.mjs +55 -42
  114. package/scripts/places-du-serveur.mjs +2 -2
  115. package/scripts/plafond-de-la-machine.d.mts +7 -13
  116. package/scripts/plafond-de-la-machine.mjs +19 -35
  117. package/scripts/prefixe-des-tickets.mjs +1 -1
  118. package/scripts/references-changees.mjs +159 -0
  119. package/scripts/regles-des-places.d.mts +8 -31
  120. package/scripts/regles-des-places.mjs +14 -64
  121. package/scripts/repli-de-la-nuit.mjs +112 -0
  122. package/scripts/reponses-du-circuit.d.mts +2 -2
  123. package/scripts/reponses-du-circuit.mjs +21 -12
  124. package/scripts/reprise.mjs +27 -8
  125. package/scripts/resultats.mjs +21 -9
  126. package/scripts/seances.mjs +258 -40
  127. package/scripts/services-du-noyau.mjs +3 -0
  128. package/scripts/sous-commandes.mjs +24 -7
  129. package/scripts/superviseur.mjs +185 -39
  130. package/scripts/tableau.mjs +220 -89
  131. package/scripts/taches-du-graphe.mjs +84 -4
  132. package/scripts/ticket.mjs +345 -0
  133. package/scripts/transitions.d.mts +44 -0
  134. package/scripts/transitions.mjs +173 -13
  135. package/scripts/un-commit-par-ticket.mjs +4 -3
  136. package/scripts/verdict-de-la-nuit.mjs +47 -20
  137. package/scripts/verrou-de-fichier.mjs +2 -2
  138. package/scripts/verrous/ecriture-hors-enveloppe.mjs +86 -0
  139. package/scripts/verrous/verrou.mjs +17 -1
  140. package/skills/developpeur/SKILL.md +1 -1
  141. package/skills/direct/SKILL.md +57 -0
  142. package/skills/explorateur/SKILL.md +10 -6
  143. package/skills/pitmaster/SKILL.md +34 -14
  144. package/skills/pitmaster/references/consigne-agent.md +7 -1
  145. package/skills/relecteur/SKILL.md +8 -0
  146. package/skills/testwriter/SKILL.md +10 -0
  147. package/scripts/ticket.sh +0 -25
package/scripts/bilan.mjs CHANGED
@@ -98,6 +98,7 @@ import path from 'node:path';
98
98
  import { StringDecoder } from 'node:string_decoder';
99
99
  import { REGISTRE } from './adresse-du-registre.mjs';
100
100
  import { lireLaConsommation } from './consommation-des-passes.mjs';
101
+ import { lireLeJournal } from './journal-des-etats.mjs';
101
102
  import { pathToFileURL } from 'node:url';
102
103
  import {
103
104
  AGENTS_DU_LOT,
@@ -219,6 +220,81 @@ function longueur(l) {
219
220
  const commun = ([d, f], l) =>
220
221
  longueur(l.map(([a, b]) => [Math.max(a, d), Math.min(b, f)]).filter(([a, b]) => b > a));
221
222
 
223
+ // The disjoint intervals of the union of <l>, in order.
224
+ function fusion(l) {
225
+ const out = [];
226
+ for (const [d, f] of [...l].filter(([a, b]) => b > a).sort((x, y) => x[0] - y[0])) {
227
+ const dernier = out.at(-1);
228
+ if (dernier && d <= dernier[1]) {
229
+ dernier[1] = Math.max(dernier[1], f);
230
+ } else {
231
+ out.push([d, f]);
232
+ }
233
+ }
234
+ return out;
235
+ }
236
+ // The parts of the disjoint intervals <a> that lie in the intervals <b>.
237
+ const dans = (a, b) =>
238
+ fusion(
239
+ a.flatMap(([d, f]) => b.map(([x, y]) => [Math.max(d, x), Math.min(f, y)]).filter(([x, y]) => y > x))
240
+ );
241
+ // The parts of the intervals <a> outside the intervals <b>.
242
+ function sansLes(a, b) {
243
+ const sans = fusion(b);
244
+ return a.flatMap(([d, f]) => {
245
+ const out = [];
246
+ let x = d;
247
+ for (const [y, z] of sans) {
248
+ if (z <= x || y >= f) {
249
+ continue;
250
+ }
251
+ if (y > x) {
252
+ out.push([x, y]);
253
+ }
254
+ x = Math.max(x, z);
255
+ }
256
+ if (x < f) {
257
+ out.push([x, f]);
258
+ }
259
+ return out;
260
+ });
261
+ }
262
+
263
+ // The intervals of the traces of <journal> (the lines of the ticket's journal of states) by cause:
264
+ // the waits for a place (`places` `attente` to the next `prise`, the reason naming another circuit
265
+ // included), the waits of the queue (`file` `attente` to the next line `file`, those a line gives
266
+ // `autre` apart). A wait never closed counts nothing.
267
+ function tracesDuJournal(journal, ticket) {
268
+ const lignes = journal
269
+ .filter(l => l.ticket === ticket && Number.isFinite(Date.parse(l.ts)))
270
+ .map((l, i) => ({ l, i, t: Date.parse(l.ts) }))
271
+ .sort((x, y) => x.t - y.t || x.i - y.i);
272
+ const place = [];
273
+ const autre = [];
274
+ const file = [];
275
+ let attendPlace = null;
276
+ let attendFile = null;
277
+ for (const { l, t } of lignes) {
278
+ if (l.genre === 'places') {
279
+ if (l.etape === 'attente') {
280
+ attendPlace ??= t;
281
+ } else if (l.etape === 'prise' && attendPlace !== null) {
282
+ place.push([attendPlace, t]);
283
+ attendPlace = null;
284
+ }
285
+ } else if (l.genre === 'file') {
286
+ if (attendFile) {
287
+ (attendFile.autre ? autre : file).push([attendFile.t, t]);
288
+ attendFile = null;
289
+ }
290
+ if (l.etape === 'attente') {
291
+ attendFile = { t, autre: Boolean(l.autre) };
292
+ }
293
+ }
294
+ }
295
+ return { place, autre, file };
296
+ }
297
+
222
298
  // The bilan of <ticket> from the register's lines <lignes> (of its project), the results the
223
299
  // circuit kept <entrees> (`<ticket>.fiches.jsonl`), the circuit's state <etat> (or null), the
224
300
  // project's night <nuit> and the times of the owner's messages in the supervisor's sessions the
@@ -230,6 +306,7 @@ export function bilan({
230
306
  etat = null,
231
307
  nuit = NUIT,
232
308
  duResponsable = [],
309
+ journal = [],
233
310
  maintenant = Date.now(),
234
311
  }) {
235
312
  // The sessions the circuit launched, by their id.
@@ -403,6 +480,40 @@ export function bilan({
403
480
  0,
404
481
  mur - longueur([...segments.map(fenetre).filter(([d, f]) => f > d), ...attentes])
405
482
  );
483
+ // The causes of « entre deux étapes »: each instant of the gaps goes to the first cause of the
484
+ // list that a trace covers (a session starting, a place or cores, another circuit, the queue),
485
+ // the rest unattributed.
486
+ const trous = sansLes(
487
+ mur ? [[debut, fin]] : [],
488
+ [...segments.map(fenetre), ...attentes.map(([d, f]) => [Math.max(d, debut), Math.min(f, fin)])]
489
+ );
490
+ const traces = tracesDuJournal(journal, ticket);
491
+ const demarrages = entrees
492
+ .filter(e => e.role === CIRCUIT && e.lancement)
493
+ .flatMap(e => {
494
+ const d = Date.parse(e.date ?? '');
495
+ const s = derniere.get(e.lancement.seance);
496
+ const f = s ? Date.parse(s.debut) : NaN;
497
+ return f > d ? [[d, f]] : [];
498
+ });
499
+ let reste = trous;
500
+ const causes = {};
501
+ for (const [cause, l] of [
502
+ ['seance', demarrages],
503
+ ['place', traces.place],
504
+ ['autre', traces.autre],
505
+ ['file', traces.file],
506
+ ]) {
507
+ const pris = dans(reste, fusion(l));
508
+ causes[cause] = longueur(pris);
509
+ reste = sansLes(reste, pris);
510
+ }
511
+ const attribue = Object.values(causes).reduce((m, x) => m + x, 0);
512
+ causes.nonAttribue = Math.max(0, categories.intervalles.ms - attribue);
513
+ categories.intervalles.causes = causes;
514
+ // Whether the journal holds a line of the ticket: without one (a journal from before the lot),
515
+ // the text keeps its lines as they were.
516
+ categories.intervalles.journale = journal.some(l => l.ticket === ticket);
406
517
  for (const c of Object.values(categories)) {
407
518
  c.jetons = Math.round(c.jetons);
408
519
  c.cache = Math.round(c.cache);
@@ -563,7 +674,18 @@ export function texteDuBilan(b, avant, depassent = []) {
563
674
  const paye = new Set(['travail', 'sansEffet', 'questionnement']);
564
675
  const q = b.questionnement;
565
676
  const pluriel = (n, mot) => `${n} ${mot}${n > 1 ? 's' : ''}`;
566
- const lignes = CATEGORIES.map(([k, nom]) => {
677
+ const causes = b.categories.intervalles.causes;
678
+ const sousLignes =
679
+ causes && b.categories.intervalles.journale
680
+ ? [
681
+ ["démarrage d'une séance", 'seance'],
682
+ ['cœurs ou place', 'place'],
683
+ ['autre circuit ou projet', 'autre'],
684
+ ['file', 'file'],
685
+ ['non attribué', 'nonAttribue'],
686
+ ].map(([nom, k]) => ` - ${nom} : ${minutes(causes[k])} min`)
687
+ : [];
688
+ const lignes = CATEGORIES.flatMap(([k, nom]) => {
567
689
  const c = b.categories[k];
568
690
  const plus =
569
691
  (k === SUPERVISEUR || k === RESPONSABLE) && c.n
@@ -573,7 +695,7 @@ export function texteDuBilan(b, avant, depassent = []) {
573
695
  : paye.has(k)
574
696
  ? `, ${dollars(c.cout)} $`
575
697
  : '';
576
- return `- ${nom} : ${minutes(c.ms)} min${plus}`;
698
+ return [`- ${nom} : ${minutes(c.ms)} min${plus}`, ...(k === 'intervalles' ? sousLignes : [])];
577
699
  });
578
700
  const t = b.tri;
579
701
  const verdicts = t
@@ -752,6 +874,7 @@ function calculer(racine, ticket, fin, { responsable = true } = {}) {
752
874
  etat: fin,
753
875
  nuit: plageDeNuit(racine),
754
876
  duResponsable: responsable ? [...seances].flatMap(s => messagesDeLaSeance(String(s))) : [],
877
+ journal: lireLeJournal(racine, { ticket }).lignes,
755
878
  });
756
879
  }
757
880