summaryrefslogtreecommitdiffhomepage
path: root/js/src
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-05-26 21:22:38 -0400
committerDax Raad <[email protected]>2025-05-26 21:22:38 -0400
commitb75456f5ddc4fe5823f5014573923c5fb76625dd (patch)
tree23bdf306aa7eb96a252815208e45edfc011abeb8 /js/src
parenteb69cc39439597db54f1af29617d1a109cba5a6f (diff)
downloadopencode-b75456f5ddc4fe5823f5014573923c5fb76625dd.tar.gz
opencode-b75456f5ddc4fe5823f5014573923c5fb76625dd.zip
Clean up code formatting and remove unused imports for better consistency
🤖 Generated with opencode Co-Authored-By: opencode <[email protected]>
Diffstat (limited to 'js/src')
-rw-r--r--js/src/bus/index.ts1
-rw-r--r--js/src/index.ts7
-rw-r--r--js/src/session/session.ts16
3 files changed, 11 insertions, 13 deletions
diff --git a/js/src/bus/index.ts b/js/src/bus/index.ts
index 0064c0a7e..15d2b1107 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.ts
index ab00d522b..67f6393c2 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 @@ cli
part.toolInvocation.args,
part.toolInvocation.state === "result"
? part.toolInvocation.result
- : ""
+ : "",
);
}
}
diff --git a/js/src/session/session.ts b/js/src/session/session.ts
index 418fc1909..0a21c4b56 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;
}