variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
// server/loop.mjs -- the turn loop.
2026-11-14 03:15:53 +00:00
//
// Synchronous REST: a POST runs the tool loop and returns. ask_gm
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
// pauses mid-turn -- the whole tool-call batch waits (pairing stays
2026-11-14 03:15:53 +00:00
// sound), the request returns with the pending question, and the
2026-11-14 23:48:27 +00:00
// answer call resumes the loop. The status is re-read from the clerk
2026-11-14 03:15:53 +00:00
// before every GM turn and rides it as a <status> block; the player's
// <lost>/<gained> deltas apply after its final message, and any
// conflicts ride the next GM turn as a <conflict> block.
import { clerkJson } from './clerk.mjs' ;
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
import { toolList , runTool , assembleReminder } from './bundle.mjs' ;
2026-11-14 03:15:53 +00:00
import { renderView } from './session.mjs' ;
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
import { parseVariants , pickVariant } from './variants.mjs' ;
2026-11-14 03:15:53 +00:00
export class HttpError extends Error {
constructor ( status , message , detail ) {
super ( message );
this . status = status ;
this . detail = detail ;
}
}
function needSession ( ctx , runId ) {
const s = ctx . sessions . get ( runId );
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
if ( ! s ) throw new HttpError ( 409 , `no open session for run ' ${ runId } ' -- POST /api/runs/ ${ runId } /sessions first` );
2026-11-14 03:15:53 +00:00
return s ;
}
2026-11-14 20:01:15 +00:00
export async function gmTurn ( ctx , runId , line , user ) {
2026-11-14 03:15:53 +00:00
const s = needSession ( ctx , runId );
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
if ( s . pendingAsk ) throw new HttpError ( 409 , 'a question is pending -- answer it first (POST /ask)' );
2026-11-14 23:48:27 +00:00
const status = clerkJson ( runId , 'status' ); // fresh per turn
2026-11-14 21:15:32 +00:00
const agenda = clerkJson ( runId , 'agenda' ); // fresh per turn
// the wire renders the queue as the model cites it: numbered from the top
const agendaWire = agenda . map (( d , i ) => ` ${ i } . ${ d } ` ). join ( '; ' );
2026-11-14 23:48:27 +00:00
const content = ` ${ line . trim () } \n\n<status> ${ status . join ( ', ' ) } </status>\n<agenda> ${ agendaWire } </agenda>` ;
2026-11-14 03:15:53 +00:00
s . append ({ t : 'msg' , m : { role : 'user' , content } });
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
// the reminder follows the GM's prose as its own system chunk --
2026-11-14 22:00:04 +00:00
// every turn, one live copy (older ones elide in the view)
const reminder = assembleReminder ( runId );
if ( reminder ) s . append ({ t : 'msg' , m : { role : 'system' , content : reminder }, reminder : true });
2026-11-14 20:01:15 +00:00
return runLoop ( ctx , runId , user );
2026-11-14 03:15:53 +00:00
}
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
// the opening auto-send: a carryover that ends on a GM turn is her
// cue -- the first request of the assembled contwin fires with no new
// line (the cue is already the log's last word)
export async function openingCall ( ctx , runId , user ) {
return runLoop ( ctx , runId , user );
2026-11-14 09:04:13 +00:00
}
2026-11-14 20:01:15 +00:00
export async function answerAsk ( ctx , runId , answer , user ) {
2026-11-14 03:15:53 +00:00
const s = needSession ( ctx , runId );
if ( ! s . pendingAsk ) throw new HttpError ( 409 , 'no pending question' );
// execute the paused batch: the ask gets the answer, its siblings
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
// (if any) get dispatched now -- pairing stays whole
2026-11-14 03:15:53 +00:00
for ( const call of s . pendingAsk . calls ) {
if ( call . id === s . pendingAsk . callId ) {
s . append ({ t : 'tool' , ask : true , m : { role : 'tool' , tool_call_id : call . id , content : answer } });
} else {
s . append ({ t : 'tool' , m : { role : 'tool' , tool_call_id : call . id , content : runTool ( runId , call ) } });
}
}
s . pendingAsk = null ;
2026-11-14 20:01:15 +00:00
return runLoop ( ctx , runId , user );
2026-11-14 03:15:53 +00:00
}
2026-11-14 20:01:15 +00:00
async function runLoop ( ctx , runId , user ) {
2026-11-14 03:15:53 +00:00
const s = ctx . sessions . get ( runId );
const tools = toolList ( runId );
const out = { tools : [] };
2026-11-14 21:15:32 +00:00
let heals = 0 ;
2026-11-14 03:15:53 +00:00
for (;;) {
const view = renderView ( s );
let msg ;
if ( ctx . mock ) {
msg = mockModel ( s , view );
} else {
2026-11-14 20:01:15 +00:00
const model = resolveModel ( ctx , runId );
// attribution (#22): every LLM call names the acting user
console . log ( ` ${ new Date (). toISOString (). slice ( 11 , 19 ) } llm ${ model } u: ${ user ? . id ?? '?' } ` );
2026-11-14 03:15:53 +00:00
const data = await ctx . provider . chat ( model , view , tools , ctx . cfg . params ?? {});
msg = data . choices [ 0 ]. message ;
s . usage = data . usage
? { promptTokens : data . usage . prompt_tokens , completionTokens : data . usage . completion_tokens }
: null ;
}
if ( msg . tool_calls ? . length ) {
const ask = msg . tool_calls . find (( c ) => c . function . name === 'ask_gm' );
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
s . append ({ t : 'msg' , m : msg , ...( s . usage ? { usage : { prompt_tokens : s . usage . promptTokens , completion_tokens : s . usage . completionTokens } } : {}) });
2026-11-14 03:15:53 +00:00
if ( ask ) {
let q = '(no question)' ;
try { q = JSON . parse ( ask . function . arguments || '{}' ). question ?? q ; } catch {}
s . pendingAsk = { callId : ask . id , question : q , calls : msg . tool_calls };
s . append ({ t : 'note' , kind : 'ask' , question : q });
out . pendingAsk = q ;
return out ; // the turn request returns with the question
}
for ( const call of msg . tool_calls ) {
out . tools . push ( call . function . name );
s . append ({ t : 'tool' , m : { role : 'tool' , tool_call_id : call . id , content : runTool ( runId , call ) } });
}
continue ; // let the model see the results before ending its turn
}
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
// the final message. Variant literature resolves on reception:
// validated strictly BEFORE anything is appended (a malformed
// block refuses loud, nothing applies), then one variant is
// picked at random and only that turn goes forward -- the pick
// note rides the log as the variantary metric, the unpicked rest
// never render on any model-facing surface
let vv = null ;
try {
vv = parseVariants ( msg . content );
} catch ( e ) {
throw new HttpError ( 422 , `the player emitted a malformed variants block -- nothing applied; the turn is lost, retry: ${ e . message } ` );
}
s . append ({ t : 'msg' , m : msg , ...( s . usage ? { usage : { prompt_tokens : s . usage . promptTokens , completion_tokens : s . usage . completionTokens } } : {}) });
let text ;
if ( vv ) {
const chosen = pickVariant ( vv . variants . length );
s . append ({ t : 'note' , kind : 'pick' , chosen , count : vv . variants . length });
out . variants = { count : vv . variants . length , chosen };
text = vv . variants [ chosen ];
} else {
text = msg . content ?? '' ;
}
// the status and agenda deltas ride the turn text (the picked
// variant's, for variant literature). Same-verb blocks combine
// into one apply (the clerk's collectors gather every block before
// executing anything), never a sequence of applies.
2026-11-14 21:15:32 +00:00
const carry = [];
2026-11-14 03:15:53 +00:00
if ( /<(lost|gained)>/ . test ( text )) {
2026-11-14 23:48:27 +00:00
const r = clerkJson ( runId , 'status-apply' , text );
s . append ({ t : 'note' , kind : 'status' , applied : { lost : r . lost , gained : r . gained }, conflicts : r . conflicts });
2026-11-14 21:15:32 +00:00
carry . push (...( r . conflicts ?? []));
}
if ( /<(add|drop)>/ . test ( text )) {
const r = clerkJson ( runId , 'agenda-apply' , text );
s . append ({ t : 'note' , kind : 'agenda' , applied : { added : r . added , dropped : r . dropped , evicted : r . evicted }, conflicts : r . conflicts });
carry . push (...( r . conflicts ?? []));
}
if ( carry . length && heals < 3 ) {
// a conflict answers for itself: it goes back as its own message,
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
// not attached to a GM turn -- clean of prose, easy to read, easy
2026-11-14 21:15:32 +00:00
// to heal. Capped so a confused model cannot ping-pong forever.
heals ++ ;
s . append ({ t : 'msg' , m : { role : 'user' , content : `<conflict> ${ carry . join ( '; ' ) } </conflict>` }, conflictOnly : true });
continue ;
2026-11-14 03:15:53 +00:00
}
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
if ( carry . length ) out . conflicts = carry ; // healing gave up -- the transcript shows it
2026-11-14 03:15:53 +00:00
out . player = text ;
return out ;
}
}
function resolveModel ( ctx , runId ) {
const meta = ctx . runMeta ( runId ) ?? {};
2026-11-14 21:15:32 +00:00
return meta . models ? . player ?? ctx . cfg . models ? . player ?? null ;
2026-11-14 03:15:53 +00:00
}
// --- the mock model ----------------------------------------------------------
//
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
// A scripted stand-in that exercises the loop without a key. The
// script advances one step per assistant reply, counted across the
// whole log (the conflict heal is a reply like any other). A
// session's head -- carryover turns before the first exchange --
// never counts; a continuation carryover's exchanges DO, so a
// carried history shifts the first turn's script position, and the
// smoke knows exactly where that is. Turn one offers variant
// literature (the random pick), turn two asks (the pause/resume
// path), the answer lands with status and agenda deltas (the tag
// transports), then the drops, a bad drop, its self-heal, and
// everything after is plain prose.
2026-11-14 03:15:53 +00:00
function mockModel ( s , view ) {
const call = ( name , args , id ) => ({
role : 'assistant' ,
content : null ,
tool_calls : [{ id , type : 'function' , function : { name , arguments : JSON . stringify ( args ) } }],
});
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
let inExchange = false ;
let count = 0 ;
for ( const e of s . lines ) {
if ( e . t === 'msg' && e . m . role === 'user' && ! e . conflictOnly ) {
inExchange = true ;
} else if ( inExchange && e . t === 'msg' && e . m . role === 'assistant' ) {
count ++ ;
}
2026-11-14 03:15:53 +00:00
}
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
const toolResults = view . filter (( m ) => m . role === 'tool' ). length ;
if ( count === 0 ) {
// variant literature: two complete candidate turns, each with its
// own delta -- only the picked one's ever applies
return { role : 'assistant' , content : '<variants>\n<variant>\n*She presses on along the hull, palms flat against the warm metal.*\n<gained>determined</gained>\n</variant>\n<variant>\n*She doubles back to the container and crouches in its shadow.*\n<gained>cautious</gained>\n</variant>\n</variants>' };
2026-11-14 03:15:53 +00:00
}
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
if ( count === 1 && toolResults === 0 ) {
2026-11-14 03:15:53 +00:00
return call ( 'ask_gm' , { question : 'From where she stands, does the deck look clear toward the bow?' }, `mock-ask- ${ s . lines . length } ` );
}
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
if ( count === 2 && toolResults >= 1 ) {
2026-11-14 21:15:32 +00:00
// two <gained> and two <add> blocks on one turn: same-verb blocks
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
// combine into one apply, never a sequence -- the smoke asserts the
2026-11-14 21:15:32 +00:00
// merged, order-preserving result
return { role : 'assistant' , content : 'Mock: good to know. *She exhales and lets her shoulders drop.*\n<lost>worried</lost>\n<gained>settled</gained>\n<gained>curious about the clicking</gained>\n<add>find fresh water</add>\n<add>signal any passing ship, build a shelter</add>' };
}
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
if ( count === 3 ) {
2026-11-14 21:15:32 +00:00
return { role : 'assistant' , content : 'Mock: *She settles on the first task and starts walking.*\n<drop>0</drop>' };
}
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
if ( count === 4 ) {
2026-11-14 21:15:32 +00:00
return { role : 'assistant' , content : 'Mock: *She squints at the horizon.*\n<drop>9</drop>' };
}
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
if ( count === 5 ) {
2026-11-14 21:15:32 +00:00
// the self-heal: this fires in answer to the conflict-only message
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
return { role : 'assistant' , content : 'Mock: *She shakes her head -- no such thing on the list.*\n<drop>0, 1</drop>' };
2026-11-14 03:15:53 +00:00
}
return { role : 'assistant' , content : 'Mock: *She watches the water and waits for the world to move.*' };
}