Add automatic CONTEXT.md loading and improve share sync reliability

🤖 Generated with opencode
Co-Authored-By: opencode <noreply@opencode.ai>
This commit is contained in:
Dax Raad
2025-05-26 23:04:40 -04:00
parent 6ef0b991ec
commit 754cc66741
3 changed files with 33 additions and 11 deletions

View File

@@ -141,6 +141,7 @@ export namespace Session {
msg,
);
}
const app = await App.use();
if (msgs.length === 0) {
const system: Message = {
id: Identifier.ascending("message"),
@@ -159,6 +160,14 @@ export namespace Session {
tool: {},
},
};
const contextFile = Bun.file(path.join(app.root, "CONTEXT.md"));
if (await contextFile.exists()) {
const context = await contextFile.text();
system.parts.push({
type: "text",
text: context,
});
}
msgs.push(system);
state().messages.set(sessionID, msgs);
generateText({