Skip to content

Commit a326d8d

Browse files
committed
Merge remote-tracking branch 'upstream/dev' into feat/dynamic-console-toggle-text
2 parents b9d4376 + 4b4d8da commit a326d8d

File tree

100 files changed

+13341
-2052
lines changed

Some content is hidden

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

100 files changed

+13341
-2052
lines changed

.github/workflows/format.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
uses: actions/checkout@v4
1919
with:
2020
token: ${{ secrets.GITHUB_TOKEN }}
21+
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
22+
ref: ${{ github.event.pull_request.head.ref || github.ref_name }}
2123

2224
- name: Setup Bun
2325
uses: ./.github/actions/setup-bun
@@ -27,5 +29,4 @@ jobs:
2729
./script/format.ts
2830
env:
2931
CI: true
30-
GITHUB_HEAD_REF: ${{ github.head_ref }}
31-
GITHUB_REF_NAME: ${{ github.ref_name }}
32+
PUSH_BRANCH: ${{ github.event.pull_request.head.ref || github.ref_name }}

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.

nix/hashes.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"nodeModules": "sha256-8IMwm1sOebE9hCc/IJRsXgp6SFokWOIjBXFJ8CgNXIg="
2+
"nodeModules": "sha256-7ItLfqYrXzC6LO2iXZ8m+ZfQH1D7NWtcAcgRMO5NXZI="
33
}

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/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
</script>
2424
<noscript>You need to enable JavaScript to run this app.</noscript>
2525
<div id="root"></div>
26-
<script src="/src/index.tsx" type="module"></script>
26+
<script src="/src/entry.tsx" type="module"></script>
2727
</body>
2828
</html>

packages/desktop/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "",
55
"type": "module",
66
"exports": {
7-
".": "./src/index.tsx",
7+
".": "./src/index.ts",
88
"./vite": "./vite.js"
99
},
1010
"scripts": {
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import "@/index.css"
2+
import { Router, Route, Navigate } from "@solidjs/router"
3+
import { MetaProvider } from "@solidjs/meta"
4+
import { Font } from "@opencode-ai/ui/font"
5+
import { Favicon } from "@opencode-ai/ui/favicon"
6+
import { MarkedProvider } from "@opencode-ai/ui/context/marked"
7+
import { DiffComponentProvider } from "@opencode-ai/ui/context/diff"
8+
import { Diff } from "@opencode-ai/ui/diff"
9+
import { GlobalSyncProvider, useGlobalSync } from "./context/global-sync"
10+
import Layout from "@/pages/layout"
11+
import DirectoryLayout from "@/pages/directory-layout"
12+
import Session from "@/pages/session"
13+
import { LayoutProvider } from "./context/layout"
14+
import { GlobalSDKProvider } from "./context/global-sdk"
15+
import { SessionProvider } from "./context/session"
16+
import { base64Encode } from "./utils"
17+
import { createMemo, Show } from "solid-js"
18+
19+
const host = import.meta.env.VITE_OPENCODE_SERVER_HOST ?? "127.0.0.1"
20+
const port = import.meta.env.VITE_OPENCODE_SERVER_PORT ?? "4096"
21+
22+
const url =
23+
new URLSearchParams(document.location.search).get("url") ||
24+
(location.hostname.includes("opencode.ai") || location.hostname.includes("localhost")
25+
? `http://${host}:${port}`
26+
: "/")
27+
28+
export function DesktopInterface() {
29+
return (
30+
<MarkedProvider>
31+
<DiffComponentProvider component={Diff}>
32+
<GlobalSDKProvider url={url}>
33+
<GlobalSyncProvider>
34+
<LayoutProvider>
35+
<MetaProvider>
36+
<Font />
37+
<Router root={Layout}>
38+
<Route
39+
path="/"
40+
component={() => {
41+
const globalSync = useGlobalSync()
42+
const slug = createMemo(() => base64Encode(globalSync.data.defaultProject!.worktree))
43+
return <Navigate href={`${slug()}/session`} />
44+
}}
45+
/>
46+
<Route path="/:dir" component={DirectoryLayout}>
47+
<Route path="/" component={() => <Navigate href="session" />} />
48+
<Route
49+
path="/session/:id?"
50+
component={(p) => (
51+
<Show when={p.params.id || true} keyed>
52+
<SessionProvider>
53+
<Session />
54+
</SessionProvider>
55+
</Show>
56+
)}
57+
/>
58+
</Route>
59+
</Router>
60+
</MetaProvider>
61+
</LayoutProvider>
62+
</GlobalSyncProvider>
63+
</GlobalSDKProvider>
64+
</DiffComponentProvider>
65+
</MarkedProvider>
66+
)
67+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { createContext } from "solid-js"
2+
import { useContext } from "solid-js"
3+
4+
export interface Platform {}
5+
6+
const PlatformContext = createContext<Platform>()
7+
8+
export const PlatformProvider = PlatformContext.Provider
9+
10+
export function usePlatform() {
11+
const ctx = useContext(PlatformContext)
12+
if (!ctx) throw new Error("usePlatform must be used within a PlatformProvider")
13+
return ctx
14+
}

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
})

0 commit comments

Comments
 (0)