@roomi-fields/grillhouse 0.28.3 → 0.30.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 (238) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +739 -0
  3. package/bin/grillhouse.mjs +128 -26
  4. package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
  5. package/cadre/templates/projet/CLAUDE.md +5 -1
  6. package/cadre/templates/projet/README.md +11 -11
  7. package/cadre/templates/projet/_gitignore +2 -5
  8. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  9. package/cadre/templates/projet/package.json +2 -2
  10. package/charte.md +37 -4
  11. package/dist/temporal/acte.d.ts +24 -0
  12. package/dist/temporal/acte.js +139 -0
  13. package/dist/temporal/acte.js.map +1 -0
  14. package/dist/temporal/attributs.d.ts +6 -0
  15. package/dist/temporal/attributs.js +15 -0
  16. package/dist/temporal/attributs.js.map +1 -0
  17. package/dist/temporal/circuit/activites.d.ts +13 -0
  18. package/dist/temporal/circuit/activites.js +33 -0
  19. package/dist/temporal/circuit/activites.js.map +1 -0
  20. package/dist/temporal/circuit/client.d.ts +72 -0
  21. package/dist/temporal/circuit/client.js +247 -0
  22. package/dist/temporal/circuit/client.js.map +1 -0
  23. package/dist/temporal/circuit/commande.d.ts +2 -0
  24. package/dist/temporal/circuit/commande.js +238 -0
  25. package/dist/temporal/circuit/commande.js.map +1 -0
  26. package/dist/temporal/circuit/contrat.d.ts +305 -0
  27. package/dist/temporal/circuit/contrat.js +24 -0
  28. package/dist/temporal/circuit/contrat.js.map +1 -0
  29. package/dist/temporal/circuit/deroule.d.ts +3 -0
  30. package/dist/temporal/circuit/deroule.js +540 -0
  31. package/dist/temporal/circuit/deroule.js.map +1 -0
  32. package/dist/temporal/client.d.ts +47 -0
  33. package/dist/temporal/client.js +69 -0
  34. package/dist/temporal/client.js.map +1 -0
  35. package/dist/temporal/commande.d.ts +2 -0
  36. package/dist/temporal/commande.js +95 -0
  37. package/dist/temporal/commande.js.map +1 -0
  38. package/dist/temporal/deroules.d.ts +5 -0
  39. package/dist/temporal/deroules.js +10 -0
  40. package/dist/temporal/deroules.js.map +1 -0
  41. package/dist/temporal/etat.d.ts +33 -0
  42. package/dist/temporal/etat.js +59 -0
  43. package/dist/temporal/etat.js.map +1 -0
  44. package/dist/temporal/file/activites.d.ts +10 -0
  45. package/dist/temporal/file/activites.js +25 -0
  46. package/dist/temporal/file/activites.js.map +1 -0
  47. package/dist/temporal/file/client.d.ts +4 -0
  48. package/dist/temporal/file/client.js +6 -0
  49. package/dist/temporal/file/client.js.map +1 -0
  50. package/dist/temporal/file/contrat.d.ts +158 -0
  51. package/dist/temporal/file/contrat.js +14 -0
  52. package/dist/temporal/file/contrat.js.map +1 -0
  53. package/dist/temporal/file/deroule.d.ts +15 -0
  54. package/dist/temporal/file/deroule.js +235 -0
  55. package/dist/temporal/file/deroule.js.map +1 -0
  56. package/dist/temporal/installation.d.ts +124 -0
  57. package/dist/temporal/installation.js +408 -0
  58. package/dist/temporal/installation.js.map +1 -0
  59. package/dist/temporal/places/activites.d.ts +8 -0
  60. package/dist/temporal/places/activites.js +13 -0
  61. package/dist/temporal/places/activites.js.map +1 -0
  62. package/dist/temporal/places/client.d.ts +28 -0
  63. package/dist/temporal/places/client.js +64 -0
  64. package/dist/temporal/places/client.js.map +1 -0
  65. package/dist/temporal/places/contrat.d.ts +106 -0
  66. package/dist/temporal/places/contrat.js +21 -0
  67. package/dist/temporal/places/contrat.js.map +1 -0
  68. package/dist/temporal/places/deroule.d.ts +3 -0
  69. package/dist/temporal/places/deroule.js +198 -0
  70. package/dist/temporal/places/deroule.js.map +1 -0
  71. package/dist/temporal/sonde/activites.d.ts +6 -0
  72. package/dist/temporal/sonde/activites.js +52 -0
  73. package/dist/temporal/sonde/activites.js.map +1 -0
  74. package/dist/temporal/sonde/contrat.d.ts +35 -0
  75. package/dist/temporal/sonde/contrat.js +10 -0
  76. package/dist/temporal/sonde/contrat.js.map +1 -0
  77. package/dist/temporal/sonde/deroule.d.ts +3 -0
  78. package/dist/temporal/sonde/deroule.js +39 -0
  79. package/dist/temporal/sonde/deroule.js.map +1 -0
  80. package/dist/temporal/tickets/activites.d.ts +7 -0
  81. package/dist/temporal/tickets/activites.js +81 -0
  82. package/dist/temporal/tickets/activites.js.map +1 -0
  83. package/dist/temporal/tickets/client.d.ts +10 -0
  84. package/dist/temporal/tickets/client.js +31 -0
  85. package/dist/temporal/tickets/client.js.map +1 -0
  86. package/dist/temporal/tickets/contrat.d.ts +56 -0
  87. package/dist/temporal/tickets/contrat.js +13 -0
  88. package/dist/temporal/tickets/contrat.js.map +1 -0
  89. package/dist/temporal/tickets/deroule.d.ts +3 -0
  90. package/dist/temporal/tickets/deroule.js +94 -0
  91. package/dist/temporal/tickets/deroule.js.map +1 -0
  92. package/dist/temporal/travailleur.d.ts +2 -0
  93. package/dist/temporal/travailleur.js +69 -0
  94. package/dist/temporal/travailleur.js.map +1 -0
  95. package/docs/ARCHITECTURE.md +813 -53
  96. package/docs/CADRE.md +17 -0
  97. package/docs/INTERFACE.md +161 -30
  98. package/hooks/crochet.mjs +19 -2
  99. package/hooks/hooks.json +11 -0
  100. package/package.json +16 -4
  101. package/scripts/activites.mjs +2182 -0
  102. package/scripts/aiguillage.d.mts +37 -0
  103. package/scripts/aiguillage.mjs +328 -0
  104. package/scripts/avancement.mjs +159 -64
  105. package/scripts/bilan.mjs +37 -19
  106. package/scripts/cadre.mjs +11 -2
  107. package/scripts/circuit.mjs +888 -3654
  108. package/scripts/circuits-cles.d.mts +4 -0
  109. package/scripts/circuits-cles.mjs +21 -0
  110. package/scripts/circuits-du-serveur.mjs +105 -0
  111. package/scripts/codes-de-sortie.mjs +9 -0
  112. package/scripts/commandes-composees.mjs +45 -41
  113. package/scripts/commandes-du-path.d.mts +7 -0
  114. package/scripts/commandes-du-path.mjs +25 -0
  115. package/scripts/composition-des-langages.mjs +30 -11
  116. package/scripts/conformite.mjs +19 -10
  117. package/scripts/copies-finies.mjs +188 -42
  118. package/scripts/depart-du-ticket.d.mts +53 -0
  119. package/scripts/depart-du-ticket.mjs +124 -0
  120. package/scripts/dependances-internes.mjs +115 -0
  121. package/scripts/dernier-vert.mjs +7 -15
  122. package/scripts/donnees-cles.mjs +228 -0
  123. package/scripts/droits.mjs +11 -1
  124. package/scripts/effets.mjs +352 -0
  125. package/scripts/enveloppe/enveloppe.mjs +119 -8
  126. package/scripts/enveloppe/lancer.sh +27 -32
  127. package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
  128. package/scripts/enveloppe/travail-de-la-copie.mjs +99 -12
  129. package/scripts/etapes.mjs +6 -3
  130. package/scripts/faits-du-circuit.mjs +493 -0
  131. package/scripts/file-des-tickets.d.mts +21 -0
  132. package/scripts/file-des-tickets.mjs +58 -0
  133. package/scripts/flux-des-paquets.mjs +187 -0
  134. package/scripts/fusion-du-changelog.mjs +0 -1
  135. package/scripts/gardes-du-cadre.mjs +12 -2
  136. package/scripts/grillhouse-maj.mjs +16 -7
  137. package/scripts/integration/file.mjs +477 -422
  138. package/scripts/integration/integrer.mjs +20 -22
  139. package/scripts/integration/rejeu.mjs +19 -4
  140. package/scripts/jointure.d.ts +168 -28
  141. package/scripts/langages/cargo/commandes.mjs +426 -119
  142. package/scripts/langages/cargo/composants.mjs +187 -3
  143. package/scripts/langages/cargo/exemples.mjs +75 -17
  144. package/scripts/langages/cargo/index.mjs +32 -13
  145. package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +35 -0
  146. package/scripts/langages/cargo/sccache.mjs +62 -16
  147. package/scripts/langages/cargo/squelette.mjs +72 -3
  148. package/scripts/langages/cargo/tailles-des-tests.mjs +195 -0
  149. package/scripts/langages/cargo/tests-de-head.mjs +159 -0
  150. package/scripts/langages/python/commandes.mjs +232 -79
  151. package/scripts/langages/python/composants.mjs +65 -3
  152. package/scripts/langages/python/exemples.mjs +21 -12
  153. package/scripts/langages/python/index.mjs +25 -5
  154. package/scripts/langages/python/lot.mjs +1 -36
  155. package/scripts/langages/python/squelette.mjs +119 -17
  156. package/scripts/langages/typescript/construire.mjs +6 -163
  157. package/scripts/langages/typescript/exemples.mjs +19 -11
  158. package/scripts/langages/typescript/frontieres.mjs +1 -1
  159. package/scripts/langages/typescript/index.mjs +48 -63
  160. package/scripts/langages/typescript/interfaces-contre-code.mjs +4 -4
  161. package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
  162. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +31 -0
  163. package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
  164. package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
  165. package/scripts/langages/typescript/regle-des-tests.mjs +13 -0
  166. package/scripts/langages/typescript/squelette.mjs +18 -2
  167. package/scripts/langages/typescript/tailles-des-tests.mjs +40 -9
  168. package/scripts/langages/typescript/tests-de-nuit.mjs +44 -21
  169. package/scripts/langages/typescript/tests.mjs +17 -8
  170. package/scripts/langages/typescript/titres-de-tests.mjs +297 -0
  171. package/scripts/langages/typescript/turbo-des-paquets.mjs +183 -38
  172. package/scripts/langages/typescript/verdict.mjs +1 -1
  173. package/scripts/langages/typescript/verifier.mjs +110 -296
  174. package/scripts/langages/typescript/vitest-config/base.mjs +30 -10
  175. package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
  176. package/scripts/langages/typescript/vitest-config/cibles.mjs +123 -62
  177. package/scripts/langages/typescript/vitest-config/delais.mjs +54 -0
  178. package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
  179. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +100 -0
  180. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -64
  181. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -2
  182. package/scripts/langages/typescript/vitest-config/mesure.mjs +3 -2
  183. package/scripts/langages/typescript/vitest.nuit.config.mjs +22 -13
  184. package/scripts/lecture-unique.mjs +51 -0
  185. package/scripts/mesure/pression.mjs +11 -9
  186. package/scripts/mesure-de-la-machine.d.mts +21 -0
  187. package/scripts/mesure-de-la-machine.mjs +76 -0
  188. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +8 -2
  189. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +120 -0
  190. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
  191. package/scripts/migrations.mjs +5 -0
  192. package/scripts/nuit.sh +29 -15
  193. package/scripts/outil.mjs +72 -0
  194. package/scripts/outils-cles.d.mts +24 -0
  195. package/scripts/outils-cles.mjs +0 -1
  196. package/scripts/paquet-npm.mjs +147 -0
  197. package/scripts/paquet.mjs +112 -14
  198. package/scripts/paquets.mjs +34 -6
  199. package/scripts/passe-de-la-machine.mjs +66 -0
  200. package/scripts/places-de-la-machine.mjs +360 -0
  201. package/scripts/places-du-serveur.mjs +170 -0
  202. package/scripts/prefixe-des-tickets.mjs +68 -0
  203. package/scripts/preparation.mjs +10 -3
  204. package/scripts/registre.mjs +3 -2
  205. package/scripts/regles-des-places.d.mts +36 -0
  206. package/scripts/regles-des-places.mjs +70 -0
  207. package/scripts/reponses-du-circuit.d.mts +6 -0
  208. package/scripts/reponses-du-circuit.mjs +28 -0
  209. package/scripts/resultats.mjs +29 -14
  210. package/scripts/retirer-les-copies-finies.mjs +25 -0
  211. package/scripts/sans-reponse.d.mts +4 -0
  212. package/scripts/sans-reponse.mjs +13 -0
  213. package/scripts/seances.mjs +918 -0
  214. package/scripts/services-du-noyau.mjs +28 -11
  215. package/scripts/session-start.sh +10 -1
  216. package/scripts/sortie.mjs +23 -4
  217. package/scripts/sources.mjs +3 -3
  218. package/scripts/sous-commandes.mjs +39 -9
  219. package/scripts/style-a-l-ecriture.mjs +229 -0
  220. package/scripts/superviseur.mjs +382 -16
  221. package/scripts/tableau.mjs +329 -130
  222. package/scripts/taches-du-graphe.mjs +328 -0
  223. package/scripts/ticket-du-circuit.mjs +206 -0
  224. package/scripts/transitions.d.mts +148 -0
  225. package/scripts/transitions.mjs +901 -0
  226. package/scripts/verrou-de-fichier.mjs +2 -2
  227. package/scripts/verrou-de-machine.mjs +322 -62
  228. package/skills/developpeur/SKILL.md +11 -3
  229. package/skills/explorateur/SKILL.md +2 -1
  230. package/skills/pitmaster/SKILL.md +62 -28
  231. package/skills/pitmaster/references/consigne-agent.md +5 -1
  232. package/skills/release/SKILL.md +3 -3
  233. package/skills/relecteur/SKILL.md +22 -8
  234. package/skills/testwriter/SKILL.md +47 -39
  235. package/scripts/demon.mjs +0 -138
  236. package/scripts/integration/file-attente.mjs +0 -61
  237. package/scripts/langages/cargo/touches.mjs +0 -93
  238. package/scripts/langages/typescript/script-des-tests.mjs +0 -6
@@ -0,0 +1,31 @@
1
+ import { DES_TICKETS, idDesTickets, L_ETAT_DES_TICKETS, SEANCE_DU_SUPERVISEUR, } from './contrat.js';
2
+ /**
3
+ * Starts the queue of the tickets of <entree> on the task queue <file>, or leaves the one that
4
+ * runs; with <seance> (the supervisor's session that puts a ticket in it, or null), signals it to
5
+ * the queue, started if need be, which gives it to each circuit it starts then.
6
+ */
7
+ export async function demarrerLesTickets(client, entree, file, seance) {
8
+ const id = idDesTickets(entree.racine);
9
+ if (seance !== undefined) {
10
+ await client.workflow.signalWithStart(DES_TICKETS, {
11
+ workflowId: id,
12
+ taskQueue: file,
13
+ args: [entree],
14
+ signal: SEANCE_DU_SUPERVISEUR,
15
+ signalArgs: [seance],
16
+ });
17
+ return id;
18
+ }
19
+ await client.workflow.start(DES_TICKETS, {
20
+ workflowId: id,
21
+ taskQueue: file,
22
+ args: [entree],
23
+ workflowIdConflictPolicy: 'USE_EXISTING',
24
+ });
25
+ return id;
26
+ }
27
+ /** The queue of the tickets of the project at <racine>: its circuits alive, its fault. */
28
+ export async function lireLaFileDesTickets(client, racine) {
29
+ return client.workflow.getHandle(idDesTickets(racine)).query(L_ETAT_DES_TICKETS);
30
+ }
31
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/temporal/tickets/client.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,GAGtB,MAAM,cAAc,CAAC;AAEtB;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAc,EACd,MAAwB,EACxB,IAAY,EACZ,MAAsB;IAEtB,MAAM,EAAE,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACvC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,WAAW,EAAE;YACjD,UAAU,EAAE,EAAE;YACd,SAAS,EAAE,IAAI;YACf,IAAI,EAAE,CAAC,MAAM,CAAC;YACd,MAAM,EAAE,qBAAqB;YAC7B,UAAU,EAAE,CAAC,MAAM,CAAC;SACrB,CAAC,CAAC;QACH,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE;QACvC,UAAU,EAAE,EAAE;QACd,SAAS,EAAE,IAAI;QACf,IAAI,EAAE,CAAC,MAAM,CAAC;QACd,wBAAwB,EAAE,cAAc;KACzC,CAAC,CAAC;IACH,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,0FAA0F;AAC1F,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,MAAc,EAAE,MAAc;IACvE,OAAO,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAgB,kBAAkB,CAAC,CAAC;AAClG,CAAC"}
@@ -0,0 +1,56 @@
1
+ import type { EntreeDuCircuit } from '../circuit/contrat.js';
2
+ /** The workflow's type. */
3
+ export declare const DES_TICKETS = "ticketsDuProjet";
4
+ /** The id of the one queue of the tickets of the repository at <racine>. */
5
+ export declare const idDesTickets: (racine: string) => string;
6
+ /** The query of the queue: the circuits alive, and the fault of the setting. */
7
+ export declare const L_ETAT_DES_TICKETS = "etatDesTickets";
8
+ /**
9
+ * The signal by which `npx grillhouse circuit <ticket>` gives the queue the supervisor's session
10
+ * that put a ticket in it (a string, or null), which each circuit it starts then receives; it
11
+ * wakes the queue.
12
+ */
13
+ export declare const SEANCE_DU_SUPERVISEUR = "seanceDuSuperviseur";
14
+ /** What the queue receives. */
15
+ export interface EntreeDesTickets {
16
+ racine: string;
17
+ /** How often the queue wakes by itself, in ms: 60 s. */
18
+ reveilMs?: number;
19
+ /** What each circuit it starts receives besides its ticket (`repasserMs`, `ci`…). */
20
+ circuit?: Omit<EntreeDuCircuit, 'racine' | 'ticket' | 'suite'>;
21
+ }
22
+ /** The queue as its query gives it. */
23
+ export interface VueDesTickets {
24
+ /** The tickets whose circuit runs, as the queue last counted them. */
25
+ vivants: string[];
26
+ /** The fault that starts nothing (the setting, the package.json, Beads), by its name; null without one. */
27
+ faute: string | null;
28
+ }
29
+ export interface ActivitesDesTickets {
30
+ /**
31
+ * The tickets of the project that start now (`ticketsAPartir` of scripts/file-des-tickets.mjs,
32
+ * those of <enCours> aside), in their order, and the setting (`reglageDesCircuits` of
33
+ * scripts/circuits-cles.mjs): the number of circuits at once, or, with nothing to start, the
34
+ * fault by its name (the setting, a package.json that does not parse, a Beads that fails).
35
+ */
36
+ ticketsAPartir(e: {
37
+ racine: string;
38
+ enCours: string[];
39
+ }): Promise<{
40
+ partir: string[];
41
+ max: number | null;
42
+ faute: string | null;
43
+ }>;
44
+ /** The tickets of the project whose circuit runs, read from the server. */
45
+ circuitsVivants(e: {
46
+ racine: string;
47
+ }): Promise<string[]>;
48
+ /**
49
+ * The tickets of the project whose circuit the server holds, not integrated (`lireLesCircuits`
50
+ * of ../circuit/client.ts, one call): a circuit stopped on a question, its workflow running, or
51
+ * ended without its issue holds its ticket.
52
+ */
53
+ circuitsNonIntegres(e: {
54
+ racine: string;
55
+ }): Promise<string[]>;
56
+ }
@@ -0,0 +1,13 @@
1
+ /** The workflow's type. */
2
+ export const DES_TICKETS = 'ticketsDuProjet';
3
+ /** The id of the one queue of the tickets of the repository at <racine>. */
4
+ export const idDesTickets = (racine) => `tickets:${racine}`;
5
+ /** The query of the queue: the circuits alive, and the fault of the setting. */
6
+ export const L_ETAT_DES_TICKETS = 'etatDesTickets';
7
+ /**
8
+ * The signal by which `npx grillhouse circuit <ticket>` gives the queue the supervisor's session
9
+ * that put a ticket in it (a string, or null), which each circuit it starts then receives; it
10
+ * wakes the queue.
11
+ */
12
+ export const SEANCE_DU_SUPERVISEUR = 'seanceDuSuperviseur';
13
+ //# sourceMappingURL=contrat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contrat.js","sourceRoot":"","sources":["../../../src/temporal/tickets/contrat.ts"],"names":[],"mappings":"AAKA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAC7C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,WAAW,MAAM,EAAE,CAAC;AACpE,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AACnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,qBAAqB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type EntreeDesTickets } from './contrat.js';
2
+ /** The queue of the tickets of the project at <racine>. */
3
+ export declare function ticketsDuProjet(entree: EntreeDesTickets): Promise<void>;
@@ -0,0 +1,94 @@
1
+ // The queue of the tickets of a project (grillhouse-4nr.9, decision D9), `tickets:<racine>`, as Zuul
2
+ // and the merge queues start a change once what it depends on has merged: woken every `reveilMs`
3
+ // (60 s) and at the end of each circuit it started, it counts the
4
+ // circuits of the project alive (those the server runs, and those it has just started, which the
5
+ // server's visibility may not show yet), then starts the circuit of each ticket that starts
6
+ // (`ticketsAPartir`, unchanged: open, labelled `circuit`, its dependencies closed, by priority),
7
+ // no more alive at once than the setting of the project (`grillhouse.circuits`, 1 when absent). A
8
+ // circuit waiting for the supervisor's answer is alive: its workflow runs, waiting for the answer,
9
+ // and is never purged. A workflow closes only integrated (its ticket closed in Beads) or stopped
10
+ // on the supervisor's word (`--arreter`, the label `circuit` taken off): Beads, the durable
11
+ // register, keeps it from starting again. The circuits the server holds not integrated
12
+ // (`circuitsNonIntegres`, one call) hold their ticket too, one ended without its issue among them.
13
+ // Each circuit is a child that outlives the queue and that its cancellation does not reach; a
14
+ // ticket whose circuit runs already, visible or not yet, does not start again. A fault (the
15
+ // setting, the package.json, Beads) starts nothing, named in the query. Past its length of
16
+ // history, it continues as new; the end of a circuit started before is then read at the next
17
+ // wake. Deterministic: it imports the workflow API, the contracts and the workflow of a ticket.
18
+ import { WorkflowExecutionAlreadyStartedError } from '@temporalio/common';
19
+ import { allHandlersFinished, ChildWorkflowCancellationType, condition, continueAsNew, defineQuery, defineSignal, ParentClosePolicy, proxyActivities, setHandler, startChild, workflowInfo, } from '@temporalio/workflow';
20
+ import { idDuCircuit } from '../circuit/contrat.js';
21
+ import { circuitDuTicket } from '../circuit/deroule.js';
22
+ import { L_ETAT_DES_TICKETS, SEANCE_DU_SUPERVISEUR, } from './contrat.js';
23
+ const actes = proxyActivities({
24
+ startToCloseTimeout: '5 minutes',
25
+ retry: { initialInterval: '1 second', maximumAttempts: 4 },
26
+ });
27
+ const lEtat = defineQuery(L_ETAT_DES_TICKETS);
28
+ const laSeance = defineSignal(SEANCE_DU_SUPERVISEUR);
29
+ const REVEIL_MS = 60_000;
30
+ const LIMITE_D_HISTOIRE = 10_000;
31
+ /** The queue of the tickets of the project at <racine>. */
32
+ export async function ticketsDuProjet(entree) {
33
+ const { racine } = entree;
34
+ const reveilMs = entree.reveilMs ?? REVEIL_MS;
35
+ let reveil = false;
36
+ let vivants = [];
37
+ let faute = null;
38
+ // The circuits this run started, until their end: the server's visibility may lag behind.
39
+ const lances = new Set();
40
+ setHandler(lEtat, () => ({ vivants, faute }));
41
+ // The supervisor's session the last ticket put in the queue came with, which each circuit
42
+ // started receives; its signal wakes the queue.
43
+ let superviseur = entree.circuit?.superviseur ?? null;
44
+ setHandler(laSeance, s => {
45
+ superviseur = s;
46
+ reveil = true;
47
+ });
48
+ for (;;) {
49
+ const surLeServeur = await actes.circuitsVivants({ racine });
50
+ vivants = [...new Set([...surLeServeur, ...lances])].sort();
51
+ // A ticket whose circuit is not integrated, alive or stopped, does not start.
52
+ const tenus = await actes.circuitsNonIntegres({ racine });
53
+ const r = await actes.ticketsAPartir({
54
+ racine,
55
+ enCours: [...new Set([...vivants, ...tenus])].sort(),
56
+ });
57
+ faute = r.faute;
58
+ const places = r.max === null ? 0 : r.max - vivants.length;
59
+ for (const ticket of r.partir.slice(0, Math.max(0, places))) {
60
+ try {
61
+ const enfant = await startChild(circuitDuTicket, {
62
+ workflowId: idDuCircuit(racine, ticket),
63
+ args: [{ ...entree.circuit, superviseur, racine, ticket }],
64
+ parentClosePolicy: ParentClosePolicy.ABANDON,
65
+ cancellationType: ChildWorkflowCancellationType.ABANDON,
66
+ });
67
+ lances.add(ticket);
68
+ // The end of the circuit wakes the queue.
69
+ const fini = () => {
70
+ lances.delete(ticket);
71
+ reveil = true;
72
+ };
73
+ void enfant.result().then(fini, fini);
74
+ }
75
+ catch (e) {
76
+ if (!(e instanceof WorkflowExecutionAlreadyStartedError)) {
77
+ throw e;
78
+ }
79
+ }
80
+ vivants = [...new Set([...vivants, ticket])].sort();
81
+ }
82
+ reveil = false;
83
+ await condition(() => reveil, reveilMs);
84
+ if (workflowInfo().continueAsNewSuggested ||
85
+ workflowInfo().historyLength >= LIMITE_D_HISTOIRE) {
86
+ await condition(allHandlersFinished);
87
+ return continueAsNew({
88
+ ...entree,
89
+ circuit: { ...entree.circuit, superviseur },
90
+ });
91
+ }
92
+ }
93
+ }
94
+ //# sourceMappingURL=deroule.js.map
@@ -0,0 +1 @@
1
+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AC,aAAa,IAAI,iBAAiB,EACjD,CAAC;YACD,MAAM,SAAS,CAAC,mBAAmB,CAAC,CAAC;YACrC,OAAO,aAAa,CAAyB;gBAC3C,GAAG,MAAM;gBACT,OAAO,EAAE,EAAE,GAAG,MAAM,CAAC,OAAO,EAAE,WAAW,EAAE;aAC5C,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env node
2
+ // The frame's worker, which the units of the account start (the worker of the project, the worker
3
+ // of the machine, each on its task queue):
4
+ //
5
+ // node dist/temporal/travailleur.js --file <file des tâches>
6
+ //
7
+ // - It connects to the server of TEMPORAL_ADDRESS (the common client library, ./client.ts), bundles
8
+ // the frame's workflows (./deroules.ts: the sonde, the places of the machine, the circuit of a ticket, the queue of a
9
+ // project and the CI of a commit, the queue of the tickets of a project) and serves them
10
+ // with their activities on the task queue <file>. It writes `prêt <file>` on its standard output once it polls.
11
+ // - SIGINT and SIGTERM stop it cleanly, as the SDK's runtime has it: its running activities are
12
+ // cancelled, then it exits 0. Killed, the server gives its work to the next worker of the queue.
13
+ // - Exit 2 for a malformed call, 1 when it cannot serve (the server unreachable).
14
+ import { fileURLToPath } from 'node:url';
15
+ import { Worker } from '@temporalio/worker';
16
+ import { espaceDeNoms, ouvrirLaConnexionDuTravailleur } from './client.js';
17
+ import * as activitesDuCircuit from './circuit/activites.js';
18
+ import * as activitesDeLaFile from './file/activites.js';
19
+ import * as activitesDesPlaces from './places/activites.js';
20
+ import * as activitesDesTickets from './tickets/activites.js';
21
+ import * as activitesDeLaSonde from './sonde/activites.js';
22
+ const DEROULES = fileURLToPath(new URL('./deroules.js', import.meta.url));
23
+ // The task queue that the arguments <args> name (`--file <file>`), or null.
24
+ function fileDesArguments(args) {
25
+ const i = args.indexOf('--file');
26
+ const file = i >= 0 ? args[i + 1] : undefined;
27
+ return file && !file.startsWith('--') && args.length === 2 ? file : null;
28
+ }
29
+ async function principal(args) {
30
+ const file = fileDesArguments(args);
31
+ if (file === null) {
32
+ process.stderr.write('Usage : travailleur.js --file <file des tâches>\n');
33
+ return 2;
34
+ }
35
+ const connection = await ouvrirLaConnexionDuTravailleur();
36
+ try {
37
+ const worker = await Worker.create({
38
+ connection,
39
+ namespace: espaceDeNoms(),
40
+ taskQueue: file,
41
+ workflowsPath: DEROULES,
42
+ activities: {
43
+ ...activitesDeLaSonde,
44
+ ...activitesDesPlaces,
45
+ ...activitesDuCircuit,
46
+ ...activitesDeLaFile,
47
+ ...activitesDesTickets,
48
+ },
49
+ // A heartbeat reaches the server within the second: the last sign of life of a session
50
+ // survives a worker that dies, and a cancellation reaches its activity at once.
51
+ maxHeartbeatThrottleInterval: '1 second',
52
+ defaultHeartbeatThrottleInterval: '1 second',
53
+ });
54
+ const fin = worker.run();
55
+ process.stdout.write(`prêt ${file}\n`);
56
+ await fin;
57
+ return 0;
58
+ }
59
+ finally {
60
+ await connection.close();
61
+ }
62
+ }
63
+ principal(process.argv.slice(2)).then(code => {
64
+ process.exitCode = code;
65
+ }, (e) => {
66
+ process.stderr.write(`travailleur : ${e instanceof Error ? e.message : String(e)}\n`);
67
+ process.exitCode = 1;
68
+ });
69
+ //# sourceMappingURL=travailleur.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"travailleur.js","sourceRoot":"","sources":["../../src/temporal/travailleur.ts"],"names":[],"mappings":";AACA,kGAAkG;AAClG,2CAA2C;AAC3C,EAAE;AACF,+DAA+D;AAC/D,EAAE;AACF,oGAAoG;AACpG,wHAAwH;AACxH,2FAA2F;AAC3F,kHAAkH;AAClH,gGAAgG;AAChG,mGAAmG;AACnG,kFAAkF;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;A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