refactor(core): move database schema ownership (#29068)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
Dax
2026-05-30 21:08:38 -04:00
committed by GitHub
parent 6bcb9cb9bb
commit 7f571d36ea
390 changed files with 11127 additions and 9164 deletions

View File

@@ -1,10 +1,11 @@
import { test, expect, describe } from "bun:test"
import { SessionLegacy } from "@opencode-ai/core/session/legacy"
import { extractResponseText, formatPromptTooLargeError } from "../../src/cli/cmd/github"
import type { MessageV2 } from "../../src/session/message-v2"
import { SessionID, MessageID, PartID } from "../../src/session/schema"
// Helper to create minimal valid parts
function createTextPart(text: string): MessageV2.Part {
function createTextPart(text: string): SessionLegacy.Part {
return {
id: PartID.ascending(),
sessionID: SessionID.make("ses_test"),
@@ -14,7 +15,7 @@ function createTextPart(text: string): MessageV2.Part {
}
}
function createReasoningPart(text: string): MessageV2.Part {
function createReasoningPart(text: string): SessionLegacy.Part {
return {
id: PartID.ascending(),
sessionID: SessionID.make("ses_test"),
@@ -25,7 +26,7 @@ function createReasoningPart(text: string): MessageV2.Part {
}
}
function createToolPart(tool: string, title: string, status: "completed" | "running" = "completed"): MessageV2.Part {
function createToolPart(tool: string, title: string, status: "completed" | "running" = "completed"): SessionLegacy.Part {
if (status === "completed") {
return {
id: PartID.ascending(),
@@ -59,7 +60,7 @@ function createToolPart(tool: string, title: string, status: "completed" | "runn
}
}
function createStepStartPart(): MessageV2.Part {
function createStepStartPart(): SessionLegacy.Part {
return {
id: PartID.ascending(),
sessionID: SessionID.make("ses_test"),
@@ -68,7 +69,7 @@ function createStepStartPart(): MessageV2.Part {
}
}
function createStepFinishPart(): MessageV2.Part {
function createStepFinishPart(): SessionLegacy.Part {
return {
id: PartID.ascending(),
sessionID: SessionID.make("ses_test"),

View File

@@ -398,7 +398,6 @@ database tools
Commands:
opencode db [query] open an interactive sqlite3 shell or run a query [default]
opencode db path print the database path
opencode db migrate migrate JSON data to SQLite (merges with existing data)
Positionals:
query SQL query to execute [string]