@roomi-fields/grillhouse 0.53.0 → 0.54.1

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 (62) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +54 -0
  3. package/cadre/templates/projet/docs/agents/issue-tracker.md +2 -2
  4. package/charte.md +12 -0
  5. package/dist/temporal/circuit/deroule.js +5 -9
  6. package/dist/temporal/circuit/deroule.js.map +1 -1
  7. package/dist/temporal/installation.d.ts +15 -2
  8. package/dist/temporal/installation.js +69 -17
  9. package/dist/temporal/installation.js.map +1 -1
  10. package/docs/INTERFACE.md +21 -1
  11. package/docs/architecture/circuit.md +3 -3
  12. package/docs/architecture/entree.md +4 -4
  13. package/docs/architecture/greffon.md +28 -17
  14. package/docs/architecture/installation.md +21 -11
  15. package/docs/architecture/machine.md +1 -1
  16. package/docs/architecture/tests.md +1 -1
  17. package/hooks/register.tsx +50 -24
  18. package/package.json +1 -1
  19. package/scripts/aiguillage.mjs +4 -2
  20. package/scripts/bd-garde.mjs +69 -0
  21. package/scripts/ci-de-main.mjs +259 -56
  22. package/scripts/circuit.mjs +20 -5
  23. package/scripts/commandes-composees.mjs +1 -1
  24. package/scripts/droits.mjs +11 -4
  25. package/scripts/file-des-tickets.mjs +27 -9
  26. package/scripts/greffons.mjs +282 -17
  27. package/scripts/langages/c/commandes.mjs +1 -1
  28. package/scripts/langages/cargo/commandes.mjs +1 -1
  29. package/scripts/langages/cargo/tailles-des-tests.mjs +115 -6
  30. package/scripts/langages/python/commandes.mjs +1 -1
  31. package/scripts/langages/typescript/code-mort.mjs +36 -3
  32. package/scripts/langages/typescript/migrations/configurations-en-commonjs.mjs +95 -24
  33. package/scripts/langages/typescript/mise-a-jour.mjs +49 -12
  34. package/scripts/langages/typescript/parcours.mjs +5 -1
  35. package/scripts/langages.d.mts +6 -0
  36. package/scripts/langages.mjs +6 -0
  37. package/scripts/lire.mjs +236 -0
  38. package/scripts/migrations/cout-des-jetons-au-registre.mjs +136 -0
  39. package/scripts/migrations/lire-un-ticket.mjs +46 -0
  40. package/scripts/migrations.mjs +4 -0
  41. package/scripts/montee.mjs +123 -47
  42. package/scripts/nuit.sh +21 -12
  43. package/scripts/registre.d.mts +7 -1
  44. package/scripts/registre.mjs +114 -102
  45. package/scripts/resultats.mjs +15 -5
  46. package/scripts/retirer-copie.sh +7 -0
  47. package/scripts/sous-commandes.mjs +1 -0
  48. package/scripts/suiveur.mjs +12 -4
  49. package/scripts/superviseur.mjs +111 -31
  50. package/scripts/tableau.mjs +527 -119
  51. package/scripts/tarifs.mjs +67 -0
  52. package/scripts/ticket-du-circuit.mjs +3 -4
  53. package/scripts/transitions.d.mts +0 -5
  54. package/scripts/transitions.mjs +3 -13
  55. package/scripts/verdict-de-la-nuit.mjs +2 -2
  56. package/skills/explorateur/SKILL.md +10 -5
  57. package/skills/mesure/SKILL.md +4 -3
  58. package/skills/pitmaster/SKILL.md +18 -4
  59. package/skills/pitmaster/references/erreurs.md +4 -2
  60. package/skills/pitmaster/references/tour.md +11 -4
  61. package/types/index.d.ts +3 -1
  62. package/scripts/base-des-workflows.mjs +0 -58
@@ -409,10 +409,23 @@ function arreter(): void {
409
409
  // session's (`dossiers`); the session's otherwise.
410
410
  const dossierDu = (t: Tableau | null, id: string) => t?.dossiers?.[id] ?? cwd
411
411
 
412
+ // Runs Beads in <dossier> by the command the board names (`bd`; by its name without one). A path
413
+ // has its folder ahead of the session's PATH: the `node` that runs it stands beside it.
414
+ async function lancerBd($: EngineInterface, t: Tableau | null, args: string[], dossier: string) {
415
+ const bd = t?.bd ?? 'bd'
416
+ const barre = bd.lastIndexOf('/')
417
+ const init: { cwd: string; timeoutMs: number; env?: Record<string, string> } = { cwd: dossier, timeoutMs: 20_000 }
418
+ if (barre >= 0) {
419
+ const chemins = await $.env.get('PATH')
420
+ init.env = { PATH: [bd.slice(0, barre), chemins].filter(Boolean).join(':') }
421
+ }
422
+ return $.process.run([bd, ...args], init)
423
+ }
424
+
412
425
  // The whole text of a ticket, read from Beads in its project when the card fills the pane: the
413
426
  // board carries only each card's start.
414
- async function lireTexte($: EngineInterface, id: string, dossier: string) {
415
- const r = await $.process.run(['bd', 'show', id, '--json'], { cwd: dossier, timeoutMs: 20_000 })
427
+ async function lireTexte($: EngineInterface, t: Tableau | null, id: string) {
428
+ const r = await lancerBd($, t, ['show', id, '--json'], dossierDu(t, id))
416
429
  let contenu = ''
417
430
  try {
418
431
  const lu = JSON.parse(r.stdout) as { description?: string }[] | { description?: string }
@@ -427,11 +440,9 @@ async function lireTexte($: EngineInterface, id: string, dossier: string) {
427
440
  export const bascule = (statut: string | undefined) => (statut === 'in_progress' ? 'open' : 'in_progress')
428
441
 
429
442
  // Switches a chantier on or off in Beads, in its project, then measures the board again.
430
- async function basculer($: EngineInterface, id: string, statut: string | undefined, dossier: string) {
431
- const r = await $.process.run(['bd', 'update', id, '--status', bascule(statut)], {
432
- cwd: dossier,
433
- timeoutMs: 20_000,
434
- })
443
+ async function basculer($: EngineInterface, t: Tableau, id: string) {
444
+ const statut = t.fiches[id]?.statut
445
+ const r = await lancerBd($, t, ['update', id, '--status', bascule(statut)], dossierDu(t, id))
435
446
  // The change under `.beads/` is the follower's event: it measures, the pane reads the line.
436
447
  if (r.exitCode !== 0) await $.ui.toast(`Le chantier n'a pas basculé : ${r.stderr.slice(0, 200)}`)
437
448
  }
@@ -498,10 +509,21 @@ let relevee = false
498
509
  const tours = new Set<string>()
499
510
  // The messages submitted and not yet read: their text, and the time they were put in the queue.
500
511
  const soumis: { texte: string; envoyeA: number }[] = []
501
- // What the renewal reads of the session: the time of its last Stop with no task in flight, since
502
- // the last turn and compaction, and of the last message of the owner (0 without one).
512
+ // What the renewal reads of the session: the time of its last quiet stop since the last turn and
513
+ // compaction, and of the last message of the owner (0 without one). The stop is a classic.Stop with
514
+ // no task in flight, or the end of a turn that gave no answer, which raises no Stop
515
+ // (`sansReponse`). Such an end gives no time while the last Stop left a task in flight
516
+ // (`tacheEnVol`): turn.complete says nothing of the tasks, so one launched during that turn is not
517
+ // seen.
503
518
  let arretA = 0
519
+ let sansReponse = false
520
+ let tacheEnVol = false
504
521
  let messageA = 0
522
+ const RAISONS_SANS_REPONSE = new Set(['aborted', 'error', 'refusal'])
523
+ const noterLArret = (a: number, parUnTourSansReponse = false) => {
524
+ arretA = a
525
+ sansReponse = parUnTourSansReponse
526
+ }
505
527
  const DU_RESPONSABLE = new Set(['composer', 'bridge'])
506
528
 
507
529
  // A turn started at <lueA> with <texte>: the questions of each message it contains are read, those
@@ -556,18 +578,19 @@ async function relever($: EngineInterface): Promise<void> {
556
578
 
557
579
  // The renewal of the session of supervision (greffon.md, §5.1), as a worker is recycled between
558
580
  // two requests. The frame's command judges (`grillhouse superviseur --renouveler`): it is told the
559
- // time of the last Stop of the session that left no task in flight (`arretA`) and of the last
560
- // message of the owner (`messageA`), and gives a line when the session is to be compacted, its
561
- // message of resumption empty or not. The mod then compacts it, the PreCompact hook giving the
562
- // instructions of the summary, and submits the message, unless a turn runs, a draft stands in the
563
- // prompt box, a message of questions is not read, or a Stop or a message of the owner came since
564
- // the command was asked. A compaction refused is tried again at a later period.
581
+ // time of the last quiet stop of the session (`arretA`), that of the last message of the owner
582
+ // (`messageA`) and `sans-reponse` when the stop is the end of a turn with no answer, and gives a
583
+ // line when the session is to be compacted, its message of resumption empty or not. The mod then
584
+ // compacts it, the PreCompact hook giving the instructions of the summary, and submits the message,
585
+ // unless a turn runs, a draft stands in the prompt box, a message of questions is not read, or a
586
+ // stop or a message of the owner came since the command was asked. A compaction refused is tried again at a later period.
565
587
  async function renouveler($: EngineInterface): Promise<void> {
566
588
  if (tours.size) return
567
589
  const dits = { arretA, messageA }
590
+ const fin = sansReponse ? ['sans-reponse'] : []
568
591
  try {
569
592
  const r = await $.process.run(
570
- [GRILLHOUSE, 'superviseur', '--renouveler', cwd, String(dits.arretA), String(dits.messageA)],
593
+ [GRILLHOUSE, 'superviseur', '--renouveler', cwd, String(dits.arretA), String(dits.messageA), ...fin],
571
594
  { cwd, timeoutMs: 60_000 },
572
595
  )
573
596
  const ligne = (r.stdout || '').trim()
@@ -577,7 +600,7 @@ async function renouveler($: EngineInterface): Promise<void> {
577
600
  if (tours.size || soumis.length || arretA !== dits.arretA || messageA !== dits.messageA) return
578
601
  if ('skip' in (await $.session.compact())) return
579
602
  // The mod's own compaction: its `session.compact` hook does not hear it.
580
- arretA = 0
603
+ noterLArret(0)
581
604
  if (reprise) void $.prompt.submit({ text: reprise })
582
605
  } catch {
583
606
  // a renewal refused is tried again at the next period
@@ -587,7 +610,8 @@ async function renouveler($: EngineInterface): Promise<void> {
587
610
  // The /clear of the session ends its context: what the mod holds of it starts over, and the pane
588
611
  // takes its projects again from the store, the state having been emptied.
589
612
  async function reprendreApresClear($: EngineInterface): Promise<void> {
590
- arretA = 0
613
+ noterLArret(0)
614
+ tacheEnVol = false
591
615
  messageA = 0
592
616
  tours.clear()
593
617
  soumis.length = 0
@@ -644,17 +668,19 @@ export const register: Register = on => {
644
668
  on('turn.start', async ($, e, next) => {
645
669
  const r = await next(e)
646
670
  tours.add(e.turnId)
647
- arretA = 0
671
+ noterLArret(0)
648
672
  await marquerLesLues($, e.text, Date.now())
649
673
  return r
650
674
  })
651
675
  on('turn.complete', (_$, e, next) => {
652
676
  tours.delete(e.turnId)
677
+ if (!e.agentId && !tacheEnVol && RAISONS_SANS_REPONSE.has(e.reason)) noterLArret(Date.now(), true)
653
678
  return next(e)
654
679
  })
655
680
 
656
681
  on('classic.Stop', (_$, e, next) => {
657
- arretA = e.background_tasks?.length === 0 ? Date.now() : 0
682
+ tacheEnVol = (e.background_tasks?.length ?? 0) > 0
683
+ noterLArret(e.background_tasks?.length === 0 ? Date.now() : 0)
658
684
  return next(e)
659
685
  })
660
686
 
@@ -664,10 +690,10 @@ export const register: Register = on => {
664
690
  })
665
691
 
666
692
  // A compaction installed in the main conversation, neither a subagent's nor one computed ahead,
667
- // forgets the quiet Stop.
693
+ // forgets the quiet stop.
668
694
  on('session.compact', async (_$, e, next) => {
669
695
  const r = await next(e)
670
- if (!e.agentId && e.trigger !== 'precompute' && !('skip' in r)) arretA = 0
696
+ if (!e.agentId && e.trigger !== 'precompute' && !('skip' in r)) noterLArret(0)
671
697
  return r
672
698
  })
673
699
 
@@ -790,7 +816,7 @@ export const register: Register = on => {
790
816
  plain
791
817
  hotkey="g"
792
818
  onPress={() => {
793
- if (!grand && montre) void lireTexte($, montre, dossierDu(t, montre))
819
+ if (!grand && montre) void lireTexte($, t, montre)
794
820
  ligneTexte = 0
795
821
  void update($, etat, s => ({ ...s, grand: !s.grand }))
796
822
  }}
@@ -803,7 +829,7 @@ export const register: Register = on => {
803
829
  key="h"
804
830
  plain
805
831
  hotkey="h"
806
- onPress={() => void basculer($, chantier, t.fiches[chantier]?.statut, dossierDu(t, chantier))}
832
+ onPress={() => void basculer($, t, chantier)}
807
833
  >
808
834
  <Text dimColor>{`· h : ${fiche.statut === 'in_progress' ? 'désactiver' : 'activer'} `}</Text>
809
835
  </Button>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomi-fields/grillhouse",
3
- "version": "0.53.0",
3
+ "version": "0.54.1",
4
4
  "description": "Roomi's Grillhouse: the frame's scripts, called by one command, grillhouse <sous-commande>",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -57,7 +57,8 @@ const PAQUET_QUI_TOURNE = path.resolve(import.meta.dirname, '..');
57
57
  * supervisor, the night, the board and the status line, the hooks of Claude Code, the lock out of
58
58
  * the envelope and the rights of the sessions, the direct (its agent and its reviewer), the envelope and its
59
59
  * launcher, the integration, the
60
- * results, the removal of a copy and the balance, even when the supervisor runs one by hand.
60
+ * results, the removal of a copy and the balance, even when the supervisor runs one by hand; the
61
+ * Temporal of the machine (`temporal`), its repair by hand included.
61
62
  */
62
63
  export const REDIRIGEES = new Set([
63
64
  'attente-au-tour',
@@ -83,6 +84,7 @@ export const REDIRIGEES = new Set([
83
84
  'structure-guard',
84
85
  'superviseur',
85
86
  'tableau',
87
+ 'temporal',
86
88
  'ticket-du-sous-agent',
87
89
  'verrou-hors-enveloppe',
88
90
  ]);
@@ -120,13 +122,13 @@ export const OUTILS_DU_DEPOT = new Set([
120
122
  'binaires',
121
123
  'greffons',
122
124
  'init',
125
+ 'lire',
123
126
  'maj',
124
127
  'outil',
125
128
  'paquet',
126
129
  'pression',
127
130
  'sortie',
128
131
  'sous-modules',
129
- 'temporal',
130
132
  'ticket',
131
133
  ]);
132
134
 
@@ -0,0 +1,69 @@
1
+ // The command `bd` of the board: a process whose PATH holds it keeps its absolute path in the
2
+ // common git directory (`grillhouse-bd.chemin`); a process whose PATH lacks it (started without the
3
+ // shell's profile) takes that path back, checked before use. Mechanism: greffon.md, §5.3.
4
+ import { accessSync, constants, readFileSync, renameSync, statSync, writeFileSync } from 'node:fs';
5
+ import path from 'node:path';
6
+
7
+ import { trouverDansLePath } from './commandes-du-path.mjs';
8
+
9
+ /** The name, in the common git directory, of the file that keeps the path of `bd`. */
10
+ export const FICHIER_BD = 'grillhouse-bd.chemin';
11
+
12
+ const lireLeChemin = commun => {
13
+ try {
14
+ return readFileSync(path.join(commun, FICHIER_BD), 'utf8').trim();
15
+ } catch {
16
+ return null;
17
+ }
18
+ };
19
+
20
+ const executable = chemin => {
21
+ try {
22
+ accessSync(chemin, constants.X_OK);
23
+ return statSync(chemin).isFile();
24
+ } catch {
25
+ return false;
26
+ }
27
+ };
28
+
29
+ /**
30
+ * Keeps in the common git directory `commun` the path of the `bd` that the PATH of `env` holds,
31
+ * when it is absolute and differs from the one kept. Without one, the kept path stays.
32
+ * @param {string | null} commun
33
+ * @param {Record<string, string | undefined>} [env]
34
+ */
35
+ export function garderBd(commun, env = process.env) {
36
+ const chemin = trouverDansLePath('bd', env);
37
+ if (!commun || !chemin || !path.isAbsolute(chemin) || lireLeChemin(commun) === chemin) {
38
+ return;
39
+ }
40
+ const fichier = path.join(commun, FICHIER_BD);
41
+ try {
42
+ // Written beside, then renamed: a reader never sees a file half written.
43
+ writeFileSync(`${fichier}.${process.pid}`, `${chemin}\n`);
44
+ renameSync(`${fichier}.${process.pid}`, fichier);
45
+ } catch {
46
+ // A read-only place keeps no path.
47
+ }
48
+ }
49
+
50
+ /**
51
+ * How to call `bd` from the environment `env`: by its name when the PATH holds it; else by the path
52
+ * kept in `commun`, when it still names an executable file `bd`, its folder ahead of the PATH (the
53
+ * `node` that runs it stands beside it); else by its name, whose call says the fault.
54
+ * @param {string | null} commun
55
+ * @param {Record<string, string | undefined>} [env]
56
+ * @returns {{ commande: string, env: Record<string, string | undefined> }}
57
+ */
58
+ export function bdAAppeler(commun, env = process.env) {
59
+ const parSonNom = { commande: 'bd', env };
60
+ if (!commun || trouverDansLePath('bd', env)) {
61
+ return parSonNom;
62
+ }
63
+ const chemin = lireLeChemin(commun);
64
+ if (!chemin || !path.isAbsolute(chemin) || path.basename(chemin) !== 'bd' || !executable(chemin)) {
65
+ return parSonNom;
66
+ }
67
+ const PATH = [path.dirname(chemin), env.PATH].filter(Boolean).join(path.delimiter);
68
+ return { commande: chemin, env: { ...env, PATH } };
69
+ }