@recall_v3/mcp-server 0.1.0
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/api/client.d.ts +111 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +244 -0
- package/dist/config/index.d.ts +89 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +256 -0
- package/dist/crypto/index.d.ts +56 -0
- package/dist/crypto/index.d.ts.map +1 -0
- package/dist/crypto/index.js +224 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +189 -0
- package/dist/tools/getContext.d.ts +18 -0
- package/dist/tools/getContext.d.ts.map +1 -0
- package/dist/tools/getContext.js +87 -0
- package/dist/tools/getHistory.d.ts +18 -0
- package/dist/tools/getHistory.d.ts.map +1 -0
- package/dist/tools/getHistory.js +97 -0
- package/dist/tools/getTranscripts.d.ts +19 -0
- package/dist/tools/getTranscripts.d.ts.map +1 -0
- package/dist/tools/getTranscripts.js +129 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +37 -0
- package/dist/tools/logDecision.d.ts +19 -0
- package/dist/tools/logDecision.d.ts.map +1 -0
- package/dist/tools/logDecision.js +92 -0
- package/dist/tools/saveSession.d.ts +26 -0
- package/dist/tools/saveSession.d.ts.map +1 -0
- package/dist/tools/saveSession.js +115 -0
- package/dist/tools/types.d.ts +32 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +33 -0
- package/dist/tools/utils.d.ts +52 -0
- package/dist/tools/utils.d.ts.map +1 -0
- package/dist/tools/utils.js +238 -0
- package/package.json +46 -0
- package/src/api/client.ts +295 -0
- package/src/config/index.ts +247 -0
- package/src/crypto/index.ts +207 -0
- package/src/index.ts +232 -0
- package/src/tools/getContext.ts +106 -0
- package/src/tools/getHistory.ts +118 -0
- package/src/tools/getTranscripts.ts +150 -0
- package/src/tools/index.ts +13 -0
- package/src/tools/logDecision.ts +118 -0
- package/src/tools/saveSession.ts +159 -0
- package/src/tools/types.ts +47 -0
- package/src/tools/utils.ts +226 -0
- package/tsconfig.json +14 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recall API Client
|
|
3
|
+
*
|
|
4
|
+
* HTTP client for communicating with the Recall backend API.
|
|
5
|
+
* Handles authentication, retries, and error handling.
|
|
6
|
+
*/
|
|
7
|
+
import type { SummarizeRequest, SummarizeResponse, SaveSessionRequest, SaveSessionResponse, GetContextResponse, GetHistoryResponse, GetTranscriptsResponse, LogDecisionRequest, LogDecisionResponse, TeamKeyResponse, RecallStatusResponse, ListTeamsResponse } from '@recall_v3/shared';
|
|
8
|
+
export declare class RecallApiError extends Error {
|
|
9
|
+
readonly code: string;
|
|
10
|
+
readonly statusCode?: number | undefined;
|
|
11
|
+
readonly retryable: boolean;
|
|
12
|
+
constructor(message: string, code: string, statusCode?: number | undefined, retryable?: boolean);
|
|
13
|
+
}
|
|
14
|
+
export declare class NetworkError extends RecallApiError {
|
|
15
|
+
readonly cause?: Error | undefined;
|
|
16
|
+
constructor(message: string, cause?: Error | undefined);
|
|
17
|
+
}
|
|
18
|
+
export declare class AuthenticationError extends RecallApiError {
|
|
19
|
+
constructor(message?: string);
|
|
20
|
+
}
|
|
21
|
+
export declare class TimeoutError extends RecallApiError {
|
|
22
|
+
constructor(message?: string);
|
|
23
|
+
}
|
|
24
|
+
interface RecallApiClientConfig {
|
|
25
|
+
baseUrl: string;
|
|
26
|
+
token: string;
|
|
27
|
+
timeout?: number;
|
|
28
|
+
maxRetries?: number;
|
|
29
|
+
retryBaseDelay?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* RecallApiClient - Thin HTTP client for Recall API
|
|
33
|
+
*
|
|
34
|
+
* Features:
|
|
35
|
+
* - Bearer token authentication
|
|
36
|
+
* - Exponential backoff retry on 5xx errors
|
|
37
|
+
* - Configurable timeout (default 30s)
|
|
38
|
+
* - Typed responses using @recall_v3/shared types
|
|
39
|
+
*/
|
|
40
|
+
export declare class RecallApiClient {
|
|
41
|
+
private readonly baseUrl;
|
|
42
|
+
private readonly token;
|
|
43
|
+
private readonly timeout;
|
|
44
|
+
private readonly maxRetries;
|
|
45
|
+
private readonly retryBaseDelay;
|
|
46
|
+
constructor(config: RecallApiClientConfig);
|
|
47
|
+
/**
|
|
48
|
+
* Internal fetch wrapper with timeout and retry logic
|
|
49
|
+
*/
|
|
50
|
+
private request;
|
|
51
|
+
/**
|
|
52
|
+
* Calculate exponential backoff delay
|
|
53
|
+
*/
|
|
54
|
+
private calculateBackoff;
|
|
55
|
+
/**
|
|
56
|
+
* Sleep for a given number of milliseconds
|
|
57
|
+
*/
|
|
58
|
+
private sleep;
|
|
59
|
+
/**
|
|
60
|
+
* Summarize a session transcript
|
|
61
|
+
* Called by saveSession tool after reading JSONL from disk
|
|
62
|
+
*/
|
|
63
|
+
summarize(request: SummarizeRequest): Promise<SummarizeResponse>;
|
|
64
|
+
/**
|
|
65
|
+
* Save a session with manual input (not from transcript)
|
|
66
|
+
* Used when user provides summary directly via MCP tool
|
|
67
|
+
*/
|
|
68
|
+
saveSession(repoId: string, data: SaveSessionRequest): Promise<SaveSessionResponse>;
|
|
69
|
+
/**
|
|
70
|
+
* Get context for a repository (context.md)
|
|
71
|
+
* Returns the distilled team brain for this repo
|
|
72
|
+
*/
|
|
73
|
+
getContext(repoId: string): Promise<GetContextResponse>;
|
|
74
|
+
/**
|
|
75
|
+
* Get history for a repository (context.md + history.md)
|
|
76
|
+
* Returns more detail than getContext
|
|
77
|
+
*/
|
|
78
|
+
getHistory(repoId: string): Promise<GetHistoryResponse>;
|
|
79
|
+
/**
|
|
80
|
+
* Get full transcripts for a repository
|
|
81
|
+
* WARNING: Can be very large, uses many tokens
|
|
82
|
+
*/
|
|
83
|
+
getTranscripts(repoId: string): Promise<GetTranscriptsResponse>;
|
|
84
|
+
/**
|
|
85
|
+
* Log a decision for a repository
|
|
86
|
+
*/
|
|
87
|
+
logDecision(repoId: string, data: LogDecisionRequest): Promise<LogDecisionResponse>;
|
|
88
|
+
/**
|
|
89
|
+
* Get the encryption key for a team
|
|
90
|
+
* Used to decrypt content locally
|
|
91
|
+
*/
|
|
92
|
+
getTeamKey(teamId: string): Promise<TeamKeyResponse>;
|
|
93
|
+
/**
|
|
94
|
+
* List teams the user belongs to
|
|
95
|
+
*/
|
|
96
|
+
listTeams(): Promise<ListTeamsResponse>;
|
|
97
|
+
/**
|
|
98
|
+
* Get authentication status
|
|
99
|
+
*/
|
|
100
|
+
getStatus(): Promise<RecallStatusResponse>;
|
|
101
|
+
/**
|
|
102
|
+
* Lookup or create repo by GitHub repo info
|
|
103
|
+
* Returns the repo ID for subsequent API calls
|
|
104
|
+
*/
|
|
105
|
+
resolveRepo(fullName: string, defaultBranch?: string): Promise<{
|
|
106
|
+
repoId: string;
|
|
107
|
+
teamId: string;
|
|
108
|
+
}>;
|
|
109
|
+
}
|
|
110
|
+
export {};
|
|
111
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EAElB,MAAM,mBAAmB,CAAC;AAG3B,qBAAa,cAAe,SAAQ,KAAK;aAGrB,IAAI,EAAE,MAAM;aACZ,UAAU,CAAC,EAAE,MAAM;aACnB,SAAS,EAAE,OAAO;gBAHlC,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,YAAA,EACnB,SAAS,GAAE,OAAe;CAK7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,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAIrE;;OAEG;IACG,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAIzF;;;OAGG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAI1D;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAI7C;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAIhD;;;OAGG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAMzG"}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Recall API Client
|
|
4
|
+
*
|
|
5
|
+
* HTTP client for communicating with the Recall backend API.
|
|
6
|
+
* Handles authentication, retries, and error handling.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.RecallApiClient = exports.TimeoutError = exports.AuthenticationError = exports.NetworkError = exports.RecallApiError = void 0;
|
|
10
|
+
// Error types for the API client
|
|
11
|
+
class RecallApiError extends Error {
|
|
12
|
+
code;
|
|
13
|
+
statusCode;
|
|
14
|
+
retryable;
|
|
15
|
+
constructor(message, code, statusCode, retryable = false) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.code = code;
|
|
18
|
+
this.statusCode = statusCode;
|
|
19
|
+
this.retryable = retryable;
|
|
20
|
+
this.name = 'RecallApiError';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.RecallApiError = RecallApiError;
|
|
24
|
+
class NetworkError extends RecallApiError {
|
|
25
|
+
cause;
|
|
26
|
+
constructor(message, cause) {
|
|
27
|
+
super(message, 'NETWORK_ERROR', undefined, true);
|
|
28
|
+
this.cause = cause;
|
|
29
|
+
this.name = 'NetworkError';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.NetworkError = NetworkError;
|
|
33
|
+
class AuthenticationError extends RecallApiError {
|
|
34
|
+
constructor(message = 'Authentication failed') {
|
|
35
|
+
super(message, 'AUTH_ERROR', 401, false);
|
|
36
|
+
this.name = 'AuthenticationError';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.AuthenticationError = AuthenticationError;
|
|
40
|
+
class TimeoutError extends RecallApiError {
|
|
41
|
+
constructor(message = 'Request timed out') {
|
|
42
|
+
super(message, 'TIMEOUT', undefined, true);
|
|
43
|
+
this.name = 'TimeoutError';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.TimeoutError = TimeoutError;
|
|
47
|
+
/**
|
|
48
|
+
* RecallApiClient - Thin HTTP client for Recall API
|
|
49
|
+
*
|
|
50
|
+
* Features:
|
|
51
|
+
* - Bearer token authentication
|
|
52
|
+
* - Exponential backoff retry on 5xx errors
|
|
53
|
+
* - Configurable timeout (default 30s)
|
|
54
|
+
* - Typed responses using @recall_v3/shared types
|
|
55
|
+
*/
|
|
56
|
+
class RecallApiClient {
|
|
57
|
+
baseUrl;
|
|
58
|
+
token;
|
|
59
|
+
timeout;
|
|
60
|
+
maxRetries;
|
|
61
|
+
retryBaseDelay;
|
|
62
|
+
constructor(config) {
|
|
63
|
+
this.baseUrl = config.baseUrl.replace(/\/$/, ''); // Remove trailing slash
|
|
64
|
+
this.token = config.token;
|
|
65
|
+
this.timeout = config.timeout ?? 30000; // 30s default
|
|
66
|
+
this.maxRetries = config.maxRetries ?? 3;
|
|
67
|
+
this.retryBaseDelay = config.retryBaseDelay ?? 1000; // 1s base delay
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Internal fetch wrapper with timeout and retry logic
|
|
71
|
+
*/
|
|
72
|
+
async request(method, path, body) {
|
|
73
|
+
const url = `${this.baseUrl}${path}`;
|
|
74
|
+
let lastError;
|
|
75
|
+
for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
|
|
76
|
+
try {
|
|
77
|
+
const controller = new AbortController();
|
|
78
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
79
|
+
try {
|
|
80
|
+
const response = await fetch(url, {
|
|
81
|
+
method,
|
|
82
|
+
headers: {
|
|
83
|
+
'Content-Type': 'application/json',
|
|
84
|
+
'Authorization': `Bearer ${this.token}`,
|
|
85
|
+
},
|
|
86
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
87
|
+
signal: controller.signal,
|
|
88
|
+
});
|
|
89
|
+
clearTimeout(timeoutId);
|
|
90
|
+
// Handle non-OK responses
|
|
91
|
+
if (!response.ok) {
|
|
92
|
+
const errorBody = await response.json().catch(() => ({}));
|
|
93
|
+
const errorCode = errorBody?.error?.code ?? 'UNKNOWN_ERROR';
|
|
94
|
+
const errorMessage = errorBody?.error?.message ?? `HTTP ${response.status}`;
|
|
95
|
+
// 401 = auth error, don't retry
|
|
96
|
+
if (response.status === 401) {
|
|
97
|
+
throw new AuthenticationError(errorMessage);
|
|
98
|
+
}
|
|
99
|
+
// 5xx = server error, retry with backoff
|
|
100
|
+
if (response.status >= 500) {
|
|
101
|
+
throw new RecallApiError(errorMessage, errorCode, response.status, true);
|
|
102
|
+
}
|
|
103
|
+
// 4xx = client error, don't retry
|
|
104
|
+
throw new RecallApiError(errorMessage, errorCode, response.status, false);
|
|
105
|
+
}
|
|
106
|
+
// Parse successful response
|
|
107
|
+
const data = await response.json();
|
|
108
|
+
if (!data.success && data.error) {
|
|
109
|
+
throw new RecallApiError(data.error.message, data.error.code, response.status, false);
|
|
110
|
+
}
|
|
111
|
+
return data.data;
|
|
112
|
+
}
|
|
113
|
+
finally {
|
|
114
|
+
clearTimeout(timeoutId);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
// Handle abort (timeout)
|
|
119
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
120
|
+
lastError = new TimeoutError();
|
|
121
|
+
// Timeout is retryable
|
|
122
|
+
if (attempt < this.maxRetries) {
|
|
123
|
+
await this.sleep(this.calculateBackoff(attempt));
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
throw lastError;
|
|
127
|
+
}
|
|
128
|
+
// Handle network errors
|
|
129
|
+
if (error instanceof TypeError && error.message.includes('fetch')) {
|
|
130
|
+
lastError = new NetworkError('Network request failed', error);
|
|
131
|
+
// Network errors are retryable
|
|
132
|
+
if (attempt < this.maxRetries) {
|
|
133
|
+
await this.sleep(this.calculateBackoff(attempt));
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
throw lastError;
|
|
137
|
+
}
|
|
138
|
+
// Handle retryable API errors
|
|
139
|
+
if (error instanceof RecallApiError && error.retryable) {
|
|
140
|
+
lastError = error;
|
|
141
|
+
if (attempt < this.maxRetries) {
|
|
142
|
+
await this.sleep(this.calculateBackoff(attempt));
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
// Non-retryable errors throw immediately
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// Should not reach here, but just in case
|
|
152
|
+
throw lastError ?? new RecallApiError('Unknown error', 'UNKNOWN_ERROR');
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Calculate exponential backoff delay
|
|
156
|
+
*/
|
|
157
|
+
calculateBackoff(attempt) {
|
|
158
|
+
// Exponential backoff: 1s, 2s, 4s, 8s...
|
|
159
|
+
const delay = this.retryBaseDelay * Math.pow(2, attempt);
|
|
160
|
+
// Add jitter (0-25% of delay)
|
|
161
|
+
const jitter = delay * Math.random() * 0.25;
|
|
162
|
+
return delay + jitter;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Sleep for a given number of milliseconds
|
|
166
|
+
*/
|
|
167
|
+
sleep(ms) {
|
|
168
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
169
|
+
}
|
|
170
|
+
// =========================================================================
|
|
171
|
+
// API Methods
|
|
172
|
+
// =========================================================================
|
|
173
|
+
/**
|
|
174
|
+
* Summarize a session transcript
|
|
175
|
+
* Called by saveSession tool after reading JSONL from disk
|
|
176
|
+
*/
|
|
177
|
+
async summarize(request) {
|
|
178
|
+
return this.request('POST', '/api/v1/summarize', request);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Save a session with manual input (not from transcript)
|
|
182
|
+
* Used when user provides summary directly via MCP tool
|
|
183
|
+
*/
|
|
184
|
+
async saveSession(repoId, data) {
|
|
185
|
+
return this.request('POST', `/api/v1/repos/${repoId}/sessions`, data);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Get context for a repository (context.md)
|
|
189
|
+
* Returns the distilled team brain for this repo
|
|
190
|
+
*/
|
|
191
|
+
async getContext(repoId) {
|
|
192
|
+
return this.request('GET', `/api/v1/repos/${repoId}/context`);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Get history for a repository (context.md + history.md)
|
|
196
|
+
* Returns more detail than getContext
|
|
197
|
+
*/
|
|
198
|
+
async getHistory(repoId) {
|
|
199
|
+
return this.request('GET', `/api/v1/repos/${repoId}/history`);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Get full transcripts for a repository
|
|
203
|
+
* WARNING: Can be very large, uses many tokens
|
|
204
|
+
*/
|
|
205
|
+
async getTranscripts(repoId) {
|
|
206
|
+
return this.request('GET', `/api/v1/repos/${repoId}/transcripts`);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Log a decision for a repository
|
|
210
|
+
*/
|
|
211
|
+
async logDecision(repoId, data) {
|
|
212
|
+
return this.request('POST', `/api/v1/repos/${repoId}/decisions`, data);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Get the encryption key for a team
|
|
216
|
+
* Used to decrypt content locally
|
|
217
|
+
*/
|
|
218
|
+
async getTeamKey(teamId) {
|
|
219
|
+
return this.request('GET', `/api/v1/teams/${teamId}/key`);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* List teams the user belongs to
|
|
223
|
+
*/
|
|
224
|
+
async listTeams() {
|
|
225
|
+
return this.request('GET', '/api/v1/teams');
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Get authentication status
|
|
229
|
+
*/
|
|
230
|
+
async getStatus() {
|
|
231
|
+
return this.request('GET', '/api/v1/status');
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Lookup or create repo by GitHub repo info
|
|
235
|
+
* Returns the repo ID for subsequent API calls
|
|
236
|
+
*/
|
|
237
|
+
async resolveRepo(fullName, defaultBranch) {
|
|
238
|
+
return this.request('POST', '/api/v1/repos/resolve', {
|
|
239
|
+
fullName,
|
|
240
|
+
defaultBranch,
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
exports.RecallApiClient = RecallApiClient;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recall Configuration Management
|
|
3
|
+
*
|
|
4
|
+
* Manages the local config file at ~/.recall/config.json.
|
|
5
|
+
* Handles secure storage of API tokens and team keys.
|
|
6
|
+
*/
|
|
7
|
+
import type { RecallConfig } from '@recall_v3/shared';
|
|
8
|
+
/**
|
|
9
|
+
* Get the path to the Recall config directory
|
|
10
|
+
*/
|
|
11
|
+
export declare function getConfigDir(): string;
|
|
12
|
+
/**
|
|
13
|
+
* Get the path to the config file
|
|
14
|
+
*/
|
|
15
|
+
export declare function getConfigPath(): string;
|
|
16
|
+
/**
|
|
17
|
+
* Load configuration from disk
|
|
18
|
+
* Returns a default config if the file doesn't exist
|
|
19
|
+
*/
|
|
20
|
+
export declare function loadConfig(): RecallConfig;
|
|
21
|
+
/**
|
|
22
|
+
* Save configuration to disk with secure permissions (0600)
|
|
23
|
+
*/
|
|
24
|
+
export declare function saveConfig(config: Partial<RecallConfig>): void;
|
|
25
|
+
/**
|
|
26
|
+
* Get the API base URL from config or environment
|
|
27
|
+
*/
|
|
28
|
+
export declare function getApiBaseUrl(): string;
|
|
29
|
+
/**
|
|
30
|
+
* Get the API token from config or environment
|
|
31
|
+
*/
|
|
32
|
+
export declare function getApiToken(): string | null;
|
|
33
|
+
/**
|
|
34
|
+
* Store the API token securely
|
|
35
|
+
*/
|
|
36
|
+
export declare function setApiToken(token: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Get the active team ID
|
|
39
|
+
*/
|
|
40
|
+
export declare function getActiveTeamId(): string | null;
|
|
41
|
+
/**
|
|
42
|
+
* Set the active team ID for this session
|
|
43
|
+
*/
|
|
44
|
+
export declare function setActiveTeamId(teamId: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Set the default team ID
|
|
47
|
+
*/
|
|
48
|
+
export declare function setDefaultTeamId(teamId: string): void;
|
|
49
|
+
/**
|
|
50
|
+
* Get a cached team encryption key
|
|
51
|
+
*/
|
|
52
|
+
export declare function getTeamKey(teamId: string): string | null;
|
|
53
|
+
/**
|
|
54
|
+
* Cache a team encryption key
|
|
55
|
+
*/
|
|
56
|
+
export declare function setTeamKey(teamId: string, key: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Update cached user info
|
|
59
|
+
*/
|
|
60
|
+
export declare function setUserInfo(user: {
|
|
61
|
+
id: string;
|
|
62
|
+
email: string | null;
|
|
63
|
+
githubUsername: string;
|
|
64
|
+
}): void;
|
|
65
|
+
/**
|
|
66
|
+
* Update last sync timestamp
|
|
67
|
+
*/
|
|
68
|
+
export declare function setLastSyncAt(timestamp: string): void;
|
|
69
|
+
/**
|
|
70
|
+
* Check if the user is authenticated (has a token)
|
|
71
|
+
*/
|
|
72
|
+
export declare function isAuthenticated(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Clear all authentication data (logout)
|
|
75
|
+
*/
|
|
76
|
+
export declare function clearAuth(): void;
|
|
77
|
+
/**
|
|
78
|
+
* Extended config interface for the MCP client
|
|
79
|
+
* Adds computed properties and convenience methods
|
|
80
|
+
*/
|
|
81
|
+
export interface ExtendedConfig extends RecallConfig {
|
|
82
|
+
apiBaseUrl: string;
|
|
83
|
+
isAuthenticated: boolean;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get the full extended config
|
|
87
|
+
*/
|
|
88
|
+
export declare function getExtendedConfig(): ExtendedConfig;
|
|
89
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAQtD;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAwCD;;;GAGG;AACH,wBAAgB,UAAU,IAAI,YAAY,CAwBzC;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAe9D;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAQtC;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,MAAM,GAAG,IAAI,CAS3C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAE/C;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAG/C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEpD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAErD;AAED;;GAEG;AACH,wBAAgB,UAAU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