feat: integrate pixel teacher presence and resilient classroom preview
This commit is contained in:
@@ -321,8 +321,10 @@ function reconcileLiveIds(
|
||||
if (node.kind === 'message') {
|
||||
const live = liveNodes.find((candidate) => candidate.kind === 'message'
|
||||
&& !used.has(candidate.id)
|
||||
&& (candidate.sourceEntryId === node.sourceEntryId
|
||||
|| messageSignature(candidate) === messageSignature(node)));
|
||||
&& Boolean(node.sourceEntryId) && candidate.sourceEntryId === node.sourceEntryId)
|
||||
?? liveNodes.find((candidate) => candidate.kind === 'message'
|
||||
&& !used.has(candidate.id) && !candidate.sourceEntryId
|
||||
&& messageSignature(candidate) === messageSignature(node));
|
||||
if (!live || live.kind !== 'message') return node;
|
||||
used.add(live.id);
|
||||
return {
|
||||
@@ -383,12 +385,16 @@ export async function projectPiSessionSnapshot(
|
||||
const path = activePath(response.entries, response.leafId);
|
||||
const durableNodes = await projectEntries(path, input);
|
||||
const nodes = reconcileLiveIds(durableNodes, input.snapshot.nodes);
|
||||
const preserveTerminalRun = input.workerGeneration === input.snapshot.cursor.workerGeneration
|
||||
&& Boolean(input.snapshot.run.runId)
|
||||
&& (input.snapshot.run.status === 'error'
|
||||
|| (input.snapshot.run.status === 'idle' && input.snapshot.run.terminalReason !== undefined));
|
||||
return {
|
||||
...structuredClone(input.snapshot),
|
||||
nodes,
|
||||
run: state.isStreaming === true
|
||||
? { ...structuredClone(input.snapshot.run), status: 'running' }
|
||||
: { status: 'idle' },
|
||||
: preserveTerminalRun ? structuredClone(input.snapshot.run) : { status: 'idle' },
|
||||
queue: { items: [] },
|
||||
context: projectedContext(input, state),
|
||||
pendingInteractions: [],
|
||||
|
||||
Reference in New Issue
Block a user