@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
@@ -79,16 +79,20 @@
79
79
  // the tone of an alert.
80
80
  // - The parts of the machine (scripts/places-de-la-machine.mjs, read by `lireLaMesure`), as Slurm's
81
81
  // `squeue` names who holds what and what a job waits for. A part held or waited for by a circuit
82
- // AGENTS shows stands on that circuit's line, one line per ticket, in place of the progress of
83
- // its pass: « · <sorte> faits/prévus · <durée> » since it took its part, « · <sorte> figée
84
- // <durée> · faits/prévus » past FIGEE without a sign, « · part <sorte> · <durée> » for a wait,
85
- // the kind in lower case. The others stand at the head of AGENTS (`lignesDesParts`): the budget
86
- // taken, « Parts · 2 passes · 6 sur 8 cœurs · 11 sur 16 Go »; each pass that holds a part,
87
- // « 🔒 <sorte> · <projet> · <qui> · 4 cœurs · 8 Go », with « ⚠ » and what it consumes beyond its
88
- // part when it does; each pass that waits, in the order of its rank, « ⏳ <sorte> · <projet> ·
89
- // <qui> · attend <raison> » (cores, memory, load, with the figures). <qui> is its ticket without
90
- // its prefix (`courtDuTicket`). Such a line is marked `avancement`, which the pane measures
91
- // again more often.
82
+ // AGENTS shows on a line (a circuit, a ticket led in direct, a ticket worked out of a circuit,
83
+ // an agent) stands on that ticket's line, « 🔒 » (it holds a part) or « ⏳ » (it waits for one)
84
+ // after the head, before the subject, never in place of its sign: « · <sorte> · 2 cœurs ·
85
+ // <durée> » since it took its part, with « ⚠ » and what it consumes beyond its part when it
86
+ // does, « · <sorte> figée <durée> » past FIGEE without a sign, « · attend 2 cœurs · 26 réservés
87
+ // sur 28 · <durée> » for a wait, the kind in lower case; a circuit adds faits/prévus, and says
88
+ // it in place of the progress of its pass. The block at the head of AGENTS (`lignesDesParts`)
89
+ // keeps the budget taken, « Parts · 2 passes · 6 sur 8 cœurs · 11 sur 16 Go », which counts
90
+ // every pass that holds a part, those of a ticket the board does not show included, which
91
+ // has no other trace; and the lines of the passes with no ticket (a check launched by hand, the
92
+ // night, a measure): « 🔒 <sorte> · <projet> · 4 cœurs · 8 Go », with « ⚠ », then each one that
93
+ // waits, in the order of its rank, « ⏳ <sorte> · <projet> · attend <raison> » (cores, memory,
94
+ // load, with the figures). Such a line is marked `avancement`, which the pane measures again
95
+ // more often.
92
96
  // - Signs: each sign keeps one sense (the owner's decisions of 2026-11-01 and 2026-11-12). A
93
97
  // ticket's line in AGENTS takes one of three, by the tone of its state: ▶ its step works (cyan,
94
98
  // the hollow ▷ in a short circuit, counted with it),
@@ -96,8 +100,9 @@
96
100
  // on its right (« attend une place », « verrou », « disque », « démarre » in grey, the
97
101
  // circuit waiting for the machine; « question au superviseur », « question au responsable »,
98
102
  // « arrêté » in yellow, the circuit waiting for someone); ⛔ it stopped on a fault or its pass is
99
- // frozen, to correct (red). The head of AGENTS, the machine's lines: 🔒 a pass that holds a part,
100
- // ⏳ a pass that waits for one or for room, 🌙 the night under way. The alerts: 💤 a ticket
103
+ // frozen, to correct (red). On a ticket's line, after its head: 🔒 its pass holds a part, ⏳ it
104
+ // waits for one; at the head of AGENTS, the same two for a pass with no ticket, and 🌙 the night
105
+ // under way. The alerts: 💤 a ticket
101
106
  // claimed with nothing running, 🌙 a red night, ⚠ the alerts without a kind of their own. A
102
107
  // sign two columns wide stands as the others, a sign then a space; the width of a line counts
103
108
  // its columns (`colonnes`), ⏳ and ⛔ two.
@@ -158,7 +163,9 @@ import {
158
163
  aSonArchitecture,
159
164
  attendDeLAutreProjet,
160
165
  enFileSansArchitecture,
166
+ enFileSurMain,
161
167
  lireLesExternes,
168
+ lotEstSurMain,
162
169
  } from './file-des-tickets.mjs';
163
170
  import { etatDesPlaces } from './places-de-la-machine.mjs';
164
171
  import { duree as dureeDeLaFermeture } from './regles-des-places.mjs';
@@ -196,6 +203,9 @@ export const ROLE_DU_CIRCUIT = 'circuit';
196
203
  // The role of a register line that the workflow of the nights writes for a night it skips
197
204
  // (src/temporal/nuits/): no agent, no ticket, no turn; the board counts it nowhere.
198
205
  export const ROLE_DE_LA_NUIT = 'nuit';
206
+ // The agent of a ticket led out of the circuit (scripts/direct.mjs), and the block of the board
207
+ // that lists the sessions of that role.
208
+ const ROLE_DIRECT = 'direct';
199
209
  // A sub-agent's role from its meta file: the type it was spawned as; a named agent's `agentType`
200
210
  // is its name.
201
211
  export const roleDuMeta = m =>
@@ -248,6 +258,7 @@ export const TONS = Object.freeze({
248
258
  sansRienQuiTourne: 'attention',
249
259
  silencieux: 'attention',
250
260
  sansArchitecture: 'attention',
261
+ lotSurMain: 'attention',
251
262
  outilNonInstallable: 'attention',
252
263
  machineChargee: 'attention',
253
264
  fige: 'alerte',
@@ -774,12 +785,14 @@ export const remonteesDe = racine =>
774
785
 
775
786
  /**
776
787
  * The stops gone up of the repository at <racine>, each with its key, `depuis` (the time of its
777
- * first going up) and `presentee` (the time of its last presentation), in ms. An older file, a
778
- * list of keys, reads without error: its stops take the time <maintenant> of the reading. A file
779
- * that does not read holds none.
788
+ * first going up) and `presentee` (the time of its last presentation), in ms; `lue` (the time a
789
+ * turn of the session read the message that held it) and `chez` (the time the supervisor carried
790
+ * it to the owner) when it has them. An older file, a list of keys, reads without error: its stops
791
+ * take the time <maintenant> of the reading and are sent, never read. A file that does not read
792
+ * holds none.
780
793
  * @param {string} racine
781
794
  * @param {number} maintenant
782
- * @returns {{ cle: string, depuis: number, presentee: number }[]}
795
+ * @returns {{ cle: string, depuis: number, presentee: number, lue?: number, chez?: number }[]}
783
796
  */
784
797
  export function lireLesRemontees(racine, maintenant) {
785
798
  try {
@@ -794,6 +807,8 @@ export function lireLesRemontees(racine, maintenant) {
794
807
  cle: String(r.cle),
795
808
  depuis: Number.isFinite(r.depuis) ? r.depuis : maintenant,
796
809
  presentee: Number.isFinite(r.presentee) ? r.presentee : maintenant,
810
+ ...(Number.isFinite(r.lue) ? { lue: r.lue } : {}),
811
+ ...(Number.isFinite(r.chez) ? { chez: r.chez } : {}),
797
812
  }
798
813
  );
799
814
  } catch {
@@ -801,6 +816,14 @@ export function lireLesRemontees(racine, maintenant) {
801
816
  }
802
817
  }
803
818
 
819
+ /**
820
+ * Whether the question of the entry <r> of the file of the stops gone up is read: a turn of the
821
+ * session read it after its last sending (a reminder sent again is unread until its next reading).
822
+ * @param {{ presentee?: number, lue?: number }} r
823
+ * @returns {boolean}
824
+ */
825
+ export const estLue = r => Number.isFinite(r.lue) && !(r.lue < r.presentee);
826
+
804
827
  // A ticket's number, subject and component: its title « number — subject — component » when
805
828
  // the number ends its id, else its id without the prefix and its whole title.
806
829
  export function lecture(t, prefix) {
@@ -846,8 +869,8 @@ const goDe = octets => chiffre(Math.round((octets / 1024 ** 3) * 10) / 10);
846
869
  * part, « 🔒 <sorte> · <projet> · <qui> · 4 cœurs · 8 Go » (with « ⚠ » and what it consumes beyond
847
870
  * its part, when it does), then each pass that waits, in the order of its rank, « ⏳ <sorte> ·
848
871
  * <projet> · <qui> · attend <raison> », what it waits for (cores, memory, load) with its figures.
849
- * <masquer> leaves out the lines of the passes it names (those of a circuit's ticket, shown on its
850
- * line), <court> gives the ticket as the board names it.
872
+ * <masquer> leaves out the lines of the passes it names (those of a ticket, shown on its line or
873
+ * not shown at all: the count keeps them), <court> gives the ticket as the board names it.
851
874
  * @param {{ budget: { coeurs: number, memoire: number }, prises: DUnePart[], attentes: DUnePart[],
852
875
  * masquer?: (p: DUnePart) => boolean, court?: (ticket: string) => string }} o
853
876
  * @returns {string[]}
@@ -898,8 +921,8 @@ export function lignesDesParts({
898
921
  * places?: { prises: number, plafond: number, faute?: string | null, charge: number,
899
922
  * coeurs: number, memoireGo: number, memoireTotaleGo: number,
900
923
  * tenues?: { ticket: string | null, racine?: string | null }[], attentes: { ticket: string,
901
- * depuis: number, disque?: string | null }[], nuit?: 'attend' | 'en cours' | null,
902
- * fermeture?: { auteur: 'nuit' | 'superviseur', depuis: number, phase: string } | null } | null,
924
+ * depuis: number, disque?: string | null }[],
925
+ * fermeture?: { auteur: 'superviseur', depuis: number, phase: string } | null } | null,
903
926
  * nuit?: { racine: string, depuis: number | null } | null, muet?: boolean, faute?: string | null,
904
927
  * echecPrefixe?: string | null, voies?: Record<string, 'complet' | 'court'> }} lu
905
928
  */
@@ -928,6 +951,7 @@ export function assembler({
928
951
  superviseur = {},
929
952
  externes,
930
953
  limite = null,
954
+ lotSurMain = () => false,
931
955
  }) {
932
956
  // A circuit's lines are its steps, no agent's passage.
933
957
  const etapesFinies = lignesDuRegistre.filter(r => r.role === ROLE_DU_CIRCUIT);
@@ -1242,13 +1266,18 @@ export function assembler({
1242
1266
  const e = etapeDuRole(role);
1243
1267
  return e ? blocs.find(b => b.numero === e.numero) : undefined;
1244
1268
  };
1245
- // One line per ticket: a ticket on which a role agent runs stands at its step.
1269
+ // The block « Direct » heads them: the agents of the tickets led out of the circuit
1270
+ // (`npx grillhouse direct`), at no step.
1271
+ const directs = [];
1272
+ // One line per ticket: a ticket on which a role agent runs stands at its step, the agent of a
1273
+ // direct under the block « Direct ».
1246
1274
  for (const v of enCoursMesures) {
1247
1275
  const t = v.ticket && parId.get(v.ticket);
1248
- if (!t || !bloc(v.role)) {
1276
+ const cible = v.role === ROLE_DIRECT ? { enCours: directs } : bloc(v.role);
1277
+ if (!t || !cible) {
1249
1278
  continue;
1250
1279
  }
1251
- bloc(v.role).enCours.push({
1280
+ cible.enCours.push({
1252
1281
  id: t.id,
1253
1282
  numero: numero(t.id),
1254
1283
  sujet: titre(t).sujet,
@@ -1389,7 +1418,11 @@ export function assembler({
1389
1418
  // A circuit stopped on a question to the supervisor: the tone of that wait, whatever its length,
1390
1419
  // and how long it has waited (from the `depuis` of its stop in the file of the stops gone up);
1391
1420
  // it falls when the circuit leaves the stop.
1392
- const depuisDe = new Map(remontees.map(r => [r.cle, r.depuis]));
1421
+ // Once read, or carried to the owner, its state stands on its line « ⤷ Question »: the alert
1422
+ // speaks of the question not read yet.
1423
+ const depuisDe = new Map(
1424
+ remontees.filter(r => !estLue(r) && !Number.isFinite(r.chez)).map(r => [r.cle, r.depuis])
1425
+ );
1393
1426
  const enAttenteDuSuperviseur = [...parCircuit.values()]
1394
1427
  .filter(attendLeSuperviseur)
1395
1428
  .sort((a, b) => ordre({ id: a.ticket }, { id: b.ticket }));
@@ -1412,7 +1445,19 @@ export function assembler({
1412
1445
  texte: `En file sans architecture : ${sansArchitecture.map(t => numero(t.id)).join(', ')}`,
1413
1446
  });
1414
1447
  }
1415
- for (const b of blocs) {
1448
+ // The tickets of the queue whose lot is already on main, which the queue never starts again
1449
+ // (scripts/file-des-tickets.mjs): one line names them all, for the supervisor to close them.
1450
+ const dejaSurMain = enFileSurMain(tous, {
1451
+ enCours: new Set(parCircuit.keys()),
1452
+ externes,
1453
+ surMain: lotSurMain,
1454
+ });
1455
+ if (dejaSurMain.length) {
1456
+ alerter('lotSurMain', {
1457
+ texte: `En file, lot déjà sur main : ${dejaSurMain.map(t => numero(t.id)).join(', ')}`,
1458
+ });
1459
+ }
1460
+ for (const b of [...blocs, { numero: ROLE_DIRECT, enCours: directs }]) {
1416
1461
  for (const x of b.enCours) {
1417
1462
  if (x.ligne && x.silence !== null && x.silence > SILENCE) {
1418
1463
  alerter('silencieux', {
@@ -1457,7 +1502,7 @@ export function assembler({
1457
1502
  // supervisor stopped; or labelled `direct` and claimed (led out of the circuit); and no role
1458
1503
  // agent shown at a step. None while the circuits do not read (a silent server, a fault) and no
1459
1504
  // earlier reading is kept, when no ticket can be told out of a circuit.
1460
- const aUneEtape = new Set(blocs.flatMap(b => b.enCours.map(x => x.id)));
1505
+ const aUneEtape = new Set([...blocs.flatMap(b => b.enCours), ...directs].map(x => x.id));
1461
1506
  const tenus = new Set(
1462
1507
  [...parCircuit.values()].filter(c => c.vivant || attendLeSuperviseur(c)).map(c => c.ticket)
1463
1508
  );
@@ -1525,10 +1570,12 @@ export function assembler({
1525
1570
  alertes,
1526
1571
  limite: limiteTenue,
1527
1572
  circuits: lesCircuits,
1573
+ remontees,
1528
1574
  horsCircuit,
1529
1575
  chantiers,
1530
1576
  autres,
1531
1577
  agents: blocs,
1578
+ directs,
1532
1579
  maintenant,
1533
1580
  machine,
1534
1581
  places: placesDeLaMachine && {
@@ -1693,7 +1740,27 @@ const signeDuTon = (ton, court = false) =>
1693
1740
  const etapeDuCircuitLu = c => etapeDuCircuit({ ...c, raison: c.arret });
1694
1741
  // A circuit that waits for the supervisor (`attendLeSuperviseur`, the one rule): who must answer
1695
1742
  // its question, the supervisor when its stop names no one.
1696
- const enQuestion = c => (attendLeSuperviseur(c) ? (c.qui ?? SUPERVISEUR) : null);
1743
+ // A question the supervisor carried to the owner (`chez` in the file of the stops gone up) is the
1744
+ // owner's.
1745
+ const enQuestion = (c, chez = new Set()) =>
1746
+ attendLeSuperviseur(c) ? (chez.has(cleDe(c)) ? 'responsable' : (c.qui ?? SUPERVISEUR)) : null;
1747
+ const chezLui = t =>
1748
+ new Set((t.remontees ?? []).filter(r => Number.isFinite(r.chez)).map(r => r.cle));
1749
+ // The state at the right of the line « ⤷ Question » of the circuit <c>: « chez lui · N min » (N from
1750
+ // the mark), « lue il y a N min » (from the reading), « envoyée » (in the queue of the session);
1751
+ // empty when the greffon has not sent it.
1752
+ const etatDeLaQuestion = (c, t) => {
1753
+ const r = (t.remontees ?? []).find(x => x.cle === cleDe(c));
1754
+ const min = depuis =>
1755
+ `${Math.max(0, Math.floor(((t.maintenant ?? Date.now()) - depuis) / MINUTE))} min`;
1756
+ return !r
1757
+ ? ''
1758
+ : Number.isFinite(r.chez)
1759
+ ? `chez lui · ${min(r.chez)}`
1760
+ : estLue(r)
1761
+ ? `lue il y a ${min(r.lue)}`
1762
+ : 'envoyée';
1763
+ };
1697
1764
 
1698
1765
  /**
1699
1766
  * The state of each ticket's line of AGENTS on the board <t>, the one source of its signs, which
@@ -1702,16 +1769,26 @@ const enQuestion = c => (attendLeSuperviseur(c) ? (c.qui ?? SUPERVISEUR) : null)
1702
1769
  * and its witness (`temoin`: the part it holds or waits for, « · <sorte> faits/prévus · <durée> »,
1703
1770
  * « · part <sorte> · <durée> », else the progress of its automatic pass, `temoinDe`), in this
1704
1771
  * order: frozen; ended without its issue; its question (to the supervisor or to another); stopped;
1705
- * its wait for the disk, a place (« nuit » while the night holds the machine), a part or its first
1772
+ * its wait for the disk, a place, a part or its first
1706
1773
  * state; else it runs. `lignes`: one entry per
1707
1774
  * ticket's line of AGENTS, its id, its project on a board of several and its sign: each circuit,
1708
- * each ticket led in direct (▶) and each agent shown out of a circuit (▶).
1775
+ * each ticket led in direct (▶) and each agent shown out of a circuit (▶). `parts`: by ticket, the
1776
+ * pass of each ticket AGENTS shows (circuit, direct, out of a circuit, agent), its icon (`icone`,
1777
+ * 🔒 it holds a part, ⏳ it waits for one) and its text (`texte`), which the ticket's line bears.
1709
1778
  */
1710
1779
  export function etatsDAgents(t) {
1711
1780
  const maintenant = t.maintenant ?? Date.now();
1712
1781
  const p = t.places;
1713
1782
  const enCircuit = new Set((t.circuits ?? []).map(c => c.id));
1714
- const duCircuit = x => Boolean(x.ticket && enCircuit.has(x.ticket));
1783
+ // The tickets AGENTS shows on a line: each circuit, each ticket worked out of a circuit, each
1784
+ // agent and each direct. The part of a pass of one of them stands on its line.
1785
+ const montres = new Set([
1786
+ ...enCircuit,
1787
+ ...(t.horsCircuit ?? []).map(x => x.id),
1788
+ ...t.agents.flatMap(b => b.enCours.map(x => x.id)),
1789
+ ...(t.directs ?? []).map(x => x.id),
1790
+ ]);
1791
+ const duCircuit = x => Boolean(x.ticket && montres.has(x.ticket));
1715
1792
  const partDe = new Map();
1716
1793
  const tientUnePart = new Set();
1717
1794
  for (const tenu of t.machine?.prises ?? []) {
@@ -1726,16 +1803,20 @@ export function etatsDAgents(t) {
1726
1803
  const sorte = tenu.sorte.toLocaleLowerCase('fr');
1727
1804
  partDe.set(tenu.ticket, {
1728
1805
  fige,
1806
+ icone: '🔒',
1729
1807
  texte: fige
1730
1808
  ? ` · ${sorte} figée ${ilYa(age)}${compte ? ` · ${compte}` : ''}`
1731
- : ` · ${sorte}${compte ? ` ${compte}` : ''} · ${ilYa(maintenant - (tenu.depuis ?? maintenant))}${tenu.depasse ? ` · ⚠ ${tenu.depasse}` : ''}`,
1809
+ : ` · ${sorte}${compte ? ` ${compte}` : ''}${tenu.coeurs ? ` · ${tenu.coeurs} cœurs` : ''} · ${ilYa(maintenant - (tenu.depuis ?? maintenant))}${tenu.depasse ? ` · ⚠ ${tenu.depasse}` : ''}`,
1732
1810
  });
1733
1811
  }
1812
+ const reserves = (t.machine?.prises ?? []).reduce((n, x) => n + (x.coeurs ?? 0), 0);
1734
1813
  for (const w of t.machine?.attentes ?? []) {
1735
1814
  if (duCircuit(w) && !partDe.has(w.ticket)) {
1815
+ const budget = t.machine?.budget?.coeurs;
1736
1816
  partDe.set(w.ticket, {
1737
1817
  fige: false,
1738
- texte: ` · part ${w.sorte.toLocaleLowerCase('fr')} · ${ilYa(maintenant - w.depuis)}`,
1818
+ icone: '⏳',
1819
+ texte: ` · attend ${w.coeurs} cœurs · ${reserves} réservés sur ${budget} · ${ilYa(maintenant - w.depuis)}`,
1739
1820
  });
1740
1821
  }
1741
1822
  }
@@ -1757,7 +1838,7 @@ export function etatsDAgents(t) {
1757
1838
  return ['reporteLimite', `limite d'usage · reprise ${heure}`];
1758
1839
  }
1759
1840
  if (!c.vivant) {
1760
- const qui = enQuestion(c);
1841
+ const qui = enQuestion(c, chezLui(t));
1761
1842
  return c.sansIssue
1762
1843
  ? ['sansIssue', 'fini sans son issue']
1763
1844
  : qui === SUPERVISEUR
@@ -1770,7 +1851,7 @@ export function etatsDAgents(t) {
1770
1851
  return attendLeDisque.has(c.id)
1771
1852
  ? ['attendLeDisque', 'disque']
1772
1853
  : attendUnePlace.has(c.id)
1773
- ? ['attendUnePlace', p?.nuit ? 'nuit' : 'attend une place']
1854
+ ? ['attendUnePlace', 'attend une place']
1774
1855
  : attendUnePart.has(c.id)
1775
1856
  ? ['attendUnePart', '']
1776
1857
  : !etape
@@ -1781,24 +1862,30 @@ export function etatsDAgents(t) {
1781
1862
  for (const c of t.circuits ?? []) {
1782
1863
  const etape = etapeDuCircuitLu(c);
1783
1864
  const temoin =
1784
- partDe.get(c.id) ??
1785
- (c.vivant && etape?.qui.includes(AUTO) ? temoinDe(c, maintenant) : null);
1865
+ partDe.get(c.id) ?? (c.vivant && etape?.qui.includes(AUTO) ? temoinDe(c, maintenant) : null);
1786
1866
  const [etat, raison] = etatDuCircuit(c, temoin);
1787
1867
  circuits.set(c.id, {
1788
1868
  etat,
1789
1869
  raison,
1790
1870
  ton: TONS[etat],
1791
- signe: signeDuTon(TONS[etat], c.court),
1871
+ // A question carried to the owner is his to answer: ⛔, which « toi : … question » counts.
1872
+ signe:
1873
+ etat === 'attendLeResponsable' && chezLui(t).has(cleDe(c))
1874
+ ? '⛔'
1875
+ : signeDuTon(TONS[etat], c.court),
1792
1876
  temoin,
1793
1877
  });
1794
1878
  }
1795
1879
  const ligne = (x, signe) => ({ id: x.id, projet: x.projet, signe });
1796
1880
  return {
1797
1881
  circuits,
1882
+ parts: partDe,
1798
1883
  lignes: [
1799
1884
  ...(t.circuits ?? []).map(c => ligne(c, circuits.get(c.id).signe)),
1800
1885
  ...(t.horsCircuit ?? []).map(x => ligne(x, '▶')),
1801
- ...t.agents.flatMap(b => b.enCours.filter(x => !enCircuit.has(x.id)).map(x => ligne(x, '▶'))),
1886
+ ...[...t.agents.flatMap(b => b.enCours), ...(t.directs ?? [])]
1887
+ .filter(x => !enCircuit.has(x.id))
1888
+ .map(x => ligne(x, '▶')),
1802
1889
  ],
1803
1890
  };
1804
1891
  }
@@ -1973,43 +2060,28 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1973
2060
  ticket: w.ticket,
1974
2061
  });
1975
2062
  }
1976
- // The night reserving the machine (`nuit` of the places: `attend`, `en cours`, none outside
1977
- // the night): the stages under way finish, then the nights play.
1978
- if (p.nuit) {
2063
+ // The machine closed by the supervisor (`fermeture` of the places: since when, its phase): said,
2064
+ // with how long it has lasted, so a closure forgotten is seen; it holds no place itself, so it
2065
+ // says what its places still do.
2066
+ if (p.fermeture) {
2067
+ const { depuis, phase } = p.fermeture;
1979
2068
  poser({
1980
- texte: cadre(
1981
- p.nuit === 'attend' ? 'nuit : attend la fin des étapes en cours' : 'nuit en cours',
2069
+ texte: couperAvant(
2070
+ 'machine fermée par le superviseur',
2071
+ ` · depuis ${dureeDeLaFermeture(maintenant - depuis)}`,
1982
2072
  '',
1983
2073
  largeur
1984
2074
  ),
1985
- ton: p.nuit === 'attend' ? TONS.attendLeDisque : TONS.nuitEnCours,
2075
+ ton: TONS.attendLeDisque,
1986
2076
  });
1987
- }
1988
- // The machine closed (`fermeture` of the places: its author, `superviseur` or `nuit`, since
1989
- // when, its phase): said, with how long it has lasted, so a closure forgotten is seen.
1990
- if (p.fermeture) {
1991
- const { auteur, depuis, phase } = p.fermeture;
1992
- const duJour = auteur === 'superviseur';
1993
2077
  poser({
1994
- texte: couperAvant(
1995
- `machine fermée par ${duJour ? 'le superviseur' : 'la nuit'}`,
1996
- ` · depuis ${dureeDeLaFermeture(maintenant - depuis)}`,
2078
+ texte: cadre(
2079
+ phase === 'vide' ? 'la machine est vide' : 'attend la fin des étapes en cours',
1997
2080
  '',
1998
2081
  largeur
1999
2082
  ),
2000
- ton: duJour ? TONS.attendLeDisque : TONS.nuitEnCours,
2083
+ ton: TONS.attendLeDisque,
2001
2084
  });
2002
- // The closure of the supervisor holds no place itself: it says what its places still do.
2003
- if (duJour) {
2004
- poser({
2005
- texte: cadre(
2006
- phase === 'vide' ? 'la machine est vide' : 'attend la fin des étapes en cours',
2007
- '',
2008
- largeur
2009
- ),
2010
- ton: TONS.attendLeDisque,
2011
- });
2012
- }
2013
2085
  }
2014
2086
  }
2015
2087
  // A project at its limit of circuits (`grillhouse.circuits`) names the circuits that hold it
@@ -2035,10 +2107,10 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
2035
2107
  });
2036
2108
  }
2037
2109
  const enCircuit = new Set((t.circuits ?? []).map(c => c.id));
2038
- const duCircuit = x => Boolean(x.ticket && enCircuit.has(x.ticket));
2039
2110
  // The parts of the machine (`lireLaMesure`, `lignesDesParts`): the budget taken, then who holds
2040
- // a part and who waits for what; the part of each circuit shown stands on its line
2041
- // (`etatsDAgents`), any other here. A reserve of the user that is faulty is said by its name.
2111
+ // a part and who waits for what; the part of each ticket shown stands on its line
2112
+ // (`etatsDAgents`), a ticket's pass the board does not show nowhere but in the count, the pass
2113
+ // without a ticket here. A reserve of the user that is faulty is said by its name.
2042
2114
  const m = t.machine;
2043
2115
  if (m?.faute) {
2044
2116
  poser({
@@ -2051,12 +2123,16 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
2051
2123
  budget: m.budget,
2052
2124
  prises: m.prises,
2053
2125
  attentes: m.attentes,
2054
- masquer: duCircuit,
2126
+ masquer: p => Boolean(p.ticket),
2055
2127
  court: courtDuTicket,
2056
2128
  })) {
2057
2129
  poser({
2058
2130
  texte: cadre(l, '', largeur),
2059
- ton: l.startsWith('⏳') ? TONS.attendUnePart : l.startsWith('Parts') ? TONS.mesure : TONS.enCours,
2131
+ ton: l.startsWith('⏳')
2132
+ ? TONS.attendUnePart
2133
+ : l.startsWith('Parts')
2134
+ ? TONS.mesure
2135
+ : TONS.enCours,
2060
2136
  ...(l.startsWith('Parts') ? {} : { avancement: true }),
2061
2137
  });
2062
2138
  }
@@ -2105,7 +2181,9 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
2105
2181
  const e = etapeDe(c);
2106
2182
  return e ? blocDe(e) : !c.vivant ? ailleurs : blocDe(ETAPES[0]);
2107
2183
  };
2108
- const montres = t.agents.flatMap(b => b.enCours.filter(x => !enCircuit.has(x.id)));
2184
+ const montres = [...t.agents.flatMap(b => b.enCours), ...(t.directs ?? [])].filter(
2185
+ x => !enCircuit.has(x.id)
2186
+ );
2109
2187
  // A ticket's number, or on several projects' board its whole id, in one column.
2110
2188
  const nomme = x => String(plusieurs ? x.id : x.numero);
2111
2189
  const colonne = Math.max(
@@ -2114,17 +2192,29 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
2114
2192
  );
2115
2193
  // A ticket's line in AGENTS: « <signe> <numéro> <sujet> … <droite> »; on several projects'
2116
2194
  // board « <[projet]> <id> <sujet> … <signe> <droite> », the owner's maquette (grillhouse-erp.1).
2195
+ // The icon of its pass (🔒 holds a part, ⏳ waits for one) follows the head, before the subject.
2117
2196
  const teteDe = (signe, x) =>
2118
- plusieurs
2119
- ? `${colonneDe(x.projet)}${nomme(x).padEnd(colonne)} `
2120
- : `${signe} ${nomme(x).padEnd(colonne)} `;
2197
+ `${
2198
+ plusieurs
2199
+ ? `${colonneDe(x.projet)}${nomme(x).padEnd(colonne)} `
2200
+ : `${signe} ${nomme(x).padEnd(colonne)} `
2201
+ }${etats.parts.has(x.id) ? `${etats.parts.get(x.id).icone} ` : ''}`;
2202
+ // What the pass of the ticket <x> says on its line, after its kind.
2203
+ const partDuTicket = x => etats.parts.get(x.id)?.texte ?? '';
2121
2204
  const droiteDe = (signe, droite) =>
2122
2205
  plusieurs ? `${signe}${droite ? ` ${droite}` : ''}` : droite;
2123
2206
  // A ticket's line of `largeur` columns: its head <tete> (its sign and number, or its project and
2124
2207
  // id) whole, then its subject, cut to leave <suite> and the right part <droite> whole; without
2125
2208
  // room for the subject, <suite> is cut, never the head.
2126
- const ligneDuTicket = (tete, sujet, suite, droite) => {
2127
- const place = largeur - colonnes(tete) - colonnes(suite) - (droite ? colonnes(droite) + 1 : 0);
2209
+ const ligneDuTicket = (tete, sujet, suiteEntiere, droite, coupable = false) => {
2210
+ const libre = largeur - colonnes(tete) - (droite ? colonnes(droite) + 1 : 0);
2211
+ // The subject keeps its room (PLACE_DU_SUJET at most), the suite is cut for it.
2212
+ const gardee = Math.min(PLACE_DU_SUJET, colonnes(sujet));
2213
+ const suite =
2214
+ coupable && colonnes(suiteEntiere) > libre - gardee && libre - gardee >= 2
2215
+ ? `${debutDe(suiteEntiere, libre - gardee - 1)}…`
2216
+ : suiteEntiere;
2217
+ const place = libre - colonnes(suite);
2128
2218
  if (place < 2) {
2129
2219
  return couper(`${tete}${suite}`, droite, largeur);
2130
2220
  }
@@ -2163,13 +2253,17 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
2163
2253
  ...(temoin ? { avancement: true } : {}),
2164
2254
  });
2165
2255
  };
2256
+ const chez = chezLui(t);
2166
2257
  const contenu = b => {
2167
2258
  const tous = (t.circuits ?? []).filter(c => blocDuCircuit(c) === b);
2168
- const circuits = tous.filter(c => !enQuestion(c));
2259
+ const circuits = tous.filter(c => !enQuestion(c, chez));
2169
2260
  // The circuits on a question, by who must answer it, the supervisor first.
2170
- const enQuestions = [SUPERVISEUR, ...new Set(tous.map(enQuestion).filter(Boolean))]
2261
+ const enQuestions = [
2262
+ SUPERVISEUR,
2263
+ ...new Set(tous.map(c => enQuestion(c, chez)).filter(Boolean)),
2264
+ ]
2171
2265
  .filter((qui, i, l) => l.indexOf(qui) === i)
2172
- .map(qui => [qui, tous.filter(c => enQuestion(c) === qui)])
2266
+ .map(qui => [qui, tous.filter(c => enQuestion(c, chez) === qui)])
2173
2267
  .filter(([, l]) => l.length);
2174
2268
  const enCours = b.enCours.filter(x => !enCircuit.has(x.id));
2175
2269
  return {
@@ -2190,13 +2284,22 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
2190
2284
  }
2191
2285
  for (const x of enCours) {
2192
2286
  L(
2193
- ligneDuTicket(teteDe('▶', x), x.sujet, '', droiteDe('▶', conso(x.travail, x.jetons))),
2287
+ ligneDuTicket(
2288
+ teteDe('▶', x),
2289
+ x.sujet,
2290
+ partDuTicket(x),
2291
+ droiteDe('▶', conso(x.travail, x.jetons)),
2292
+ true
2293
+ ),
2194
2294
  TONS.enCours,
2195
2295
  x.id
2196
2296
  );
2197
2297
  }
2198
2298
  for (const [qui, l] of enQuestions) {
2199
- L(cadre(`${retrait}⤷ Question · ${qui}`, '', largeur), TONS.titre);
2299
+ L(
2300
+ cadre(`${retrait}⤷ Question · ${qui}`, etatDeLaQuestion(l[0], t) || ' ', largeur),
2301
+ TONS.titre
2302
+ );
2200
2303
  for (const c of l) {
2201
2304
  ligneDuCircuit(c);
2202
2305
  }
@@ -2207,11 +2310,36 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
2207
2310
  cadre(`${retrait}${b.numero} · ${b.titre}${b.qui ? ` · ${b.qui}` : ''}`, '', largeur),
2208
2311
  plein ? TONS.titre : TONS.vide
2209
2312
  );
2210
- // The tickets worked out of a circuit, once each, before the steps, from their claim to their
2211
- // close: « ▶ <numéro> <sujet> · en direct ».
2313
+ // The block « Direct », first of the agents: a line per ticket an agent of a direct works, its
2314
+ // number, its subject, its role and its duration: « ▶ <numéro> <sujet> · direct ».
2315
+ const lesDirects = (t.directs ?? []).filter(x => !enCircuit.has(x.id));
2316
+ if (lesDirects.length) {
2317
+ L(cadre(' Direct', '', largeur), TONS.titre);
2318
+ for (const x of lesDirects) {
2319
+ poser({
2320
+ texte: ligneDuTicket(
2321
+ teteDe('▶', x),
2322
+ x.sujet,
2323
+ ` · ${ROLE_DIRECT}${partDuTicket(x)}`,
2324
+ droiteDe('▶', conso(x.travail, x.jetons)),
2325
+ true
2326
+ ),
2327
+ ton: TONS.enCours,
2328
+ ticket: x.id,
2329
+ });
2330
+ }
2331
+ }
2332
+ // The tickets worked out of a circuit with no agent at work, once each, before the steps, from
2333
+ // their claim to their close: « ▶ <numéro> <sujet> · en direct ».
2212
2334
  for (const x of t.horsCircuit ?? []) {
2213
2335
  poser({
2214
- texte: ligneDuTicket(teteDe('▶', x), x.sujet, ' · en direct', droiteDe('▶', '')),
2336
+ texte: ligneDuTicket(
2337
+ teteDe('▶', x),
2338
+ x.sujet,
2339
+ ` · en direct${partDuTicket(x)}`,
2340
+ droiteDe('▶', ''),
2341
+ true
2342
+ ),
2215
2343
  ton: TONS.enDirect,
2216
2344
  ticket: x.id,
2217
2345
  });
@@ -2248,6 +2376,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
2248
2376
  ...(t.circuits ?? []).map(c => c.id),
2249
2377
  ...(t.horsCircuit ?? []).map(x => x.id),
2250
2378
  ...t.agents.flatMap(b => b.enCours.map(x => x.id)),
2379
+ ...(t.directs ?? []).map(x => x.id),
2251
2380
  ]);
2252
2381
  for (const ch of t.chantiers) {
2253
2382
  L('', undefined);
@@ -2279,11 +2408,11 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
2279
2408
  ? 'attend archi'
2280
2409
  : n.etat === 'enAttente'
2281
2410
  ? 'en attente'
2282
- : n.etat === 'reportes'
2283
- ? 'reporté'
2284
- : n.etat === 'fermes'
2285
- ? '✓'
2286
- : '';
2411
+ : n.etat === 'reportes'
2412
+ ? 'reporté'
2413
+ : n.etat === 'fermes'
2414
+ ? '✓'
2415
+ : '';
2287
2416
  // Every open ticket of the chantier has its line under the title of its state, the states in
2288
2417
  // their order, the tickets in their numbers' order. A ticket an agent block shows stands there
2289
2418
  // alone; its children keep their lines.
@@ -2812,6 +2941,7 @@ function lire(
2812
2941
  superviseur,
2813
2942
  externes: lireLesExternes(racine, tous),
2814
2943
  limite: maxDuProjet(commun ? path.dirname(commun) : racine) ?? null,
2944
+ lotSurMain: lotEstSurMain(commun ? path.dirname(commun) : racine),
2815
2945
  });
2816
2946
  return { t, prefix, tous, vivants, commun };
2817
2947
  }
@@ -2860,6 +2990,7 @@ export function ensemble(lus) {
2860
2990
  ciDeMain: premier.t.ciDeMain,
2861
2991
  circuits: tous('circuits'),
2862
2992
  horsCircuit: tous('horsCircuit'),
2993
+ directs: tous('directs'),
2863
2994
  chantiers: lisibles.flatMap(l => l.t.chantiers.map(noeud(l.etiquette))),
2864
2995
  autres: tous('autres'),
2865
2996
  agents: premier.t.agents.map(b => {