Skip to content

Commit ea7ec60

Browse files
thdxractions-user
andauthored
Co-authored-by: GitHub Action <action@github.com>
1 parent 6667856 commit ea7ec60

59 files changed

Lines changed: 11182 additions & 1114 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bun.lock

Lines changed: 40 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"fuzzysort": "3.1.0",
4040
"luxon": "3.6.1",
4141
"typescript": "5.8.2",
42-
"@typescript/native-preview": "7.0.0-dev.20251014.1",
42+
"@typescript/native-preview": "7.0.0-dev.20251207.1",
4343
"zod": "4.1.8",
4444
"remeda": "2.26.0",
4545
"solid-list": "0.3.0",

packages/desktop/src/components/prompt-input.tsx

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
235235

236236
const abort = () =>
237237
sdk.client.session.abort({
238-
path: {
239-
id: session.id!,
240-
},
238+
sessionID: session.id!,
241239
})
242240

243241
const handleKeyDown = (event: KeyboardEvent) => {
@@ -329,21 +327,19 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
329327
session.prompt.set([{ type: "text", content: "", start: 0, end: 0 }], 0)
330328

331329
sdk.client.session.prompt({
332-
path: { id: existing.id },
333-
body: {
334-
agent: local.agent.current()!.name,
335-
model: {
336-
modelID: local.model.current()!.id,
337-
providerID: local.model.current()!.provider.id,
338-
},
339-
parts: [
340-
{
341-
type: "text",
342-
text,
343-
},
344-
...attachmentParts,
345-
],
330+
sessionID: existing.id,
331+
agent: local.agent.current()!.name,
332+
model: {
333+
modelID: local.model.current()!.id,
334+
providerID: local.model.current()!.provider.id,
346335
},
336+
parts: [
337+
{
338+
type: "text",
339+
text,
340+
},
341+
...attachmentParts,
342+
],
347343
})
348344
}
349345

packages/desktop/src/components/terminal.tsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,10 @@ export const Terminal = (props: TerminalProps) => {
7474
term.onResize(async (size) => {
7575
if (ws && ws.readyState === WebSocket.OPEN) {
7676
await sdk.client.pty.update({
77-
path: { id: local.pty.id },
78-
body: {
79-
size: {
80-
cols: size.cols,
81-
rows: size.rows,
82-
},
77+
ptyID: local.pty.id,
78+
size: {
79+
cols: size.cols,
80+
rows: size.rows,
8381
},
8482
})
8583
}
@@ -100,12 +98,10 @@ export const Terminal = (props: TerminalProps) => {
10098
ws.addEventListener("open", () => {
10199
console.log("WebSocket connected")
102100
sdk.client.pty.update({
103-
path: { id: local.pty.id },
104-
body: {
105-
size: {
106-
cols: term.cols,
107-
rows: term.rows,
108-
},
101+
ptyID: local.pty.id,
102+
size: {
103+
cols: term.cols,
104+
rows: term.rows,
109105
},
110106
})
111107
})

packages/desktop/src/context/global-sdk.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createOpencodeClient, type Event } from "@opencode-ai/sdk/client"
1+
import { createOpencodeClient, type Event } from "@opencode-ai/sdk/v2/client"
22
import { createSimpleContext } from "@opencode-ai/ui/context"
33
import { createGlobalEmitter } from "@solid-primitives/event-bus"
44
import { onCleanup } from "solid-js"

packages/desktop/src/context/global-sync.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type {
1212
FileDiff,
1313
Todo,
1414
SessionStatus,
15-
} from "@opencode-ai/sdk"
15+
} from "@opencode-ai/sdk/v2"
1616
import { createStore, produce, reconcile } from "solid-js/store"
1717
import { Binary } from "@opencode-ai/util/binary"
1818
import { createSimpleContext } from "@opencode-ai/ui/context"

packages/desktop/src/context/local.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createStore, produce, reconcile } from "solid-js/store"
22
import { batch, createEffect, createMemo } from "solid-js"
33
import { uniqueBy } from "remeda"
4-
import type { FileContent, FileNode, Model, Provider, File as FileStatus } from "@opencode-ai/sdk"
4+
import type { FileContent, FileNode, Model, Provider, File as FileStatus } from "@opencode-ai/sdk/v2"
55
import { createSimpleContext } from "@opencode-ai/ui/context"
66
import { useSDK } from "./sdk"
77
import { useSync } from "./sync"
@@ -257,7 +257,7 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
257257

258258
const load = async (path: string) => {
259259
const relativePath = relative(path)
260-
sdk.client.file.read({ query: { path: relativePath } }).then((x) => {
260+
sdk.client.file.read({ path: relativePath }).then((x) => {
261261
setStore(
262262
"node",
263263
relativePath,
@@ -305,7 +305,7 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
305305
}
306306

307307
const list = async (path: string) => {
308-
return sdk.client.file.list({ query: { path: path + "/" } }).then((x) => {
308+
return sdk.client.file.list({ path: path + "/" }).then((x) => {
309309
setStore(
310310
"node",
311311
produce((draft) => {
@@ -318,10 +318,9 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
318318
})
319319
}
320320

321-
const searchFiles = (query: string) =>
322-
sdk.client.find.files({ query: { query, dirs: "false" } }).then((x) => x.data!)
321+
const searchFiles = (query: string) => sdk.client.find.files({ query, dirs: "false" }).then((x) => x.data!)
323322
const searchFilesAndDirectories = (query: string) =>
324-
sdk.client.find.files({ query: { query, dirs: "true" } }).then((x) => x.data!)
323+
sdk.client.find.files({ query, dirs: "true" }).then((x) => x.data!)
325324

326325
sdk.event.listen((e) => {
327326
const event = e.details

packages/desktop/src/context/sdk.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createOpencodeClient, type Event } from "@opencode-ai/sdk/client"
1+
import { createOpencodeClient, type Event } from "@opencode-ai/sdk/v2/client"
22
import { createSimpleContext } from "@opencode-ai/ui/context"
33
import { createGlobalEmitter } from "@solid-primitives/event-bus"
44
import { onCleanup } from "solid-js"

packages/desktop/src/context/session.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useSync } from "./sync"
55
import { makePersisted } from "@solid-primitives/storage"
66
import { TextSelection } from "./local"
77
import { pipe, sumBy } from "remeda"
8-
import { AssistantMessage, UserMessage } from "@opencode-ai/sdk"
8+
import { AssistantMessage, UserMessage } from "@opencode-ai/sdk/v2"
99
import { useParams } from "@solidjs/router"
1010
import { base64Encode } from "@/utils"
1111
import { useSDK } from "./sdk"
@@ -198,7 +198,7 @@ export const { use: useSession, provider: SessionProvider } = createSimpleContex
198198
all: createMemo(() => Object.values(store.terminals.all)),
199199
active: createMemo(() => store.terminals.active),
200200
new() {
201-
sdk.client.pty.create({ body: { title: `Terminal ${store.terminals.all.length + 1}` } }).then((pty) => {
201+
sdk.client.pty.create({ title: `Terminal ${store.terminals.all.length + 1}` }).then((pty) => {
202202
const id = pty.data?.id
203203
if (!id) return
204204
setStore("terminals", "all", [
@@ -214,18 +214,17 @@ export const { use: useSession, provider: SessionProvider } = createSimpleContex
214214
update(pty: Partial<LocalPTY> & { id: string }) {
215215
setStore("terminals", "all", (x) => x.map((x) => (x.id === pty.id ? { ...x, ...pty } : x)))
216216
sdk.client.pty.update({
217-
path: { id: pty.id },
218-
body: { title: pty.title, size: pty.cols && pty.rows ? { rows: pty.rows, cols: pty.cols } : undefined },
217+
ptyID: pty.id,
218+
title: pty.title,
219+
size: pty.cols && pty.rows ? { rows: pty.rows, cols: pty.cols } : undefined,
219220
})
220221
},
221222
async clone(id: string) {
222223
const index = store.terminals.all.findIndex((x) => x.id === id)
223224
const pty = store.terminals.all[index]
224225
if (!pty) return
225226
const clone = await sdk.client.pty.create({
226-
body: {
227-
title: pty.title,
228-
},
227+
title: pty.title,
229228
})
230229
if (!clone.data) return
231230
setStore("terminals", "all", index, {
@@ -252,7 +251,7 @@ export const { use: useSession, provider: SessionProvider } = createSimpleContex
252251
setStore("terminals", "active", previous)
253252
}
254253
})
255-
await sdk.client.pty.remove({ path: { id } })
254+
await sdk.client.pty.remove({ ptyID: id })
256255
},
257256
move(id: string, to: number) {
258257
const index = store.terminals.all.findIndex((f) => f.id === id)

packages/desktop/src/context/sync.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const { use: useSync, provider: SyncProvider } = createSimpleContext({
2828
status: () => sdk.client.session.status().then((x) => setStore("session_status", x.data!)),
2929
config: () => sdk.client.config.get().then((x) => setStore("config", x.data!)),
3030
changes: () => sdk.client.file.status().then((x) => setStore("changes", x.data!)),
31-
node: () => sdk.client.file.list({ query: { path: "/" } }).then((x) => setStore("node", x.data!)),
31+
node: () => sdk.client.file.list({ path: "/" }).then((x) => setStore("node", x.data!)),
3232
}
3333

3434
Promise.all(Object.values(load).map((p) => p())).then(() => setStore("ready", true))
@@ -49,10 +49,10 @@ export const { use: useSync, provider: SyncProvider } = createSimpleContext({
4949
},
5050
async sync(sessionID: string, _isRetry = false) {
5151
const [session, messages, todo, diff] = await Promise.all([
52-
sdk.client.session.get({ path: { id: sessionID }, throwOnError: true }),
53-
sdk.client.session.messages({ path: { id: sessionID }, query: { limit: 100 } }),
54-
sdk.client.session.todo({ path: { id: sessionID } }),
55-
sdk.client.session.diff({ path: { id: sessionID } }),
52+
sdk.client.session.get({ sessionID }, { throwOnError: true }),
53+
sdk.client.session.messages({ sessionID, limit: 100 }),
54+
sdk.client.session.todo({ sessionID }),
55+
sdk.client.session.diff({ sessionID }),
5656
])
5757
setStore(
5858
produce((draft) => {

0 commit comments

Comments
 (0)