ConusAI vendor v0.1.0-dev.20261027+9b1131fb
ci / gate (push) Waiting to run

This commit is contained in:
ConusAI vendor v0.1.0-dev.20261027+9b1131fb
2026-10-27 18:05:17 +00:00
commit 3102273ec7
538 changed files with 80203 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
"use client"
// How this module's interactive components reach the API: through a transport the app provides
// (apps/web/src/ui/transport.tsx). A module may not import the app, and a server component cannot
// hand a function to a client one, so the seam is a context -- the same one every module with a
// client component declares for itself, until `@conusai-kit/ui/data` is the one shared facade.
import { createContext, type ReactElement, type ReactNode, useContext } from "react"
export type Transport = (procedure: string, input: unknown) => Promise<unknown>
export type DescribeError = (error: unknown) => string
interface Provided {
readonly call: Transport
readonly describe: DescribeError
}
const TransportContext = createContext<Provided | undefined>(undefined)
export function TransportProvider({ call, describe, children }: Provided & { children: ReactNode }): ReactElement {
return <TransportContext.Provider value={{ call, describe }}>{children}</TransportContext.Provider>
}
export function useTransport(): Provided {
const provided = useContext(TransportContext)
if (!provided) throw new Error("branding: wrap the page in a TransportProvider (apps/web/src/ui/transport.tsx)")
return provided
}