Compare commits

..

1 Commits

Author SHA1 Message Date
Dax Raad 95d5a4a562 refactor(core): decouple session version 2026-07-21 14:08:06 -04:00
3 changed files with 1 additions and 23 deletions
-7
View File
@@ -93,10 +93,8 @@ const GeminiToolConfig = Schema.Struct({
const GeminiThinkingConfig = Schema.Struct({
thinkingBudget: Schema.optional(Schema.Number),
thinkingLevel: Schema.optional(Schema.Literals(["minimal", "low", "medium", "high"])),
includeThoughts: Schema.optional(Schema.Boolean),
})
type GeminiThinkingLevel = NonNullable<Schema.Schema.Type<typeof GeminiThinkingConfig>["thinkingLevel"]>
const GeminiGenerationConfig = Schema.Struct({
maxOutputTokens: Schema.optional(Schema.Number),
@@ -291,16 +289,11 @@ const lowerMessages = Effect.fn("Gemini.lowerMessages")(function* (request: LLMR
const geminiOptions = (request: LLMRequest) => request.providerOptions?.gemini
const isThinkingLevel = (value: unknown): value is GeminiThinkingLevel =>
value === "minimal" || value === "low" || value === "medium" || value === "high"
const thinkingConfig = (request: LLMRequest) => {
const value = geminiOptions(request)?.thinkingConfig
if (!ProviderShared.isRecord(value)) return undefined
const thinkingLevel = value.thinkingLevel
const result = {
thinkingBudget: typeof value.thinkingBudget === "number" ? value.thinkingBudget : undefined,
thinkingLevel: isThinkingLevel(thinkingLevel) ? thinkingLevel : undefined,
includeThoughts: typeof value.includeThoughts === "boolean" ? value.includeThoughts : undefined,
}
return Object.values(result).some((item) => item !== undefined) ? result : undefined
-14
View File
@@ -36,20 +36,6 @@ describe("Gemini route", () => {
}),
)
it.effect("prepares thinking level", () =>
Effect.gen(function* () {
const prepared = yield* LLMClient.prepare<Gemini.GeminiBody>(
LLM.request({
model,
prompt: "Say hello.",
providerOptions: { gemini: { thinkingConfig: { thinkingLevel: "minimal" } } },
}),
)
expect(prepared.body.generationConfig).toEqual({ thinkingConfig: { thinkingLevel: "minimal" } })
}),
)
it.effect("lowers chronological system updates to wrapped user text in order", () =>
Effect.gen(function* () {
const prepared = yield* LLMClient.prepare<Gemini.GeminiBody>(
+1 -2
View File
@@ -20,7 +20,6 @@ import { AbsolutePath, PositiveInt, RelativePath } from "./schema"
import { AgentV2 } from "./agent"
import { SessionV1 } from "./v1/session"
import { Money } from "@opencode-ai/schema/money"
import { InstallationVersion } from "@opencode-ai/util/installation/version"
import { Slug } from "./util/slug"
import { ProjectTable } from "./project/sql"
import path from "path"
@@ -352,7 +351,7 @@ const layer = Layer.effect(
const info = SessionV1.SessionInfo.make({
id: sessionID,
slug: Slug.create(),
version: InstallationVersion,
version: "unknown",
projectID: project.id,
parentID: input.parentID,
directory: location.directory,