@routstr/sdk 0.3.7 → 0.3.9

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.
Files changed (39) hide show
  1. package/dist/client/index.d.mts +411 -0
  2. package/dist/client/index.d.ts +411 -0
  3. package/dist/client/index.js +4938 -0
  4. package/dist/client/index.js.map +1 -0
  5. package/dist/client/index.mjs +4932 -0
  6. package/dist/client/index.mjs.map +1 -0
  7. package/dist/discovery/index.d.mts +247 -0
  8. package/dist/discovery/index.d.ts +247 -0
  9. package/dist/discovery/index.js +894 -0
  10. package/dist/discovery/index.js.map +1 -0
  11. package/dist/discovery/index.mjs +891 -0
  12. package/dist/discovery/index.mjs.map +1 -0
  13. package/dist/index.d.mts +195 -0
  14. package/dist/index.d.ts +195 -0
  15. package/dist/index.js +6797 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/index.mjs +6746 -0
  18. package/dist/index.mjs.map +1 -0
  19. package/dist/interfaces-C-DYd9Jy.d.ts +176 -0
  20. package/dist/interfaces-Csn8Uq04.d.mts +176 -0
  21. package/dist/interfaces-Cv1k2EUK.d.mts +118 -0
  22. package/dist/interfaces-iL7CWeG5.d.ts +118 -0
  23. package/dist/storage/index.d.mts +113 -0
  24. package/dist/storage/index.d.ts +113 -0
  25. package/dist/storage/index.js +2019 -0
  26. package/dist/storage/index.js.map +1 -0
  27. package/dist/storage/index.mjs +1995 -0
  28. package/dist/storage/index.mjs.map +1 -0
  29. package/dist/store-58VcEUoA.d.ts +172 -0
  30. package/dist/store-C6dfj1cc.d.mts +172 -0
  31. package/dist/types-_21yYFZG.d.mts +234 -0
  32. package/dist/types-_21yYFZG.d.ts +234 -0
  33. package/dist/wallet/index.d.mts +249 -0
  34. package/dist/wallet/index.d.ts +249 -0
  35. package/dist/wallet/index.js +1383 -0
  36. package/dist/wallet/index.js.map +1 -0
  37. package/dist/wallet/index.mjs +1380 -0
  38. package/dist/wallet/index.mjs.map +1 -0
  39. package/package.json +3 -2
@@ -0,0 +1,176 @@
1
+ import { k as ProviderInfo, e as Model, M as Message, n as TransactionHistory } from './types-_21yYFZG.js';
2
+
3
+ /**
4
+ * Interfaces for the Routstr SDK wallet abstraction layer
5
+ * These interfaces allow the SDK to be framework-agnostic
6
+ */
7
+
8
+ /**
9
+ * WalletAdapter - Abstracts wallet operations (NIP-60 or legacy)
10
+ * The React app implements this using its hooks
11
+ */
12
+ interface WalletAdapter {
13
+ /** Get balances for all mints (mintUrl -> balance in sats) */
14
+ getBalances(): Promise<Record<string, number>>;
15
+ /** Get unit type for each mint (mintUrl -> 'sat' | 'msat') */
16
+ getMintUnits(): Record<string, "sat" | "msat">;
17
+ /** Get the currently active mint URL */
18
+ getActiveMintUrl(): string | null;
19
+ /**
20
+ * Create and send a cashu token from a mint
21
+ * @param mintUrl The mint URL to send from
22
+ * @param amount Amount in sats
23
+ * @param p2pkPubkey Optional P2PK public key
24
+ * @returns Encoded cashu token string
25
+ */
26
+ sendToken(mintUrl: string, amount: number, p2pkPubkey?: string): Promise<string>;
27
+ /**
28
+ * Receive/store a cashu token
29
+ * Handles both NIP-60 and legacy storage internally
30
+ * @param token Encoded cashu token string
31
+ * @returns Result with success flag and amount received
32
+ */
33
+ receiveToken(token: string): Promise<{
34
+ success: boolean;
35
+ amount: number;
36
+ unit: "sat" | "msat";
37
+ message?: string;
38
+ }>;
39
+ }
40
+ /**
41
+ * StorageAdapter - Abstracts local storage operations
42
+ * Separates token storage from wallet operations
43
+ */
44
+ interface ApiKeyEntry {
45
+ baseUrl: string;
46
+ key: string;
47
+ balance: number;
48
+ lastUsed: number | null;
49
+ }
50
+ interface ChildKeyEntry {
51
+ parentBaseUrl: string;
52
+ childKey: string;
53
+ balance: number;
54
+ balanceLimit?: number;
55
+ validityDate?: number;
56
+ createdAt: number;
57
+ }
58
+ interface XCashuTokenEntry {
59
+ baseUrl: string;
60
+ token: string;
61
+ createdAt: number;
62
+ tryCount: number;
63
+ }
64
+ interface StorageAdapter {
65
+ /** Save provider info to cache */
66
+ saveProviderInfo(baseUrl: string, info: ProviderInfo): void;
67
+ /** Get cached provider info */
68
+ getProviderInfo(baseUrl: string): ProviderInfo | null;
69
+ /** Get stored API key entry for a provider */
70
+ getApiKey(baseUrl: string): ApiKeyEntry | null;
71
+ /** Store API key for a provider */
72
+ setApiKey(baseUrl: string, key: string): void;
73
+ /** Update balance for an existing stored API key (based on provider response) */
74
+ updateApiKeyBalance(baseUrl: string, balance: number): void;
75
+ /** Remove API key for a provider */
76
+ removeApiKey(baseUrl: string): void;
77
+ /** Get all stored API keys */
78
+ getAllApiKeys(): ApiKeyEntry[];
79
+ /** Get all stored API keys as distribution (baseUrl -> amount in sats) */
80
+ getApiKeyDistribution(): Array<{
81
+ baseUrl: string;
82
+ amount: number;
83
+ }>;
84
+ /** Get stored child key for a parent provider */
85
+ getChildKey(parentBaseUrl: string): ChildKeyEntry | null;
86
+ /** Store a child key for a parent provider */
87
+ setChildKey(parentBaseUrl: string, childKey: string, balance?: number, validityDate?: number, balanceLimit?: number): void;
88
+ /** Update balance for an existing child key */
89
+ updateChildKeyBalance(parentBaseUrl: string, balance: number): void;
90
+ /** Remove child key for a parent provider */
91
+ removeChildKey(parentBaseUrl: string): void;
92
+ /** Get all stored child keys */
93
+ getAllChildKeys(): ChildKeyEntry[];
94
+ /** Get cached receive tokens (tokens that failed to receive due to mint errors) */
95
+ getCachedReceiveTokens(): Array<{
96
+ token: string;
97
+ amount: number;
98
+ unit: "sat" | "msat";
99
+ createdAt: number;
100
+ }>;
101
+ /** Set cached receive tokens */
102
+ setCachedReceiveTokens(tokens: Array<{
103
+ token: string;
104
+ amount: number;
105
+ unit: "sat" | "msat";
106
+ createdAt?: number;
107
+ }>): void;
108
+ /** Get all stored xcashu tokens */
109
+ getXcashuTokens(): Record<string, XCashuTokenEntry[]>;
110
+ /** Get xcashu tokens for a specific baseUrl */
111
+ getXcashuTokensForBaseUrl(baseUrl: string): XCashuTokenEntry[];
112
+ /** Add an xcashu token for a baseUrl */
113
+ addXcashuToken(baseUrl: string, token: string): void;
114
+ /** Remove an xcashu token */
115
+ removeXcashuToken(baseUrl: string, token: string): void;
116
+ /** Clear all xcashu tokens for a baseUrl */
117
+ clearXcashuTokensForBaseUrl(baseUrl: string): void;
118
+ /** Update try count for a specific token */
119
+ updateXcashuTokenTryCount(token: string, tryCount: number): void;
120
+ }
121
+ /**
122
+ * ProviderRegistry - Provides access to provider/model data
123
+ * Used by ProviderManager for failover logic
124
+ */
125
+ interface ProviderRegistry {
126
+ /** Get all models available from a provider */
127
+ getModelsForProvider(baseUrl: string): Model[];
128
+ /** Get list of disabled provider URLs */
129
+ getDisabledProviders(): string[];
130
+ /** Get mints accepted by a provider */
131
+ getProviderMints(baseUrl: string): string[];
132
+ /**
133
+ * Get provider info (version, etc.)
134
+ * Should fetch from network if not cached, or return cached version
135
+ */
136
+ getProviderInfo(baseUrl: string): Promise<ProviderInfo | null>;
137
+ /** Get all providers with their models */
138
+ getAllProvidersModels(): Record<string, Model[]>;
139
+ }
140
+ /**
141
+ * StreamingCallbacks - Callbacks for real-time updates during API calls
142
+ * Used by RoutstrClient to communicate with the UI
143
+ */
144
+ interface StreamingCallbacks {
145
+ /** Called when new content arrives from the stream */
146
+ onStreamingUpdate: (content: string) => void;
147
+ /** Called when thinking/reasoning content arrives */
148
+ onThinkingUpdate: (content: string) => void;
149
+ /** Called when a complete message should be appended */
150
+ onMessageAppend: (message: Message) => void;
151
+ /** Called when balance changes */
152
+ onBalanceUpdate: (balance: number) => void;
153
+ /** Called when a transaction is recorded */
154
+ onTransactionUpdate: (transaction: TransactionHistory) => void;
155
+ /** Called when a new token is created (amount in sats) */
156
+ onTokenCreated?: (amount: number) => void;
157
+ /** Called when payment processing starts/stops */
158
+ onPaymentProcessing?: (isProcessing: boolean) => void;
159
+ /** Called when sats spent on the last message is known */
160
+ onLastMessageSatsUpdate?: (satsSpent: number, estimatedCosts: number) => void;
161
+ }
162
+ /**
163
+ * Options for creating a RoutstrClient
164
+ */
165
+ interface RoutstrClientOptions {
166
+ /** Wallet adapter for cashu operations */
167
+ walletAdapter: WalletAdapter;
168
+ /** Storage adapter for token management */
169
+ storageAdapter: StorageAdapter;
170
+ /** Provider registry for failover logic */
171
+ providerRegistry: ProviderRegistry;
172
+ /** Nostr relay URLs (for future nostr-based features) */
173
+ relayUrls?: string[];
174
+ }
175
+
176
+ export type { ApiKeyEntry as A, ChildKeyEntry as C, ProviderRegistry as P, RoutstrClientOptions as R, StorageAdapter as S, WalletAdapter as W, XCashuTokenEntry as X, StreamingCallbacks as a };
@@ -0,0 +1,176 @@
1
+ import { k as ProviderInfo, e as Model, M as Message, n as TransactionHistory } from './types-_21yYFZG.mjs';
2
+
3
+ /**
4
+ * Interfaces for the Routstr SDK wallet abstraction layer
5
+ * These interfaces allow the SDK to be framework-agnostic
6
+ */
7
+
8
+ /**
9
+ * WalletAdapter - Abstracts wallet operations (NIP-60 or legacy)
10
+ * The React app implements this using its hooks
11
+ */
12
+ interface WalletAdapter {
13
+ /** Get balances for all mints (mintUrl -> balance in sats) */
14
+ getBalances(): Promise<Record<string, number>>;
15
+ /** Get unit type for each mint (mintUrl -> 'sat' | 'msat') */
16
+ getMintUnits(): Record<string, "sat" | "msat">;
17
+ /** Get the currently active mint URL */
18
+ getActiveMintUrl(): string | null;
19
+ /**
20
+ * Create and send a cashu token from a mint
21
+ * @param mintUrl The mint URL to send from
22
+ * @param amount Amount in sats
23
+ * @param p2pkPubkey Optional P2PK public key
24
+ * @returns Encoded cashu token string
25
+ */
26
+ sendToken(mintUrl: string, amount: number, p2pkPubkey?: string): Promise<string>;
27
+ /**
28
+ * Receive/store a cashu token
29
+ * Handles both NIP-60 and legacy storage internally
30
+ * @param token Encoded cashu token string
31
+ * @returns Result with success flag and amount received
32
+ */
33
+ receiveToken(token: string): Promise<{
34
+ success: boolean;
35
+ amount: number;
36
+ unit: "sat" | "msat";
37
+ message?: string;
38
+ }>;
39
+ }
40
+ /**
41
+ * StorageAdapter - Abstracts local storage operations
42
+ * Separates token storage from wallet operations
43
+ */
44
+ interface ApiKeyEntry {
45
+ baseUrl: string;
46
+ key: string;
47
+ balance: number;
48
+ lastUsed: number | null;
49
+ }
50
+ interface ChildKeyEntry {
51
+ parentBaseUrl: string;
52
+ childKey: string;
53
+ balance: number;
54
+ balanceLimit?: number;
55
+ validityDate?: number;
56
+ createdAt: number;
57
+ }
58
+ interface XCashuTokenEntry {
59
+ baseUrl: string;
60
+ token: string;
61
+ createdAt: number;
62
+ tryCount: number;
63
+ }
64
+ interface StorageAdapter {
65
+ /** Save provider info to cache */
66
+ saveProviderInfo(baseUrl: string, info: ProviderInfo): void;
67
+ /** Get cached provider info */
68
+ getProviderInfo(baseUrl: string): ProviderInfo | null;
69
+ /** Get stored API key entry for a provider */
70
+ getApiKey(baseUrl: string): ApiKeyEntry | null;
71
+ /** Store API key for a provider */
72
+ setApiKey(baseUrl: string, key: string): void;
73
+ /** Update balance for an existing stored API key (based on provider response) */
74
+ updateApiKeyBalance(baseUrl: string, balance: number): void;
75
+ /** Remove API key for a provider */
76
+ removeApiKey(baseUrl: string): void;
77
+ /** Get all stored API keys */
78
+ getAllApiKeys(): ApiKeyEntry[];
79
+ /** Get all stored API keys as distribution (baseUrl -> amount in sats) */
80
+ getApiKeyDistribution(): Array<{
81
+ baseUrl: string;
82
+ amount: number;
83
+ }>;
84
+ /** Get stored child key for a parent provider */
85
+ getChildKey(parentBaseUrl: string): ChildKeyEntry | null;
86
+ /** Store a child key for a parent provider */
87
+ setChildKey(parentBaseUrl: string, childKey: string, balance?: number, validityDate?: number, balanceLimit?: number): void;
88
+ /** Update balance for an existing child key */
89
+ updateChildKeyBalance(parentBaseUrl: string, balance: number): void;
90
+ /** Remove child key for a parent provider */
91
+ removeChildKey(parentBaseUrl: string): void;
92
+ /** Get all stored child keys */
93
+ getAllChildKeys(): ChildKeyEntry[];
94
+ /** Get cached receive tokens (tokens that failed to receive due to mint errors) */
95
+ getCachedReceiveTokens(): Array<{
96
+ token: string;
97
+ amount: number;
98
+ unit: "sat" | "msat";
99
+ createdAt: number;
100
+ }>;
101
+ /** Set cached receive tokens */
102
+ setCachedReceiveTokens(tokens: Array<{
103
+ token: string;
104
+ amount: number;
105
+ unit: "sat" | "msat";
106
+ createdAt?: number;
107
+ }>): void;
108
+ /** Get all stored xcashu tokens */
109
+ getXcashuTokens(): Record<string, XCashuTokenEntry[]>;
110
+ /** Get xcashu tokens for a specific baseUrl */
111
+ getXcashuTokensForBaseUrl(baseUrl: string): XCashuTokenEntry[];
112
+ /** Add an xcashu token for a baseUrl */
113
+ addXcashuToken(baseUrl: string, token: string): void;
114
+ /** Remove an xcashu token */
115
+ removeXcashuToken(baseUrl: string, token: string): void;
116
+ /** Clear all xcashu tokens for a baseUrl */
117
+ clearXcashuTokensForBaseUrl(baseUrl: string): void;
118
+ /** Update try count for a specific token */
119
+ updateXcashuTokenTryCount(token: string, tryCount: number): void;
120
+ }
121
+ /**
122
+ * ProviderRegistry - Provides access to provider/model data
123
+ * Used by ProviderManager for failover logic
124
+ */
125
+ interface ProviderRegistry {
126
+ /** Get all models available from a provider */
127
+ getModelsForProvider(baseUrl: string): Model[];
128
+ /** Get list of disabled provider URLs */
129
+ getDisabledProviders(): string[];
130
+ /** Get mints accepted by a provider */
131
+ getProviderMints(baseUrl: string): string[];
132
+ /**
133
+ * Get provider info (version, etc.)
134
+ * Should fetch from network if not cached, or return cached version
135
+ */
136
+ getProviderInfo(baseUrl: string): Promise<ProviderInfo | null>;
137
+ /** Get all providers with their models */
138
+ getAllProvidersModels(): Record<string, Model[]>;
139
+ }
140
+ /**
141
+ * StreamingCallbacks - Callbacks for real-time updates during API calls
142
+ * Used by RoutstrClient to communicate with the UI
143
+ */
144
+ interface StreamingCallbacks {
145
+ /** Called when new content arrives from the stream */
146
+ onStreamingUpdate: (content: string) => void;
147
+ /** Called when thinking/reasoning content arrives */
148
+ onThinkingUpdate: (content: string) => void;
149
+ /** Called when a complete message should be appended */
150
+ onMessageAppend: (message: Message) => void;
151
+ /** Called when balance changes */
152
+ onBalanceUpdate: (balance: number) => void;
153
+ /** Called when a transaction is recorded */
154
+ onTransactionUpdate: (transaction: TransactionHistory) => void;
155
+ /** Called when a new token is created (amount in sats) */
156
+ onTokenCreated?: (amount: number) => void;
157
+ /** Called when payment processing starts/stops */
158
+ onPaymentProcessing?: (isProcessing: boolean) => void;
159
+ /** Called when sats spent on the last message is known */
160
+ onLastMessageSatsUpdate?: (satsSpent: number, estimatedCosts: number) => void;
161
+ }
162
+ /**
163
+ * Options for creating a RoutstrClient
164
+ */
165
+ interface RoutstrClientOptions {
166
+ /** Wallet adapter for cashu operations */
167
+ walletAdapter: WalletAdapter;
168
+ /** Storage adapter for token management */
169
+ storageAdapter: StorageAdapter;
170
+ /** Provider registry for failover logic */
171
+ providerRegistry: ProviderRegistry;
172
+ /** Nostr relay URLs (for future nostr-based features) */
173
+ relayUrls?: string[];
174
+ }
175
+
176
+ export type { ApiKeyEntry as A, ChildKeyEntry as C, ProviderRegistry as P, RoutstrClientOptions as R, StorageAdapter as S, WalletAdapter as W, XCashuTokenEntry as X, StreamingCallbacks as a };
@@ -0,0 +1,118 @@
1
+ import { e as Model, k as ProviderInfo } from './types-_21yYFZG.mjs';
2
+
3
+ /**
4
+ * Interfaces for the model and provider discovery system
5
+ * These abstractions allow the discovery logic to be independent of storage implementation
6
+ */
7
+
8
+ /**
9
+ * Discovery adapter for managing cached provider and model data
10
+ * Abstracts localStorage operations so discovery logic is testable and reusable
11
+ */
12
+ interface DiscoveryAdapter {
13
+ /**
14
+ * Get cached models from all providers
15
+ * @returns Record mapping baseUrl -> array of models
16
+ */
17
+ getCachedModels(): Record<string, Model[]>;
18
+ /**
19
+ * Save models cache
20
+ * @param models Record mapping baseUrl -> array of models
21
+ */
22
+ setCachedModels(models: Record<string, Model[]>): void;
23
+ /**
24
+ * Get cached mints from all providers
25
+ * @returns Record mapping baseUrl -> array of mint URLs
26
+ */
27
+ getCachedMints(): Record<string, string[]>;
28
+ /**
29
+ * Save mints cache
30
+ * @param mints Record mapping baseUrl -> array of mint URLs
31
+ */
32
+ setCachedMints(mints: Record<string, string[]>): void;
33
+ /**
34
+ * Get cached provider info from all providers
35
+ * @returns Record mapping baseUrl -> provider info object
36
+ */
37
+ getCachedProviderInfo(): Record<string, ProviderInfo>;
38
+ /**
39
+ * Save provider info cache
40
+ * @param info Record mapping baseUrl -> provider info object
41
+ */
42
+ setCachedProviderInfo(info: Record<string, ProviderInfo>): void;
43
+ /**
44
+ * Get provider last update timestamp
45
+ * @param baseUrl Provider base URL
46
+ * @returns Timestamp in milliseconds or null if never updated
47
+ */
48
+ getProviderLastUpdate(baseUrl: string): number | null;
49
+ /**
50
+ * Set provider last update timestamp
51
+ * @param baseUrl Provider base URL
52
+ * @param timestamp Timestamp in milliseconds
53
+ */
54
+ setProviderLastUpdate(baseUrl: string, timestamp: number): void;
55
+ /**
56
+ * Get last used model ID
57
+ * @returns Model ID or null if none
58
+ */
59
+ getLastUsedModel(): string | null;
60
+ /**
61
+ * Save last used model ID
62
+ * @param modelId Model ID to save
63
+ */
64
+ setLastUsedModel(modelId: string): void;
65
+ /**
66
+ * Get list of disabled provider base URLs
67
+ * @returns Array of disabled provider URLs
68
+ */
69
+ getDisabledProviders(): string[];
70
+ /**
71
+ * Save list of disabled provider base URLs
72
+ * Optional because some read-only adapters can only expose current disabled state.
73
+ * @param urls Array of disabled provider URLs
74
+ */
75
+ setDisabledProviders?(urls: string[]): void;
76
+ /**
77
+ * Get list of configured provider base URLs
78
+ * @returns Array of provider base URLs
79
+ */
80
+ getBaseUrlsList(): string[];
81
+ /**
82
+ * Get base URLs list last update timestamp
83
+ * @returns Timestamp in milliseconds or null if never updated
84
+ */
85
+ getBaseUrlsLastUpdate(): number | null;
86
+ /**
87
+ * Save list of provider base URLs
88
+ * @param urls Array of provider base URLs
89
+ */
90
+ setBaseUrlsList(urls: string[]): void;
91
+ /**
92
+ * Set base URLs list last update timestamp
93
+ * @param timestamp Timestamp in milliseconds
94
+ */
95
+ setBaseUrlsLastUpdate(timestamp: number): void;
96
+ /**
97
+ * Get list of routstr21 models
98
+ * @returns Array of model IDs
99
+ */
100
+ getRoutstr21Models(): string[];
101
+ /**
102
+ * Save routstr21 models list
103
+ * @param models Array of model IDs
104
+ */
105
+ setRoutstr21Models(models: string[]): void;
106
+ /**
107
+ * Get routstr21 models last update timestamp
108
+ * @returns Timestamp in milliseconds or null if never updated
109
+ */
110
+ getRoutstr21ModelsLastUpdate(): number | null;
111
+ /**
112
+ * Set routstr21 models last update timestamp
113
+ * @param timestamp Timestamp in milliseconds
114
+ */
115
+ setRoutstr21ModelsLastUpdate(timestamp: number): void;
116
+ }
117
+
118
+ export type { DiscoveryAdapter as D };
@@ -0,0 +1,118 @@
1
+ import { e as Model, k as ProviderInfo } from './types-_21yYFZG.js';
2
+
3
+ /**
4
+ * Interfaces for the model and provider discovery system
5
+ * These abstractions allow the discovery logic to be independent of storage implementation
6
+ */
7
+
8
+ /**
9
+ * Discovery adapter for managing cached provider and model data
10
+ * Abstracts localStorage operations so discovery logic is testable and reusable
11
+ */
12
+ interface DiscoveryAdapter {
13
+ /**
14
+ * Get cached models from all providers
15
+ * @returns Record mapping baseUrl -> array of models
16
+ */
17
+ getCachedModels(): Record<string, Model[]>;
18
+ /**
19
+ * Save models cache
20
+ * @param models Record mapping baseUrl -> array of models
21
+ */
22
+ setCachedModels(models: Record<string, Model[]>): void;
23
+ /**
24
+ * Get cached mints from all providers
25
+ * @returns Record mapping baseUrl -> array of mint URLs
26
+ */
27
+ getCachedMints(): Record<string, string[]>;
28
+ /**
29
+ * Save mints cache
30
+ * @param mints Record mapping baseUrl -> array of mint URLs
31
+ */
32
+ setCachedMints(mints: Record<string, string[]>): void;
33
+ /**
34
+ * Get cached provider info from all providers
35
+ * @returns Record mapping baseUrl -> provider info object
36
+ */
37
+ getCachedProviderInfo(): Record<string, ProviderInfo>;
38
+ /**
39
+ * Save provider info cache
40
+ * @param info Record mapping baseUrl -> provider info object
41
+ */
42
+ setCachedProviderInfo(info: Record<string, ProviderInfo>): void;
43
+ /**
44
+ * Get provider last update timestamp
45
+ * @param baseUrl Provider base URL
46
+ * @returns Timestamp in milliseconds or null if never updated
47
+ */
48
+ getProviderLastUpdate(baseUrl: string): number | null;
49
+ /**
50
+ * Set provider last update timestamp
51
+ * @param baseUrl Provider base URL
52
+ * @param timestamp Timestamp in milliseconds
53
+ */
54
+ setProviderLastUpdate(baseUrl: string, timestamp: number): void;
55
+ /**
56
+ * Get last used model ID
57
+ * @returns Model ID or null if none
58
+ */
59
+ getLastUsedModel(): string | null;
60
+ /**
61
+ * Save last used model ID
62
+ * @param modelId Model ID to save
63
+ */
64
+ setLastUsedModel(modelId: string): void;
65
+ /**
66
+ * Get list of disabled provider base URLs
67
+ * @returns Array of disabled provider URLs
68
+ */
69
+ getDisabledProviders(): string[];
70
+ /**
71
+ * Save list of disabled provider base URLs
72
+ * Optional because some read-only adapters can only expose current disabled state.
73
+ * @param urls Array of disabled provider URLs
74
+ */
75
+ setDisabledProviders?(urls: string[]): void;
76
+ /**
77
+ * Get list of configured provider base URLs
78
+ * @returns Array of provider base URLs
79
+ */
80
+ getBaseUrlsList(): string[];
81
+ /**
82
+ * Get base URLs list last update timestamp
83
+ * @returns Timestamp in milliseconds or null if never updated
84
+ */
85
+ getBaseUrlsLastUpdate(): number | null;
86
+ /**
87
+ * Save list of provider base URLs
88
+ * @param urls Array of provider base URLs
89
+ */
90
+ setBaseUrlsList(urls: string[]): void;
91
+ /**
92
+ * Set base URLs list last update timestamp
93
+ * @param timestamp Timestamp in milliseconds
94
+ */
95
+ setBaseUrlsLastUpdate(timestamp: number): void;
96
+ /**
97
+ * Get list of routstr21 models
98
+ * @returns Array of model IDs
99
+ */
100
+ getRoutstr21Models(): string[];
101
+ /**
102
+ * Save routstr21 models list
103
+ * @param models Array of model IDs
104
+ */
105
+ setRoutstr21Models(models: string[]): void;
106
+ /**
107
+ * Get routstr21 models last update timestamp
108
+ * @returns Timestamp in milliseconds or null if never updated
109
+ */
110
+ getRoutstr21ModelsLastUpdate(): number | null;
111
+ /**
112
+ * Set routstr21 models last update timestamp
113
+ * @param timestamp Timestamp in milliseconds
114
+ */
115
+ setRoutstr21ModelsLastUpdate(timestamp: number): void;
116
+ }
117
+
118
+ export type { DiscoveryAdapter as D };