diff options
| author | Dax Raad <[email protected]> | 2025-05-19 19:29:38 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-05-26 12:40:17 -0400 |
| commit | 2437ce3f8b79a7f9d987862b633f3340bfa2c1c4 (patch) | |
| tree | d46690ea1bf8043871e26b6139f96997b16a6252 /js/src/session/session.ts | |
| parent | fa8a46326afa2d7fbb592542abf243f248cb5992 (diff) | |
| download | opencode-2437ce3f8b79a7f9d987862b633f3340bfa2c1c4.tar.gz opencode-2437ce3f8b79a7f9d987862b633f3340bfa2c1c4.zip | |
toolz
Diffstat (limited to 'js/src/session/session.ts')
| -rw-r--r-- | js/src/session/session.ts | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/js/src/session/session.ts b/js/src/session/session.ts index e86048b1c..66b78229c 100644 --- a/js/src/session/session.ts +++ b/js/src/session/session.ts @@ -7,6 +7,7 @@ import { Log } from "../util/log"; import { convertToModelMessages, streamText, + tool, type TextUIPart, type ToolInvocationUIPart, type UIDataTypes, @@ -14,6 +15,10 @@ import { type UIMessagePart, } from "ai"; import { z } from "zod"; +import { BashTool } from "../tool/bash"; +import { EditTool } from "../tool/edit"; +import ANTHROPIC_PROMPT from "./prompt/anthropic.txt"; +import { ViewTool } from "../tool/view"; export namespace Session { const log = Log.create({ service: "session" }); @@ -126,7 +131,7 @@ export namespace Session { parts: [ { type: "text", - text: "You are a helpful assistant called opencode", + text: ANTHROPIC_PROMPT, }, ], metadata: { @@ -150,8 +155,14 @@ export namespace Session { const model = await LLM.findModel("claude-3-7-sonnet-20250219"); const result = streamText({ + maxSteps: 1000, messages: convertToModelMessages(msgs), temperature: 0, + tools: { + ...BashTool, + ...ViewTool, + ...EditTool, + }, model, }); const next: Message = { @@ -175,6 +186,7 @@ export namespace Session { case "start": break; case "start-step": + text = undefined; next.parts.push({ type: "step-start", }); |
