Skip to content

Commit 81bf880

Browse files
committed
Merge branch 'fix/copilot-models-fire-and-forget' of github.com:eastwood/opencode into fix/copilot-models-fire-and-forget
2 parents 769f2c0 + 822860b commit 81bf880

File tree

95 files changed

+63433
-1513
lines changed

Some content is hidden

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

95 files changed

+63433
-1513
lines changed

bun.lock

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

nix/hashes.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"nodeModules": {
3-
"x86_64-linux": "sha256-85wpU1oCWbthPleNIOj5d5AOuuYZ6rM7gMLZR6YJ2WU=",
4-
"aarch64-linux": "sha256-C3A56SDQGJquCpIRj2JhIzr4A7N4cc9lxtEjl8bXDeM=",
5-
"aarch64-darwin": "sha256-/Ij3qhGRrcLlMfl9uEacDNnGK5URxhctuQFBW4Njrog=",
6-
"x86_64-darwin": "sha256-10sOPuN4eZ75orw4FI8ztCq1+AKS2e8aAfg3Z6Yn56w="
3+
"x86_64-linux": "sha256-285KZ7rZLRoc6XqCZRHc25NE+mmpGh/BVeMpv8aPQtQ=",
4+
"aarch64-linux": "sha256-qIwmY4TP4CI7R7G6A5OMYRrorVNXjkg25tTtVpIHm2o=",
5+
"aarch64-darwin": "sha256-RwvnZQhdYZ0u7h7evyfxuPLHHX9eO/jXTAxIFc8B+IE=",
6+
"x86_64-darwin": "sha256-vVj40al+TEeMpbe5XG2GmJEpN+eQAvtr9W0T98l5PBE="
77
}
88
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@
7171
"@solidjs/router": "0.15.4",
7272
"@solidjs/start": "https://pkg.pr.new/@solidjs/start@dfb2020",
7373
"solid-js": "1.9.10",
74-
"vite-plugin-solid": "2.11.10"
74+
"vite-plugin-solid": "2.11.10",
75+
"@lydell/node-pty": "1.2.0-beta.10"
7576
}
7677
},
7778
"devDependencies": {

packages/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opencode-ai/app",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"description": "",
55
"type": "module",
66
"exports": {

packages/app/src/components/terminal.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ export const Terminal = (props: TerminalProps) => {
174174
const auth = server.current?.http
175175
const username = auth?.username ?? "opencode"
176176
const password = auth?.password ?? ""
177+
const sameOrigin = new URL(url, location.href).origin === location.origin
177178
let container!: HTMLDivElement
178179
const [local, others] = splitProps(props, ["pty", "class", "classList", "autoFocus", "onConnect", "onConnectError"])
179180
const id = local.pty.id
@@ -519,8 +520,12 @@ export const Terminal = (props: TerminalProps) => {
519520
next.searchParams.set("directory", directory)
520521
next.searchParams.set("cursor", String(seek))
521522
next.protocol = next.protocol === "https:" ? "wss:" : "ws:"
522-
next.username = username
523-
next.password = password
523+
if (!sameOrigin && password) {
524+
next.searchParams.set("auth_token", btoa(`${username}:${password}`))
525+
// For same-origin requests, let the browser reuse the page's existing auth.
526+
next.username = username
527+
next.password = password
528+
}
524529

525530
const socket = new WebSocket(next)
526531
socket.binaryType = "arraybuffer"

packages/app/src/context/global-sync/event-reducer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import type {
1414
import type { State, VcsCache } from "./types"
1515
import { trimSessions } from "./session-trim"
1616
import { dropSessionCaches } from "./session-cache"
17+
import { diffs as list, message as clean } from "@/utils/diffs"
1718

1819
const SKIP_PARTS = new Set(["patch", "step-start", "step-finish"])
1920

@@ -162,7 +163,7 @@ export function applyDirectoryEvent(input: {
162163
}
163164
case "session.diff": {
164165
const props = event.properties as { sessionID: string; diff: SnapshotFileDiff[] }
165-
input.setStore("session_diff", props.sessionID, reconcile(props.diff, { key: "file" }))
166+
input.setStore("session_diff", props.sessionID, reconcile(list(props.diff), { key: "file" }))
166167
break
167168
}
168169
case "todo.updated": {
@@ -177,7 +178,7 @@ export function applyDirectoryEvent(input: {
177178
break
178179
}
179180
case "message.updated": {
180-
const info = (event.properties as { info: Message }).info
181+
const info = clean((event.properties as { info: Message }).info)
181182
const messages = input.store.message[info.sessionID]
182183
if (!messages) {
183184
input.setStore("message", info.sessionID, [info])

packages/app/src/context/sync.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { useGlobalSync } from "./global-sync"
1313
import { useSDK } from "./sdk"
1414
import type { Message, Part } from "@opencode-ai/sdk/v2/client"
1515
import { SESSION_CACHE_LIMIT, dropSessionCaches, pickSessionCacheEvictions } from "./global-sync/session-cache"
16+
import { diffs as list, message as clean } from "@/utils/diffs"
1617

1718
const SKIP_PARTS = new Set(["patch", "step-start", "step-finish"])
1819

@@ -300,7 +301,7 @@ export const { use: useSync, provider: SyncProvider } = createSimpleContext({
300301
input.client.session.messages({ sessionID: input.sessionID, limit: input.limit, before: input.before }),
301302
)
302303
const items = (messages.data ?? []).filter((x) => !!x?.info?.id)
303-
const session = items.map((x) => x.info).sort((a, b) => cmp(a.id, b.id))
304+
const session = items.map((x) => clean(x.info)).sort((a, b) => cmp(a.id, b.id))
304305
const part = items.map((message) => ({ id: message.info.id, part: sortParts(message.parts) }))
305306
const cursor = messages.response.headers.get("x-next-cursor") ?? undefined
306307
return {
@@ -509,7 +510,7 @@ export const { use: useSync, provider: SyncProvider } = createSimpleContext({
509510
return runInflight(inflightDiff, key, () =>
510511
retry(() => client.session.diff({ sessionID })).then((diff) => {
511512
if (!tracked(directory, sessionID)) return
512-
setStore("session_diff", sessionID, reconcile(diff.data ?? [], { key: "file" }))
513+
setStore("session_diff", sessionID, reconcile(list(diff.data), { key: "file" }))
513514
}),
514515
)
515516
},

0 commit comments

Comments
 (0)