agenda: the player's second paper (add/drop deltas, cap-5 recency queue); conflicts self-heal as their own turn; same-verb blocks combine; per-run model selection; substrate-tag syntax rule

This commit is contained in:
2026-11-14 21:15:32 +00:00
parent 711634cc38
commit 5956e44f7a
15 changed files with 627 additions and 71 deletions
+8 -9
View File
@@ -53,7 +53,6 @@ function makeSession(runId, st) {
file: sessionFile(runId, st),
lines: [],
pendingAsk: null, // { callId, question, calls } — the whole batch pauses
conflict: null, // carried to the next GM turn as a <conflict> block
usage: null, // { promptTokens, completionTokens } from the last response
fresh: false,
append(entry) {
@@ -153,10 +152,6 @@ function derive(s) {
}
} else if (e.t === 'tool' && pending && e.m.tool_call_id === pending.callId) {
pending = null;
} else if (e.t === 'note' && e.kind === 'paper') {
s.conflict = e.conflicts?.length ? e.conflicts.join('; ') : null;
} else if (e.t === 'msg' && e.m.role === 'user') {
s.conflict = null; // it rode this GM turn
} else if (e.t === 'msg' && e.usage) {
s.usage = { promptTokens: e.usage.prompt_tokens, completionTokens: e.usage.completion_tokens };
}
@@ -166,7 +161,7 @@ function derive(s) {
// --- the view renderer: log + policy -> per-call context ---------------------
const STRIP_BLOCKS = /\n?<(status|conflict)>[\s\S]*?<\/\1>\n?/g;
const STRIP_BLOCKS = /\n?<(status|conflict|agenda)>[\s\S]*?<\/\1>\n?/g;
export function renderView(s, keepToolResults = 4) {
const toolIdx = [];
@@ -186,13 +181,17 @@ export function renderView(s, keepToolResults = 4) {
const m = { role: 'assistant', content: e.m.content ?? null };
if (e.m.tool_calls?.length) m.tool_calls = e.m.tool_calls;
msgs.push(m);
} else if (e.conflictOnly) {
// transient error traffic: visible while it is the latest word
// (the model answers it), elided entirely once the story moves
// on — the log keeps it for provenance
if (i === lastGmIdx) msgs.push({ role: e.m.role, content: e.m.content.trim() });
} else if (i === lastGmIdx) {
// the newest GM turn keeps its blocks as-sent: the current
// paper rides it, and a pending conflict rides it — the
// model must see both
// paper and agenda ride it
msgs.push({ role: e.m.role, content: e.m.content.trim() });
} else {
// older GM turns: status/conflict blocks elide
// older GM turns: status/agenda/conflict blocks elide
msgs.push({ role: e.m.role, content: e.m.content.replace(STRIP_BLOCKS, '').trim() });
}
} else if (e.t === 'tool') {