dsh-keys-manager 0.4.2 → 0.4.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 +12 -0
- package/README.md +4 -4
- package/lib/client/types.d.ts +1 -1
- package/lib/client.js +49 -8
- package/lib/domain.d.ts +12 -0
- package/lib/index.d.ts +12 -1
- package/lib/index.js +54 -3
- package/lib/index.js.map +1 -1
- package/locale/en.json +1 -0
- package/locale/zh.json +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to dsh-keys-manager are documented here. Assembled from `.changes/unreleased/` fragments by the release-prep workflow.
|
|
4
4
|
|
|
5
|
+
## [0.4.3] - 2026-11-19
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- `pnpm run build` now builds every `packages/*` component first, so a root-only build can no longer leave a stale `dsh-llm-omp-transports` artifact in place while the root looks current — a transport route kept serving the previous version's sign-in methods and model catalog.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Devin now lists the account's own models instead of a single seed row: a signed-in route discovers them through `GetCliModelConfigs` (cached five minutes, seed kept when the read fails).
|
|
14
|
+
- Devin sign-in offers a second method that imports the seat key the official Devin CLI already stores, so a machine already signed in with `devin auth login` needs no browser.
|
|
15
|
+
- The Devin account row renders one sign-in button per method the transport flow declares, and the model picker refreshes an account-scoped catalog before it renders.
|
|
16
|
+
|
|
5
17
|
## [0.4.2] - 2026-11-18
|
|
6
18
|
|
|
7
19
|
### Changed
|
package/README.md
CHANGED
|
@@ -134,7 +134,7 @@ Providers the vendored pi-ai cannot speak are served by the companion
|
|
|
134
134
|
| Route | Sign-in | Refresh | Model rows |
|
|
135
135
|
|---|---|---|---|
|
|
136
136
|
| `cursor` | browser page + poll | on the credential seam | 123 |
|
|
137
|
-
| `devin` | paste the landed callback URL | none — sign in again |
|
|
137
|
+
| `devin` | paste the landed callback URL, or import the Devin CLI seat key | none — sign in again | 1 seed, then the account's roster |
|
|
138
138
|
| `google-gemini-cli` | loopback `8085` + paste fallback | on the credential seam | 7 |
|
|
139
139
|
| `google-antigravity` | loopback `51121` + paste fallback | on the credential seam | 22 |
|
|
140
140
|
| `factory-droid` | WorkOS device code (URL + user code) | one refresh in a 60 s window, keeps `orgId`/`region` | 77 |
|
|
@@ -147,9 +147,9 @@ Providers the vendored pi-ai cannot speak are served by the companion
|
|
|
147
147
|
- **Cursor** — streams text and reasoning and hands tool calls to DSH's tool
|
|
148
148
|
loop; images are refused with a typed error. The client presents Cursor's
|
|
149
149
|
vendor-internal OAuth identity.
|
|
150
|
-
- **Devin** — no refresh
|
|
151
|
-
(JWT `exp` minus five minutes, else one year)
|
|
152
|
-
|
|
150
|
+
- **Devin** — no refresh. The browser sign-in derives an expiry from the token
|
|
151
|
+
(JWT `exp` minus five minutes, else one year); the CLI import's seat key has
|
|
152
|
+
none, so that row is a static bearer with a blank countdown column.
|
|
153
153
|
- **Google routes** — both share one generated `lib/omp/google.mjs` artifact yet
|
|
154
154
|
keep separate grants, account rows and catalogs. The grant is
|
|
155
155
|
`{access, refresh, expires, projectId, email?}`; sign-in resolves the Cloud
|
package/lib/client/types.d.ts
CHANGED
|
@@ -117,7 +117,7 @@ export interface ClientStore {
|
|
|
117
117
|
* Start the `llm-omp-transports/<route>` sign-in; resolves with the attempt
|
|
118
118
|
* view, which the login dialog polls through {@link accountAttempt}.
|
|
119
119
|
*/
|
|
120
|
-
beginTransportLogin(route: string): Promise<AccountAttemptResult>;
|
|
120
|
+
beginTransportLogin(route: string, method?: string): Promise<AccountAttemptResult>;
|
|
121
121
|
/** Re-read one transport route's stored grant (activation writes nothing). */
|
|
122
122
|
activateTransportAccount(route: string): Promise<ActionOutcome>;
|
|
123
123
|
/** Delete one transport route's grant record. */
|
package/lib/client.js
CHANGED
|
@@ -214,6 +214,7 @@ var zh = {
|
|
|
214
214
|
transportProviderHint: "\u8BE5\u8DEF\u7531\u7531\u4F20\u8F93\u63D2\u4EF6\u63D0\u4F9B\uFF0C\u51ED\u8BC1\u5C31\u5728\u672C\u5361\u7247\u4E2D\u7BA1\u7406\u3002",
|
|
215
215
|
transportTag: "\u4F20\u8F93",
|
|
216
216
|
transportSignIn: "\u767B\u5F55",
|
|
217
|
+
transportMethodCliImport: "\u4ECE Devin CLI \u5BFC\u5165",
|
|
217
218
|
transportExpires: "\u6709\u6548\u671F\u81F3 {time}",
|
|
218
219
|
transportStatusActive: "\u6B63\u5E38",
|
|
219
220
|
transportStatusExpired: "\u8FC7\u671F\uFF08\u5C06\u81EA\u52A8\u7EED\u671F\uFF09",
|
|
@@ -418,6 +419,7 @@ var en = {
|
|
|
418
419
|
transportProviderHint: "Served by a transport plugin: its credential is managed inside this card.",
|
|
419
420
|
transportTag: "Transport",
|
|
420
421
|
transportSignIn: "Sign in",
|
|
422
|
+
transportMethodCliImport: "Import from Devin CLI",
|
|
421
423
|
transportExpires: "Expires {time}",
|
|
422
424
|
transportStatusActive: "Active",
|
|
423
425
|
transportStatusExpired: "Expired (auto-renews)",
|
|
@@ -965,8 +967,8 @@ function createStore(ctx, options = {}) {
|
|
|
965
967
|
return { ok: false, error: messageOf(error) };
|
|
966
968
|
}
|
|
967
969
|
},
|
|
968
|
-
beginTransportLogin(route) {
|
|
969
|
-
return send("beginTransportLogin", { provider: route }, attemptOutcome);
|
|
970
|
+
beginTransportLogin(route, method) {
|
|
971
|
+
return send("beginTransportLogin", method === void 0 ? { provider: route } : { provider: route, method }, attemptOutcome);
|
|
970
972
|
},
|
|
971
973
|
activateTransportAccount(route) {
|
|
972
974
|
return send("activateTransportAccount", { provider: route }, stateOutcome);
|
|
@@ -1807,6 +1809,9 @@ function AccountRow({ provider, keyRecord, now, onReauthenticate, quotaRejected
|
|
|
1807
1809
|
}, h("p", { className: "km-modal-copy" }, t(provider.supported === true ? "deleteAccountBody" : "deleteAccountBodyNoKeys"))) : null
|
|
1808
1810
|
);
|
|
1809
1811
|
}
|
|
1812
|
+
function transportMethodLabel(method, t) {
|
|
1813
|
+
return method.id === "devin-cli" ? t("transportMethodCliImport") : method.label;
|
|
1814
|
+
}
|
|
1810
1815
|
function TransportAccountRow({ account, now }) {
|
|
1811
1816
|
const runtime = useRuntime();
|
|
1812
1817
|
const t = useT();
|
|
@@ -1816,10 +1821,10 @@ function TransportAccountRow({ account, now }) {
|
|
|
1816
1821
|
const [confirm, setConfirm] = import_react2.default.useState(false);
|
|
1817
1822
|
const [login, setLogin] = import_react2.default.useState(null);
|
|
1818
1823
|
const [quotaRejected, setQuotaRejected] = import_react2.default.useState(false);
|
|
1819
|
-
async function signIn() {
|
|
1824
|
+
async function signIn(method) {
|
|
1820
1825
|
setBusy(true);
|
|
1821
1826
|
setError(null);
|
|
1822
|
-
const result = await runtime.store.beginTransportLogin(account.id);
|
|
1827
|
+
const result = await runtime.store.beginTransportLogin(account.id, method);
|
|
1823
1828
|
setBusy(false);
|
|
1824
1829
|
if (!result.ok) {
|
|
1825
1830
|
setError(result.error);
|
|
@@ -1837,6 +1842,7 @@ function TransportAccountRow({ account, now }) {
|
|
|
1837
1842
|
}
|
|
1838
1843
|
const identity = account.email ?? account.accountId ?? account.displayName;
|
|
1839
1844
|
const tone = transportStatusTone(account.status);
|
|
1845
|
+
const [primary, ...rest] = account.methods ?? [];
|
|
1840
1846
|
return h(
|
|
1841
1847
|
"div",
|
|
1842
1848
|
{ className: "km-account-row km-transport-row" },
|
|
@@ -1886,17 +1892,40 @@ function TransportAccountRow({ account, now }) {
|
|
|
1886
1892
|
h(
|
|
1887
1893
|
"div",
|
|
1888
1894
|
{ className: "km-key-actions" },
|
|
1889
|
-
h(
|
|
1895
|
+
...primary === void 0 ? [h(
|
|
1890
1896
|
Button,
|
|
1891
1897
|
{
|
|
1898
|
+
key: "sign-in",
|
|
1892
1899
|
size: "small",
|
|
1893
1900
|
disabled: busy,
|
|
1894
|
-
onClick: signIn,
|
|
1901
|
+
onClick: () => void signIn(void 0),
|
|
1895
1902
|
title: account.active ? t("accountReauth") : t("transportSignIn")
|
|
1896
1903
|
},
|
|
1897
1904
|
busy ? h(Icon, { name: "refresh", size: 14, className: "km-spin" }) : h(Icon, { name: "refresh", size: 14 }),
|
|
1898
1905
|
t(account.active ? "accountReauth" : "transportSignIn")
|
|
1899
|
-
)
|
|
1906
|
+
)] : [
|
|
1907
|
+
h(
|
|
1908
|
+
Button,
|
|
1909
|
+
{
|
|
1910
|
+
key: primary.id,
|
|
1911
|
+
size: "small",
|
|
1912
|
+
disabled: busy,
|
|
1913
|
+
onClick: () => void signIn(primary.id),
|
|
1914
|
+
// Same localizer as the sibling methods: the flow's label is
|
|
1915
|
+
// English, and this is the control's accessible name.
|
|
1916
|
+
title: transportMethodLabel(primary, t)
|
|
1917
|
+
},
|
|
1918
|
+
busy ? h(Icon, { name: "refresh", size: 14, className: "km-spin" }) : h(Icon, { name: "refresh", size: 14 }),
|
|
1919
|
+
t(account.active ? "accountReauth" : "transportSignIn")
|
|
1920
|
+
),
|
|
1921
|
+
...rest.map((method) => h(Button, {
|
|
1922
|
+
key: method.id,
|
|
1923
|
+
size: "small",
|
|
1924
|
+
disabled: busy,
|
|
1925
|
+
onClick: () => void signIn(method.id),
|
|
1926
|
+
title: transportMethodLabel(method, t)
|
|
1927
|
+
}, transportMethodLabel(method, t)))
|
|
1928
|
+
],
|
|
1900
1929
|
// No "Set active" entry: activation would write nothing (the stored grant
|
|
1901
1930
|
// already IS the route's live credential), so the host endpoint stays for
|
|
1902
1931
|
// API symmetry with the account surface and the row omits a no-effect
|
|
@@ -1925,6 +1954,10 @@ function TransportAccountRow({ account, now }) {
|
|
|
1925
1954
|
}) : null
|
|
1926
1955
|
);
|
|
1927
1956
|
}
|
|
1957
|
+
function transportSignInKey(account) {
|
|
1958
|
+
if (account === void 0) return "signed-out";
|
|
1959
|
+
return `${account.status}:${account.accountId ?? account.email ?? account.scope}`;
|
|
1960
|
+
}
|
|
1928
1961
|
function TransportModels({ route }) {
|
|
1929
1962
|
const runtime = useRuntime();
|
|
1930
1963
|
const t = useT();
|
|
@@ -2243,7 +2276,15 @@ function ProviderCard({ provider, expanded, onToggle, now, transportAccount }) {
|
|
|
2243
2276
|
"div",
|
|
2244
2277
|
{ className: "km-transport-body" },
|
|
2245
2278
|
transportAccount !== void 0 ? h("div", { className: "km-keys" }, h(TransportAccountRow, { account: transportAccount, now })) : h("div", { className: "km-muted" }, t("transportProviderHint")),
|
|
2246
|
-
|
|
2279
|
+
// The roster is credential-scoped, so a catalog read before a
|
|
2280
|
+
// sign-in — or by the previous account — must not survive it. Keying
|
|
2281
|
+
// the picker to the sign-in state remounts it on any change, which
|
|
2282
|
+
// drops the stale list and its draft and makes the next open read
|
|
2283
|
+
// again instead of pinning the signed-out seed as the allow-list.
|
|
2284
|
+
h(TransportModels, {
|
|
2285
|
+
key: `models:${provider.provider}:${transportSignInKey(transportAccount)}`,
|
|
2286
|
+
route: provider.provider
|
|
2287
|
+
})
|
|
2247
2288
|
) : !managed ? h(
|
|
2248
2289
|
"div",
|
|
2249
2290
|
{ className: "km-adopt" },
|
package/lib/domain.d.ts
CHANGED
|
@@ -256,6 +256,18 @@ export interface TransportAccountView {
|
|
|
256
256
|
status: TransportAccountStatus;
|
|
257
257
|
/** Derived from {@link status}: true only while it is `'active'`. */
|
|
258
258
|
active: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* The sign-in methods the route's own flow declares, in its order.
|
|
261
|
+
*
|
|
262
|
+
* A route can offer more than one way in (Devin: a browser sign-in, or
|
|
263
|
+
* importing the credential the Devin CLI already stores), and the flow — not
|
|
264
|
+
* this plugin — owns that list, so the row carries it for the row's buttons.
|
|
265
|
+
* Absent when the host could not enumerate the flow.
|
|
266
|
+
*/
|
|
267
|
+
methods?: {
|
|
268
|
+
id: string;
|
|
269
|
+
label: string;
|
|
270
|
+
}[];
|
|
259
271
|
/** Latest cached plan usage; absent until a quota refresh ran for this route. */
|
|
260
272
|
quota?: QuotaView;
|
|
261
273
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -757,7 +757,7 @@ export declare class KeysManagerService {
|
|
|
757
757
|
* polls through `accountAttempt`, so the client reuses that dialog; an
|
|
758
758
|
* authorized outcome is terminal here (the flow has already committed).
|
|
759
759
|
*/
|
|
760
|
-
beginTransportLogin(route: string): Promise<AccountAttemptView>;
|
|
760
|
+
beginTransportLogin(route: string, method?: string): Promise<AccountAttemptView>;
|
|
761
761
|
/**
|
|
762
762
|
* Remote: confirm one transport route's stored grant.
|
|
763
763
|
*
|
|
@@ -793,6 +793,17 @@ export declare class KeysManagerService {
|
|
|
793
793
|
* per route.
|
|
794
794
|
*/
|
|
795
795
|
private reportMissingCatalog;
|
|
796
|
+
/**
|
|
797
|
+
* Ask a transport route to refresh its account-scoped catalog.
|
|
798
|
+
*
|
|
799
|
+
* The transports package owns the read (the grant, the RPC, the codec), so
|
|
800
|
+
* this only probes its export and hands over the credential seam. Never
|
|
801
|
+
* throws: a model picker with a stale catalog is better than one that fails
|
|
802
|
+
* to open, and the next open retries.
|
|
803
|
+
*
|
|
804
|
+
* @param route - the transport route id.
|
|
805
|
+
*/
|
|
806
|
+
private refreshTransportCatalog;
|
|
796
807
|
/**
|
|
797
808
|
* Remote: read one transport route's catalog and configured allow-list.
|
|
798
809
|
*
|
package/lib/index.js
CHANGED
|
@@ -268,7 +268,7 @@ const INVOCATIONS = [
|
|
|
268
268
|
// Transport accounts (llm-omp-transports/<route>): managed beside the pi-ai
|
|
269
269
|
// pool, never through it. The sign-in reuses the same attempt machinery and
|
|
270
270
|
// is polled through `accountAttempt` above.
|
|
271
|
-
endpoint('beginTransportLogin', ['provider']),
|
|
271
|
+
endpoint('beginTransportLogin', ['provider', 'method']),
|
|
272
272
|
endpoint('activateTransportAccount', ['provider']),
|
|
273
273
|
endpoint('removeTransportAccount', ['provider']),
|
|
274
274
|
// The transport card's model picker: the catalog lives in the transports
|
|
@@ -594,6 +594,7 @@ function transportAccountOf(flow, record, now) {
|
|
|
594
594
|
id: route,
|
|
595
595
|
scope: flow.key,
|
|
596
596
|
displayName: flow.label,
|
|
597
|
+
methods: flow.methods.map(method => ({ id: method.id, label: method.label })),
|
|
597
598
|
...(grant?.email === undefined ? {} : { email: grant.email }),
|
|
598
599
|
...(grant?.accountId === undefined ? {} : { accountId: grant.accountId }),
|
|
599
600
|
...(grant?.expires === undefined ? {} : { expiresAt: grant.expires }),
|
|
@@ -622,6 +623,17 @@ const DEVIN_ROUTE = 'devin';
|
|
|
622
623
|
* added after the installed build, including the Google pair, `factory-droid`
|
|
623
624
|
* and the GitLab pair), so a probe can legitimately find nothing.
|
|
624
625
|
*/
|
|
626
|
+
/**
|
|
627
|
+
* The catalog *refresh* accessor a transport route may ship.
|
|
628
|
+
*
|
|
629
|
+
* Devin's roster is credential-scoped, so its committed table only carries the
|
|
630
|
+
* seed and the real one has to be read from the account. A route listed here has
|
|
631
|
+
* its catalog refreshed before the picker reads it; an installed build without
|
|
632
|
+
* the export is served its committed table, which is what every other route has.
|
|
633
|
+
*/
|
|
634
|
+
const TRANSPORT_CATALOG_REFRESH = Object.freeze({
|
|
635
|
+
[DEVIN_ROUTE]: 'ensureDevinCatalog',
|
|
636
|
+
});
|
|
625
637
|
const TRANSPORT_CATALOG_EXPORTS = Object.freeze({
|
|
626
638
|
[DEVIN_ROUTE]: 'devinCatalogModels',
|
|
627
639
|
'google-gemini-cli': 'googleGeminiCliCatalogModels',
|
|
@@ -2302,12 +2314,17 @@ export class KeysManagerService {
|
|
|
2302
2314
|
* polls through `accountAttempt`, so the client reuses that dialog; an
|
|
2303
2315
|
* authorized outcome is terminal here (the flow has already committed).
|
|
2304
2316
|
*/
|
|
2305
|
-
async beginTransportLogin(route) {
|
|
2317
|
+
async beginTransportLogin(route, method) {
|
|
2306
2318
|
if (typeof route !== 'string' || route.length === 0)
|
|
2307
2319
|
throw new TypeError('provider is required');
|
|
2308
2320
|
const flow = this.transportFlowFor(route);
|
|
2309
2321
|
if (flow === undefined)
|
|
2310
2322
|
throw new Error(`Provider "${route}" offers no transport sign-in flow`);
|
|
2323
|
+
// The flow owns its method ids; a caller may pick one, and an unknown id is
|
|
2324
|
+
// refused instead of silently falling back to the first.
|
|
2325
|
+
const methodId = method === undefined ? transportMethodOf(flow) : flow.methods.find(entry => entry.id === method)?.id;
|
|
2326
|
+
if (methodId === undefined)
|
|
2327
|
+
throw new Error(`Provider "${route}" offers no sign-in method "${String(method)}"`);
|
|
2311
2328
|
const pendingId = this.transportInFlight.get(route);
|
|
2312
2329
|
if (pendingId !== undefined) {
|
|
2313
2330
|
const pendingAttempt = this.loginAttempts.get(pendingId);
|
|
@@ -2335,7 +2352,7 @@ export class KeysManagerService {
|
|
|
2335
2352
|
// method; the method id is the flow's own, not the pi-ai `'oauth'` literal.
|
|
2336
2353
|
const settled = this.ctx.authorization.begin({
|
|
2337
2354
|
key: flow.key,
|
|
2338
|
-
method:
|
|
2355
|
+
method: methodId,
|
|
2339
2356
|
interaction: this.attemptInteraction(attempt),
|
|
2340
2357
|
signal: attempt.controller.signal,
|
|
2341
2358
|
}).then(async (outcome) => {
|
|
@@ -2445,6 +2462,36 @@ export class KeysManagerService {
|
|
|
2445
2462
|
this.catalogReports.add(route);
|
|
2446
2463
|
this.pushWarning(`The installed dsh-llm-omp-transports build registers "${route}" but ships no catalog for it; the model list stays empty until the transport package is rebuilt or upgraded`);
|
|
2447
2464
|
}
|
|
2465
|
+
/**
|
|
2466
|
+
* Ask a transport route to refresh its account-scoped catalog.
|
|
2467
|
+
*
|
|
2468
|
+
* The transports package owns the read (the grant, the RPC, the codec), so
|
|
2469
|
+
* this only probes its export and hands over the credential seam. Never
|
|
2470
|
+
* throws: a model picker with a stale catalog is better than one that fails
|
|
2471
|
+
* to open, and the next open retries.
|
|
2472
|
+
*
|
|
2473
|
+
* @param route - the transport route id.
|
|
2474
|
+
*/
|
|
2475
|
+
async refreshTransportCatalog(route) {
|
|
2476
|
+
const exportName = Object.hasOwn(TRANSPORT_CATALOG_REFRESH, route) ? TRANSPORT_CATALOG_REFRESH[route] : undefined;
|
|
2477
|
+
if (exportName === undefined)
|
|
2478
|
+
return;
|
|
2479
|
+
const probe = transportModule[exportName];
|
|
2480
|
+
const records = this.credentialRecords();
|
|
2481
|
+
if (typeof probe !== 'function' || records === undefined)
|
|
2482
|
+
return;
|
|
2483
|
+
try {
|
|
2484
|
+
// The RPC is slow by design (a full account catalog takes seconds), so a
|
|
2485
|
+
// bounded wait keeps the picker responsive; the package's own cache keeps
|
|
2486
|
+
// a later read from starting over.
|
|
2487
|
+
await probe(records, {
|
|
2488
|
+
signal: AbortSignal.timeout(20_000),
|
|
2489
|
+
});
|
|
2490
|
+
}
|
|
2491
|
+
catch (error) {
|
|
2492
|
+
this.warn(`transport catalog refresh for ${route} failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2448
2495
|
/**
|
|
2449
2496
|
* Remote: read one transport route's catalog and configured allow-list.
|
|
2450
2497
|
*
|
|
@@ -2456,6 +2503,10 @@ export class KeysManagerService {
|
|
|
2456
2503
|
*/
|
|
2457
2504
|
async transportModels(route) {
|
|
2458
2505
|
this.assertTransportRoute(route);
|
|
2506
|
+
// A credential-scoped catalog is read from the account before the picker
|
|
2507
|
+
// renders; a failure keeps the committed table (the row still lists what
|
|
2508
|
+
// the route can serve without the discovery answer).
|
|
2509
|
+
await this.refreshTransportCatalog(route);
|
|
2459
2510
|
const configured = this.transportModelIds(route);
|
|
2460
2511
|
let missingCatalog = false;
|
|
2461
2512
|
const catalog = transportCatalogOf(route, missing => {
|