@byok-sdk/keys 0.3.10 → 0.4.1
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/dist/bin/pi-provider-launcher.js +124 -6
- package/dist/bin/pi-provider-launcher.js.map +1 -1
- package/dist/errors.d.ts +4 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +126 -7
- package/dist/index.js.map +1 -1
- package/dist/provider-catalog.d.ts +73 -0
- package/dist/provider-profile.d.ts +32 -4
- package/dist/sqlite-profile-store.d.ts +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { ModelProviderAdapter, ProviderAuthMode } from './provider-profile';
|
|
2
|
+
/**
|
|
3
|
+
* One vendor the SDK can address without the consumer typing its endpoint.
|
|
4
|
+
*
|
|
5
|
+
* Ported from the provider catalog deepseek-harness resolves its routes from:
|
|
6
|
+
* pi-ai 0.84.2 `dist/providers/*.js` (the version the SDK's pinned
|
|
7
|
+
* `@earendil-works/pi-coding-agent` 0.84.2 resolves) plus the harness's own
|
|
8
|
+
* `packages/llm/llm-deepseek/src/index.ts` `PUBLIC_BASE_URL`, which agrees
|
|
9
|
+
* with pi-ai's `deepseek` entry. Selection and the URL mapping rule are
|
|
10
|
+
* recorded in `docs/researches/2026-09-06_deepseek-harness-provider-catalog-port.md`.
|
|
11
|
+
*
|
|
12
|
+
* Every field is declared configuration a consumer may copy into a
|
|
13
|
+
* `ModelProviderProfile`; nothing here is read at request time, and a
|
|
14
|
+
* profile still carries its own `base_url` so a self-hosted gateway for a
|
|
15
|
+
* vendor stays expressible. `api_key_env` is the credential name the vendor's
|
|
16
|
+
* own tooling reads; this package never reads it, and `@byok-sdk/client`'s
|
|
17
|
+
* credential deny list must contain every value listed here.
|
|
18
|
+
*/
|
|
19
|
+
export interface ModelProviderVendor {
|
|
20
|
+
readonly display_name: string;
|
|
21
|
+
/**
|
|
22
|
+
* Endpoint base in this package's suffix convention: an
|
|
23
|
+
* `openai_compatible` client appends `chat/completions`, an `anthropic`
|
|
24
|
+
* client appends `messages`. pi-ai's anthropic-dialect entries therefore
|
|
25
|
+
* gain a `/v1` segment here; its OpenAI-dialect entries are verbatim.
|
|
26
|
+
*/
|
|
27
|
+
readonly base_url: string;
|
|
28
|
+
readonly adapter: ModelProviderAdapter;
|
|
29
|
+
readonly auth_mode: Exclude<ProviderAuthMode, 'none'>;
|
|
30
|
+
readonly api_key_env: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Vendor id → declared endpoint facts. Ids are pi-ai's provider ids so a
|
|
34
|
+
* profile's `provider_kind` names the same route deepseek-harness would.
|
|
35
|
+
* Ordered by dialect, then alphabetically; order carries no meaning.
|
|
36
|
+
*/
|
|
37
|
+
export declare const MODEL_PROVIDER_VENDORS: {
|
|
38
|
+
readonly 'ant-ling': ModelProviderVendor;
|
|
39
|
+
readonly baseten: ModelProviderVendor;
|
|
40
|
+
readonly cerebras: ModelProviderVendor;
|
|
41
|
+
readonly deepseek: ModelProviderVendor;
|
|
42
|
+
readonly groq: ModelProviderVendor;
|
|
43
|
+
readonly huggingface: ModelProviderVendor;
|
|
44
|
+
readonly moonshotai: ModelProviderVendor;
|
|
45
|
+
readonly 'moonshotai-cn': ModelProviderVendor;
|
|
46
|
+
readonly nvidia: ModelProviderVendor;
|
|
47
|
+
readonly openai: ModelProviderVendor;
|
|
48
|
+
readonly openrouter: ModelProviderVendor;
|
|
49
|
+
readonly 'qwen-token-plan': ModelProviderVendor;
|
|
50
|
+
readonly 'qwen-token-plan-cn': ModelProviderVendor;
|
|
51
|
+
readonly together: ModelProviderVendor;
|
|
52
|
+
readonly xai: ModelProviderVendor;
|
|
53
|
+
readonly xiaomi: ModelProviderVendor;
|
|
54
|
+
readonly 'xiaomi-token-plan-ams': ModelProviderVendor;
|
|
55
|
+
readonly 'xiaomi-token-plan-cn': ModelProviderVendor;
|
|
56
|
+
readonly 'xiaomi-token-plan-sgp': ModelProviderVendor;
|
|
57
|
+
readonly zai: ModelProviderVendor;
|
|
58
|
+
readonly 'zai-coding-cn': ModelProviderVendor;
|
|
59
|
+
readonly anthropic: ModelProviderVendor;
|
|
60
|
+
readonly fireworks: ModelProviderVendor;
|
|
61
|
+
readonly 'kimi-coding': ModelProviderVendor;
|
|
62
|
+
readonly minimax: ModelProviderVendor;
|
|
63
|
+
readonly 'minimax-cn': ModelProviderVendor;
|
|
64
|
+
readonly 'vercel-ai-gateway': ModelProviderVendor;
|
|
65
|
+
};
|
|
66
|
+
export type ModelProviderVendorId = keyof typeof MODEL_PROVIDER_VENDORS;
|
|
67
|
+
/** Catalog vendor ids; `MODEL_PROVIDER_KINDS` is this list plus `custom`. */
|
|
68
|
+
export declare const MODEL_PROVIDER_VENDOR_IDS: readonly ModelProviderVendorId[];
|
|
69
|
+
/**
|
|
70
|
+
* The catalog entry for a provider kind, or `undefined` for `custom`, which
|
|
71
|
+
* by definition declares everything itself.
|
|
72
|
+
*/
|
|
73
|
+
export declare function modelProviderVendor(kind: string): ModelProviderVendor | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { type ModelProviderVendorId } from './provider-catalog';
|
|
2
3
|
/**
|
|
3
4
|
* Opaque, portable identity of one locally configured provider profile.
|
|
4
5
|
*
|
|
@@ -23,11 +24,14 @@ export type ProviderProfileRef = z.infer<typeof ProviderProfileRefSchema>;
|
|
|
23
24
|
* Provider kinds this package knows how to address — the surviving half of the
|
|
24
25
|
* former `MODEL_PROVIDER_IDS`. A kind says *what dialect family and vendor
|
|
25
26
|
* shape* a profile is; {@link ProviderProfileRefSchema} says *which* profile.
|
|
26
|
-
*
|
|
27
|
-
* (`LOCAL_MODEL_PROVIDER_IDS`)
|
|
27
|
+
* Originally ported from `aip-main-open@c6a5385` `providers.ts:30-36`
|
|
28
|
+
* (`LOCAL_MODEL_PROVIDER_IDS`); the list is now derived: every id in
|
|
29
|
+
* {@link MODEL_PROVIDER_VENDORS}, plus `custom` for an endpoint the catalog
|
|
30
|
+
* does not name. `provider-catalog.ts` is the single authority, and
|
|
31
|
+
* `sqlite-profile-store.ts` generates its CHECK constraint from this list.
|
|
28
32
|
*/
|
|
29
|
-
export
|
|
30
|
-
export
|
|
33
|
+
export type ModelProviderKind = ModelProviderVendorId | 'custom';
|
|
34
|
+
export declare const MODEL_PROVIDER_KINDS: readonly [ModelProviderKind, ...ModelProviderKind[]];
|
|
31
35
|
/**
|
|
32
36
|
* Bounded model capabilities a profile may declare. A capability is explicit
|
|
33
37
|
* local configuration, never inferred from the model name or the base URL.
|
|
@@ -76,10 +80,34 @@ export declare const ModelProviderProfileSchema: z.ZodObject<{
|
|
|
76
80
|
model: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
77
81
|
profile_ref: z.ZodString;
|
|
78
82
|
provider_kind: z.ZodEnum<{
|
|
83
|
+
"ant-ling": "ant-ling";
|
|
79
84
|
anthropic: "anthropic";
|
|
85
|
+
baseten: "baseten";
|
|
86
|
+
cerebras: "cerebras";
|
|
80
87
|
custom: "custom";
|
|
81
88
|
deepseek: "deepseek";
|
|
89
|
+
fireworks: "fireworks";
|
|
90
|
+
groq: "groq";
|
|
91
|
+
huggingface: "huggingface";
|
|
92
|
+
"kimi-coding": "kimi-coding";
|
|
93
|
+
minimax: "minimax";
|
|
94
|
+
"minimax-cn": "minimax-cn";
|
|
95
|
+
moonshotai: "moonshotai";
|
|
96
|
+
"moonshotai-cn": "moonshotai-cn";
|
|
97
|
+
nvidia: "nvidia";
|
|
82
98
|
openai: "openai";
|
|
99
|
+
openrouter: "openrouter";
|
|
100
|
+
"qwen-token-plan": "qwen-token-plan";
|
|
101
|
+
"qwen-token-plan-cn": "qwen-token-plan-cn";
|
|
102
|
+
together: "together";
|
|
103
|
+
"vercel-ai-gateway": "vercel-ai-gateway";
|
|
104
|
+
xai: "xai";
|
|
105
|
+
xiaomi: "xiaomi";
|
|
106
|
+
"xiaomi-token-plan-ams": "xiaomi-token-plan-ams";
|
|
107
|
+
"xiaomi-token-plan-cn": "xiaomi-token-plan-cn";
|
|
108
|
+
"xiaomi-token-plan-sgp": "xiaomi-token-plan-sgp";
|
|
109
|
+
zai: "zai";
|
|
110
|
+
"zai-coding-cn": "zai-coding-cn";
|
|
83
111
|
}>;
|
|
84
112
|
updated_at: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
85
113
|
}, z.core.$strip>;
|
|
@@ -34,4 +34,4 @@ export declare class SqliteProviderProfileStore implements ProviderProfileStore
|
|
|
34
34
|
setEnabled(profileRef: ProviderProfileRef): Promise<ModelProviderProfile>;
|
|
35
35
|
}
|
|
36
36
|
/** Exported for the store's own tests to enumerate the CHECK-constrained kinds. */
|
|
37
|
-
export declare const SQLITE_PROFILE_PROVIDER_KINDS: readonly ["
|
|
37
|
+
export declare const SQLITE_PROFILE_PROVIDER_KINDS: readonly [import("./provider-profile").ModelProviderKind, ...import("./provider-profile").ModelProviderKind[]];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byok-sdk/keys",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "BYOK SDK key management: provider profiles, credential-backed auth headers, and direct provider transports",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"clean": "rm -rf dist"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@byok-sdk/core": "0.
|
|
51
|
+
"@byok-sdk/core": "0.15.0",
|
|
52
52
|
"zod": "^4.4.3"
|
|
53
53
|
}
|
|
54
54
|
}
|