Move live background tasks into a composer badge and modal
This commit is contained in:
@@ -310,7 +310,7 @@ async function staticFile(base, pathname, req, res) {
|
||||
* It serves the built probe bundle and upgrades /connect on the same origin, so
|
||||
* the normal web composition infers this server from Uri.base.
|
||||
*/
|
||||
export async function startFixture({ root, runs = RUNS, runDetail, files = {}, chatMessages, chatSessions, chatHistoryDelayMs = 0, onChatHistory }) {
|
||||
export async function startFixture({ root, runs = RUNS, runDetail, files = {}, chatMessages, chatSessions, chatShells = [], chatShellOutput = '', chatHistoryDelayMs = 0, onChatHistory }) {
|
||||
const base = await realpath(root);
|
||||
const connections = new Set();
|
||||
const sockets = new Set();
|
||||
@@ -327,6 +327,7 @@ export async function startFixture({ root, runs = RUNS, runDetail, files = {}, c
|
||||
let chatSubscribed = 0;
|
||||
let chatHistory = 0;
|
||||
const chatPrompts = [];
|
||||
const shellOutputRequests = [];
|
||||
const fileReads = [];
|
||||
let chatRunning = false;
|
||||
let chatInterrupts = 0;
|
||||
@@ -367,6 +368,9 @@ export async function startFixture({ root, runs = RUNS, runDetail, files = {}, c
|
||||
for await (const chunk of req) chunks.push(chunk);
|
||||
const event = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
||||
if (event.kind === 'step') chatRunning = event.step?.status !== 'ended';
|
||||
if (event.kind === 'shell' && event.shell?.id) {
|
||||
chatShells = [...chatShells.filter(shell => shell.id !== event.shell.id), event.shell];
|
||||
}
|
||||
broadcast({ type: 'chat_event', chat_event: {
|
||||
session_id: CHAT_SESSION.id, ...event,
|
||||
} });
|
||||
@@ -417,6 +421,7 @@ export async function startFixture({ root, runs = RUNS, runDetail, files = {}, c
|
||||
chatSubscribed,
|
||||
chatHistory,
|
||||
chatPrompts,
|
||||
shellOutputRequests,
|
||||
chatRunning,
|
||||
chatInterrupts,
|
||||
fileReads,
|
||||
@@ -580,7 +585,15 @@ export async function startFixture({ root, runs = RUNS, runDetail, files = {}, c
|
||||
return;
|
||||
}
|
||||
if (request.type === 'chat_shells') {
|
||||
client.send({ id: request.id, type: 'chat_shells', chat_shells: [] });
|
||||
client.send({ id: request.id, type: 'chat_shells', chat_shells: chatShells });
|
||||
return;
|
||||
}
|
||||
if (request.type === 'chat_shell_output') {
|
||||
const query = request.chat_shell_output_query ?? {};
|
||||
shellOutputRequests.push(query);
|
||||
const shell = chatShells.find(shell => shell.id === query.shell_id);
|
||||
client.send({ id: request.id, type: 'chat_shell_output', chat_shell_output:
|
||||
shell ? { shell, output: chatShellOutput } : { unavailable: true } });
|
||||
return;
|
||||
}
|
||||
if (request.type === 'chat_interrupt') {
|
||||
|
||||
Reference in New Issue
Block a user