dsh-keys-manager 0.2.4 → 0.2.6

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/lib/index.d.ts CHANGED
@@ -49,7 +49,15 @@ export declare class KeysManagerService {
49
49
  private attemptSequence;
50
50
  private readonly switches;
51
51
  private warnings;
52
+ /** Transport routes already reported as having no shipped catalog. */
53
+ private readonly catalogReports;
52
54
  settings: SettingsLike | undefined;
55
+ /**
56
+ * Test/embedding seam for the in-process sign-in drivers (the same pattern
57
+ * `isolationWaitMs` uses). Production leaves it undefined, so `runSignIn`
58
+ * loads the build artifact lazily on the first attempt.
59
+ */
60
+ private signInAdapter;
53
61
  private rawCredentials;
54
62
  private readonly credentialOriginals;
55
63
  private readonly credentialWrappers;
@@ -659,8 +667,51 @@ export declare class KeysManagerService {
659
667
  * {@link getAccountAttempt} / {@link listAccountAttempts}.
660
668
  */
661
669
  beginAccountLogin(provider: string, alias?: string, targetAccountId?: string): Promise<AccountAttemptView>;
670
+ /**
671
+ * Run one in-process sign-in and commit the static credential it mints.
672
+ *
673
+ * The driver runs outside the mutation queue (design §4.4): it performs
674
+ * provider I/O and parks on prompts, so holding the queue would block every
675
+ * other remote call for minutes. The commit itself re-enters through the
676
+ * public transactional methods, exactly like a remote caller would.
677
+ */
678
+ private driveSignIn;
679
+ /**
680
+ * Turn a minted static credential into pool state.
681
+ *
682
+ * Three shapes, one rule — the credential is a *static* secret, so it is an
683
+ * ordinary `kind: 'api-key'` row with `importedFrom: 'signin:<driver>'`, never
684
+ * a grant:
685
+ *
686
+ * 1. `targetAccountId` → replace that row's literal in place (same id, same
687
+ * ref, same list position).
688
+ * 2. an unmanaged *extra* route → create the route and its first row
689
+ * (`kilo`, whose card is an extra profile).
690
+ * 3. a managed route → append a row (`zai`, a shipped DSH route).
691
+ *
692
+ * The secret passes the same `validateKeyInput` guard `addKey` uses, so an
693
+ * over-long provider token fails as the existing named error.
694
+ */
695
+ private commitSignIn;
696
+ /**
697
+ * Replace a sign-in row's literal in place on re-authentication.
698
+ *
699
+ * Mirrors the recovery half of the grant harvest: the row keeps its id, ref
700
+ * and position, the missing flag a demotion set goes, and a cooldown the OLD
701
+ * credential earned ends with the new one. No row is added and no record is
702
+ * created — the literal is the whole credential.
703
+ */
704
+ private replaceSignInCredential;
662
705
  /** Resolve the attempt's parked prompt with the human's answer. */
663
706
  answerAccountPrompt(attemptId: string, value: string): Promise<void>;
707
+ /**
708
+ * Remote: cancel one interactive attempt.
709
+ *
710
+ * The seam path learns about cancellation from `authorization`; an
711
+ * in-process sign-in has no seam handle, so the login dialog's Cancel calls
712
+ * this. Idempotent: a settled attempt is left alone.
713
+ */
714
+ cancelAccountLogin(attemptId: string): void;
664
715
  /** One attempt's serializable view, or undefined when unknown. */
665
716
  getAccountAttempt(attemptId: string): AccountAttemptView | undefined;
666
717
  /** Remote: poll one attempt's serializable state (T3 dialog channel). */
@@ -718,6 +769,16 @@ export declare class KeysManagerService {
718
769
  removeTransportAccount(route: string): Promise<StateView>;
719
770
  /** The route's removal epoch; absent means never removed. */
720
771
  private transportGenerationOf;
772
+ /**
773
+ * Explain a registered transport flow that has no catalog.
774
+ *
775
+ * An empty list is also the legitimate all-models state, so the only honest
776
+ * way to tell a stale transport build apart is to say so. The message rides
777
+ * every read whose accessor is missing — a once-only gate would leave a
778
+ * remounted or reloaded picker unexplained — while `catalogReports` keeps
779
+ * the state warning to one push per route.
780
+ */
781
+ private reportMissingCatalog;
721
782
  /**
722
783
  * Remote: read one transport route's catalog and configured allow-list.
723
784
  *
@@ -1605,6 +1666,39 @@ export declare class KeysManagerService {
1605
1666
  private createKeyRecord;
1606
1667
  /** Find the first existing key value worth importing. */
1607
1668
  private findImport;
1669
+ /**
1670
+ * The installed catalog's models for one route, normalized for a profile
1671
+ * write, or `undefined` when the seam cannot answer. A `provider`-only
1672
+ * discovery request reads pi-ai's bundled catalog instead of the endpoint,
1673
+ * so materializing a profile for an unconfigured route uses no network and
1674
+ * no credential.
1675
+ */
1676
+ private catalogModelsFor;
1677
+ /**
1678
+ * Write the installed catalog's models into a route's missing profile, or
1679
+ * into one that exists without models. The written profile names no
1680
+ * credential reference and no endpoint: pi-ai falls back to the catalog for
1681
+ * both, and a broker reference here would shadow a stored OAuth grant.
1682
+ *
1683
+ * A profile created while the catalog call was outstanding belongs to the
1684
+ * user, so the write re-reads it and only fills models a working profile
1685
+ * still lacks. `created` distinguishes the node this call created from a
1686
+ * user profile it filled, because rollback may only remove the former.
1687
+ */
1688
+ private materializeCatalogProfile;
1689
+ /**
1690
+ * Repair the profile a row test needs on an already-managed route: a route
1691
+ * adopted before profiles were materialized has none, and a key-pool profile
1692
+ * carried over from Models may lack models.
1693
+ *
1694
+ * Rules: a profile carrying models is never touched; one missing them is
1695
+ * filled; a missing profile is rebuilt only when the record gives no sign of
1696
+ * ever having had one. A pre-fix adoption records neither `hadProfile` nor
1697
+ * `createdProfile`, so a profile the user deletes there cannot be told apart
1698
+ * from a route that never had one — it is rebuilt, and the row test is the
1699
+ * only caller.
1700
+ */
1701
+ private ensureCatalogProfile;
1608
1702
  /** Remote: take over one existing provider route. */
1609
1703
  adoptProvider(provider: string): Promise<StateView>;
1610
1704
  /**
@@ -1638,8 +1732,10 @@ export declare class KeysManagerService {
1638
1732
  * Undo an adoption whose initial binding write was refused (PR review
1639
1733
  * round 2): drop the managed record and its broker entry, delete the
1640
1734
  * plugin-scope copy this call created, and put back a pre-adoption
1641
- * reference that landed despite the refusal. The source credential and the
1642
- * profile's other fields are never touched — adoption only read them.
1735
+ * reference that landed despite the refusal. The source credential is never
1736
+ * touched, and a profile this adoption materialized is removed whole only
1737
+ * while it still holds exactly that materialized node: a user save landing
1738
+ * between the write and the rollback owns the profile, so it keeps it.
1643
1739
  */
1644
1740
  private rollbackAdoption;
1645
1741
  /**
@@ -1658,7 +1754,9 @@ export declare class KeysManagerService {
1658
1754
  * the key that serves it in the same mutation, so the write below is the
1659
1755
  * route's first binding rather than a takeover of a value the user owns.
1660
1756
  */
1661
- addExtraProvider(extraId: string, alias: string, value: string): Promise<StateView>;
1757
+ addExtraProvider(extraId: string, alias: string, value: string,
1758
+ /** Provenance for the first row; `signin:<driver>` for an in-process sign-in. */
1759
+ importedFrom?: string | null): Promise<StateView>;
1662
1760
  /**
1663
1761
  * Restore a managed extra route's declared static headers.
1664
1762
  *
@@ -1679,7 +1777,7 @@ export declare class KeysManagerService {
1679
1777
  /** Add one key; caller already owns the mutation queue. */
1680
1778
  private addKeyLocked;
1681
1779
  /** Remote: add one key to a managed provider. */
1682
- addKey(provider: string, alias: string, value: string): Promise<StateView>;
1780
+ addKey(provider: string, alias: string, value: string, importedFrom?: string | null): Promise<StateView>;
1683
1781
  /** Remote: rename or pause/resume one key. */
1684
1782
  updateKey(provider: string, keyId: string, patch: unknown): Promise<StateView>;
1685
1783
  /** Remote: delete one key, releasing the provider when it was the last one. */