Accueil par l'IA, sans programme par défaut (ADR 0008)

Le programme d'Atelier devient un programme d'exemple ; State.program peut
être null ; une proposition peut porter un profil.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pierre MARTIN
2026-11-18 00:59:15 +01:00
co-authored by Claude Opus 5.5
parent 285fca57f5
commit 677507771c
14 changed files with 122 additions and 27 deletions
+7 -4
View File
@@ -2,7 +2,6 @@
// tourne dans l'app et dans le serveur MCP.
import { compareEvents, validateEvent } from "./events.js";
import { DEFAULT_PROGRAM } from "./default-program.js";
import { DEFAULT_PROFILE } from "./profile.js";
/**
@@ -27,11 +26,12 @@ import { DEFAULT_PROFILE } from "./profile.js";
* @property {import("./vocabulary.js").ProgramSource} source
* @property {string} reason
* @property {import("./program.js").Program} program
* @property {import("./profile.js").Profile|null} profile profil proposé avec le programme, s'il y en a un
*/
/**
* @typedef {object} State
* @property {import("./program.js").Program} program programme courant
* @property {import("./program.js").Program|null} program programme courant ; null tant qu'aucun n'est adopté (accueil, ADR 0008)
* @property {ProgramVersion[]} programVersions du plus ancien au plus récent
* @property {Proposal[]} proposals en attente de décision
* @property {import("./profile.js").Profile} profile
@@ -49,7 +49,7 @@ import { DEFAULT_PROFILE } from "./profile.js";
/** @returns {State} */
export function emptyState() {
return {
program: structuredClone(DEFAULT_PROGRAM),
program: null,
programVersions: [],
proposals: [],
profile: structuredClone(DEFAULT_PROFILE),
@@ -122,7 +122,10 @@ export function foldEvents(events) {
weights.delete(e.data.date);
break;
case "ProgramProposed":
proposals.set(e.id, { id: e.id, at: e.at, source: e.data.source, reason: e.data.reason, program: structuredClone(e.data.program) });
proposals.set(e.id, {
id: e.id, at: e.at, source: e.data.source, reason: e.data.reason,
program: structuredClone(e.data.program), profile: e.data.profile ? structuredClone(e.data.profile) : null,
});
break;
case "ProgramAdopted":
state.program = structuredClone(e.data.program);