summaryrefslogtreecommitdiffhomepage
path: root/js/src/index.ts
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-05-18 02:43:01 -0400
committerDax Raad <[email protected]>2025-05-26 12:40:17 -0400
commitd0d67029f4baad7389b5ba072379c2ff44a22dc4 (patch)
treecb81e86662c14c20687bf5bac488dda911a9855e /js/src/index.ts
parenta34d020bc6b252e842f042d935c7a0e6444460cf (diff)
downloadopencode-d0d67029f4baad7389b5ba072379c2ff44a22dc4.tar.gz
opencode-d0d67029f4baad7389b5ba072379c2ff44a22dc4.zip
process
Diffstat (limited to 'js/src/index.ts')
-rw-r--r--js/src/index.ts18
1 files changed, 17 insertions, 1 deletions
diff --git a/js/src/index.ts b/js/src/index.ts
index 9ccbfda6c..959d1182a 100644
--- a/js/src/index.ts
+++ b/js/src/index.ts
@@ -2,12 +2,28 @@ import { App } from "./app";
import process from "node:process";
import { RPC } from "./server/server";
import { Session } from "./session/session";
+import { Identifier } from "./id/id";
const app = await App.create({
directory: process.cwd(),
});
App.provide(app, async () => {
- const session = await Session.create();
+ const sessionID = await Session.list()
+ [Symbol.asyncIterator]()
+ .next()
+ .then((v) => v.value ?? Session.create().then((s) => s.id));
+
+ await Session.chat(sessionID, {
+ role: "user",
+ id: Identifier.create("message"),
+ parts: [
+ {
+ type: "text",
+ text: "Hey how are you? try to use tools",
+ },
+ ],
+ });
+
const rpc = RPC.listen();
});