fix: resolve apiProxy via ctx.get for /model (v0.3.2)
Cordis throws on ctx.apiProxy without inject; use ctx.get and declare apiProxy inject so catalog and model APIs work under dsh web. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
import type { Context } from '@deepseek-ai/cordis';
|
||||
/** Loose ApiProxy surface used by catalog + model helpers. */
|
||||
export type ApiProxySessions = {
|
||||
list?: (req: {
|
||||
rpcId: string;
|
||||
payload: unknown;
|
||||
}) => Promise<unknown>;
|
||||
models?: (req: {
|
||||
rpcId: string;
|
||||
payload: unknown;
|
||||
}) => Promise<unknown>;
|
||||
selectModel?: (req: {
|
||||
rpcId: string;
|
||||
payload: unknown;
|
||||
}) => Promise<unknown>;
|
||||
};
|
||||
export type ApiProxyLike = {
|
||||
workspace?: {
|
||||
list?: (req: {
|
||||
rpcId: string;
|
||||
payload: unknown;
|
||||
}) => Promise<unknown>;
|
||||
};
|
||||
sessions?: ApiProxySessions;
|
||||
};
|
||||
/**
|
||||
* Resolve host apiProxy without requiring Cordis inject.
|
||||
* Direct `ctx.apiProxy` throws "cannot get property without inject" on real fibers.
|
||||
*/
|
||||
export declare function resolveApiProxy(ctx: Context): ApiProxyLike | undefined;
|
||||
Reference in New Issue
Block a user