mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-22 02:04:22 +01:00
Clean up code formatting and remove unused imports for better consistency
🤖 Generated with opencode Co-Authored-By: opencode <noreply@opencode.ai>
This commit is contained in:
@@ -52,7 +52,6 @@ export namespace Bus {
|
|||||||
};
|
};
|
||||||
log.info("publishing", {
|
log.info("publishing", {
|
||||||
type: def.type,
|
type: def.type,
|
||||||
...properties,
|
|
||||||
});
|
});
|
||||||
for (const key of [def.type, "*"]) {
|
for (const key of [def.type, "*"]) {
|
||||||
const match = state().subscriptions.get(key);
|
const match = state().subscriptions.get(key);
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import path from "path";
|
|||||||
import { Bus } from "./bus";
|
import { Bus } from "./bus";
|
||||||
import { Session } from "./session/session";
|
import { Session } from "./session/session";
|
||||||
import cac from "cac";
|
import cac from "cac";
|
||||||
import { Storage } from "./storage/storage";
|
|
||||||
import { Share } from "./share/share";
|
import { Share } from "./share/share";
|
||||||
|
|
||||||
const cli = cac("opencode");
|
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 fs.mkdir(dir, { recursive: true });
|
||||||
await Bun.write(
|
await Bun.write(
|
||||||
path.join(dir, "openapi.json"),
|
path.join(dir, "openapi.json"),
|
||||||
JSON.stringify(specs, null, 2)
|
JSON.stringify(specs, null, 2),
|
||||||
);
|
);
|
||||||
await Bun.write(
|
await Bun.write(
|
||||||
path.join(dir, "event.json"),
|
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.args,
|
||||||
part.toolInvocation.state === "result"
|
part.toolInvocation.state === "result"
|
||||||
? part.toolInvocation.result
|
? part.toolInvocation.result
|
||||||
: ""
|
: "",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,8 +88,8 @@ export namespace Session {
|
|||||||
if (session.shareID) return session.shareID;
|
if (session.shareID) return session.shareID;
|
||||||
const shareID = await Share.create(id);
|
const shareID = await Share.create(id);
|
||||||
if (!shareID) return;
|
if (!shareID) return;
|
||||||
await update(id, () => {
|
await update(id, (draft) => {
|
||||||
session.shareID = shareID;
|
draft.shareID = shareID;
|
||||||
});
|
});
|
||||||
return shareID as string;
|
return shareID as string;
|
||||||
}
|
}
|
||||||
@@ -179,8 +179,8 @@ export namespace Session {
|
|||||||
]),
|
]),
|
||||||
model,
|
model,
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
return Session.update(sessionID, (session) => {
|
return Session.update(sessionID, (draft) => {
|
||||||
session.title = result.text;
|
draft.title = result.text;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
await write(system);
|
await write(system);
|
||||||
@@ -293,10 +293,10 @@ export namespace Session {
|
|||||||
session.tokens.input += usage.inputTokens || 0;
|
session.tokens.input += usage.inputTokens || 0;
|
||||||
session.tokens.output += usage.outputTokens || 0;
|
session.tokens.output += usage.outputTokens || 0;
|
||||||
session.tokens.reasoning += usage.reasoningTokens || 0;
|
session.tokens.reasoning += usage.reasoningTokens || 0;
|
||||||
await update(sessionID, (session) => {
|
await update(sessionID, (draft) => {
|
||||||
session.tokens.input += usage.inputTokens || 0;
|
draft.tokens.input += usage.inputTokens || 0;
|
||||||
session.tokens.output += usage.outputTokens || 0;
|
draft.tokens.output += usage.outputTokens || 0;
|
||||||
session.tokens.reasoning += usage.reasoningTokens || 0;
|
draft.tokens.reasoning += usage.reasoningTokens || 0;
|
||||||
});
|
});
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user