workspace out of cache; welcome.md

This commit is contained in:
2026-04-13 22:24:12 -04:00
parent 45a21ac933
commit dacfa9c1a3
5 changed files with 70 additions and 44 deletions

View File

@@ -257,7 +257,8 @@ export class WebSocketHandler {
})
);
// Replay conversation history so the UI pre-populates on reconnect
// Replay conversation history so the UI pre-populates on reconnect;
// greet new users on their first conversation
if (this.config.conversationService) {
const history = await this.config.conversationService.getHistory(
authContext.userId,
@@ -265,6 +266,29 @@ export class WebSocketHandler {
);
if (history.length > 0) {
socket.send(JSON.stringify({ type: 'conversation_history', messages: history }));
} else {
// First conversation — auto-send greeting prompt and stream the response
socket.send(JSON.stringify({ type: 'agent_chunk', content: '', done: false }));
for await (const event of harness!.streamGreeting()) {
const e = event as HarnessEvent;
switch (e.type) {
case 'chunk':
socket.send(JSON.stringify({ type: 'agent_chunk', content: e.content, done: false }));
break;
case 'tool_call':
socket.send(JSON.stringify({ type: 'agent_tool_call', toolName: e.toolName, label: e.label }));
break;
case 'image':
socket.send(JSON.stringify({ type: 'image', data: e.data, mimeType: e.mimeType, caption: e.caption }));
break;
case 'error':
socket.send(JSON.stringify({ type: 'text', text: `An error occurred during greeting.` }));
break;
case 'done':
break;
}
}
socket.send(JSON.stringify({ type: 'agent_chunk', content: '', done: true }));
}
}