@roomi-fields/grillhouse 0.29.0 → 0.31.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 (263) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +769 -0
  3. package/agents/developpeur.md +0 -1
  4. package/agents/explorateur.md +0 -1
  5. package/agents/questionneur.md +0 -1
  6. package/agents/testwriter.md +0 -1
  7. package/bin/grillhouse.mjs +79 -18
  8. package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
  9. package/cadre/templates/projet/CLAUDE.md +5 -1
  10. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  11. package/cadre/templates/projet/package.json +2 -2
  12. package/charte.md +24 -0
  13. package/dist/temporal/acte.d.ts +24 -0
  14. package/dist/temporal/acte.js +139 -0
  15. package/dist/temporal/acte.js.map +1 -0
  16. package/dist/temporal/attributs.d.ts +6 -0
  17. package/dist/temporal/attributs.js +15 -0
  18. package/dist/temporal/attributs.js.map +1 -0
  19. package/dist/temporal/circuit/activites.d.ts +13 -0
  20. package/dist/temporal/circuit/activites.js +33 -0
  21. package/dist/temporal/circuit/activites.js.map +1 -0
  22. package/dist/temporal/circuit/client.d.ts +72 -0
  23. package/dist/temporal/circuit/client.js +247 -0
  24. package/dist/temporal/circuit/client.js.map +1 -0
  25. package/dist/temporal/circuit/commande.d.ts +2 -0
  26. package/dist/temporal/circuit/commande.js +238 -0
  27. package/dist/temporal/circuit/commande.js.map +1 -0
  28. package/dist/temporal/circuit/contrat.d.ts +305 -0
  29. package/dist/temporal/circuit/contrat.js +30 -0
  30. package/dist/temporal/circuit/contrat.js.map +1 -0
  31. package/dist/temporal/circuit/deroule.d.ts +3 -0
  32. package/dist/temporal/circuit/deroule.js +540 -0
  33. package/dist/temporal/circuit/deroule.js.map +1 -0
  34. package/dist/temporal/client.d.ts +47 -0
  35. package/dist/temporal/client.js +69 -0
  36. package/dist/temporal/client.js.map +1 -0
  37. package/dist/temporal/commande.d.ts +2 -0
  38. package/dist/temporal/commande.js +94 -0
  39. package/dist/temporal/commande.js.map +1 -0
  40. package/dist/temporal/deroules.d.ts +5 -0
  41. package/dist/temporal/deroules.js +10 -0
  42. package/dist/temporal/deroules.js.map +1 -0
  43. package/dist/temporal/etat.d.ts +33 -0
  44. package/dist/temporal/etat.js +59 -0
  45. package/dist/temporal/etat.js.map +1 -0
  46. package/dist/temporal/file/activites.d.ts +10 -0
  47. package/dist/temporal/file/activites.js +25 -0
  48. package/dist/temporal/file/activites.js.map +1 -0
  49. package/dist/temporal/file/client.d.ts +4 -0
  50. package/dist/temporal/file/client.js +6 -0
  51. package/dist/temporal/file/client.js.map +1 -0
  52. package/dist/temporal/file/contrat.d.ts +158 -0
  53. package/dist/temporal/file/contrat.js +14 -0
  54. package/dist/temporal/file/contrat.js.map +1 -0
  55. package/dist/temporal/file/deroule.d.ts +15 -0
  56. package/dist/temporal/file/deroule.js +235 -0
  57. package/dist/temporal/file/deroule.js.map +1 -0
  58. package/dist/temporal/installation.d.ts +120 -0
  59. package/dist/temporal/installation.js +386 -0
  60. package/dist/temporal/installation.js.map +1 -0
  61. package/dist/temporal/places/activites.d.ts +8 -0
  62. package/dist/temporal/places/activites.js +13 -0
  63. package/dist/temporal/places/activites.js.map +1 -0
  64. package/dist/temporal/places/client.d.ts +28 -0
  65. package/dist/temporal/places/client.js +64 -0
  66. package/dist/temporal/places/client.js.map +1 -0
  67. package/dist/temporal/places/contrat.d.ts +106 -0
  68. package/dist/temporal/places/contrat.js +21 -0
  69. package/dist/temporal/places/contrat.js.map +1 -0
  70. package/dist/temporal/places/deroule.d.ts +3 -0
  71. package/dist/temporal/places/deroule.js +198 -0
  72. package/dist/temporal/places/deroule.js.map +1 -0
  73. package/dist/temporal/sonde/activites.d.ts +6 -0
  74. package/dist/temporal/sonde/activites.js +52 -0
  75. package/dist/temporal/sonde/activites.js.map +1 -0
  76. package/dist/temporal/sonde/contrat.d.ts +35 -0
  77. package/dist/temporal/sonde/contrat.js +10 -0
  78. package/dist/temporal/sonde/contrat.js.map +1 -0
  79. package/dist/temporal/sonde/deroule.d.ts +3 -0
  80. package/dist/temporal/sonde/deroule.js +39 -0
  81. package/dist/temporal/sonde/deroule.js.map +1 -0
  82. package/dist/temporal/tickets/activites.d.ts +7 -0
  83. package/dist/temporal/tickets/activites.js +81 -0
  84. package/dist/temporal/tickets/activites.js.map +1 -0
  85. package/dist/temporal/tickets/client.d.ts +10 -0
  86. package/dist/temporal/tickets/client.js +31 -0
  87. package/dist/temporal/tickets/client.js.map +1 -0
  88. package/dist/temporal/tickets/contrat.d.ts +56 -0
  89. package/dist/temporal/tickets/contrat.js +13 -0
  90. package/dist/temporal/tickets/contrat.js.map +1 -0
  91. package/dist/temporal/tickets/deroule.d.ts +3 -0
  92. package/dist/temporal/tickets/deroule.js +94 -0
  93. package/dist/temporal/tickets/deroule.js.map +1 -0
  94. package/dist/temporal/travailleur.d.ts +2 -0
  95. package/dist/temporal/travailleur.js +69 -0
  96. package/dist/temporal/travailleur.js.map +1 -0
  97. package/docs/ARCHITECTURE.md +646 -87
  98. package/docs/CADRE.md +27 -0
  99. package/docs/INTERFACE.md +139 -42
  100. package/hooks/crochet.mjs +19 -2
  101. package/hooks/hooks.json +11 -0
  102. package/package.json +16 -4
  103. package/scripts/activites.mjs +2255 -0
  104. package/scripts/aiguillage.d.mts +37 -0
  105. package/scripts/aiguillage.mjs +40 -14
  106. package/scripts/avancement.mjs +155 -26
  107. package/scripts/bilan.mjs +137 -43
  108. package/scripts/cadre.mjs +16 -4
  109. package/scripts/circuit.mjs +993 -4075
  110. package/scripts/circuits-cles.d.mts +4 -0
  111. package/scripts/circuits-cles.mjs +21 -0
  112. package/scripts/circuits-du-serveur.mjs +105 -0
  113. package/scripts/codes-de-sortie.mjs +9 -0
  114. package/scripts/commandes-composees.mjs +45 -41
  115. package/scripts/commandes-du-path.d.mts +7 -0
  116. package/scripts/commandes-du-path.mjs +25 -0
  117. package/scripts/composants-affectes.mjs +64 -21
  118. package/scripts/composition-des-langages.mjs +18 -12
  119. package/scripts/conformite.mjs +56 -28
  120. package/scripts/copies-finies.mjs +52 -47
  121. package/scripts/depart-du-ticket.d.mts +53 -0
  122. package/scripts/depart-du-ticket.mjs +124 -0
  123. package/scripts/dependances-internes.mjs +121 -0
  124. package/scripts/dernier-vert.mjs +61 -34
  125. package/scripts/dette.mjs +32 -11
  126. package/scripts/donnees-cles.mjs +244 -0
  127. package/scripts/droits.mjs +51 -16
  128. package/scripts/effets.mjs +352 -0
  129. package/scripts/empreinte-d-etape.mjs +17 -0
  130. package/scripts/engendres.mjs +15 -5
  131. package/scripts/enveloppe/enveloppe.mjs +259 -55
  132. package/scripts/enveloppe/lancer.sh +14 -18
  133. package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
  134. package/scripts/enveloppe/travail-de-la-copie.mjs +41 -13
  135. package/scripts/etapes.mjs +5 -2
  136. package/scripts/faits-du-circuit.mjs +493 -0
  137. package/scripts/file-des-tickets.d.mts +21 -0
  138. package/scripts/file-des-tickets.mjs +58 -0
  139. package/scripts/flux-des-paquets.mjs +201 -0
  140. package/scripts/gardes-du-cadre.mjs +21 -5
  141. package/scripts/init.mjs +11 -4
  142. package/scripts/integration/file.mjs +544 -434
  143. package/scripts/integration/integrer.mjs +87 -43
  144. package/scripts/integration/rejeu.mjs +45 -13
  145. package/scripts/jointure.d.ts +151 -28
  146. package/scripts/langages/cargo/commandes.mjs +383 -124
  147. package/scripts/langages/cargo/composants.mjs +154 -42
  148. package/scripts/langages/cargo/exemples.mjs +12 -21
  149. package/scripts/langages/cargo/index.mjs +22 -8
  150. package/scripts/langages/cargo/sccache.mjs +8 -14
  151. package/scripts/langages/cargo/tests-de-head.mjs +25 -9
  152. package/scripts/langages/python/commandes.mjs +218 -100
  153. package/scripts/langages/python/composants.mjs +53 -21
  154. package/scripts/langages/python/exemples.mjs +6 -16
  155. package/scripts/langages/python/index.mjs +28 -8
  156. package/scripts/langages/python/lot.mjs +1 -36
  157. package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
  158. package/scripts/langages/typescript/composants.mjs +9 -3
  159. package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
  160. package/scripts/langages/typescript/consommateurs.mjs +39 -14
  161. package/scripts/langages/typescript/construire.mjs +6 -163
  162. package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
  163. package/scripts/langages/typescript/exemples.mjs +3 -11
  164. package/scripts/langages/typescript/frontieres.mjs +66 -22
  165. package/scripts/langages/typescript/index-interfaces.mjs +36 -13
  166. package/scripts/langages/typescript/index.mjs +50 -61
  167. package/scripts/langages/typescript/interfaces-contre-code.mjs +113 -45
  168. package/scripts/langages/typescript/lecteurs.mjs +36 -11
  169. package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
  170. package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
  171. package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
  172. package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
  173. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +33 -0
  174. package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
  175. package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
  176. package/scripts/langages/typescript/parcours.mjs +12 -4
  177. package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
  178. package/scripts/langages/typescript/resumes.mjs +9 -3
  179. package/scripts/langages/typescript/tailles-des-tests.mjs +93 -20
  180. package/scripts/langages/typescript/tests-de-nuit.mjs +15 -10
  181. package/scripts/langages/typescript/tests.mjs +40 -15
  182. package/scripts/langages/typescript/titres-de-tests.mjs +320 -0
  183. package/scripts/langages/typescript/turbo-des-paquets.mjs +327 -81
  184. package/scripts/langages/typescript/verdict.mjs +4 -2
  185. package/scripts/langages/typescript/verifier.mjs +58 -20
  186. package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
  187. package/scripts/langages/typescript/vitest-config/base.mjs +29 -3
  188. package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
  189. package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
  190. package/scripts/langages/typescript/vitest-config/cibles.mjs +36 -14
  191. package/scripts/langages/typescript/vitest-config/delais.mjs +60 -0
  192. package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
  193. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +108 -0
  194. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -59
  195. package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
  196. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +10 -0
  197. package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
  198. package/scripts/langages/typescript/vitest.nuit.config.mjs +4 -0
  199. package/scripts/lint-des-scripts.mjs +58 -0
  200. package/scripts/mesure/base-de-passe.mjs +117 -25
  201. package/scripts/mesure/pression.mjs +12 -6
  202. package/scripts/mesure-de-la-machine.d.mts +21 -0
  203. package/scripts/mesure-de-la-machine.mjs +76 -0
  204. package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
  205. package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
  206. package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
  207. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +56 -18
  208. package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
  209. package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
  210. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +124 -0
  211. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
  212. package/scripts/migrations.mjs +5 -0
  213. package/scripts/nuit.sh +25 -3
  214. package/scripts/outil.mjs +3 -1
  215. package/scripts/outils-cles.d.mts +24 -0
  216. package/scripts/outils-cles.mjs +18 -8
  217. package/scripts/paquet-npm.mjs +157 -0
  218. package/scripts/paquet.mjs +73 -4
  219. package/scripts/paquets.mjs +46 -10
  220. package/scripts/passe-de-la-machine.mjs +71 -0
  221. package/scripts/places-de-la-machine.mjs +414 -0
  222. package/scripts/places-du-serveur.mjs +170 -0
  223. package/scripts/prefixe-des-tickets.mjs +68 -0
  224. package/scripts/preparation.mjs +25 -8
  225. package/scripts/registre.mjs +9 -4
  226. package/scripts/regles-des-places.d.mts +36 -0
  227. package/scripts/regles-des-places.mjs +70 -0
  228. package/scripts/reponses-du-circuit.d.mts +6 -0
  229. package/scripts/reponses-du-circuit.mjs +28 -0
  230. package/scripts/reprise.mjs +66 -0
  231. package/scripts/resultats.mjs +112 -46
  232. package/scripts/retirer-les-copies-finies.mjs +25 -0
  233. package/scripts/sans-reponse.d.mts +4 -0
  234. package/scripts/sans-reponse.mjs +13 -0
  235. package/scripts/seances.mjs +936 -0
  236. package/scripts/services-du-noyau.mjs +27 -8
  237. package/scripts/session-start.sh +2 -2
  238. package/scripts/sortie.mjs +3 -3
  239. package/scripts/sous-commandes.mjs +41 -10
  240. package/scripts/style-a-l-ecriture.mjs +260 -0
  241. package/scripts/superviseur.mjs +122 -111
  242. package/scripts/tableau.mjs +180 -117
  243. package/scripts/taches-du-graphe.mjs +348 -0
  244. package/scripts/ticket-du-circuit.mjs +216 -0
  245. package/scripts/transitions.d.mts +148 -0
  246. package/scripts/transitions.mjs +1018 -0
  247. package/scripts/verrou-de-fichier.mjs +8 -4
  248. package/scripts/verrou-de-machine.mjs +150 -51
  249. package/scripts/verrous/commande.mjs +50 -17
  250. package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
  251. package/scripts/verrous/verrou.mjs +42 -14
  252. package/skills/explorateur/SKILL.md +9 -2
  253. package/skills/grill/SKILL.md +1 -1
  254. package/skills/mesure/SKILL.md +3 -0
  255. package/skills/pitmaster/SKILL.md +17 -18
  256. package/skills/pitmaster/references/consigne-agent.md +5 -1
  257. package/skills/release/SKILL.md +3 -3
  258. package/skills/relecteur/SKILL.md +5 -3
  259. package/skills/testwriter/SKILL.md +49 -31
  260. package/scripts/demon.mjs +0 -251
  261. package/scripts/integration/file-attente.mjs +0 -61
  262. package/scripts/langages/cargo/touches.mjs +0 -93
  263. package/scripts/langages/typescript/script-des-tests.mjs +0 -6
@@ -33,6 +33,9 @@
33
33
  // `~/.claude`, `~/.claude.json`, the npm cache, the paths of `MAISON_EN_LECTURE` (claude, node,
34
34
  // git and the session's tools) and the repository. No socket of the session comes back. Of
35
35
  // the machine's credentials, only claude's own are in sight.
36
+ // - A project that names its published version (`grillhouse.outil`) gets `~/.cache/grillhouse/outil`
37
+ // read-only, the version installed by the envelope before the session starts: the write lock
38
+ // runs on that version, never on the code of the copy it guards.
36
39
  // - The tools of the project (`grillhouse.outils` of the package.json of the main tree, never of
37
40
  // the copy, so that an agent never opens a path for its next session; `{ "<VARIABLE>":
38
41
  // "<chemin>" }`, read by scripts/outils-cles.mjs), as Bazel declares what an action sees out of
@@ -62,8 +65,9 @@
62
65
  // (`VARIABLES_DE_CHEMIN`) enters only when its path is in sight inside the envelope, tested there
63
66
  // before the command runs. The session has its own process space: it reads the environment of
64
67
  // no process of the machine.
65
- // - A declared path that is a symbolic link comes back as that link, and its target with it
66
- // (`avecLiens`).
68
+ // - A declared path that is a symbolic link, or that holds one among its components, comes back as
69
+ // that link, and its target with it (`avecLiens`); a store, a read or a written output is mounted
70
+ // at its real path, never at a link, by that same mechanism.
67
71
  // - A worktree of the repository under an emptied directory (the home, `/tmp`) comes back
68
72
  // read-only, `.git` included; the copy's packages of the plan and the tickets base are then
69
73
  // written as above.
@@ -122,7 +126,10 @@ import {
122
126
  } from './paquets-du-plan.mjs';
123
127
 
124
128
  export { paquetsDuLangage };
129
+ import { cacheDesOutils, installer, versionDeLOutil } from '../aiguillage.mjs';
125
130
  import { ouvrirBase } from '../mesure/base-de-passe.mjs';
131
+ import { travailleursDe, VARIABLE_TENUE } from '../places-de-la-machine.mjs';
132
+ import { donneesDe } from '../donnees-cles.mjs';
126
133
  import { outilsDe } from '../outils-cles.mjs';
127
134
 
128
135
  // The role that writes the package of the shared test material and the lock files of the versions.
@@ -176,7 +183,9 @@ const MAISON_EN_LECTURE = [
176
183
 
177
184
  // The variables of a login session that the envelope passes on, as sudo's env_reset keeps them,
178
185
  // claude's OAuth credential, the author of the session's comments at the ticket (`BEADS_ACTOR`,
179
- // which the circuit sets to the session's role), and the prefixes of the families it passes on:
186
+ // which the circuit sets to the session's role), the mark of the place the session holds
187
+ // (`GRILLHOUSE_PLACE_TENUE`, scripts/places-de-la-machine.mjs), which covers its commands, and
188
+ // the prefixes of the families it passes on:
180
189
  // the locale, and the configuration and credentials of claude's API. The state of a launching claude session
181
190
  // (`CLAUDE_CODE_SESSION_ID`, its messaging socket and token…) stays out.
182
191
  const ENVIRONNEMENT_DECLARE = [
@@ -192,6 +201,7 @@ const ENVIRONNEMENT_DECLARE = [
192
201
  'COLORTERM',
193
202
  'CLAUDE_CODE_OAUTH_TOKEN',
194
203
  'BEADS_ACTOR',
204
+ VARIABLE_TENUE,
195
205
  ];
196
206
  const FAMILLES_DECLAREES = ['LC_', 'ANTHROPIC_'];
197
207
  // The declared variables that name a path: each enters only when its path is in sight inside the
@@ -233,9 +243,14 @@ export function dossierDeTravail(copie, env = process.env) {
233
243
  // script: a `prepare` that writes under the read-only `.git` would fail `npm install`; the
234
244
  // launcher installs outside the session), `TMPDIR`, `TMP` and `TEMP` set to the session's working
235
245
  // directory <travail>, and `GRILLHOUSE_ENVELOPPE` set to the plan <paquets>; with them, each tool of the
236
- // project <outils> (`grillhouse.outils`), its variable set to its path. Nothing else of <env>
237
- // enters.
238
- export function environnementDeLaSeance(env, { cacheNpm, paquets, travail, outils = {} }) {
246
+ // project <outils> (`grillhouse.outils`), its variable set to its path; and, when <travailleurs>
247
+ // is given, GRILLHOUSE_TRAVAILLEURS set to it: the workers the session's tests play on, which the
248
+ // module of each language passes to its tool (scripts/places-de-la-machine.mjs `travailleursDe`).
249
+ // Nothing else of <env> enters.
250
+ export function environnementDeLaSeance(
251
+ env,
252
+ { cacheNpm, paquets, travail, outils = {}, donnees = {}, travailleurs }
253
+ ) {
239
254
  const declare = nom =>
240
255
  ENVIRONNEMENT_DECLARE.includes(nom) ||
241
256
  VARIABLES_DE_CHEMIN.includes(nom) ||
@@ -244,12 +259,57 @@ export function environnementDeLaSeance(env, { cacheNpm, paquets, travail, outil
244
259
  return {
245
260
  ...Object.fromEntries(garde),
246
261
  ...outils,
262
+ ...donnees,
247
263
  npm_config_cache: cacheNpm,
248
264
  npm_config_ignore_scripts: 'true',
249
265
  TMPDIR: travail,
250
266
  TMP: travail,
251
267
  TEMP: travail,
252
268
  [VARIABLE]: ecrireLaListe(paquets),
269
+ ...(travailleurs === undefined ? {} : { GRILLHOUSE_TRAVAILLEURS: String(travailleurs) }),
270
+ };
271
+ }
272
+
273
+ /**
274
+ * The command <commande> placed under `nice` then `ionice`, so a session of an agent yields the
275
+ * CPU and the disk to the rest of the machine (its command kept whole at the end).
276
+ * @param {string[]} commande
277
+ * @returns {string[]}
278
+ */
279
+ export function sousNiceEtIonice(commande) {
280
+ return ['nice', '-n', '10', 'ionice', '-c', '2', '-n', '7', ...commande];
281
+ }
282
+
283
+ /**
284
+ * What `envelopper` launches for a session: `bwrap` with the arguments <argsBwrap> of the plan, then
285
+ * <commande> under `nice` and `ionice`, behind the test of the variables that name a path; and the
286
+ * environment of the session, GRILLHOUSE_TRAVAILLEURS set to max(1, cores ÷ places) of <env>.
287
+ * @param {{ argsBwrap: string[], commande: string[], env: Record<string, string | undefined>,
288
+ * cacheNpm: string, paquets: string[], travail: string, outils?: Record<string, string>,
289
+ * donnees?: Record<string, string> }} o
290
+ * @returns {{ cmd: string, args: string[], env: Record<string, string> }}
291
+ */
292
+ export function lancementDeLaSeance({
293
+ argsBwrap,
294
+ commande,
295
+ env,
296
+ cacheNpm,
297
+ paquets,
298
+ travail,
299
+ outils,
300
+ donnees,
301
+ }) {
302
+ return {
303
+ cmd: 'bwrap',
304
+ args: [...argsBwrap, ...commandeEprouvee(sousNiceEtIonice(commande))],
305
+ env: environnementDeLaSeance(env, {
306
+ cacheNpm,
307
+ paquets,
308
+ travail,
309
+ outils,
310
+ donnees,
311
+ travailleurs: travailleursDe({ env }),
312
+ }),
253
313
  };
254
314
  }
255
315
 
@@ -273,6 +333,7 @@ export function montagesDeLaSeance({
273
333
  scratchpads,
274
334
  sessions = [],
275
335
  outils = {},
336
+ publie = null,
276
337
  }) {
277
338
  const maison = path.dirname(claude);
278
339
  return [
@@ -284,6 +345,7 @@ export function montagesDeLaSeance({
284
345
  { chemin: projet, ecriture: true },
285
346
  ...MAISON_EN_LECTURE.map(rel => ({ chemin: path.join(maison, rel), ecriture: false })),
286
347
  ...Object.values(outils).map(chemin => ({ chemin, ecriture: false })),
348
+ ...(publie === null ? [] : [{ chemin: publie, ecriture: false }]),
287
349
  ];
288
350
  }
289
351
 
@@ -292,26 +354,56 @@ export function montagesDeLaSeance({
292
354
  // an emptied directory and under no other declared path comes back with the link's rights, so a
293
355
  // launcher finds its package beside its real path. A target the root shows needs no mount.
294
356
  // `lien(path)` gives the text of the link at <path>, or null when <path> is not a link.
295
- function avecLiens(montages, lien) {
296
- const videes = montages.filter(m => m.vide).map(m => m.chemin);
297
- const declares = montages.filter(m => !m.vide && !m.lien).map(m => m.chemin);
357
+ // A declared path whose chain breaks (a target that does not exist, a link broken along the way, a
358
+ // loop of links) is not mounted, and nothing is raised. A component of the path that is a link is
359
+ // followed as well as the path itself, and the real path is mounted where the path was, never at a
360
+ // link: bwrap cannot mount over one. Each link of the chain that an emptied directory hides, and
361
+ // no other declared path holds, is made again; the real path is mounted when it lies in an emptied
362
+ // directory, is written, or is marked `monter` (a store, a read, a written output). `contexte`
363
+ // lists mounts beyond <montages> that also hold a link; `existe(path)` tells a real path that is
364
+ // there. The steps keep every other property of the mount they come from.
365
+ function avecLiens(montages, lien, existe = () => true, contexte = []) {
366
+ const videes = [...montages, ...contexte].filter(m => m.vide).map(m => m.chemin);
367
+ const declares = [...montages, ...contexte].filter(m => !m.vide && !m.lien).map(m => m.chemin);
368
+ const decouper = p => p.split('/').filter(Boolean);
298
369
  return montages.flatMap(m => {
299
- if (m.vide || m.lien || (m.source ?? m.chemin) !== m.chemin) return [m];
300
- const suite = [];
301
- const vus = new Set();
302
- let chemin = m.chemin;
303
- let texte = lien(chemin);
304
- if (texte === null) return [m];
305
- while (texte !== null && !vus.has(chemin)) {
306
- vus.add(chemin);
307
- suite.push({ chemin, lien: texte });
308
- chemin = path.resolve(path.dirname(chemin), texte);
309
- const cachee = videes.some(v => inside(chemin, v));
310
- const tenue = declares.some(d => d !== m.chemin && inside(chemin, d));
311
- if (!cachee || tenue) return suite;
312
- texte = lien(chemin);
370
+ if (m.vide || m.lien || (m.source ?? m.chemin) !== m.chemin) {
371
+ return [m];
313
372
  }
314
- return vus.has(chemin) ? suite : [...suite, { chemin, ecriture: m.ecriture }];
373
+ const chaine = [];
374
+ let courant = '/';
375
+ let restants = decouper(m.chemin);
376
+ while (restants.length > 0) {
377
+ const [nom, ...reste] = restants;
378
+ const suivant = path.join(courant, nom);
379
+ const texte = lien(suivant);
380
+ if (texte === null) {
381
+ courant = suivant;
382
+ restants = reste;
383
+ continue;
384
+ }
385
+ if (chaine.length >= 40) {
386
+ return [];
387
+ }
388
+ chaine.push({ chemin: suivant, lien: texte });
389
+ restants = [...decouper(path.resolve(courant, texte)), ...reste];
390
+ courant = '/';
391
+ }
392
+ if (chaine.length === 0) {
393
+ return [m];
394
+ }
395
+ if (!existe(courant)) {
396
+ return [];
397
+ }
398
+ const liens = chaine
399
+ .filter(
400
+ ({ chemin }) =>
401
+ videes.some(v => inside(chemin, v)) &&
402
+ !declares.some(d => d !== m.chemin && d !== chemin && inside(chemin, d))
403
+ )
404
+ .map(({ chemin, lien: texte }) => ({ chemin, lien: texte }));
405
+ const cachee = videes.some(v => inside(courant, v));
406
+ return cachee || m.ecriture || m.monter ? [...liens, { ...m, chemin: courant }] : liens;
315
407
  });
316
408
  }
317
409
 
@@ -404,7 +496,9 @@ const inside = (child, parent) => {
404
496
  // in the copy.
405
497
  export function jugerComposant({ depot, composant, paquets = [] }, fs) {
406
498
  const propre = path.join(depot, composant);
407
- if (fs.existe(propre)) return null;
499
+ if (fs.existe(propre)) {
500
+ return null;
501
+ }
408
502
  const nomme =
409
503
  paquets.find(p => p.pkg?.name === composant) ??
410
504
  paquets.find(p => path.basename(p.dossier) === composant);
@@ -431,8 +525,8 @@ export function jugerComposant({ depot, composant, paquets = [] }, fs) {
431
525
  // exist is not mounted. `sorties` lists, from the root of the copy,
432
526
  // where a run of the language's tools writes (`sortiesDuLangage`): `ecrites` in writing, `propres`
433
527
  // an empty directory proper to the session, there and in each package of the material the role
434
- // does not write; one that does not exist, or that a symbolic link carries out of the copy, is not
435
- // mounted. `fs` gives `existe(path)`, and `lien(path)`, the text of a link or null, so the plan is
528
+ // does not write; one that does not exist is not mounted, and one that a symbolic link carries out
529
+ // of the copy is mounted at its real path as a store, whatever the plan writes. `fs` gives `existe(path)`, and `lien(path)`, the text of a link or null, so the plan is
436
530
  // testable without disk.
437
531
  /**
438
532
  * @param {{
@@ -478,7 +572,9 @@ export function plan(
478
572
  }
479
573
  for (const p of paquets) {
480
574
  const refus = jugerComposant({ depot: copie, composant: p, paquets: paquetsDeLaCopie }, fs);
481
- if (refus) return { refus };
575
+ if (refus) {
576
+ return { refus };
577
+ }
482
578
  }
483
579
  const ecrits = ecritsDuPlan(paquets, paquetsDeLaCopie);
484
580
  const toute = ecrits.includes('.');
@@ -498,14 +594,47 @@ export function plan(
498
594
  '/proc',
499
595
  ];
500
596
  for (const { chemin, source = chemin, ecriture, vide, lien } of montages) {
501
- if (vide) args.push('--tmpfs', chemin);
502
- else if (lien !== undefined) args.push('--symlink', lien, chemin);
503
- else if (fs.existe(source)) args.push(ecriture ? '--bind' : '--ro-bind', source, chemin);
597
+ if (vide) {
598
+ args.push('--tmpfs', chemin);
599
+ } else if (lien !== undefined) {
600
+ args.push('--symlink', lien, chemin);
601
+ } else if (fs.existe(source)) {
602
+ args.push(ecriture ? '--bind' : '--ro-bind', source, chemin);
603
+ }
504
604
  }
505
- // A worktree that an emptied directory covers comes back read-only, before the copy is written.
605
+ // A declared path (read, store, written output) is mounted at its real path, never at a link,
606
+ // by the one mechanism the session's mounts use (`avecLiens`): the links of its chain that an
607
+ // emptied directory hides, and no declared path holds, are made again before the emptied
608
+ // directories are sealed. A written output of the copy is mounted as a store when a link carries
609
+ // it out of the copy, whether the plan writes one package or the whole copy.
610
+ const lienDe = fs.lien ?? (() => null);
506
611
  const videes = montages.filter(m => m.vide).map(m => m.chemin);
612
+ const declarees = [
613
+ ...lectures.map(chemin => ({ chemin, ecriture: false, monter: true, genre: 'lu' })),
614
+ ...magasins.map(chemin => ({ chemin, ecriture: true, monter: true, genre: 'ecrit' })),
615
+ ...sorties.ecrites.map(s => ({
616
+ chemin: path.join(copie, s),
617
+ ecriture: true,
618
+ monter: true,
619
+ genre: 'sortie',
620
+ })),
621
+ ];
622
+ const suivis = avecLiens(declarees, lienDe, fs.existe, montages);
623
+ const refaits = suivis.filter(m => m.lien !== undefined);
624
+ const reels = genre =>
625
+ suivis.flatMap(m =>
626
+ m.lien === undefined && m.genre === genre && fs.existe(m.chemin) ? [m.chemin] : []
627
+ );
628
+ const reelsLus = reels('lu');
629
+ const reelsEcrits = [...reels('ecrit'), ...reels('sortie').filter(c => !inside(c, copie))];
630
+ for (const { chemin, lien } of refaits) {
631
+ args.push('--symlink', lien, chemin);
632
+ }
633
+ // A worktree that an emptied directory covers comes back read-only, before the copy is written.
507
634
  for (const t of trees) {
508
- if (videes.some(v => inside(t, v)) && fs.existe(t)) args.push('--ro-bind', t, t);
635
+ if (videes.some(v => inside(t, v)) && fs.existe(t)) {
636
+ args.push('--ro-bind', t, t);
637
+ }
509
638
  }
510
639
  // The copy is mounted after them: an emptied /tmp does not hide it. It is read-only, and the
511
640
  // packages of the plan come back in writing below, as a sandbox of Bazel opens only what the
@@ -514,24 +643,34 @@ export function plan(
514
643
  // root writes the whole copy. Its .git stays read-only.
515
644
  args.push(toute ? '--bind' : '--ro-bind', copie, copie);
516
645
  if (!toute) {
517
- for (const s of sortiesDe(copie, sorties.propres, fs.lien))
518
- if (fs.existe(s)) args.push('--tmpfs', s);
519
- for (const s of sortiesDe(copie, sorties.ecrites, fs.lien))
520
- if (fs.existe(s)) args.push('--bind', s, s);
646
+ for (const s of sortiesDe(copie, sorties.propres, fs.lien)) {
647
+ if (fs.existe(s)) {
648
+ args.push('--tmpfs', s);
649
+ }
650
+ }
651
+ for (const s of sortiesDe(copie, sorties.ecrites, fs.lien)) {
652
+ if (fs.existe(s)) {
653
+ args.push('--bind', s, s);
654
+ }
655
+ }
521
656
  }
522
657
  const gitDeLaCopie = path.join(copie, '.git');
523
- if (fs.existe(gitDeLaCopie)) args.push('--ro-bind', gitDeLaCopie, gitDeLaCopie);
658
+ if (fs.existe(gitDeLaCopie)) {
659
+ args.push('--ro-bind', gitDeLaCopie, gitDeLaCopie);
660
+ }
524
661
  // What the language's tools read (cargo's home) comes back read-only; then the stores inside it
525
662
  // or beside it (Turborepo's cache, cargo's registry and locks) are written by the agent's runs,
526
663
  // as by every copy's.
527
- for (const l of lectures) {
528
- if (fs.existe(l)) {
529
- args.push('--ro-bind', l, l);
530
- }
664
+ for (const l of reelsLus) {
665
+ args.push('--ro-bind', l, l);
666
+ }
667
+ for (const m of reelsEcrits) {
668
+ args.push('--bind', m, m);
531
669
  }
532
- for (const m of magasins) if (fs.existe(m)) args.push('--bind', m, m);
533
670
  const tickets = trees.length > 0 ? path.join(trees[0], '.beads') : null;
534
- if (tickets && fs.existe(tickets)) args.push('--bind', tickets, tickets);
671
+ if (tickets && fs.existe(tickets)) {
672
+ args.push('--bind', tickets, tickets);
673
+ }
535
674
  if (!toute) {
536
675
  for (const e of ecrits) {
537
676
  const d = path.join(copie, e);
@@ -540,25 +679,64 @@ export function plan(
540
679
  // The lock files of the versions, which a run of the testwriter's tests brings in line with
541
680
  // the dependencies of his tests, are written by him alone.
542
681
  for (const v of verrous.map(v => path.join(copie, v))) {
543
- if (role === ROLE_MATIERE && fs.existe(v)) args.push('--bind', v, v);
682
+ if (role === ROLE_MATIERE && fs.existe(v)) {
683
+ args.push('--bind', v, v);
684
+ }
544
685
  }
545
686
  }
546
687
  for (const m of matieres.map(m => path.join(copie, m))) {
547
688
  args.push(role === ROLE_MATIERE ? '--bind' : '--ro-bind', m, m);
548
689
  // What a run of its tests writes goes, for a role that does not write it, to an empty
549
690
  // directory proper to the session, as Bazel writes a test's logs out of its source.
550
- if (role === ROLE_MATIERE) continue;
551
- for (const s of sortiesDe(m, sorties.propres, fs.lien))
552
- if (fs.existe(s)) args.push('--tmpfs', s);
691
+ if (role === ROLE_MATIERE) {
692
+ continue;
693
+ }
694
+ for (const s of sortiesDe(m, sorties.propres, fs.lien)) {
695
+ if (fs.existe(s)) {
696
+ args.push('--tmpfs', s);
697
+ }
698
+ }
553
699
  }
554
700
  // The emptied directories close behind the mounts: nothing new is written there.
555
- for (const { chemin } of montages.filter(m => m.scelle)) args.push('--remount-ro', chemin);
701
+ for (const { chemin } of montages.filter(m => m.scelle)) {
702
+ args.push('--remount-ro', chemin);
703
+ }
556
704
  args.push('--chdir', copie);
557
705
  return { args };
558
706
  }
559
707
 
560
708
  const disque = { existe: existsSync, lien: lienSurDisque };
561
709
 
710
+ // The cache of the published versions to mount when the project of <copie> names its version
711
+ // (`grillhouse.outil`, read in the main tree), after installing the version here, outside the
712
+ // session; null without the key, or when the version cannot be installed (said on the error stream:
713
+ // the lock then falls back on the code of the copy, and refuses when that does not load either).
714
+ function cacheDeLaVersionPubliee(copie) {
715
+ const commun = execFileSync(
716
+ 'git',
717
+ ['-C', copie, 'rev-parse', '--path-format=absolute', '--git-common-dir'],
718
+ { encoding: 'utf8' }
719
+ ).trim();
720
+ let version;
721
+ try {
722
+ version = versionDeLOutil(path.dirname(commun));
723
+ } catch {
724
+ return null;
725
+ }
726
+ if (version === null) {
727
+ return null;
728
+ }
729
+ try {
730
+ installer(version);
731
+ } catch (e) {
732
+ process.stderr.write(
733
+ `⚠️ enveloppe : version publiée ${version} non installable : ${e.message}\n`
734
+ );
735
+ return null;
736
+ }
737
+ return cacheDesOutils();
738
+ }
739
+
562
740
  // The command: the session of <commande> in the envelope of the plan <paquets> in <copie>; its
563
741
  // exit code.
564
742
  function envelopper(argv) {
@@ -593,14 +771,20 @@ function envelopper(argv) {
593
771
  ];
594
772
  // The tools of the project, judged before anything is prepared: none holds a mount.
595
773
  let outils;
774
+ let donnees;
596
775
  try {
597
776
  outils = outilsDe(copie, {
598
777
  montages: [copie, claude, scratchpads, cacheNpm, TEMPORAIRE, ...sessions],
599
778
  });
779
+ donnees = donneesDe(copie);
600
780
  } catch (e) {
601
781
  process.stderr.write(`⛔ ENVELOPPE REFUSÉE — ${e.message}\n`);
602
782
  return CODE_REFUS;
603
783
  }
784
+ // The cache of the published versions (`grillhouse.outil` of the main tree's package.json) comes
785
+ // in read-only, the version installed here, outside the session: the write lock runs on it, and
786
+ // a session cannot install it. A version that cannot be installed is said, nothing mounted.
787
+ const publie = cacheDeLaVersionPubliee(copie);
604
788
  mkdirSync(projet, { recursive: true });
605
789
  // The session's working directory, created here inside the scratchpads that bwrap mounts.
606
790
  mkdirSync(travail, { recursive: true });
@@ -609,9 +793,20 @@ function envelopper(argv) {
609
793
  // killed (../mesure/base-de-passe.mjs).
610
794
  const temporaire = ouvrirBase('enveloppe');
611
795
  const etatJetable = path.join(temporaire.dossier, 'claude.json');
612
- if (existsSync(`${claude}.json`)) copyFileSync(`${claude}.json`, etatJetable);
796
+ if (existsSync(`${claude}.json`)) {
797
+ copyFileSync(`${claude}.json`, etatJetable);
798
+ }
613
799
  const montages = avecLiens(
614
- montagesDeLaSeance({ cacheNpm, claude, projet, etatJetable, scratchpads, sessions, outils }),
800
+ montagesDeLaSeance({
801
+ cacheNpm,
802
+ claude,
803
+ projet,
804
+ etatJetable,
805
+ scratchpads,
806
+ sessions,
807
+ outils,
808
+ publie,
809
+ }),
615
810
  lienSurDisque
616
811
  );
617
812
  const langage = langageDe(copie);
@@ -672,11 +867,20 @@ function envelopper(argv) {
672
867
  process.stderr.write(`⛔ ENVELOPPE REFUSÉE — ${refus}\n`);
673
868
  code = CODE_REFUS;
674
869
  } else {
675
- const r = spawnSync('bwrap', [...args, ...commandeEprouvee(commande)], {
676
- stdio: 'inherit',
677
- env: environnementDeLaSeance(process.env, { cacheNpm, paquets, travail, outils }),
870
+ const lancement = lancementDeLaSeance({
871
+ argsBwrap: args,
872
+ commande,
873
+ env: process.env,
874
+ cacheNpm,
875
+ paquets,
876
+ travail,
877
+ outils,
878
+ donnees,
678
879
  });
679
- if (r.error) process.stderr.write(`⛔ ENVELOPPE IMPOSSIBLE — ${r.error.message}\n`);
880
+ const r = spawnSync(lancement.cmd, lancement.args, { stdio: 'inherit', env: lancement.env });
881
+ if (r.error) {
882
+ process.stderr.write(`⛔ ENVELOPPE IMPOSSIBLE — ${r.error.message}\n`);
883
+ }
680
884
  code = r.error ? CODE_REFUS : (r.status ?? 1);
681
885
  }
682
886
  temporaire.fermer();
@@ -37,8 +37,7 @@
37
37
  # without a copy, it is brought back to the main tree's HEAD and the copy is made on it: the lot
38
38
  # the branch carried ahead of main (a branch the queue sent back) comes back as local work in
39
39
  # the copy, a conflict with main marked in its file; a branch with nothing ahead simply starts
40
- # again from main. A ticket whose branch is still in the integration queue is not launched:
41
- # the refusal goes to the log, which names the queue, CODE_COPIE, before any copy is made.
40
+ # again from main.
42
41
  # The copy, new or existing, then goes through the one preparation of a copy, which the circuit
43
42
  # also plays before each pass that judges the lot (scripts/enveloppe/travail-de-la-copie.mjs
44
43
  # `preparer`, its output in the log). Moving forward keeps
@@ -98,19 +97,20 @@
98
97
  # `--output-format json --json-schema <its schema>` (`npx grillhouse resultats --schema
99
98
  # <rôle>`); --fiche <sorte> names the schema of a sheet that is not its role's (`geste`, the
100
99
  # explorateur's gesture of a mechanical ticket, grillhouse-sos), taking a value as --modele does:
101
- # claude's JSON result, its sheet in `structured_output`, goes to
102
- # .claude/worktrees/<ticket>.resultat.json, which a launch removes first and the circuit reads,
103
- # then to the log; its errors go to the log.
100
+ # claude's JSON result, its sheet in `structured_output`, goes to `resultat.json` in the folder
101
+ # of the session (.claude/worktrees/<ticket>.travail/seances/<id>/, <id> the session's
102
+ # --seance or --reprise, `courante` without one), which a launch removes first and the circuit
103
+ # reads, then to the log; its errors go to the log.
104
104
  # - Its output, and an envelope refusal (CODE_REFUS), are added to .claude/worktrees/<ticket>.log,
105
105
  # the log of the ticket, which keeps every session of the ticket: each launch past the checks of
106
106
  # its call adds a header line, `=== <time> · <rôle> · <composant> ===`, then its preparation and
107
107
  # its session. The agent writes its handover in the ticket. Once the envelope has ended, the
108
- # launcher writes the session's exit code to .claude/worktrees/<ticket>.fin, which a launch
108
+ # launcher writes the session's exit code to `fin` in the folder of the session, which a launch
109
109
  # removes first: a launch that stops before its session leaves none, so the circuit
110
110
  # (scripts/circuit.mjs) tells a code of the session from CODE_USAGE, CODE_REFUS and CODE_COPIE.
111
111
  # A session its lock stopped on a write out of the plan (scripts/verrous/verrou.mjs) left the
112
112
  # reason in its working directory (`hors-plan`, removed before the session): the launcher moves
113
- # it to .claude/worktrees/<ticket>.hors-plan, which a launch removes first and the circuit reads,
113
+ # it to `hors-plan` in the folder of the session, which a launch removes first and the circuit reads,
114
114
  # and adds it to the log. It then writes the session's line to the register
115
115
  # (scripts/registre.mjs --copie), and exits with the envelope's code.
116
116
  # - The exit codes are named in scripts/enveloppe/codes.mjs; a malformed call exits CODE_USAGE.
@@ -176,19 +176,15 @@ grep -qE "TON TICKET : ${motif}([^A-Za-z0-9_.-]|$)" "$consigne" || { echo "⛔ L
176
176
 
177
177
  copie="$racine/.claude/worktrees/$ticket"
178
178
  journal="$copie.log"
179
- fin="$copie.fin"
180
- resultat="$copie.resultat.json"
181
- hors_plan="$copie.hors-plan"
182
- mkdir -p "$(dirname "$copie")"
179
+ # The folder of the session, its id the one it opens or resumes: each session's result apart, so
180
+ # that an attempt played again reads the one its dead attempt left.
181
+ rang="$copie.travail/seances/${seance:-${reprise:-courante}}"
182
+ fin="$rang/fin"
183
+ resultat="$rang/resultat.json"
184
+ hors_plan="$rang/hors-plan"
185
+ mkdir -p "$(dirname "$copie")" "$rang"
183
186
  rm -f "$fin" "$resultat" "$hors_plan"
184
187
  printf '=== %s · %s · %s ===\n' "$(date -Iseconds)" "$role" "$composant" >> "$journal"
185
- # A branch still in the queue is not relaunched: the queue brings it onto main, or sends it back.
186
- if node --input-type=module -e "import { lireEntrees } from '$ici/../integration/file-attente.mjs'; const [r, b, t] = process.argv.slice(1); process.exit(lireEntrees(r).some(e => e.branche === b || e.ticket === t) ? 0 : 1);" "$racine" "agent/$ticket" "$ticket"; then
187
- refus="⛔ La branche agent/$ticket est encore en file d'intégration : la file l'amène sur main ou la renvoie ; le ticket ne se relance pas avant."
188
- echo "$refus" >> "$journal"
189
- echo "$refus" >&2
190
- exit "$CODE_COPIE"
191
- fi
192
188
  # The temporary directory of the ticket (`ouvrirBaseDuTicket`, scripts/mesure/base-de-passe.mjs):
193
189
  # TMPDIR, TMP and TEMP of the rest of the launch and of the session, whose scratchpads and working
194
190
  # directory lie in it. It stays from one session and one resumption of the ticket to the next, and
@@ -12,8 +12,8 @@ import { paquets } from '../paquets.mjs';
12
12
 
13
13
  export const VARIABLE = 'GRILLHOUSE_ENVELOPPE';
14
14
  // The file the lock of a session leaves in its working directory when it stops the session on a
15
- // write out of the plan (scripts/verrous/verrou.mjs); the launcher hands it to the circuit as
16
- // `<copie>.hors-plan` (scripts/enveloppe/lancer.sh).
15
+ // write out of the plan (scripts/verrous/verrou.mjs); the launcher hands it to the circuit in the
16
+ // session's result folder, `<copie>.travail/seances/<id>/hors-plan` (scripts/enveloppe/lancer.sh).
17
17
  export const MARQUE_HORS_PLAN = 'hors-plan';
18
18
 
19
19
  // The list <paquets> as the variable carries it.