/
Alex_Ural
/
opencode
Обзор
Документация
Войти
/
Alex_Ural
/
opencode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
packages/app/src/context/sdk.tsx
17 строк
728 B
Brendan Allan
refactor(app): rename cached context accessors (#33627)
24 июн 2026, 11:55
Не верифицирован
24 июн 2026, 11:55
cacb7d0
Код
Авторство
О чём код?
import { createSimpleContext } from "@opencode-ai/ui/context" import { type Accessor, createMemo } from "solid-js" import { type ServerSDK, useServerSDK } from "./server-sdk" export type DirectorySDK = ReturnType<ServerSDK["ensureDirSdkContext"]> export const { use: useSDK, provider: SDKProvider } = createSimpleContext({ name: "SDK", // Resolves the directory-scoped SDK reactively from the (possibly changing) server. init: (props: { directory: string | Accessor<string> }) => { const serverSDK = useServerSDK() return createMemo(() => { const directory = typeof props.directory === "function" ? props.directory() : props.directory return serverSDK().ensureDirSdkContext(directory) }) }, })