Download packages/app/src/context/sdk.tsx from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 728 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/app/src/context/sdk.tsx
- Command line
-
hf download hf://SaylorTwift/opencode/packages/app/src/context/sdk.tsx
-
curl -L -o sdk.tsx https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/app/src/context/sdk.tsx
728 Bytes
| 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) | |
| }) | |
| }, | |
| }) | |