Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions packages/app/src/context/local.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
const [store, setStore] = createStore<{
current?: string
draft?: State
promoting?: State
last?: {
type: "agent" | "model" | "variant"
agent?: string
Expand Down Expand Up @@ -124,7 +123,7 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({

const scope = createMemo<State | undefined>(() => {
const session = id()
if (!session) return store.draft ?? store.promoting
if (!session) return store.draft
return saved.session[session] ?? handoff.get(handoffKey(serverSDK().scope, sdk().directory, session))
})

Expand All @@ -137,13 +136,11 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
if (!next) return
if (saved.session[session] !== undefined) {
handoff.delete(key)
setStore("promoting", undefined)
return
}

setSaved("session", session, clone(next))
handoff.delete(key)
setStore("promoting", undefined)
})

const configuredModel = () => {
Expand Down Expand Up @@ -377,7 +374,7 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
session: {
ready: savedReady,
reset() {
setStore({ draft: undefined, promoting: undefined })
setStore("draft", undefined)
},
promote(dir: string, session: string, state?: State) {
const next = clone(state ?? snapshot())
Expand All @@ -388,8 +385,6 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
if (dir === sdk().directory) {
setSaved("session", session, next)
}

setStore("promoting", next)
setStore("draft", undefined)
},
restore(msg: { sessionID: string; agent: string; model: ModelKey }) {
Expand Down
Loading