@roomi-fields/grillhouse 0.51.0 → 0.53.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 (149) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +68 -0
  3. package/agents/direct.md +1 -1
  4. package/cadre/templates/projet/vitest.config.cjs +45 -0
  5. package/charte/plan.md +47 -0
  6. package/charte/preuve.md +39 -0
  7. package/charte/superviseur.md +60 -0
  8. package/charte/tests.md +38 -0
  9. package/charte.md +23 -178
  10. package/dist/temporal/circuit/appel.d.ts +2 -0
  11. package/dist/temporal/circuit/appel.js +24 -2
  12. package/dist/temporal/circuit/appel.js.map +1 -1
  13. package/dist/temporal/circuit/client.d.ts +15 -7
  14. package/dist/temporal/circuit/client.js +42 -11
  15. package/dist/temporal/circuit/client.js.map +1 -1
  16. package/dist/temporal/circuit/commande.js +17 -6
  17. package/dist/temporal/circuit/commande.js.map +1 -1
  18. package/dist/temporal/circuit/contrat.d.ts +9 -0
  19. package/dist/temporal/circuit/contrat.js +6 -0
  20. package/dist/temporal/circuit/contrat.js.map +1 -1
  21. package/dist/temporal/circuit/deroule.js +25 -4
  22. package/dist/temporal/circuit/deroule.js.map +1 -1
  23. package/dist/temporal/client.d.ts +35 -1
  24. package/dist/temporal/client.js +144 -1
  25. package/dist/temporal/client.js.map +1 -1
  26. package/dist/temporal/commande.js +31 -13
  27. package/dist/temporal/commande.js.map +1 -1
  28. package/dist/temporal/etat.d.ts +3 -1
  29. package/dist/temporal/etat.js +31 -17
  30. package/dist/temporal/etat.js.map +1 -1
  31. package/dist/temporal/file/activites.js +1 -1
  32. package/dist/temporal/file/activites.js.map +1 -1
  33. package/dist/temporal/file/contrat.d.ts +4 -5
  34. package/dist/temporal/file/contrat.js +2 -2
  35. package/dist/temporal/file/contrat.js.map +1 -1
  36. package/dist/temporal/file/deroule.js +7 -5
  37. package/dist/temporal/file/deroule.js.map +1 -1
  38. package/dist/temporal/installation.d.ts +103 -53
  39. package/dist/temporal/installation.js +842 -237
  40. package/dist/temporal/installation.js.map +1 -1
  41. package/dist/temporal/nuits/deroule.js +3 -1
  42. package/dist/temporal/nuits/deroule.js.map +1 -1
  43. package/dist/temporal/places/deroule.js +2 -1
  44. package/dist/temporal/places/deroule.js.map +1 -1
  45. package/dist/temporal/sonde/deroule.js +2 -1
  46. package/dist/temporal/sonde/deroule.js.map +1 -1
  47. package/dist/temporal/tickets/deroule.js +4 -3
  48. package/dist/temporal/tickets/deroule.js.map +1 -1
  49. package/dist/temporal/travailleur.d.ts +7 -1
  50. package/dist/temporal/travailleur.js +49 -25
  51. package/dist/temporal/travailleur.js.map +1 -1
  52. package/docs/INTERFACE.md +20 -14
  53. package/docs/architecture/circuit.md +19 -16
  54. package/docs/architecture/entree.md +8 -9
  55. package/docs/architecture/greffon.md +54 -20
  56. package/docs/architecture/installation.md +99 -60
  57. package/docs/architecture/machine.md +31 -4
  58. package/docs/architecture/tests.md +22 -8
  59. package/docs/lexique.md +12 -3
  60. package/hooks/hooks.json +10 -10
  61. package/hooks/register.tsx +84 -2
  62. package/package.json +4 -2
  63. package/scripts/activites.mjs +25 -9
  64. package/scripts/aiguillage.mjs +1 -1
  65. package/scripts/attente-au-tour.mjs +2 -3
  66. package/scripts/bilan.mjs +116 -56
  67. package/scripts/bilans-gardes.mjs +37 -0
  68. package/scripts/circuit.mjs +256 -42
  69. package/scripts/circuits-du-serveur.mjs +3 -2
  70. package/scripts/circuits-tenus.d.mts +7 -0
  71. package/scripts/circuits-tenus.mjs +17 -0
  72. package/scripts/copie-de-montee.mjs +354 -0
  73. package/scripts/copies-du-depot.d.mts +13 -0
  74. package/scripts/copies-du-depot.mjs +66 -0
  75. package/scripts/copies-finies.mjs +6 -40
  76. package/scripts/crochets.mjs +16 -2
  77. package/scripts/direct.mjs +2 -2
  78. package/scripts/droits.mjs +117 -38
  79. package/scripts/engendres.mjs +5 -3
  80. package/scripts/entree-de-seance.mjs +35 -0
  81. package/scripts/enveloppe/enveloppe.mjs +23 -16
  82. package/scripts/enveloppe/lancer.sh +32 -22
  83. package/scripts/enveloppe/travail-de-la-copie.mjs +154 -0
  84. package/scripts/etapes.mjs +11 -3
  85. package/scripts/faits-du-circuit.mjs +12 -5
  86. package/scripts/file-des-tickets.d.mts +13 -2
  87. package/scripts/file-des-tickets.mjs +44 -12
  88. package/scripts/greffons.mjs +42 -27
  89. package/scripts/grillhouse-maj.mjs +105 -85
  90. package/scripts/init.mjs +1 -1
  91. package/scripts/integration/file.mjs +5 -2
  92. package/scripts/integration/integrer.mjs +14 -4
  93. package/scripts/jointure.d.ts +18 -1
  94. package/scripts/langages/c/commandes.mjs +17 -7
  95. package/scripts/langages/cargo/commandes.mjs +87 -34
  96. package/scripts/langages/cargo/index.mjs +6 -3
  97. package/scripts/langages/cargo/sccache.mjs +15 -12
  98. package/scripts/langages/python/commandes.mjs +68 -15
  99. package/scripts/langages/python/squelette.mjs +4 -3
  100. package/scripts/langages/typescript/configurations-de-vitest.mjs +118 -0
  101. package/scripts/langages/typescript/index.mjs +14 -12
  102. package/scripts/langages/typescript/migrations/configurations-en-commonjs.mjs +299 -0
  103. package/scripts/langages/typescript/squelette.mjs +20 -17
  104. package/scripts/langages/typescript/tests-de-nuit.mjs +3 -3
  105. package/scripts/langages/typescript/turbo-des-paquets.mjs +76 -39
  106. package/scripts/langages/typescript/verifier.mjs +27 -2
  107. package/scripts/langages/typescript/vitest-config/base.mjs +1 -1
  108. package/scripts/langages/typescript/vitest-config/bornes.mjs +1 -1
  109. package/scripts/langages/typescript/vitest-config/cibles.mjs +2 -2
  110. package/scripts/langages/typescript/{vitest.nuit.config.mjs → vitest.nuit.config.cjs} +61 -50
  111. package/scripts/mesure/pression.mjs +5 -3
  112. package/scripts/migrations/serveurs-de-l-index.mjs +1 -1
  113. package/scripts/migrations/suivi-du-superviseur-retire.mjs +56 -0
  114. package/scripts/migrations.mjs +2 -0
  115. package/scripts/montee.mjs +524 -0
  116. package/scripts/nuit.sh +3 -2
  117. package/scripts/outil.mjs +5 -3
  118. package/scripts/paquet-npm.mjs +22 -0
  119. package/scripts/paquet.mjs +5 -5
  120. package/scripts/pre-compact.mjs +25 -0
  121. package/scripts/reponses-du-circuit.d.mts +17 -2
  122. package/scripts/reponses-du-circuit.mjs +78 -20
  123. package/scripts/resultats.mjs +42 -14
  124. package/scripts/retirer-les-copies-finies.mjs +4 -7
  125. package/scripts/seances.mjs +81 -29
  126. package/scripts/services-du-noyau.mjs +7 -2
  127. package/scripts/session-start.sh +19 -10
  128. package/scripts/sortie-de-seance.mjs +70 -0
  129. package/scripts/sortie.mjs +4 -7
  130. package/scripts/sous-commandes.mjs +1 -1
  131. package/scripts/superviseur.mjs +417 -159
  132. package/scripts/tableau.mjs +249 -152
  133. package/scripts/ticket-du-circuit.mjs +22 -0
  134. package/scripts/transitions.d.mts +6 -9
  135. package/scripts/transitions.mjs +123 -36
  136. package/scripts/verrou-de-fichier.d.mts +11 -0
  137. package/skills/direct/SKILL.md +21 -11
  138. package/skills/explorateur/SKILL.md +8 -3
  139. package/skills/grill/SKILL.md +11 -8
  140. package/skills/grill/references/paquets.md +4 -4
  141. package/skills/pitmaster/SKILL.md +99 -53
  142. package/skills/pitmaster/references/cadre.md +1 -1
  143. package/skills/pitmaster/references/consigne-agent.md +1 -1
  144. package/skills/pitmaster/references/tour.md +6 -5
  145. package/skills/relecteur/SKILL.md +9 -2
  146. package/skills/testwriter/SKILL.md +3 -3
  147. package/cadre/templates/projet/pitmaster/SUIVI.md +0 -22
  148. package/cadre/templates/projet/vitest.config.ts +0 -44
  149. package/scripts/attente-a-l-arret.mjs +0 -114
@@ -3,8 +3,9 @@
3
3
  // nor output: the one rule the client (src/temporal/circuit/client.ts: its refusals and the
4
4
  // circuits it reads), the opening, the wait, the board and the line of a stop name; and the
5
5
  // answer `--mecanique`, which turns the sort of a ticket stopped on the testwriter or on the proof
6
- // of the red.
6
+ // of the red; and the answer `--planifier`, which switches a direct circuit to the plan.
7
7
  import { refusDeLaCommande } from './commande-du-plan.mjs';
8
+ import { DEMANDE_UN_PLAN } from './etapes.mjs';
8
9
  import { CODE, GESTE, PREUVE, TESTS } from './transitions.mjs';
9
10
 
10
11
  /** The statuses of a workflow ended without its issue. */
@@ -35,38 +36,72 @@ export function lesReponses(ticket, statut, ecrit) {
35
36
  }
36
37
  const etendre = '--etendre <paquet>';
37
38
  const mecanique = '--mecanique [<commande>] --contexte <raison>';
39
+ const planifier = '--planifier --contexte <raison>';
38
40
  // The question carried to the owner: it stays quiet until the circuit answers.
39
41
  const chez = '--chez-le-responsable';
40
42
  return statut === 'RUNNING'
41
- ? `${circuit} --reprendre\`, \`${depuis}\`, \`${mecanique}\`, \`${etendre}\`, \`--reporter <heure>\`, \`${chez}\` ou \`--arreter`
43
+ ? `${circuit} --reprendre\`, \`${depuis}\`, \`${mecanique}\`, \`${planifier}\`, \`${etendre}\`, \`--reporter <heure>\`, \`${chez}\` ou \`--arreter`
42
44
  : `${circuit} --reprendre\`, \`${depuis}\`, \`${mecanique}\`, \`${etendre}\` ou \`${chez}`;
43
45
  }
44
46
 
45
- /**
46
- * The hour of a deferral (`--reporter <heure>`): a lone hour (`H:MM` or `HH:MM`, 0-23 and 00-59)
47
- * aims at its next occurrence in the machine's local time, today when strictly after <maintenant>
48
- * (to the second), else tomorrow, and is handed to `bd update --defer` as `AAAA-MM-JJTHH:MM:00`,
49
- * the form bd reads as that wall time (bd reads a space-separated `AAAA-MM-JJ HH:MM` with the
50
- * month and the day taken for the hour); any other form goes to bd as written. `quand` is the phrase of the texts (« reportée <quand> »).
51
- * @param {string} heure
52
- * @param {Date} maintenant
53
- * @returns {{ defer: string, quand: string }}
54
- */
55
- export function heureDuReport(heure, maintenant) {
56
- const lue = /^(\d{1,2}):([0-5]\d)$/.exec(heure);
57
- if (!lue || Number(lue[1]) > 23) {
58
- return { defer: heure, quand: `au ${heure}` };
47
+ /** The refusal of an hour of deferral, which cites the forms accepted. */
48
+ export const REFUS_DE_L_HEURE =
49
+ '--reporter attend son heure, à venir : H:MM, AAAA-MM-JJ, AAAA-MM-JJ HH:MM, AAAA-MM-JJTHH:MM, +6h (en heures) ou +2d (en jours).';
50
+
51
+ const deux = n => String(n).padStart(2, '0');
52
+ // The local wall time of <d> as bd reads it, `AAAA-MM-JJTHH:MM:00`.
53
+ const pourBd = d =>
54
+ `${d.getFullYear()}-${deux(d.getMonth() + 1)}-${deux(d.getDate())}T${deux(d.getHours())}:${deux(d.getMinutes())}:00`;
55
+
56
+ // The next occurrence of the lone hour <heures>:<minutes> after <maintenant>.
57
+ function prochaine(heure, heures, minutes, maintenant) {
58
+ if (heures > 23) {
59
+ return null;
59
60
  }
60
61
  const cible = new Date(maintenant);
61
- cible.setHours(Number(lue[1]), Number(lue[2]), 0, 0);
62
+ cible.setHours(heures, minutes, 0, 0);
62
63
  const demain = cible.getTime() <= maintenant.getTime();
63
64
  if (demain) {
64
65
  cible.setDate(cible.getDate() + 1);
65
66
  }
66
- const deux = (n) => String(n).padStart(2, '0');
67
67
  const hhmm = `${deux(cible.getHours())}:${deux(cible.getMinutes())}`;
68
- const defer = `${cible.getFullYear()}-${deux(cible.getMonth() + 1)}-${deux(cible.getDate())}T${hhmm}:00`;
69
- return { defer, quand: demain ? `à demain ${hhmm}` : `au ${heure}` };
68
+ return { defer: pourBd(cible), quand: demain ? `à demain ${hhmm}` : `au ${heure}` };
69
+ }
70
+
71
+ /**
72
+ * The hour of a deferral (`--reporter <heure>`), read here alone: what `bd update --defer`
73
+ * receives and the phrase of the texts (« reportée <quand> »), or null for a form refused, an
74
+ * impossible date or hour, or a time not strictly after <maintenant>. A lone hour (`H:MM` or
75
+ * `HH:MM`) aims at its next occurrence in the machine's local time, today when strictly after
76
+ * <maintenant> (to the second), else tomorrow. A date (`AAAA-MM-JJ`, at midnight) and a date and
77
+ * hour (`AAAA-MM-JJ HH:MM` or `AAAA-MM-JJTHH:MM`) go to bd as `AAAA-MM-JJTHH:MM:00`, the form it
78
+ * reads as that wall time (bd reads a space-separated one with the month and the day taken for the
79
+ * hour). The durations `+<n>h` and `+<n>d` go as written.
80
+ * @param {string} heure
81
+ * @param {Date} maintenant
82
+ * @returns {{ defer: string, quand: string } | null}
83
+ */
84
+ export function heureDuReport(heure, maintenant) {
85
+ const seule = /^(\d{1,2}):([0-5]\d)$/.exec(heure);
86
+ if (seule) {
87
+ return prochaine(heure, Number(seule[1]), Number(seule[2]), maintenant);
88
+ }
89
+ const quand = `au ${heure}`;
90
+ const duree = /^\+(\d+)[hd]$/.exec(heure);
91
+ if (duree) {
92
+ return Number(duree[1]) > 0 ? { defer: heure, quand } : null;
93
+ }
94
+ const date = /^(\d{4})-(\d{2})-(\d{2})(?:[ T](\d{2}):(\d{2}))?$/.exec(heure);
95
+ if (!date) {
96
+ return null;
97
+ }
98
+ const [, annee, mois, jour, heures = '00', minutes = '00'] = date;
99
+ const cible = new Date(maintenant);
100
+ cible.setFullYear(Number(annee), Number(mois) - 1, Number(jour));
101
+ cible.setHours(Number(heures), Number(minutes), 0, 0);
102
+ // A date or an hour that does not exist rolls over to another one.
103
+ const defer = `${annee}-${mois}-${jour}T${heures}:${minutes}:00`;
104
+ return pourBd(cible) === defer && cible > maintenant ? { defer, quand } : null;
70
105
  }
71
106
 
72
107
  /**
@@ -103,3 +138,26 @@ export function reponseMecanique({ etat, sorte, commande, contexte }) {
103
138
  ? { sorte: { genre: 'mécanique', raison, commande: geste }, suivant: { etape: GESTE } }
104
139
  : { sorte: { genre: 'comportement', raison, comportement: 'inchangé' }, suivant: { etape: CODE } };
105
140
  }
141
+
142
+ /**
143
+ * The answer `--planifier --contexte <raison>` to the stop <etat> (`{ raison, motif, circuit }`,
144
+ * circuit.md §5.6): a refusal `{ refus }` unless a direct circuit is stopped on « besoin » or
145
+ * « hors-portee » with the motif « demande-un-plan », and with a reason; else `{}`.
146
+ * @param {{ etat: { etape: string, raison?: string | null, motif?: string | null,
147
+ * circuit?: string | null } | null, contexte: string | null }} o
148
+ * @returns {{ refus?: string }}
149
+ */
150
+ export function reponsePlanifier({ etat, contexte }) {
151
+ if (
152
+ etat?.motif !== DEMANDE_UN_PLAN ||
153
+ !['besoin', 'hors-portee'].includes(etat.raison ?? '') ||
154
+ (etat.circuit && etat.circuit !== 'direct')
155
+ ) {
156
+ return {
157
+ refus: `--planifier répond à un arrêt (besoin ou hors-portee) d’un circuit direct au motif « ${DEMANDE_UN_PLAN} » : le circuit est à ${etat?.etape ?? 'aucun état'}${etat?.raison ? `, arrêté sur ${etat.raison}` : ''}.`,
158
+ };
159
+ }
160
+ return String(contexte ?? '').trim()
161
+ ? {}
162
+ : { refus: '--planifier attend sa raison en --contexte.' };
163
+ }
@@ -6,7 +6,7 @@
6
6
  //
7
7
  // - The sheet of the end of a session (« la fiche ») of the explorateur, the questionneur, the
8
8
  // testwriter, the developpeur, the agent direct and the reviewer: the schema of each role (FICHES), which the
9
- // session receives (`claude -p --output-format json --json-schema <schéma>`) and fills as its
9
+ // session receives (`claude -p --json-schema <schéma>`) and fills as its
10
10
  // last act, in the field `structured_output` of its result. A field exists only when a reader
11
11
  // reads it:
12
12
  // - `statut` (FAIT, BLOQUÉ, BESOIN), with `raison` for BLOQUÉ and `question` for BESOIN, each
@@ -58,8 +58,10 @@
58
58
  // envelope of every later session writes; the open questions, a change or a removal of a
59
59
  // criterion written among them, go up to the supervisor, each naming why: the language, the
60
60
  // architecture, a gap to the reference, or no answer (explorateur);
61
- // - `sorte` (`genre` mécanique or comportement, its `raison`, the `commande` a mechanical ticket
62
- // plays, and, for a comportement, `comportement` changé, tests-adaptés or inchangé): a
61
+ // - `sorte` (`genre` mécanique, comportement or correction triviale, its `raison`, the
62
+ // `commande` a mechanical ticket plays, the `piece` a correction triviale needs, judged as every
63
+ // piece of a sheet, a correction triviale switching to the direct circuit once its plan passes
64
+ // (circuit.md §5.6), and, for a comportement, `comportement` changé, tests-adaptés or inchangé): a
63
65
  // mechanical ticket skips the testwriter, the proof and the developpeur; under
64
66
  // « tests-adaptés » the testwriter writes and every green of the proof is expected, then the
65
67
  // developpeur writes; under « inchangé » the developpeur alone writes; a sort absent, out of
@@ -122,7 +124,7 @@ import path from 'node:path';
122
124
  import { pathToFileURL } from 'node:url';
123
125
  import { refusDeLaCommande } from './commande-du-plan.mjs';
124
126
  import { paquets } from './paquets.mjs';
125
- import { AUTEUR_DU_CIRCUIT, AUTEURS_DE_LOT, EXPLORATEUR } from './etapes.mjs';
127
+ import { AUTEUR_DU_CIRCUIT, AUTEURS_DE_LOT, DEMANDE_UN_PLAN, EXPLORATEUR } from './etapes.mjs';
126
128
 
127
129
  // The variable that names the results directory of a run.
128
130
  export const RESULTATS = 'GRILLHOUSE_RESULTATS';
@@ -202,8 +204,10 @@ export const VERDICTS_ROUVERTS = ['a-porter', 'non-confirmee'];
202
204
  const VERDICTS_PROUVES = ['traitee', 'a-porter'];
203
205
 
204
206
  // The sorts of a ticket the explorateur judges at the plan: a gesture without new
205
- // behaviour, which its command makes, or a change of behaviour, which the circuit of code makes.
206
- export const SORTES = ['mécanique', 'comportement'];
207
+ // behaviour, which its command makes, a change of behaviour, which the circuit of code makes, or a
208
+ // correction triviale, which the direct circuit makes.
209
+ const TRIVIALE = 'correction triviale';
210
+ export const SORTES = ['mécanique', 'comportement', TRIVIALE];
207
211
  // The values of the field `comportement` of a plan of sort comportement: changé (the testwriter
208
212
  // writes, a red is required), tests-adaptés (the testwriter writes, the proof accepts every
209
213
  // green), inchangé (a gesture written by hand: the developpeur alone, no testwriter).
@@ -280,12 +284,13 @@ const FICHES = {
280
284
  type: 'string',
281
285
  enum: SORTES,
282
286
  description:
283
- 'mécanique : un geste sans comportement neuf (montée du cadre, documents seuls, renommage ou déplacement, montée de dépendance, configuration seule, correction de style, seuil relevé), que sa commande fait ; comportement : tout autre ticket, et tout doute.',
287
+ 'mécanique : un geste sans comportement neuf (montée du cadre, documents seuls, renommage ou déplacement, montée de dépendance, configuration seule, correction de style, seuil relevé), que sa commande fait ; correction triviale : une ligne fautive, un mauvais argument, que le ticket décrit en entier, que l’agent direct fait ; comportement : tout autre ticket, et tout doute.',
284
288
  },
285
289
  raison: texte('Pourquoi le ticket est de cette sorte.'),
286
290
  commande: texte(
287
291
  'mécanique : la commande ou l’outil qui fait le geste, tel qu’il se lance à la racine de la copie.'
288
292
  ),
293
+ piece: piece('correction triviale : sa pièce'),
289
294
  comportement: {
290
295
  type: 'string',
291
296
  enum: COMPORTEMENTS,
@@ -294,7 +299,7 @@ const FICHES = {
294
299
  },
295
300
  },
296
301
  ['genre', 'raison'],
297
- 'La sorte du ticket, et sa raison ; un ticket mécanique saute le testwriter, la preuve du rouge et le développeur. Une sorte absente vaut comportement.'
302
+ 'La sorte du ticket, et sa raison ; un ticket mécanique saute le testwriter, la preuve du rouge et le développeur ; une correction triviale, avec sa pièce, bascule au circuit direct une fois le plan passé. Une sorte absente vaut comportement.'
298
303
  ),
299
304
  ecartes: liste(
300
305
  objet(
@@ -401,15 +406,22 @@ const FICHES = {
401
406
  ),
402
407
  }),
403
408
  // The agent direct writes the tests with the code: he sends no red to the testwriter.
404
- direct: fiche(),
409
+ direct: fiche({
410
+ motif: {
411
+ type: 'string',
412
+ enum: [DEMANDE_UN_PLAN],
413
+ description:
414
+ 'BESOIN ou BLOQUÉ, avec sa raison et sa pièce : le ticket demande un plan ou plus d’un agent ; le circuit s’arrête, et le superviseur confirme la bascule (`--planifier`) ou garde le direct (`--reprendre`).',
415
+ },
416
+ }),
405
417
  relecteur: objet(
406
418
  {
407
419
  verdict: { type: 'string', enum: ['ACCEPTÉ', 'RENDU'] },
408
420
  motif: {
409
421
  type: 'string',
410
- enum: ['comportement-change'],
422
+ enum: ['comportement-change', DEMANDE_UN_PLAN],
411
423
  description:
412
- 'RENDU d’un lot du circuit court dont le comportement du produit change : le circuit reprend le ticket à 2 Tests sur le même plan, sa sorte changée en comportement.',
424
+ 'comportement-change : RENDU d’un lot du circuit court dont le comportement du produit change, le circuit reprend le ticket à 2 Tests sur le même plan, sa sorte changée en comportement. demande-un-plan : RENDU d’un lot direct dont le ticket demande un plan, avec sa pièce, le circuit s’arrête et le superviseur décide (`--planifier` ou `--reprendre`).',
413
425
  },
414
426
  conformite: liste(
415
427
  objet(
@@ -532,7 +544,8 @@ const FICHES = {
532
544
  export const schemaDeFiche = role => FICHES[role] ?? null;
533
545
 
534
546
  // The sort of the ticket the explorateur's sheet of the plan <fiche> says (`sorte`): `{ genre:
535
- // 'mécanique', raison, commande }` for a mechanical ticket with its reason and its command; else
547
+ // 'mécanique', raison, commande }` for a mechanical ticket with its reason and its command; `{
548
+ // genre: 'correction triviale', raison }` for a correction triviale with its reason; else
536
549
  // `{ genre: 'comportement', raison, comportement }`, `comportement` one of COMPORTEMENTS, changé
537
550
  // when absent, unknown or without its reason. A sort absent, out of its kinds or without what it needs is comportement, the
538
551
  // whole circuit, as a doubt goes to the circuit.
@@ -543,6 +556,9 @@ export function sorteDuPlan(fiche) {
543
556
  if (raison && s.genre === 'mécanique' && plein(s.commande)) {
544
557
  return { genre: 'mécanique', raison, commande: s.commande.trim() };
545
558
  }
559
+ if (raison && s.genre === TRIVIALE) {
560
+ return { genre: TRIVIALE, raison };
561
+ }
546
562
  const valeur = raison && s.genre === 'comportement' ? s.comportement : null;
547
563
  return {
548
564
  genre: 'comportement',
@@ -829,10 +845,11 @@ function pieceDuTicket(reste) {
829
845
  }
830
846
 
831
847
  // The pieces of the sheet <f>, each `[son chemin, son texte]`: of the stop it carries (a status,
832
- // a reviewer's question), of its findings, of its lines of conformity, of its questions, of its
848
+ // a reviewer's question), of its sort correction triviale, of its findings, of its lines of conformity, of its questions, of its
833
849
  // criteria out of the plan, of the verdicts of a tri, of the developpeur's answers.
834
850
  const piecesDe = f => [
835
851
  ...('piece' in f ? [['piece', f.piece]] : []),
852
+ ...(f.sorte?.genre === TRIVIALE && 'piece' in f.sorte ? [['sorte.piece', f.sorte.piece]] : []),
836
853
  ...['constats', 'conformite', 'questions', 'hors_plan', 'verdicts', 'reponses'].flatMap(k =>
837
854
  (f[k] ?? []).map((x, i) => [`${k}[${i}].piece`, x.piece]).filter(([, p]) => p !== undefined)
838
855
  ),
@@ -929,6 +946,14 @@ function manques(role, f) {
929
946
  if (f.statut === 'BESOIN' && !plein('question')) {
930
947
  out.push('question : manque, pour BESOIN');
931
948
  }
949
+ if (
950
+ role === 'direct' &&
951
+ f.motif === DEMANDE_UN_PLAN &&
952
+ f.statut === 'BESOIN' &&
953
+ !plein('raison')
954
+ ) {
955
+ out.push(`raison : manque, pour le motif ${DEMANDE_UN_PLAN}`);
956
+ }
932
957
  if (['BLOQUÉ', 'BESOIN'].includes(f.statut) && !('piece' in f)) {
933
958
  out.push(`piece : manque, pour ${f.statut}`);
934
959
  }
@@ -983,6 +1008,9 @@ function manques(role, f) {
983
1008
  if (!(f.paquets ?? []).length) {
984
1009
  out.push('paquets : manque, pour un plan');
985
1010
  }
1011
+ if (f.sorte?.genre === TRIVIALE && !('piece' in f.sorte)) {
1012
+ out.push(`sorte.piece : manque, pour une ${TRIVIALE}`);
1013
+ }
986
1014
  const refus = refusDeLaCommande(f.sorte?.commande);
987
1015
  if (refus) {
988
1016
  out.push(`sorte.commande : ${refus}`);
@@ -1024,7 +1052,7 @@ function manques(role, f) {
1024
1052
  return out;
1025
1053
  }
1026
1054
 
1027
- // The sheet of <role> in <sortie>, what claude prints with `--output-format json`: `{ fiche,
1055
+ // The sheet of <role> in <sortie>, the line `type: result` of claude's stream: `{ fiche,
1028
1056
  // seance }`, or `{ erreur }` naming what lacks or does not conform; with <copie>, the directory
1029
1057
  // of the copy, each file piece of the sheet stands in it, its file and its line; with <ticket>,
1030
1058
  // the description of the ticket, each piece of the ticket names a criterion or a section of it.
@@ -4,23 +4,20 @@
4
4
  //
5
5
  // node scripts/retirer-les-copies-finies.mjs [<copie finie de jouer>…] from the main tree
6
6
  //
7
- // - The circuits that hold their copy are what the Temporal server says (./circuits-du-serveur.mjs,
8
- // 5 s at most): each that has not ended (it runs, or waits an answer or a place), and
9
- // each ended without its issue, which waits the supervisor's answer; a server that does not
7
+ // - The circuits that hold their copy are what the Temporal server says (./circuits-tenus.mjs,
8
+ // 5 s at most); a server that does not
10
9
  // answer, a client not built or any other fault of that reading leaves them unread (null), and
11
10
  // the removal of ./copies-finies.mjs then keeps each copy beside its `.travail`.
12
11
  // - The removal lives in ./copies-finies.mjs, which imports nothing of the built `dist/`: the lock
13
12
  // of the machine (./attente-de-la-machine.mjs) and the base configuration of the tests import it,
14
13
  // and a project of trial holds the frame's scripts without `dist/`.
15
- import { circuitsDuServeur } from './circuits-du-serveur.mjs';
14
+ import { ticketsTenus } from './circuits-tenus.mjs';
16
15
  import { retirerLesCopiesDuDepot } from './copies-finies.mjs';
17
16
 
18
17
  const racine = process.cwd();
19
18
  let tenus = null;
20
19
  try {
21
- tenus = new Set(
22
- (await circuitsDuServeur(racine)).filter(c => c.fin === null || c.question).map(c => c.ticket)
23
- );
20
+ tenus = new Set(await ticketsTenus(racine));
24
21
  } catch {
25
22
  tenus = null;
26
23
  }
@@ -29,6 +29,8 @@ import os from 'node:os';
29
29
  import path from 'node:path';
30
30
  import { pathToFileURL } from 'node:url';
31
31
  import { GREFFON } from './cadre.mjs';
32
+ import { competencesDuRole } from './droits.mjs';
33
+ import { entreeDeSeance } from './entree-de-seance.mjs';
32
34
  import { avecLeFichierDuPoste, configurationDuPoste } from './fichier-du-poste.mjs';
33
35
  import {
34
36
  changements,
@@ -45,7 +47,7 @@ import {
45
47
  VARIABLE_TESTS_ETENDUS,
46
48
  } from './enveloppe/paquets-du-plan.mjs';
47
49
  import { langageDe, langageDeLaCopie } from './langages.mjs';
48
- import { leRole, nomDuRole } from './etapes.mjs';
50
+ import { DEMANDE_UN_PLAN, leRole, nomDuRole } from './etapes.mjs';
49
51
  import { departDe, VARIABLE_SEANCE } from './mesure/base-de-passe.mjs';
50
52
  import { groupeVivant, signalerGroupe } from './mesure-de-la-machine.mjs';
51
53
  import {
@@ -124,19 +126,28 @@ const OUVRIR_LE_TEMPORAIRE = `import { ouvrirBase } from ${JSON.stringify(
124
126
  )}; process.stdout.write(ouvrirBase('seance', { pid: Number(process.argv[1]) }).dossier);`;
125
127
 
126
128
  // The shell that carries a session out of the envelope (`$0` the file of its exit code, `$1` node,
127
- // `$2` the script above, then the session's command): it opens the session's temporary directory,
128
- // which it owns, so that it outlives a dead circuit, names it in TMPDIR, TMP and TEMP, whatever
129
- // CLAUDE_CODE_TMPDIR the poste holds, and removes it at its end, even interrupted.
129
+ // `$2` the script above, `$3` the sorter of its stream (scripts/sortie-de-seance.mjs), `$4` the
130
+ // file of its result, `$5` that of the lines the log takes of it, then the session's command): it
131
+ // opens the session's temporary directory, which it owns, so that it outlives a dead circuit,
132
+ // names it in TMPDIR, TMP and TEMP, whatever CLAUDE_CODE_TMPDIR the poste holds, and removes it at
133
+ // its end, even interrupted. The stream of the session is written beside that directory, then
134
+ // sorted: its result to `$4`, the lines of the log to `$5`, which the circuit adds to the log
135
+ // after the last attempt of the launch.
130
136
  const PORTER_LA_SEANCE = [
131
137
  "trap 'exit 129' HUP; trap 'exit 130' INT; trap 'exit 143' TERM",
132
138
  't=$("$1" --input-type=module -e "$2" "$$" </dev/null) || exit',
133
139
  'trap \'rm -rf -- "${t%/t}"\' EXIT',
134
- 'shift 2',
140
+ 'node=$1 tri=$3 resultat=$4 journal=$5 flux="${t%/t}/flux"',
141
+ 'shift 5',
135
142
  'export TMPDIR="$t" TMP="$t" TEMP="$t"',
136
143
  'unset CLAUDE_CODE_TMPDIR',
137
- '"$@"; c=$?; echo "$c" > "$0"; exit "$c"',
144
+ '"$@" > "$flux"; c=$?',
145
+ '"$node" "$tri" "$flux" "$resultat" > "$journal"',
146
+ 'echo "$c" > "$0"; exit "$c"',
138
147
  ].join('\n');
139
148
 
149
+ const TRIER_LE_FLUX = path.join(import.meta.dirname, 'sortie-de-seance.mjs');
150
+
140
151
  // The templates of the instructions, in the skill of the supervisor, which the frame's plugin
141
152
  // carries, read at the plugin's root (scripts/cadre.mjs).
142
153
  const GABARIT = path.join(GREFFON, 'skills', 'pitmaster', 'references', 'consigne-agent.md');
@@ -170,9 +181,10 @@ const mtime = f => {
170
181
 
171
182
  /**
172
183
  * Where the session <id> of <ctx> keeps its result, in the working directory of the ticket
173
- * (`<copie>.travail/seances/<id>/`, as lancer.sh writes it): its exit code (`fin`), claude's JSON
174
- * result (`resultat.json`), the tree the prepared copy held before it (`avant`) and the witness
175
- * that the envelope started its command (`demarree`).
184
+ * (`<copie>.travail/seances/<id>/`, as lancer.sh writes it): its exit code (`fin`), the line
185
+ * `type: result` of claude's stream (`resultat.json`), the lines the log takes of the stream of
186
+ * a session out of the envelope (`au-journal`), the tree the prepared copy held before it
187
+ * (`avant`) and the witness that the envelope started its command (`demarree`).
176
188
  */
177
189
  export function rangDeLaSeance(ctx, id) {
178
190
  const dossier = path.join(ctx.tmp, 'seances', id);
@@ -180,6 +192,7 @@ export function rangDeLaSeance(ctx, id) {
180
192
  dossier,
181
193
  fin: path.join(dossier, 'fin'),
182
194
  resultat: path.join(dossier, 'resultat.json'),
195
+ auJournal: path.join(dossier, 'au-journal'),
183
196
  avant: path.join(dossier, 'avant'),
184
197
  demarree: path.join(dossier, 'demarree'),
185
198
  };
@@ -215,10 +228,12 @@ function resultatRange(rang, id, { horsEnveloppe = false } = {}) {
215
228
  // itself, in the ticket's
216
229
  // copy (the main tree once the copy is gone), under <droits> (`horsDeLEnveloppe`), the
217
230
  // schema of its role's sheet and the options <session> names (its id, or the session it
218
- // resumes), its instruction on its standard input and its result on its standard output, in a
219
- // temporary directory of its own (PORTER_LA_SEANCE), ranged
220
- // under its id with its exit code as lancer.sh ranges them, added to the log under its header
221
- // line, then its line written to the register, as lancer.sh does.
231
+ // resumes), in stream-json both ways: the skills of its role and its instruction on its standard
232
+ // input (scripts/entree-de-seance.mjs), its stream on its standard output, in a temporary
233
+ // directory of its own (PORTER_LA_SEANCE); of that stream, its result is ranged under its id with
234
+ // its exit code as lancer.sh ranges them, and the log takes under its header line what is not the
235
+ // conversation (scripts/sortie-de-seance.mjs); then its line is written to the register, as
236
+ // lancer.sh does.
222
237
  // Its launch is kept with the circuit's results (`lancement`: its role, its session id, and the
223
238
  // <objet> of a session that is not its role's own work, `tri`), which the bilan reads to count the
224
239
  // sessions the circuit launched (scripts/bilan.mjs). Its sign of life names the session
@@ -301,6 +316,7 @@ export async function lancer(
301
316
  mkdirSync(rang.dossier, { recursive: true });
302
317
  rmSync(rang.fin, { force: true });
303
318
  rmSync(rang.resultat, { force: true });
319
+ rmSync(rang.auJournal, { force: true });
304
320
  rmSync(rang.avant, { force: true });
305
321
  rmSync(rang.demarree, { force: true });
306
322
  inscrire(ctx, {
@@ -312,22 +328,27 @@ export async function lancer(
312
328
  writeFileSync(fichier, consigne);
313
329
  // A file, not a pipe: a session whose circuit is dead writes its errors without breaking.
314
330
  const erreurs = path.join(ctx.tmp, `erreurs-${numero}.txt`);
331
+ // The input of a session out of the envelope; lancer.sh composes that of an enveloped one.
332
+ const entree = path.join(ctx.tmp, `entree-${numero}.jsonl`);
333
+ if (horsEnveloppe) {
334
+ writeFileSync(entree, entreeDeSeance({ competences: competencesDuRole(role), consigne }));
335
+ }
315
336
  let commande;
316
- // Its result ranged under its id, as lancer.sh ranges a session's: claude's output, then its
317
- // exit code once it ends, written by the shell that runs it, which outlives a dead circuit.
318
- const ouvrirLesFds = () =>
319
- horsEnveloppe
320
- ? [openSync(fichier, 'r'), openSync(rang.resultat, 'w'), openSync(ctx.journal, 'a')]
321
- : ['ignore', 'ignore', openSync(erreurs, 'w')];
337
+ // Its result ranged under its id, as lancer.sh ranges a session's: the result of claude's
338
+ // stream, then its exit code once it ends, written by the shell that runs it, which outlives a
339
+ // dead circuit.
340
+ const ouvrirLesFds = () => {
341
+ if (!horsEnveloppe) {
342
+ return ['ignore', 'ignore', openSync(erreurs, 'w')];
343
+ }
344
+ const journal = openSync(ctx.journal, 'a');
345
+ return [openSync(entree, 'r'), journal, journal];
346
+ };
322
347
  let fds = ouvrirLesFds();
323
348
  if (horsEnveloppe) {
324
349
  entete(ctx, role);
325
- const fiche = [
326
- '--output-format',
327
- 'json',
328
- '--json-schema',
329
- JSON.stringify(schemaDeFiche(sorte ?? role)),
330
- ];
350
+ const flux = ['--input-format', 'stream-json', '--output-format', 'stream-json', '--verbose'];
351
+ const fiche = ['--json-schema', JSON.stringify(schemaDeFiche(sorte ?? role))];
331
352
  commande = {
332
353
  cmd: 'sh',
333
354
  args: [
@@ -336,8 +357,11 @@ export async function lancer(
336
357
  rang.fin,
337
358
  process.execPath,
338
359
  OUVRIR_LE_TEMPORAIRE,
360
+ TRIER_LE_FLUX,
361
+ rang.resultat,
362
+ rang.auJournal,
339
363
  process.env.CLAUDE_BIN || 'claude',
340
- ...['-p', '--agent', role, ...fiche, ...droits, '--add-dir', ctx.tmp, ...session],
364
+ ...['-p', '--agent', role, ...flux, ...fiche, ...droits, '--add-dir', ctx.tmp, ...session],
341
365
  ],
342
366
  cwd: existsSync(ctx.copie) ? ctx.copie : ctx.racine,
343
367
  };
@@ -473,6 +497,7 @@ export async function lancer(
473
497
  );
474
498
  rmSync(rang.fin, { force: true });
475
499
  rmSync(rang.resultat, { force: true });
500
+ rmSync(rang.auJournal, { force: true });
476
501
  fds = ouvrirLesFds();
477
502
  const { ANTHROPIC_API_KEY: _cle, ...sansCle } = process.env;
478
503
  r = await jouer(sansCle);
@@ -486,7 +511,9 @@ export async function lancer(
486
511
  : r.erreur === null
487
512
  ? r.code
488
513
  : null;
489
- appendFileSync(ctx.journal, `${sortie}\n`);
514
+ if (existsSync(rang.auJournal)) {
515
+ appendFileSync(ctx.journal, readFileSync(rang.auJournal));
516
+ }
490
517
  spawnSync(process.execPath, [REGISTRE, '--copie', ctx.copie], {
491
518
  cwd: ctx.racine,
492
519
  stdio: ['ignore', 'ignore', 'ignore'],
@@ -716,7 +743,7 @@ export function consigne(valeurs, rang = 0) {
716
743
  // reviewer on a direct circuit and that of the rescue command carry it.
717
744
  const EXIGENCE_DU_DIRECT = [
718
745
  'CE LOT EST UN DIRECT : un seul agent, le rôle `direct`, a écrit les tests et le code ensemble. Tout constat bloquant lui est adressé : son destinataire est `direct`.',
719
- "La preuve du rouge n'est pas jouée : tu la tiens. Un défaut corrigé porte un test qui le reproduit, et ce test échoue sans le code du lot ; sans lui, le constat est bloquant. Un ticket de données ou le squelette d'un paquet, qui ne change aucun comportement, n'a pas de test à exiger.",
746
+ "La preuve du rouge n'est pas jouée : tu la tiens. Un défaut corrigé porte un test qui le reproduit, et ce test échoue sans le code du lot ; sans lui, le constat est bloquant. Le squelette d'un paquet, qui ne change aucun comportement, n'a pas de test à exiger.",
720
747
  ].join('\n\n');
721
748
 
722
749
  /**
@@ -1016,6 +1043,24 @@ export function arretDuStatut(
1016
1043
  const passation = derniereDe(ctx, role)?.text ?? 'aucune';
1017
1044
  const qui = leRole(role);
1018
1045
  const { piece } = fiche;
1046
+ if (role === 'direct' && fiche.motif === DEMANDE_UN_PLAN) {
1047
+ const nom = fiche.statut === 'BESOIN' ? 'besoin' : 'hors-portee';
1048
+ return new Arret(
1049
+ nom,
1050
+ `${qui} demande un plan (séance ${tentative}) : ${fiche.raison}\n\nSa passation :\n\n${passation}`,
1051
+ {
1052
+ piece,
1053
+ question: [
1054
+ `${qui} demande un plan : ${fiche.raison}`,
1055
+ fiche.question,
1056
+ '`--planifier --contexte <raison>` confirme la bascule vers le plan, `--reprendre --contexte <texte>` garde le circuit direct.',
1057
+ ]
1058
+ .filter(Boolean)
1059
+ .join('\n\n'),
1060
+ demande: DEMANDE_UN_PLAN,
1061
+ }
1062
+ );
1063
+ }
1019
1064
  return fiche.statut === 'BESOIN'
1020
1065
  ? new Arret(
1021
1066
  'besoin',
@@ -1375,7 +1420,14 @@ export async function jusquALaFiche(ctx, role, texte, options = {}) {
1375
1420
  if (hors && reste.horsEnveloppe) {
1376
1421
  lu = { erreur: [lu.erreur, hors.rapport].filter(Boolean).join(' ; ') };
1377
1422
  }
1378
- if (lu.fiche?.statut === 'BESOIN' && lu.fiche.manque && !reste.horsEnveloppe) {
1423
+ // A request for a plan ends the session on its sheet: no extension of the plan, no resumption.
1424
+ const demandeUnPlan = role === 'direct' && lu.fiche?.motif === DEMANDE_UN_PLAN;
1425
+ if (
1426
+ lu.fiche?.statut === 'BESOIN' &&
1427
+ lu.fiche.manque &&
1428
+ !demandeUnPlan &&
1429
+ !reste.horsEnveloppe
1430
+ ) {
1379
1431
  const demande = extensionDemandee(ctx, role, lu.fiche.manque);
1380
1432
  const extension = demande?.etendre ?? demande?.etendreTests;
1381
1433
  const etendre = demande?.etendre ? ctx.etendreEnVol : ctx.etendreTestsEnVol;
@@ -29,7 +29,7 @@ export { arbitrageTranche, estArbitrage } from './arbitrages.mjs';
29
29
  export { garderLeTotal, inscrireLePlan, ouvrirAvancement } from './avancement.mjs';
30
30
  export { sources } from './sources.mjs';
31
31
  export { trouverDansLePath } from './commandes-du-path.mjs';
32
- export { paquetsSansPackageJson } from './paquet-npm.mjs';
32
+ export { gesteDuPackageJson, paquetsSansPackageJson } from './paquet-npm.mjs';
33
33
  export { fournisseursDuPaquet } from './donnees-cles.mjs';
34
34
  export { poserLeGabaritAbsent } from './gabarit-absent.mjs';
35
35
  export {
@@ -78,7 +78,12 @@ export { A_REPASSER, MEMOIRE_COUPEE } from './codes-de-sortie.mjs';
78
78
  export const GARDE_DE_LA_MEMOIRE = fileURLToPath(
79
79
  new URL('./garde-de-la-memoire.mjs', import.meta.url)
80
80
  );
81
- export { ecrirePression, lirePression, SEUIL_PRESSION } from './mesure/pression.mjs';
81
+ export {
82
+ attendreLeRepos,
83
+ ecrirePression,
84
+ lirePression,
85
+ SEUIL_PRESSION,
86
+ } from './mesure/pression.mjs';
82
87
  export { avecLaPasse, surUnePart } from './passe-de-la-machine.mjs';
83
88
  export {
84
89
  nommerLAvancement,