@klarkxy/dsh-magpie 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +42 -0
- package/README.md +35 -2
- package/cordis.patch.yml +5 -0
- package/docs/README.zh-CN.md +36 -0
- package/icon.svg +17 -0
- package/lib/client.inner.cjs +967 -0
- package/lib/client.inner.cjs.map +1 -0
- package/lib/client.js +976 -0
- package/lib/contracts.d.ts +104 -0
- package/lib/contracts.js +38 -0
- package/lib/contracts.js.map +1 -0
- package/lib/index.d.ts +191 -0
- package/lib/index.js +806 -0
- package/lib/index.js.map +1 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +137 -4
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
//#region src/contracts.d.ts
|
|
2
|
+
declare const PLUGIN_NAME = "@klarkxy/dsh-magpie";
|
|
3
|
+
declare const PLUGIN_VERSION = "0.1.0";
|
|
4
|
+
declare const RPC_CHANNEL = "/dsh-magpie";
|
|
5
|
+
/** Wire endpoint names; the host RPC transport only admits lowercase/dotted names. */
|
|
6
|
+
declare const RPC_ENDPOINTS: {
|
|
7
|
+
readonly status: "status";
|
|
8
|
+
readonly saveConnection: "connection.save";
|
|
9
|
+
readonly test: "test";
|
|
10
|
+
readonly sync: "sync";
|
|
11
|
+
readonly setOptions: "options.set";
|
|
12
|
+
readonly disconnect: "disconnect";
|
|
13
|
+
};
|
|
14
|
+
/** The three llm-pi-ai provider routes, named exactly as `magpie dsh` writes them. */
|
|
15
|
+
declare const ROUTES: {
|
|
16
|
+
readonly completions: "magpie";
|
|
17
|
+
readonly responses: "magpie-responses";
|
|
18
|
+
readonly anthropic: "magpie-anthropic";
|
|
19
|
+
};
|
|
20
|
+
type RouteKind = keyof typeof ROUTES;
|
|
21
|
+
type RouteName = (typeof ROUTES)[RouteKind];
|
|
22
|
+
declare const ROUTE_NAMES: readonly RouteName[];
|
|
23
|
+
/** Settings namespaces this plugin writes through `ctx.settings`. */
|
|
24
|
+
declare const NS_LLM = "llm-pi-ai";
|
|
25
|
+
declare const NS_DEFAULT_MODEL = "agent-default-model";
|
|
26
|
+
declare const NS_WEB_SEARCH = "web-search-deepseek";
|
|
27
|
+
declare const DEFAULT_ADDRESS = "http://127.0.0.1:3425";
|
|
28
|
+
declare const DEFAULT_KEY_REF = "MAGPIE_GATEWAY_KEY";
|
|
29
|
+
/** Placeholder bearer the local magpie accepts on loopback, matching magpie's own agent configs. */
|
|
30
|
+
declare const LOOPBACK_PLACEHOLDER_KEY = "magpie";
|
|
31
|
+
declare const STREAM_IDLE_TIMEOUT_MS = 600000;
|
|
32
|
+
declare const GATEWAY_TIMEOUT_MS = 10000;
|
|
33
|
+
interface MagpieOptions {
|
|
34
|
+
address: string;
|
|
35
|
+
apiKeyEnv: string;
|
|
36
|
+
syncOnStart: boolean;
|
|
37
|
+
defaultModel?: string;
|
|
38
|
+
webSearch: boolean;
|
|
39
|
+
webSearchModel?: string;
|
|
40
|
+
}
|
|
41
|
+
interface GatewayInfo {
|
|
42
|
+
name: string;
|
|
43
|
+
version?: string;
|
|
44
|
+
}
|
|
45
|
+
interface SyncResult {
|
|
46
|
+
at: string;
|
|
47
|
+
/** Models written per route, keyed by route name. */
|
|
48
|
+
routes: Record<string, number>;
|
|
49
|
+
warnings: string[];
|
|
50
|
+
}
|
|
51
|
+
interface StatusError {
|
|
52
|
+
at: string;
|
|
53
|
+
message: string;
|
|
54
|
+
}
|
|
55
|
+
/** One model currently present in one of the three llm-pi-ai routes. */
|
|
56
|
+
interface RouteModel {
|
|
57
|
+
id: string;
|
|
58
|
+
name?: string;
|
|
59
|
+
route: RouteName;
|
|
60
|
+
}
|
|
61
|
+
interface MagpieStatus {
|
|
62
|
+
address: string;
|
|
63
|
+
apiKeyEnv: string;
|
|
64
|
+
keyConfigured: boolean;
|
|
65
|
+
keyWritable: boolean;
|
|
66
|
+
options: Omit<MagpieOptions, 'address' | 'apiKeyEnv'>;
|
|
67
|
+
/** Whether the active profile accepts settings writes. */
|
|
68
|
+
writable: boolean;
|
|
69
|
+
gateway?: GatewayInfo;
|
|
70
|
+
syncing: boolean;
|
|
71
|
+
lastSync?: SyncResult;
|
|
72
|
+
lastError?: StatusError;
|
|
73
|
+
/** Models in the three magpie routes as stored in the active settings. */
|
|
74
|
+
models: RouteModel[];
|
|
75
|
+
}
|
|
76
|
+
interface SaveConnectionInput {
|
|
77
|
+
address?: string;
|
|
78
|
+
apiKey?: string;
|
|
79
|
+
clearKey?: boolean;
|
|
80
|
+
}
|
|
81
|
+
interface SetOptionsInput {
|
|
82
|
+
syncOnStart?: boolean;
|
|
83
|
+
defaultModel?: string | null;
|
|
84
|
+
webSearch?: boolean;
|
|
85
|
+
webSearchModel?: string | null;
|
|
86
|
+
}
|
|
87
|
+
interface TestResult {
|
|
88
|
+
gateway: GatewayInfo;
|
|
89
|
+
models: number;
|
|
90
|
+
}
|
|
91
|
+
type RpcResult<T = unknown> = {
|
|
92
|
+
ok: true;
|
|
93
|
+
value: T;
|
|
94
|
+
} | {
|
|
95
|
+
ok: false;
|
|
96
|
+
error: {
|
|
97
|
+
code: string;
|
|
98
|
+
message: string;
|
|
99
|
+
details?: Record<string, unknown>;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
//#endregion
|
|
103
|
+
export { DEFAULT_ADDRESS, DEFAULT_KEY_REF, GATEWAY_TIMEOUT_MS, GatewayInfo, LOOPBACK_PLACEHOLDER_KEY, MagpieOptions, MagpieStatus, NS_DEFAULT_MODEL, NS_LLM, NS_WEB_SEARCH, PLUGIN_NAME, PLUGIN_VERSION, ROUTES, ROUTE_NAMES, RPC_CHANNEL, RPC_ENDPOINTS, RouteKind, RouteModel, RouteName, RpcResult, STREAM_IDLE_TIMEOUT_MS, SaveConnectionInput, SetOptionsInput, StatusError, SyncResult, TestResult };
|
|
104
|
+
//# sourceMappingURL=contracts.d.ts.map
|
package/lib/contracts.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region src/contracts.ts
|
|
2
|
+
const PLUGIN_NAME = "@klarkxy/dsh-magpie";
|
|
3
|
+
const PLUGIN_VERSION = "0.1.0";
|
|
4
|
+
const RPC_CHANNEL = "/dsh-magpie";
|
|
5
|
+
/** Wire endpoint names; the host RPC transport only admits lowercase/dotted names. */
|
|
6
|
+
const RPC_ENDPOINTS = {
|
|
7
|
+
status: "status",
|
|
8
|
+
saveConnection: "connection.save",
|
|
9
|
+
test: "test",
|
|
10
|
+
sync: "sync",
|
|
11
|
+
setOptions: "options.set",
|
|
12
|
+
disconnect: "disconnect"
|
|
13
|
+
};
|
|
14
|
+
/** The three llm-pi-ai provider routes, named exactly as `magpie dsh` writes them. */
|
|
15
|
+
const ROUTES = {
|
|
16
|
+
completions: "magpie",
|
|
17
|
+
responses: "magpie-responses",
|
|
18
|
+
anthropic: "magpie-anthropic"
|
|
19
|
+
};
|
|
20
|
+
const ROUTE_NAMES = [
|
|
21
|
+
ROUTES.completions,
|
|
22
|
+
ROUTES.responses,
|
|
23
|
+
ROUTES.anthropic
|
|
24
|
+
];
|
|
25
|
+
/** Settings namespaces this plugin writes through `ctx.settings`. */
|
|
26
|
+
const NS_LLM = "llm-pi-ai";
|
|
27
|
+
const NS_DEFAULT_MODEL = "agent-default-model";
|
|
28
|
+
const NS_WEB_SEARCH = "web-search-deepseek";
|
|
29
|
+
const DEFAULT_ADDRESS = "http://127.0.0.1:3425";
|
|
30
|
+
const DEFAULT_KEY_REF = "MAGPIE_GATEWAY_KEY";
|
|
31
|
+
/** Placeholder bearer the local magpie accepts on loopback, matching magpie's own agent configs. */
|
|
32
|
+
const LOOPBACK_PLACEHOLDER_KEY = "magpie";
|
|
33
|
+
const STREAM_IDLE_TIMEOUT_MS = 6e5;
|
|
34
|
+
const GATEWAY_TIMEOUT_MS = 1e4;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { DEFAULT_ADDRESS, DEFAULT_KEY_REF, GATEWAY_TIMEOUT_MS, LOOPBACK_PLACEHOLDER_KEY, NS_DEFAULT_MODEL, NS_LLM, NS_WEB_SEARCH, PLUGIN_NAME, PLUGIN_VERSION, ROUTES, ROUTE_NAMES, RPC_CHANNEL, RPC_ENDPOINTS, STREAM_IDLE_TIMEOUT_MS };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","names":[],"sources":["../src/contracts.ts"],"sourcesContent":["export const PLUGIN_NAME = '@klarkxy/dsh-magpie'\nexport const PLUGIN_VERSION = '0.1.0'\nexport const RPC_CHANNEL = '/dsh-magpie'\n/** Wire endpoint names; the host RPC transport only admits lowercase/dotted names. */\nexport const RPC_ENDPOINTS = {\n status: 'status',\n saveConnection: 'connection.save',\n test: 'test',\n sync: 'sync',\n setOptions: 'options.set',\n disconnect: 'disconnect',\n} as const\n\n/** The three llm-pi-ai provider routes, named exactly as `magpie dsh` writes them. */\nexport const ROUTES = {\n completions: 'magpie',\n responses: 'magpie-responses',\n anthropic: 'magpie-anthropic',\n} as const\nexport type RouteKind = keyof typeof ROUTES\nexport type RouteName = (typeof ROUTES)[RouteKind]\nexport const ROUTE_NAMES: readonly RouteName[] = [ROUTES.completions, ROUTES.responses, ROUTES.anthropic]\n\n/** Settings namespaces this plugin writes through `ctx.settings`. */\nexport const NS_LLM = 'llm-pi-ai'\nexport const NS_DEFAULT_MODEL = 'agent-default-model'\nexport const NS_WEB_SEARCH = 'web-search-deepseek'\n\nexport const DEFAULT_ADDRESS = 'http://127.0.0.1:3425'\nexport const DEFAULT_KEY_REF = 'MAGPIE_GATEWAY_KEY'\n/** Placeholder bearer the local magpie accepts on loopback, matching magpie's own agent configs. */\nexport const LOOPBACK_PLACEHOLDER_KEY = 'magpie'\nexport const STREAM_IDLE_TIMEOUT_MS = 600000\nexport const GATEWAY_TIMEOUT_MS = 10000\n\nexport interface MagpieOptions {\n address: string\n apiKeyEnv: string\n syncOnStart: boolean\n defaultModel?: string\n webSearch: boolean\n webSearchModel?: string\n}\n\nexport interface GatewayInfo {\n name: string\n version?: string\n}\n\nexport interface SyncResult {\n at: string\n /** Models written per route, keyed by route name. */\n routes: Record<string, number>\n warnings: string[]\n}\n\nexport interface StatusError {\n at: string\n message: string\n}\n\n/** One model currently present in one of the three llm-pi-ai routes. */\nexport interface RouteModel {\n id: string\n name?: string\n route: RouteName\n}\n\nexport interface MagpieStatus {\n address: string\n apiKeyEnv: string\n keyConfigured: boolean\n keyWritable: boolean\n options: Omit<MagpieOptions, 'address' | 'apiKeyEnv'>\n /** Whether the active profile accepts settings writes. */\n writable: boolean\n gateway?: GatewayInfo\n syncing: boolean\n lastSync?: SyncResult\n lastError?: StatusError\n /** Models in the three magpie routes as stored in the active settings. */\n models: RouteModel[]\n}\n\nexport interface SaveConnectionInput {\n address?: string\n apiKey?: string\n clearKey?: boolean\n}\n\nexport interface SetOptionsInput {\n syncOnStart?: boolean\n defaultModel?: string | null\n webSearch?: boolean\n webSearchModel?: string | null\n}\n\nexport interface TestResult {\n gateway: GatewayInfo\n models: number\n}\n\nexport type RpcResult<T = unknown> =\n | { ok: true; value: T }\n | { ok: false; error: { code: string; message: string; details?: Record<string, unknown> } }\n"],"mappings":";AAAA,MAAa,cAAc;AAC3B,MAAa,iBAAiB;AAC9B,MAAa,cAAc;;AAE3B,MAAa,gBAAgB;CAC3B,QAAQ;CACR,gBAAgB;CAChB,MAAM;CACN,MAAM;CACN,YAAY;CACZ,YAAY;AACd;;AAGA,MAAa,SAAS;CACpB,aAAa;CACb,WAAW;CACX,WAAW;AACb;AAGA,MAAa,cAAoC;CAAC,OAAO;CAAa,OAAO;CAAW,OAAO;AAAS;;AAGxG,MAAa,SAAS;AACtB,MAAa,mBAAmB;AAChC,MAAa,gBAAgB;AAE7B,MAAa,kBAAkB;AAC/B,MAAa,kBAAkB;;AAE/B,MAAa,2BAA2B;AACxC,MAAa,yBAAyB;AACtC,MAAa,qBAAqB"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { MagpieOptions, MagpieStatus, RouteKind, RouteModel, RouteName, RpcResult, SaveConnectionInput, SetOptionsInput, TestResult } from "./contracts.js";
|
|
2
|
+
import Schema from "@deepseek-ai/schemastery";
|
|
3
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
4
|
+
import { PiAiProviderProfile } from "@deepseek-ai/dsh-llm-pi-ai";
|
|
5
|
+
//#region src/plan.d.ts
|
|
6
|
+
interface SettingsDescriptorLike {
|
|
7
|
+
ns: string;
|
|
8
|
+
value?: unknown;
|
|
9
|
+
base?: unknown;
|
|
10
|
+
user?: unknown;
|
|
11
|
+
revision: number;
|
|
12
|
+
}
|
|
13
|
+
type PlanOp = {
|
|
14
|
+
op: 'set';
|
|
15
|
+
path: string[];
|
|
16
|
+
value: unknown;
|
|
17
|
+
} | {
|
|
18
|
+
op: 'unset';
|
|
19
|
+
path: string[];
|
|
20
|
+
};
|
|
21
|
+
interface NamespacePlan {
|
|
22
|
+
ns: string;
|
|
23
|
+
revision: number;
|
|
24
|
+
ops: PlanOp[];
|
|
25
|
+
}
|
|
26
|
+
interface SyncPlan {
|
|
27
|
+
namespaces: NamespacePlan[];
|
|
28
|
+
warnings: string[];
|
|
29
|
+
}
|
|
30
|
+
interface DesiredSync {
|
|
31
|
+
/** Produced provider profiles; absent keys mean "no such route". */
|
|
32
|
+
routes: Partial<Record<RouteName, unknown>>;
|
|
33
|
+
/** Credential reference shared by the routes and web search. */
|
|
34
|
+
apiKeyEnv: string;
|
|
35
|
+
/** Requested default model id; empty means leave `agent-default-model` alone. */
|
|
36
|
+
defaultModel?: string;
|
|
37
|
+
webSearch: boolean;
|
|
38
|
+
/** Web-search model id; falls back to defaultModel when empty. */
|
|
39
|
+
webSearchModel?: string;
|
|
40
|
+
}
|
|
41
|
+
declare function deepEqual(left: unknown, right: unknown): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Plan the ops writing one gateway state into llm-pi-ai routes, the default
|
|
44
|
+
* model, and web search. Missing namespaces become warnings, not ops.
|
|
45
|
+
*/
|
|
46
|
+
declare function planSync(descriptors: readonly SettingsDescriptorLike[], desired: DesiredSync, root: string): SyncPlan;
|
|
47
|
+
/** Remove the three routes and revert the defaults they may own; the stored credential is kept. */
|
|
48
|
+
declare function planDisconnect(descriptors: readonly SettingsDescriptorLike[], root: string): SyncPlan;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/service.d.ts
|
|
51
|
+
interface CredentialsLike {
|
|
52
|
+
resolve(ref: string): Promise<{
|
|
53
|
+
value: string;
|
|
54
|
+
} | undefined>;
|
|
55
|
+
describe(ref: string): Promise<{
|
|
56
|
+
configured: boolean;
|
|
57
|
+
writable: boolean;
|
|
58
|
+
}>;
|
|
59
|
+
set(ref: string, value: string): Promise<void>;
|
|
60
|
+
unset(ref: string): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
interface MagpieServiceDeps {
|
|
63
|
+
describe(): SettingsDescriptorLike[];
|
|
64
|
+
mutate(ns: string, ops: readonly PlanOp[], expectedRevision?: number): Promise<void>;
|
|
65
|
+
/** Whether the active profile accepts settings writes. */
|
|
66
|
+
writable(): boolean;
|
|
67
|
+
/** The host credential store; absent on hosts that ship none (e.g. headless). */
|
|
68
|
+
credentials(): CredentialsLike | undefined;
|
|
69
|
+
/** Own settings namespace (the profile entry id of this plugin). */
|
|
70
|
+
ownNamespace: string;
|
|
71
|
+
options(): MagpieOptions;
|
|
72
|
+
fetchImpl?: typeof fetch;
|
|
73
|
+
userAgent: string;
|
|
74
|
+
logger?: {
|
|
75
|
+
warn(message: string, ...args: unknown[]): void;
|
|
76
|
+
};
|
|
77
|
+
now?: () => Date;
|
|
78
|
+
}
|
|
79
|
+
declare function createMagpieService(deps: MagpieServiceDeps): {
|
|
80
|
+
status: () => Promise<MagpieStatus>;
|
|
81
|
+
sync: (signal?: AbortSignal) => Promise<MagpieStatus>;
|
|
82
|
+
saveConnection: (input: SaveConnectionInput, signal?: AbortSignal) => Promise<MagpieStatus>;
|
|
83
|
+
setOptions: (input: SetOptionsInput, signal?: AbortSignal) => Promise<MagpieStatus>;
|
|
84
|
+
disconnect: (signal?: AbortSignal) => Promise<MagpieStatus>;
|
|
85
|
+
test: (signal?: AbortSignal) => Promise<TestResult>;
|
|
86
|
+
handleRpc: (endpoint: string, payload: unknown, signal: AbortSignal) => Promise<RpcResult>;
|
|
87
|
+
};
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/address.d.ts
|
|
90
|
+
/**
|
|
91
|
+
* Gateway address normalization. The result is the gateway root every
|
|
92
|
+
* endpoint path is appended to, e.g. `http://192.168.1.5:3425`.
|
|
93
|
+
*/
|
|
94
|
+
declare class AddressError extends Error {
|
|
95
|
+
name: string;
|
|
96
|
+
}
|
|
97
|
+
interface GatewayAddress {
|
|
98
|
+
/** Normalized gateway root without a trailing slash or `/v1` suffix. */
|
|
99
|
+
root: string;
|
|
100
|
+
/** Whether the address points at this computer. */
|
|
101
|
+
loopback: boolean;
|
|
102
|
+
}
|
|
103
|
+
declare function isLoopbackHost(hostname: string): boolean;
|
|
104
|
+
/** Normalize user input into a gateway root. Throws {@link AddressError}. */
|
|
105
|
+
declare function normalizeGatewayAddress(input: string): GatewayAddress;
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/mapping.d.ts
|
|
108
|
+
/** One entry of the magpie `/v1/models` reply, fields beyond this shape ignored. */
|
|
109
|
+
interface MagpieModelEntry {
|
|
110
|
+
id?: unknown;
|
|
111
|
+
type?: unknown;
|
|
112
|
+
owned_by?: unknown;
|
|
113
|
+
magpie_label?: unknown;
|
|
114
|
+
display_name?: unknown;
|
|
115
|
+
context_length?: unknown;
|
|
116
|
+
context_window?: unknown;
|
|
117
|
+
max_output_tokens?: unknown;
|
|
118
|
+
modalities?: unknown;
|
|
119
|
+
reasoning_levels?: unknown;
|
|
120
|
+
supported_reasoning_levels?: unknown;
|
|
121
|
+
native_endpoints?: unknown;
|
|
122
|
+
}
|
|
123
|
+
type Protocol = RouteKind;
|
|
124
|
+
/** Text models only: typed non-models and output modality lists without 'text' are skipped. */
|
|
125
|
+
declare function isSelectableModel(entry: MagpieModelEntry): boolean;
|
|
126
|
+
/** Which wire protocol this model prefers, from its declared native endpoints. */
|
|
127
|
+
declare function endpointProtocol(entry: MagpieModelEntry): Protocol | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* Models that declare no native endpoints inherit the unanimous protocol of
|
|
130
|
+
* same-owner models that do declare one; a split owner falls back to
|
|
131
|
+
* completions, matching `magpie dsh`.
|
|
132
|
+
*/
|
|
133
|
+
declare function modelProtocol(entry: MagpieModelEntry, siblings: readonly MagpieModelEntry[]): Protocol;
|
|
134
|
+
/**
|
|
135
|
+
* Build the `llm-pi-ai` providers dict for one gateway listing. Listing order
|
|
136
|
+
* is kept; a duplicated id keeps its first entry; an empty route is omitted.
|
|
137
|
+
*/
|
|
138
|
+
declare function buildRoutes(listing: {
|
|
139
|
+
data?: readonly MagpieModelEntry[];
|
|
140
|
+
} | readonly MagpieModelEntry[], root: string, apiKeyEnv: string): Partial<Record<RouteName, PiAiProviderProfile>>;
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region src/index.d.ts
|
|
143
|
+
declare const name = "@klarkxy/dsh-magpie";
|
|
144
|
+
declare const inject: readonly ["settings", "loader"];
|
|
145
|
+
declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
|
|
146
|
+
/** magpie gateway root; `http://` is assumed and a trailing `/v1` is stripped. */
|
|
147
|
+
address: Schema<string, string, "volatile-defined">;
|
|
148
|
+
/** Credential reference (`env`-style name) holding the gateway key. */
|
|
149
|
+
apiKeyEnv: Schema<string, string, "volatile-defined">;
|
|
150
|
+
/** Run one sync when the profile starts. */
|
|
151
|
+
syncOnStart: Schema<boolean, boolean, "volatile-defined">;
|
|
152
|
+
/** magpie model id promoted to the default model; empty keeps the current one. */
|
|
153
|
+
defaultModel: Schema<string, string, "volatile">;
|
|
154
|
+
/** Route the DeepSeek web-search provider through this gateway. */
|
|
155
|
+
webSearch: Schema<boolean, boolean, "volatile-defined">;
|
|
156
|
+
/** Web-search model; empty uses the default model. */
|
|
157
|
+
webSearchModel: Schema<string, string, "volatile">;
|
|
158
|
+
}>>, Schemastery.ObjectT<NoInfer<{
|
|
159
|
+
/** magpie gateway root; `http://` is assumed and a trailing `/v1` is stripped. */
|
|
160
|
+
address: Schema<string, string, "volatile-defined">;
|
|
161
|
+
/** Credential reference (`env`-style name) holding the gateway key. */
|
|
162
|
+
apiKeyEnv: Schema<string, string, "volatile-defined">;
|
|
163
|
+
/** Run one sync when the profile starts. */
|
|
164
|
+
syncOnStart: Schema<boolean, boolean, "volatile-defined">;
|
|
165
|
+
/** magpie model id promoted to the default model; empty keeps the current one. */
|
|
166
|
+
defaultModel: Schema<string, string, "volatile">;
|
|
167
|
+
/** Route the DeepSeek web-search provider through this gateway. */
|
|
168
|
+
webSearch: Schema<boolean, boolean, "volatile-defined">;
|
|
169
|
+
/** Web-search model; empty uses the default model. */
|
|
170
|
+
webSearchModel: Schema<string, string, "volatile">;
|
|
171
|
+
}>>, "plain">;
|
|
172
|
+
type Cell<T> = {
|
|
173
|
+
get(): T;
|
|
174
|
+
} | T;
|
|
175
|
+
interface ResolvedConfig {
|
|
176
|
+
address: Cell<string>;
|
|
177
|
+
apiKeyEnv: Cell<string>;
|
|
178
|
+
syncOnStart: Cell<boolean>;
|
|
179
|
+
defaultModel: Cell<string | undefined>;
|
|
180
|
+
webSearch: Cell<boolean>;
|
|
181
|
+
webSearchModel: Cell<string | undefined>;
|
|
182
|
+
}
|
|
183
|
+
declare module '@deepseek-ai/cordis' {
|
|
184
|
+
interface Context {
|
|
185
|
+
magpie: ReturnType<typeof createMagpieService>;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
declare function apply(ctx: Context, config: ResolvedConfig): void;
|
|
189
|
+
//#endregion
|
|
190
|
+
export { AddressError, Config, type MagpieOptions, type MagpieStatus, type RouteModel, type RpcResult, type TestResult, apply, buildRoutes, createMagpieService, deepEqual, endpointProtocol, inject, isLoopbackHost, isSelectableModel, modelProtocol, name, normalizeGatewayAddress, planDisconnect, planSync };
|
|
191
|
+
//# sourceMappingURL=index.d.ts.map
|