dsh-keys-manager 0.2.1 → 0.2.3
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/CHANGELOG.md +97 -0
- package/README.md +108 -15
- package/README.zh-CN.md +80 -2
- package/bundle/cordis.patch.yml +5 -2
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/types.d.ts +27 -2
- package/lib/client/ui.d.ts +14 -0
- package/lib/client.js +445 -18
- package/lib/domain.d.ts +63 -0
- package/lib/host-types.d.ts +29 -0
- package/lib/index.d.ts +973 -45
- package/lib/index.js +4257 -332
- package/lib/index.js.map +1 -1
- package/lib/providers.js +426 -0
- package/lib/providers.js.map +1 -1
- package/lib/store.js +4 -0
- package/lib/store.js.map +1 -1
- package/locale/en.json +27 -1
- package/locale/zh.json +27 -1
- package/package.json +14 -12
- package/scripts/prepare-release.mjs +431 -154
- package/scripts/verify-install.mjs +156 -0
package/lib/domain.d.ts
CHANGED
|
@@ -94,6 +94,13 @@ export interface ProviderRecord {
|
|
|
94
94
|
brokerRef: string;
|
|
95
95
|
/** The profile's reference before adoption, restored on release. */
|
|
96
96
|
originalApiKeyEnv: string | null;
|
|
97
|
+
/**
|
|
98
|
+
* Adoption found a foreign projection serving the route, so it could not
|
|
99
|
+
* complete its one-time takeover of `originalApiKeyEnv` (PR review round 40).
|
|
100
|
+
* The debt survives a restart and is settled by the next projection-change
|
|
101
|
+
* sync; it never authorises an ordinary repair.
|
|
102
|
+
*/
|
|
103
|
+
takeoverPending?: boolean;
|
|
97
104
|
/** True when the profile itself was created by adding an extra provider. */
|
|
98
105
|
createdProfile: boolean;
|
|
99
106
|
/** True when a profile existed before adoption. */
|
|
@@ -163,6 +170,8 @@ export interface ProviderView {
|
|
|
163
170
|
* is account-adoptable while carrying no key-pool credential.
|
|
164
171
|
*/
|
|
165
172
|
accountSupported?: boolean;
|
|
173
|
+
/** True when another plugin serves this route on its own credential (not the pi-ai key pool). */
|
|
174
|
+
transport?: boolean;
|
|
166
175
|
reason?: string;
|
|
167
176
|
settingsNs: string;
|
|
168
177
|
settingsPath: string[];
|
|
@@ -185,6 +194,36 @@ export interface ProviderView {
|
|
|
185
194
|
status: ProviderStatus;
|
|
186
195
|
keys: KeyView[];
|
|
187
196
|
warning?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Requests this route served before its ownership read decided which
|
|
199
|
+
* account serves it (`I-000120`, D8). Process-local and additive: an older
|
|
200
|
+
* snapshot without the field still renders, and zero keeps it absent.
|
|
201
|
+
*/
|
|
202
|
+
unattributedRequests?: number;
|
|
203
|
+
}
|
|
204
|
+
/** Health state a transport account row renders. */
|
|
205
|
+
export type TransportAccountStatus = 'active' | 'expired' | 'needs-reauth' | 'signed-out';
|
|
206
|
+
/**
|
|
207
|
+
* One `llm-omp-transports/<route>` account held beside the pi-ai pool.
|
|
208
|
+
*
|
|
209
|
+
* A transport route keeps exactly one grant record, so a row is either that
|
|
210
|
+
* record's secret-free view or the route's signed-out placeholder. It never
|
|
211
|
+
* carries the grant payload itself, and it is never part of a pi-ai
|
|
212
|
+
* projection: the transports package's own adapter resolves the record.
|
|
213
|
+
*/
|
|
214
|
+
export interface TransportAccountView {
|
|
215
|
+
/** Provider route the grant serves, e.g. 'cursor'. */
|
|
216
|
+
id: string;
|
|
217
|
+
/** The credential record holding the grant, e.g. 'llm-omp-transports/cursor'. */
|
|
218
|
+
scope: string;
|
|
219
|
+
displayName: string;
|
|
220
|
+
email?: string;
|
|
221
|
+
accountId?: string;
|
|
222
|
+
/** Epoch ms when the access token expires. */
|
|
223
|
+
expiresAt?: number;
|
|
224
|
+
status: TransportAccountStatus;
|
|
225
|
+
/** Derived from {@link status}: true only while it is `'active'`. */
|
|
226
|
+
active: boolean;
|
|
188
227
|
}
|
|
189
228
|
/** Complete manager snapshot the UI renders. */
|
|
190
229
|
export interface StateView {
|
|
@@ -199,6 +238,22 @@ export interface StateView {
|
|
|
199
238
|
pausedKeyCount: number;
|
|
200
239
|
bindingsCount: number;
|
|
201
240
|
warnings: string[];
|
|
241
|
+
/**
|
|
242
|
+
* Transport accounts managed beside the pi-ai pool. Additive and optional,
|
|
243
|
+
* so a snapshot from a build without transport support still renders.
|
|
244
|
+
*/
|
|
245
|
+
transportAccounts?: TransportAccountView[];
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Outcome of one per-row connection test: one minimal request through the
|
|
249
|
+
* provider route, with no health or selection side effects.
|
|
250
|
+
*/
|
|
251
|
+
export interface KeyTestResult {
|
|
252
|
+
ok: boolean;
|
|
253
|
+
/** Wall-clock time of the request that was actually sent. */
|
|
254
|
+
latencyMs: number;
|
|
255
|
+
/** Provider failure message, timeout, or the reason no request was sent. */
|
|
256
|
+
error?: string;
|
|
202
257
|
}
|
|
203
258
|
/** One curated extra built-in provider. */
|
|
204
259
|
export interface ExtraProvider {
|
|
@@ -207,6 +262,14 @@ export interface ExtraProvider {
|
|
|
207
262
|
api: string;
|
|
208
263
|
baseURL: string;
|
|
209
264
|
env: string[];
|
|
265
|
+
/**
|
|
266
|
+
* Static request headers this route needs. Maps header name → environment
|
|
267
|
+
* variable name; each value is resolved from the environment at add time.
|
|
268
|
+
* Only non-secret metadata headers are supported: values are persisted as
|
|
269
|
+
* plain profile settings, so a credential-bearing name (`authorization`,
|
|
270
|
+
* `proxy-authorization`, `cookie`, `x-api-key`, `*-api-key`) is refused.
|
|
271
|
+
*/
|
|
272
|
+
headerEnv?: Record<string, string>;
|
|
210
273
|
models: ModelRecord[];
|
|
211
274
|
}
|
|
212
275
|
/** Serializable notice captured on an interactive sign-in attempt. */
|
package/lib/host-types.d.ts
CHANGED
|
@@ -46,6 +46,18 @@ export interface LlmRuntimeLike {
|
|
|
46
46
|
name: string;
|
|
47
47
|
}>;
|
|
48
48
|
discoverModels(settingsNs: string, request: DiscoveryRequest, signal: AbortSignal): Promise<DiscoveredModel[]>;
|
|
49
|
+
/**
|
|
50
|
+
* One model request through the provider route. The host runs the
|
|
51
|
+
* `llm/stream` waterfall, so the manager's own stream listener — and the
|
|
52
|
+
* broker credential wrapper — observe it exactly like a chat request.
|
|
53
|
+
*/
|
|
54
|
+
stream(options: {
|
|
55
|
+
provider: string;
|
|
56
|
+
model: string;
|
|
57
|
+
messages: readonly unknown[];
|
|
58
|
+
maxTokens?: number;
|
|
59
|
+
signal?: AbortSignal;
|
|
60
|
+
}): AsyncIterable<StreamChunkLike>;
|
|
49
61
|
}
|
|
50
62
|
/** Credential value/source facts returned by the credential seam. */
|
|
51
63
|
export interface CredentialHit {
|
|
@@ -126,6 +138,23 @@ export interface CredentialRecordsLike {
|
|
|
126
138
|
modifyRecord(key: string, mutate: (current: CredentialRecordLike | undefined) => Promise<CredentialRecordLike | undefined>): Promise<CredentialRecordLike | undefined>;
|
|
127
139
|
deleteRecord(key: string): Promise<void>;
|
|
128
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* The grant payload the llm-omp transports package writes at
|
|
143
|
+
* `llm-omp-transports/<route>`. Keys Manager only reads it (list/status) and
|
|
144
|
+
* deletes the whole record; the payload stays owned by its writer, so this is
|
|
145
|
+
* a structural shape (the package exports no runtime type for it without
|
|
146
|
+
* pulling its transport code in).
|
|
147
|
+
*/
|
|
148
|
+
export interface TransportGrantLike {
|
|
149
|
+
/** Bearer token the route's adapter sends. */
|
|
150
|
+
access: string;
|
|
151
|
+
/** Refresh token; absent on a grant that cannot be renewed. */
|
|
152
|
+
refresh?: string;
|
|
153
|
+
/** Epoch ms when the access token expires. */
|
|
154
|
+
expires: number;
|
|
155
|
+
email?: string;
|
|
156
|
+
accountId?: string;
|
|
157
|
+
}
|
|
129
158
|
/** One path-addressed settings edit. */
|
|
130
159
|
export type SettingsPathOp = {
|
|
131
160
|
op: 'set';
|