The open source coding agent.
TypeScript
Clean up code formatting and remove unused imports for better consistency
Dax Raadb75456f5ddc4
diff --git a/js/src/bus/index.ts b/js/src/bus/index.tsindex 0064c0a7e75..15d2b110713 100644--- a/js/src/bus/index.ts+++ b/js/src/bus/index.ts@@ -52,7 +52,6 @@ export namespace Bus {};log.info("publishing", {type: def.type,- ...properties,});for (const key of [def.type, "*"]) {const match = state().subscriptions.get(key);diff --git a/js/src/index.ts b/js/src/index.tsindex ab00d522bf7..67f6393c2e5 100644--- a/js/src/index.ts+++ b/js/src/index.ts@@ -5,7 +5,6 @@ import path from "path";import { Bus } from "./bus";import { Session } from "./session/session";import cac from "cac";-import { Storage } from "./storage/storage";import { Share } from "./share/share";const cli = cac("opencode");@@ -24,11 +23,11 @@ cli.command("generate", "Generate OpenAPI and event specs").action(async () => {await fs.mkdir(dir, { recursive: true });await Bun.write(path.join(dir, "openapi.json"),- JSON.stringify(specs, null, 2)+ JSON.stringify(specs, null, 2),);await Bun.write(path.join(dir, "event.json"),- JSON.stringify(Bus.specs(), null, 2)+ JSON.stringify(Bus.specs(), null, 2),);});@@ -58,7 +57,7 @@ clipart.toolInvocation.args,part.toolInvocation.state === "result"? part.toolInvocation.result- : ""+ : "",);}}diff --git a/js/src/session/session.ts b/js/src/session/session.tsindex 418fc1909f5..0a21c4b56c0 100644--- a/js/src/session/session.ts+++ b/js/src/session/session.ts@@ -88,8 +88,8 @@ export namespace Session {if (session.shareID) return session.shareID;const shareID = await Share.create(id);if (!shareID) return;- await update(id, () => {- session.shareID = shareID;+ await update(id, (draft) => {+ draft.shareID = shareID;});return shareID as string;}@@ -179,8 +179,8 @@ export namespace Session {]),model,}).then((result) => {- return Session.update(sessionID, (session) => {- session.title = result.text;+ return Session.update(sessionID, (draft) => {+ draft.title = result.text;});});await write(system);@@ -293,10 +293,10 @@ export namespace Session {session.tokens.input += usage.inputTokens || 0;session.tokens.output += usage.outputTokens || 0;session.tokens.reasoning += usage.reasoningTokens || 0;- await update(sessionID, (session) => {- session.tokens.input += usage.inputTokens || 0;- session.tokens.output += usage.outputTokens || 0;- session.tokens.reasoning += usage.reasoningTokens || 0;+ await update(sessionID, (draft) => {+ draft.tokens.input += usage.inputTokens || 0;+ draft.tokens.output += usage.outputTokens || 0;+ draft.tokens.reasoning += usage.reasoningTokens || 0;});return next;}