From 754cc667411cc1d652acd0a811c530dcc35f5927 Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Mon, 26 May 2025 23:04:40 -0400 Subject: Add automatic CONTEXT.md loading and improve share sync reliability MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with opencode Co-Authored-By: opencode --- js/src/session/session.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'js/src/session') diff --git a/js/src/session/session.ts b/js/src/session/session.ts index d911270a7..cbe6cd89c 100644 --- a/js/src/session/session.ts +++ b/js/src/session/session.ts @@ -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({ -- cgit v1.2.3