@vybestack/llxprt-code-settings 0.10.0-nightly.260613.1adad3b34
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/.last_build +0 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/src/__tests__/SettingsService.test.d.ts +12 -0
- package/dist/src/__tests__/SettingsService.test.js +231 -0
- package/dist/src/__tests__/SettingsService.test.js.map +1 -0
- package/dist/src/__tests__/settingsRegistry.test.d.ts +15 -0
- package/dist/src/__tests__/settingsRegistry.test.js +471 -0
- package/dist/src/__tests__/settingsRegistry.test.js.map +1 -0
- package/dist/src/__tests__/settingsServiceInstance.test.d.ts +13 -0
- package/dist/src/__tests__/settingsServiceInstance.test.js +60 -0
- package/dist/src/__tests__/settingsServiceInstance.test.js.map +1 -0
- package/dist/src/index.d.ts +15 -0
- package/dist/src/index.js +14 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/profiles/ProfileManager.d.ts +91 -0
- package/dist/src/profiles/ProfileManager.js +328 -0
- package/dist/src/profiles/ProfileManager.js.map +1 -0
- package/dist/src/profiles/__tests__/ProfileManager.test.d.ts +12 -0
- package/dist/src/profiles/__tests__/ProfileManager.test.js +294 -0
- package/dist/src/profiles/__tests__/ProfileManager.test.js.map +1 -0
- package/dist/src/profiles/types.d.ts +196 -0
- package/dist/src/profiles/types.js +48 -0
- package/dist/src/profiles/types.js.map +1 -0
- package/dist/src/settings/SettingsService.d.ts +59 -0
- package/dist/src/settings/SettingsService.js +289 -0
- package/dist/src/settings/SettingsService.js.map +1 -0
- package/dist/src/settings/settingsRegistry.d.ts +72 -0
- package/dist/src/settings/settingsRegistry.js +1469 -0
- package/dist/src/settings/settingsRegistry.js.map +1 -0
- package/dist/src/settings/settingsServiceInstance.d.ts +21 -0
- package/dist/src/settings/settingsServiceInstance.js +34 -0
- package/dist/src/settings/settingsServiceInstance.js.map +1 -0
- package/dist/src/storage/Storage.d.ts +8 -0
- package/dist/src/storage/Storage.js +9 -0
- package/dist/src/storage/Storage.js.map +1 -0
- package/dist/src/storage/__tests__/Storage.test.d.ts +11 -0
- package/dist/src/storage/__tests__/Storage.test.js +160 -0
- package/dist/src/storage/__tests__/Storage.test.js.map +1 -0
- package/dist/src/types.d.ts +16 -0
- package/dist/src/types.js +16 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @plan PLAN-20260608-ISSUE1588.P04
|
|
3
|
+
* @requirement REQ-PROF-001
|
|
4
|
+
*
|
|
5
|
+
* Behavioral TDD tests for ProfileManager.
|
|
6
|
+
*
|
|
7
|
+
* These tests verify real temp filesystem JSON and path behavior.
|
|
8
|
+
* They use actual temp directories and verify file content.
|
|
9
|
+
* Tests fail against stubs because methods throw instead of performing
|
|
10
|
+
* real filesystem operations.
|
|
11
|
+
*/
|
|
12
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
13
|
+
import fs from 'fs/promises';
|
|
14
|
+
import os from 'os';
|
|
15
|
+
import path from 'path';
|
|
16
|
+
import { ProfileManager } from '../ProfileManager.js';
|
|
17
|
+
async function makeTempDir() {
|
|
18
|
+
return fs.mkdtemp(path.join(os.tmpdir(), 'llxprt-profile-test-'));
|
|
19
|
+
}
|
|
20
|
+
describe('ProfileManager — saveProfile and loadProfile', () => {
|
|
21
|
+
let tempDir;
|
|
22
|
+
let pm;
|
|
23
|
+
beforeEach(async () => {
|
|
24
|
+
tempDir = await makeTempDir();
|
|
25
|
+
pm = new ProfileManager(tempDir);
|
|
26
|
+
});
|
|
27
|
+
afterEach(async () => {
|
|
28
|
+
await fs.rm(tempDir, { recursive: true, force: true }).catch(() => { });
|
|
29
|
+
});
|
|
30
|
+
it('saves a profile as JSON to the profiles directory', async () => {
|
|
31
|
+
const profile = {
|
|
32
|
+
version: 1,
|
|
33
|
+
provider: 'openai',
|
|
34
|
+
model: 'gpt-4',
|
|
35
|
+
modelParams: { temperature: 0.7 },
|
|
36
|
+
ephemeralSettings: {},
|
|
37
|
+
};
|
|
38
|
+
await pm.saveProfile('test-profile', profile);
|
|
39
|
+
const filePath = path.join(tempDir, 'test-profile.json');
|
|
40
|
+
const content = await fs.readFile(filePath, 'utf8');
|
|
41
|
+
const parsed = JSON.parse(content);
|
|
42
|
+
expect(parsed.provider).toBe('openai');
|
|
43
|
+
expect(parsed.model).toBe('gpt-4');
|
|
44
|
+
expect(parsed.version).toBe(1);
|
|
45
|
+
});
|
|
46
|
+
it('loads a previously saved profile', async () => {
|
|
47
|
+
const profile = {
|
|
48
|
+
version: 1,
|
|
49
|
+
provider: 'anthropic',
|
|
50
|
+
model: 'claude-3',
|
|
51
|
+
modelParams: { temperature: 0.5 },
|
|
52
|
+
ephemeralSettings: { 'base-url': 'https://api.anthropic.com' },
|
|
53
|
+
};
|
|
54
|
+
await pm.saveProfile('my-profile', profile);
|
|
55
|
+
const loaded = await pm.loadProfile('my-profile');
|
|
56
|
+
expect(loaded.provider).toBe('anthropic');
|
|
57
|
+
expect(loaded.model).toBe('claude-3');
|
|
58
|
+
expect(loaded.version).toBe(1);
|
|
59
|
+
});
|
|
60
|
+
it('creates the profiles directory if it does not exist', async () => {
|
|
61
|
+
const nestedDir = path.join(tempDir, 'nested', 'profiles');
|
|
62
|
+
const nestedPm = new ProfileManager(nestedDir);
|
|
63
|
+
const profile = {
|
|
64
|
+
version: 1,
|
|
65
|
+
provider: 'openai',
|
|
66
|
+
model: 'gpt-4',
|
|
67
|
+
modelParams: {},
|
|
68
|
+
ephemeralSettings: {},
|
|
69
|
+
};
|
|
70
|
+
await nestedPm.saveProfile('test', profile);
|
|
71
|
+
const stat = await fs.stat(nestedDir);
|
|
72
|
+
expect(stat.isDirectory()).toBe(true);
|
|
73
|
+
});
|
|
74
|
+
it('throws when loading a nonexistent profile', async () => {
|
|
75
|
+
await expect(pm.loadProfile('nonexistent')).rejects.toThrow('not found');
|
|
76
|
+
});
|
|
77
|
+
it('persists JSON with pretty-printed formatting', async () => {
|
|
78
|
+
const profile = {
|
|
79
|
+
version: 1,
|
|
80
|
+
provider: 'openai',
|
|
81
|
+
model: 'gpt-4',
|
|
82
|
+
modelParams: {},
|
|
83
|
+
ephemeralSettings: {},
|
|
84
|
+
};
|
|
85
|
+
await pm.saveProfile('pretty', profile);
|
|
86
|
+
const filePath = path.join(tempDir, 'pretty.json');
|
|
87
|
+
const content = await fs.readFile(filePath, 'utf8');
|
|
88
|
+
// Pretty-printed JSON has newlines and indentation
|
|
89
|
+
expect(content).toContain('\n');
|
|
90
|
+
expect(content).toContain(' ');
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
describe('ProfileManager — listProfiles', () => {
|
|
94
|
+
let tempDir;
|
|
95
|
+
let pm;
|
|
96
|
+
beforeEach(async () => {
|
|
97
|
+
tempDir = await makeTempDir();
|
|
98
|
+
pm = new ProfileManager(tempDir);
|
|
99
|
+
});
|
|
100
|
+
afterEach(async () => {
|
|
101
|
+
await fs.rm(tempDir, { recursive: true, force: true }).catch(() => { });
|
|
102
|
+
});
|
|
103
|
+
it('returns empty array when no profiles exist', async () => {
|
|
104
|
+
const profiles = await pm.listProfiles();
|
|
105
|
+
expect(profiles).toStrictEqual([]);
|
|
106
|
+
});
|
|
107
|
+
it('lists saved profile names without .json extension', async () => {
|
|
108
|
+
const profile = {
|
|
109
|
+
version: 1,
|
|
110
|
+
provider: 'openai',
|
|
111
|
+
model: 'gpt-4',
|
|
112
|
+
modelParams: {},
|
|
113
|
+
ephemeralSettings: {},
|
|
114
|
+
};
|
|
115
|
+
await pm.saveProfile('alpha', profile);
|
|
116
|
+
await pm.saveProfile('beta', profile);
|
|
117
|
+
const profiles = await pm.listProfiles();
|
|
118
|
+
expect(profiles).toContain('alpha');
|
|
119
|
+
expect(profiles).toContain('beta');
|
|
120
|
+
});
|
|
121
|
+
it('does not include non-JSON files', async () => {
|
|
122
|
+
await fs.writeFile(path.join(tempDir, 'readme.txt'), 'hello', 'utf8');
|
|
123
|
+
const profile = {
|
|
124
|
+
version: 1,
|
|
125
|
+
provider: 'openai',
|
|
126
|
+
model: 'gpt-4',
|
|
127
|
+
modelParams: {},
|
|
128
|
+
ephemeralSettings: {},
|
|
129
|
+
};
|
|
130
|
+
await pm.saveProfile('real-profile', profile);
|
|
131
|
+
const profiles = await pm.listProfiles();
|
|
132
|
+
expect(profiles).toContain('real-profile');
|
|
133
|
+
expect(profiles).not.toContain('readme');
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
describe('ProfileManager — deleteProfile', () => {
|
|
137
|
+
let tempDir;
|
|
138
|
+
let pm;
|
|
139
|
+
beforeEach(async () => {
|
|
140
|
+
tempDir = await makeTempDir();
|
|
141
|
+
pm = new ProfileManager(tempDir);
|
|
142
|
+
});
|
|
143
|
+
afterEach(async () => {
|
|
144
|
+
await fs.rm(tempDir, { recursive: true, force: true }).catch(() => { });
|
|
145
|
+
});
|
|
146
|
+
it('deletes an existing profile', async () => {
|
|
147
|
+
const profile = {
|
|
148
|
+
version: 1,
|
|
149
|
+
provider: 'openai',
|
|
150
|
+
model: 'gpt-4',
|
|
151
|
+
modelParams: {},
|
|
152
|
+
ephemeralSettings: {},
|
|
153
|
+
};
|
|
154
|
+
await pm.saveProfile('to-delete', profile);
|
|
155
|
+
await pm.deleteProfile('to-delete');
|
|
156
|
+
const filePath = path.join(tempDir, 'to-delete.json');
|
|
157
|
+
await expect(fs.access(filePath)).rejects.toThrow('ENOENT');
|
|
158
|
+
});
|
|
159
|
+
it('throws when deleting a nonexistent profile', async () => {
|
|
160
|
+
await expect(pm.deleteProfile('nonexistent')).rejects.toThrow('not found');
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
describe('ProfileManager — profileExists', () => {
|
|
164
|
+
let tempDir;
|
|
165
|
+
let pm;
|
|
166
|
+
beforeEach(async () => {
|
|
167
|
+
tempDir = await makeTempDir();
|
|
168
|
+
pm = new ProfileManager(tempDir);
|
|
169
|
+
});
|
|
170
|
+
afterEach(async () => {
|
|
171
|
+
await fs.rm(tempDir, { recursive: true, force: true }).catch(() => { });
|
|
172
|
+
});
|
|
173
|
+
it('returns true for an existing profile', async () => {
|
|
174
|
+
const profile = {
|
|
175
|
+
version: 1,
|
|
176
|
+
provider: 'openai',
|
|
177
|
+
model: 'gpt-4',
|
|
178
|
+
modelParams: {},
|
|
179
|
+
ephemeralSettings: {},
|
|
180
|
+
};
|
|
181
|
+
await pm.saveProfile('exists', profile);
|
|
182
|
+
expect(await pm.profileExists('exists')).toBe(true);
|
|
183
|
+
});
|
|
184
|
+
it('returns false for a nonexistent profile', async () => {
|
|
185
|
+
expect(await pm.profileExists('nonexistent')).toBe(false);
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
describe('ProfileManager — save and load with SettingsService', () => {
|
|
189
|
+
let tempDir;
|
|
190
|
+
let pm;
|
|
191
|
+
beforeEach(async () => {
|
|
192
|
+
tempDir = await makeTempDir();
|
|
193
|
+
pm = new ProfileManager(tempDir);
|
|
194
|
+
});
|
|
195
|
+
afterEach(async () => {
|
|
196
|
+
await fs.rm(tempDir, { recursive: true, force: true }).catch(() => { });
|
|
197
|
+
});
|
|
198
|
+
it('save persists profile data from a settings-like object', async () => {
|
|
199
|
+
// Minimal mock that satisfies the save() contract
|
|
200
|
+
const mockSettingsService = {
|
|
201
|
+
exportForProfile: async () => ({
|
|
202
|
+
defaultProvider: 'openai',
|
|
203
|
+
providers: {
|
|
204
|
+
openai: { model: 'gpt-4', temperature: 0.7 },
|
|
205
|
+
},
|
|
206
|
+
tools: { allowed: [], disabled: [] },
|
|
207
|
+
}),
|
|
208
|
+
setCurrentProfileName: (_name) => { },
|
|
209
|
+
};
|
|
210
|
+
await pm.save('round-trip', mockSettingsService);
|
|
211
|
+
// Verify file was created with correct content
|
|
212
|
+
const filePath = path.join(tempDir, 'round-trip.json');
|
|
213
|
+
const content = await fs.readFile(filePath, 'utf8');
|
|
214
|
+
const parsed = JSON.parse(content);
|
|
215
|
+
expect(parsed.provider).toBe('openai');
|
|
216
|
+
expect(parsed.model).toBe('gpt-4');
|
|
217
|
+
});
|
|
218
|
+
it('load reads a profile file from disk', async () => {
|
|
219
|
+
// First manually save a profile
|
|
220
|
+
const profile = {
|
|
221
|
+
version: 1,
|
|
222
|
+
provider: 'anthropic',
|
|
223
|
+
model: 'claude-3',
|
|
224
|
+
modelParams: { temperature: 0.5 },
|
|
225
|
+
ephemeralSettings: {},
|
|
226
|
+
};
|
|
227
|
+
await pm.saveProfile('load-target', profile);
|
|
228
|
+
// Then load it through the load() method
|
|
229
|
+
const appliedData = {};
|
|
230
|
+
const mockSettingsService = {
|
|
231
|
+
setCurrentProfileName: (name) => {
|
|
232
|
+
appliedData['currentProfile'] = name;
|
|
233
|
+
},
|
|
234
|
+
importFromProfile: async (data) => {
|
|
235
|
+
appliedData['imported'] = data;
|
|
236
|
+
},
|
|
237
|
+
set: (key, value) => {
|
|
238
|
+
appliedData[key] = value;
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
await pm.load('load-target', mockSettingsService);
|
|
242
|
+
expect(appliedData['currentProfile']).toBe('load-target');
|
|
243
|
+
});
|
|
244
|
+
it('save persists auth-keyfile in ephemeralSettings', async () => {
|
|
245
|
+
const mockSettingsService = {
|
|
246
|
+
exportForProfile: async () => ({
|
|
247
|
+
defaultProvider: 'openai',
|
|
248
|
+
providers: {
|
|
249
|
+
openai: {
|
|
250
|
+
model: 'gpt-4',
|
|
251
|
+
'auth-key': 'sk-secret',
|
|
252
|
+
'auth-keyfile': '/path/to/keyfile',
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
tools: { allowed: [], disabled: [] },
|
|
256
|
+
}),
|
|
257
|
+
setCurrentProfileName: (_name) => { },
|
|
258
|
+
};
|
|
259
|
+
await pm.save('authfile-profile', mockSettingsService);
|
|
260
|
+
const filePath = path.join(tempDir, 'authfile-profile.json');
|
|
261
|
+
const content = await fs.readFile(filePath, 'utf8');
|
|
262
|
+
const parsed = JSON.parse(content);
|
|
263
|
+
expect(parsed.ephemeralSettings['auth-key']).toBe('sk-secret');
|
|
264
|
+
expect(parsed.ephemeralSettings['auth-keyfile']).toBe('/path/to/keyfile');
|
|
265
|
+
});
|
|
266
|
+
it('load round-trips auth-keyfile back to settings', async () => {
|
|
267
|
+
const profile = {
|
|
268
|
+
version: 1,
|
|
269
|
+
provider: 'openai',
|
|
270
|
+
model: 'gpt-4',
|
|
271
|
+
modelParams: {},
|
|
272
|
+
ephemeralSettings: {
|
|
273
|
+
'auth-key': 'sk-roundtrip',
|
|
274
|
+
'auth-keyfile': '/roundtrip/keyfile',
|
|
275
|
+
},
|
|
276
|
+
};
|
|
277
|
+
await pm.saveProfile('rt-keyfile', profile);
|
|
278
|
+
let importedData;
|
|
279
|
+
const mockSettingsService = {
|
|
280
|
+
setCurrentProfileName: () => { },
|
|
281
|
+
importFromProfile: async (data) => {
|
|
282
|
+
importedData = data;
|
|
283
|
+
},
|
|
284
|
+
set: () => { },
|
|
285
|
+
};
|
|
286
|
+
await pm.load('rt-keyfile', mockSettingsService);
|
|
287
|
+
expect(importedData).toBeDefined();
|
|
288
|
+
const imported = importedData;
|
|
289
|
+
const providers = imported.providers;
|
|
290
|
+
expect(providers.openai['auth-key']).toBe('sk-roundtrip');
|
|
291
|
+
expect(providers.openai['auth-keyfile']).toBe('/roundtrip/keyfile');
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
//# sourceMappingURL=ProfileManager.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProfileManager.test.js","sourceRoot":"","sources":["../../../../src/profiles/__tests__/ProfileManager.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,MAAM,aAAa,CAAC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
|
5
|
+
* Explicit temporary duplicate; core copy remains until P09.
|
|
6
|
+
*
|
|
7
|
+
* Settings-owned: does NOT import core types.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
/**
|
|
11
|
+
* OAuth bucket authentication configuration
|
|
12
|
+
*/
|
|
13
|
+
export interface AuthConfig {
|
|
14
|
+
type: 'oauth' | 'apikey';
|
|
15
|
+
buckets?: string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Zod schema for AuthConfig validation
|
|
19
|
+
*/
|
|
20
|
+
export declare const AuthConfigSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
21
|
+
type: z.ZodLiteral<"oauth">;
|
|
22
|
+
buckets: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
type: "oauth";
|
|
25
|
+
buckets?: string[] | undefined;
|
|
26
|
+
}, {
|
|
27
|
+
type: "oauth";
|
|
28
|
+
buckets?: string[] | undefined;
|
|
29
|
+
}>, z.ZodObject<{
|
|
30
|
+
type: z.ZodLiteral<"apikey">;
|
|
31
|
+
}, "strict", z.ZodTypeAny, {
|
|
32
|
+
type: "apikey";
|
|
33
|
+
}, {
|
|
34
|
+
type: "apikey";
|
|
35
|
+
}>]>;
|
|
36
|
+
/**
|
|
37
|
+
* Parameters that are sent directly to the model API
|
|
38
|
+
*/
|
|
39
|
+
export interface ModelParams {
|
|
40
|
+
/** Sampling temperature (0-2 for OpenAI) */
|
|
41
|
+
temperature?: number;
|
|
42
|
+
/** Maximum tokens to generate */
|
|
43
|
+
max_tokens?: number;
|
|
44
|
+
/** Nucleus sampling parameter */
|
|
45
|
+
top_p?: number;
|
|
46
|
+
/** Top-k sampling parameter */
|
|
47
|
+
top_k?: number;
|
|
48
|
+
/** Presence penalty (-2 to 2) */
|
|
49
|
+
presence_penalty?: number;
|
|
50
|
+
/** Frequency penalty (-2 to 2) */
|
|
51
|
+
frequency_penalty?: number;
|
|
52
|
+
/** Random seed for reproducibility */
|
|
53
|
+
seed?: number;
|
|
54
|
+
/** Additional provider-specific parameters */
|
|
55
|
+
[key: string]: unknown;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Settings that affect client behavior, not sent to API
|
|
59
|
+
*/
|
|
60
|
+
export interface EphemeralSettings {
|
|
61
|
+
'context-limit'?: number;
|
|
62
|
+
'compression-threshold'?: number;
|
|
63
|
+
'auth-key'?: string;
|
|
64
|
+
'auth-keyfile'?: string;
|
|
65
|
+
'auth-key-name'?: string;
|
|
66
|
+
'base-url'?: string;
|
|
67
|
+
'sandbox-base-url'?: string;
|
|
68
|
+
'requires-auth'?: boolean;
|
|
69
|
+
'tool-format'?: string;
|
|
70
|
+
'api-version'?: string;
|
|
71
|
+
'custom-headers'?: Record<string, string>;
|
|
72
|
+
'tool-output-max-items'?: number;
|
|
73
|
+
'tool-output-max-tokens'?: number;
|
|
74
|
+
'tool-output-truncate-mode'?: 'warn' | 'truncate' | 'sample';
|
|
75
|
+
'tool-output-item-size-limit'?: number;
|
|
76
|
+
'max-prompt-tokens'?: number;
|
|
77
|
+
'disabled-tools'?: string[];
|
|
78
|
+
'shell-replacement'?: 'allowlist' | 'all' | 'none' | boolean;
|
|
79
|
+
'todo-continuation'?: boolean;
|
|
80
|
+
'socket-timeout'?: number;
|
|
81
|
+
'socket-keepalive'?: boolean;
|
|
82
|
+
'socket-nodelay'?: boolean;
|
|
83
|
+
streaming?: 'enabled' | 'disabled';
|
|
84
|
+
retries?: number;
|
|
85
|
+
retrywait?: number;
|
|
86
|
+
'auth-retry-timeout'?: number;
|
|
87
|
+
authOnly?: boolean;
|
|
88
|
+
'tools.allowed'?: string[];
|
|
89
|
+
'tools.disabled'?: string[];
|
|
90
|
+
GOOGLE_CLOUD_PROJECT?: string;
|
|
91
|
+
GOOGLE_CLOUD_LOCATION?: string;
|
|
92
|
+
'include-folder-structure'?: boolean;
|
|
93
|
+
'prompt-caching'?: 'off' | '5m' | '1h' | '24h';
|
|
94
|
+
'enable-tool-prompts'?: boolean;
|
|
95
|
+
'rate-limit-throttle'?: 'on' | 'off';
|
|
96
|
+
'rate-limit-throttle-threshold'?: number;
|
|
97
|
+
'rate-limit-max-wait'?: number;
|
|
98
|
+
'task-default-timeout-seconds'?: number;
|
|
99
|
+
'task-max-timeout-seconds'?: number;
|
|
100
|
+
'shell-default-timeout-seconds'?: number;
|
|
101
|
+
'shell-max-timeout-seconds'?: number;
|
|
102
|
+
'shell-inactivity-timeout-seconds'?: number;
|
|
103
|
+
tpm_threshold?: number;
|
|
104
|
+
timeout_ms?: number;
|
|
105
|
+
circuit_breaker_enabled?: boolean;
|
|
106
|
+
circuit_breaker_failure_threshold?: number;
|
|
107
|
+
circuit_breaker_failure_window_ms?: number;
|
|
108
|
+
circuit_breaker_recovery_timeout_ms?: number;
|
|
109
|
+
'stream-options'?: Record<string, unknown>;
|
|
110
|
+
maxTurnsPerPrompt?: number;
|
|
111
|
+
loopDetectionEnabled?: boolean;
|
|
112
|
+
toolCallLoopThreshold?: number;
|
|
113
|
+
contentLoopThreshold?: number;
|
|
114
|
+
dumpcontext?: 'now' | 'status' | 'on' | 'error' | 'off';
|
|
115
|
+
dumponerror?: 'enabled' | 'disabled';
|
|
116
|
+
emojifilter?: 'allowed' | 'auto' | 'warn' | 'error';
|
|
117
|
+
'reasoning.enabled'?: boolean;
|
|
118
|
+
'reasoning.effort'?: 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
119
|
+
'reasoning.maxTokens'?: number;
|
|
120
|
+
'reasoning.budgetTokens'?: number;
|
|
121
|
+
'reasoning.adaptiveThinking'?: boolean;
|
|
122
|
+
'reasoning.includeInResponse'?: boolean;
|
|
123
|
+
'reasoning.includeInContext'?: boolean;
|
|
124
|
+
'reasoning.stripFromContext'?: 'all' | 'allButLast' | 'none';
|
|
125
|
+
'reasoning.format'?: 'native' | 'field';
|
|
126
|
+
'compression.strategy'?: string;
|
|
127
|
+
'compression.profile'?: string;
|
|
128
|
+
'compression.density.readWritePruning'?: boolean;
|
|
129
|
+
'compression.density.fileDedupe'?: boolean;
|
|
130
|
+
'compression.density.recencyPruning'?: boolean;
|
|
131
|
+
'compression.density.recencyRetention'?: number;
|
|
132
|
+
'compression.density.compressHeadroom'?: number;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Sub-profile configuration for load balancing
|
|
136
|
+
*/
|
|
137
|
+
export interface LoadBalancerSubProfileConfig {
|
|
138
|
+
name: string;
|
|
139
|
+
provider: string;
|
|
140
|
+
model?: string;
|
|
141
|
+
baseURL?: string;
|
|
142
|
+
apiKey?: string;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Load balancer configuration
|
|
146
|
+
*/
|
|
147
|
+
export interface LoadBalancerConfig {
|
|
148
|
+
strategy: 'round-robin';
|
|
149
|
+
subProfiles: LoadBalancerSubProfileConfig[];
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Standard profile configuration (single model)
|
|
153
|
+
*/
|
|
154
|
+
export interface StandardProfile {
|
|
155
|
+
version: 1;
|
|
156
|
+
type?: 'standard';
|
|
157
|
+
provider: string;
|
|
158
|
+
model: string;
|
|
159
|
+
modelParams: ModelParams;
|
|
160
|
+
ephemeralSettings: EphemeralSettings;
|
|
161
|
+
loadBalancer?: LoadBalancerConfig;
|
|
162
|
+
auth?: AuthConfig;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Load balancer profile configuration (multiple profiles)
|
|
166
|
+
*/
|
|
167
|
+
export interface LoadBalancerProfile {
|
|
168
|
+
version: 1;
|
|
169
|
+
type: 'loadbalancer';
|
|
170
|
+
policy: 'roundrobin' | 'failover';
|
|
171
|
+
profiles: string[];
|
|
172
|
+
provider: string;
|
|
173
|
+
model: string;
|
|
174
|
+
modelParams: ModelParams;
|
|
175
|
+
ephemeralSettings: EphemeralSettings;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Complete profile configuration (union type)
|
|
179
|
+
*/
|
|
180
|
+
export type Profile = StandardProfile | LoadBalancerProfile;
|
|
181
|
+
/**
|
|
182
|
+
* Type guard to check if a profile is a load balancer profile
|
|
183
|
+
*/
|
|
184
|
+
export declare function isLoadBalancerProfile(profile: Profile): profile is LoadBalancerProfile;
|
|
185
|
+
/**
|
|
186
|
+
* Type guard to check if a profile is a standard profile
|
|
187
|
+
*/
|
|
188
|
+
export declare function isStandardProfile(profile: Profile): profile is StandardProfile;
|
|
189
|
+
/**
|
|
190
|
+
* Type guard to check if a profile has auth configuration
|
|
191
|
+
*/
|
|
192
|
+
export declare function hasAuthConfig(profile: Profile): boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Type guard to check if a profile is OAuth-based
|
|
195
|
+
*/
|
|
196
|
+
export declare function isOAuthProfile(profile: Profile): boolean;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @plan PLAN-20260608-ISSUE1588.P05
|
|
3
|
+
*
|
|
4
|
+
* Profile types — migrated from core modelParams.
|
|
5
|
+
* Explicit temporary duplicate; core copy remains until P09.
|
|
6
|
+
*
|
|
7
|
+
* Settings-owned: does NOT import core types.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
/**
|
|
11
|
+
* Zod schema for AuthConfig validation
|
|
12
|
+
*/
|
|
13
|
+
export const AuthConfigSchema = z.discriminatedUnion('type', [
|
|
14
|
+
z.object({
|
|
15
|
+
type: z.literal('oauth'),
|
|
16
|
+
buckets: z.array(z.string()).optional(),
|
|
17
|
+
}),
|
|
18
|
+
z
|
|
19
|
+
.object({
|
|
20
|
+
type: z.literal('apikey'),
|
|
21
|
+
})
|
|
22
|
+
.strict(),
|
|
23
|
+
]);
|
|
24
|
+
/**
|
|
25
|
+
* Type guard to check if a profile is a load balancer profile
|
|
26
|
+
*/
|
|
27
|
+
export function isLoadBalancerProfile(profile) {
|
|
28
|
+
return profile.type === 'loadbalancer';
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Type guard to check if a profile is a standard profile
|
|
32
|
+
*/
|
|
33
|
+
export function isStandardProfile(profile) {
|
|
34
|
+
return profile.type !== 'loadbalancer';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Type guard to check if a profile has auth configuration
|
|
38
|
+
*/
|
|
39
|
+
export function hasAuthConfig(profile) {
|
|
40
|
+
return isStandardProfile(profile) && profile.auth !== undefined;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Type guard to check if a profile is OAuth-based
|
|
44
|
+
*/
|
|
45
|
+
export function isOAuthProfile(profile) {
|
|
46
|
+
return isStandardProfile(profile) && profile.auth?.type === 'oauth';
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/profiles/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC3D,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;QACxB,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;KACxC,CAAC;IACF,CAAC;SACE,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;KAC1B,CAAC;SACD,MAAM,EAAE;CACZ,CAAC,CAAC;AA0JH;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAgB;IAEhB,OAAO,OAAO,CAAC,IAAI,KAAK,cAAc,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAgB;IAEhB,OAAO,OAAO,CAAC,IAAI,KAAK,cAAc,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,OAAO,iBAAiB,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC;AAClE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,OAAO,iBAAiB,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @plan PLAN-20260608-ISSUE1588.P05
|
|
3
|
+
*
|
|
4
|
+
* SettingsService — migrated from core.
|
|
5
|
+
* Explicit temporary duplicate; core copy remains until P09.
|
|
6
|
+
*/
|
|
7
|
+
import { EventEmitter } from 'events';
|
|
8
|
+
interface SettingsChangeEvent {
|
|
9
|
+
key: string;
|
|
10
|
+
oldValue: unknown;
|
|
11
|
+
newValue: unknown;
|
|
12
|
+
}
|
|
13
|
+
interface ProviderSettingsChangeEvent extends SettingsChangeEvent {
|
|
14
|
+
provider: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class SettingsService extends EventEmitter {
|
|
17
|
+
private settings;
|
|
18
|
+
private eventEmitter;
|
|
19
|
+
constructor();
|
|
20
|
+
get(key: string): unknown;
|
|
21
|
+
set(key: string, value: unknown): void;
|
|
22
|
+
getProviderSettings(provider: string): Record<string, unknown>;
|
|
23
|
+
setProviderSetting(provider: string, key: string, value: unknown): void;
|
|
24
|
+
clear(): void;
|
|
25
|
+
getAllGlobalSettings(): Record<string, unknown>;
|
|
26
|
+
private getNestedValue;
|
|
27
|
+
private setNestedValue;
|
|
28
|
+
on(event: 'change', listener: (event: SettingsChangeEvent) => void): this;
|
|
29
|
+
on(event: 'provider-change', listener: (event: ProviderSettingsChangeEvent) => void): this;
|
|
30
|
+
on(event: 'cleared', listener: () => void): this;
|
|
31
|
+
on(event: 'settings-changed', listener: () => void): this;
|
|
32
|
+
on(event: string | symbol, listener: (...args: unknown[]) => void): this;
|
|
33
|
+
off(event: 'change', listener: (event: SettingsChangeEvent) => void): this;
|
|
34
|
+
off(event: 'provider-change', listener: (event: ProviderSettingsChangeEvent) => void): this;
|
|
35
|
+
off(event: 'cleared', listener: () => void): this;
|
|
36
|
+
off(event: 'settings-changed', listener: () => void): this;
|
|
37
|
+
off(event: string, listener: (...args: unknown[]) => void): this;
|
|
38
|
+
getSettings(): Promise<Record<string, unknown>>;
|
|
39
|
+
getSettings(provider: string): Promise<Record<string, unknown>>;
|
|
40
|
+
updateSettings(changes: Record<string, unknown>): Promise<void>;
|
|
41
|
+
updateSettings(provider: string, changes: Record<string, unknown>): Promise<void>;
|
|
42
|
+
switchProvider(newProvider: string): Promise<void>;
|
|
43
|
+
exportForProfile(): Promise<{
|
|
44
|
+
defaultProvider: string;
|
|
45
|
+
providers: {
|
|
46
|
+
[x: string]: Record<string, unknown>;
|
|
47
|
+
};
|
|
48
|
+
tools: {
|
|
49
|
+
allowed: string[];
|
|
50
|
+
disabled: string[];
|
|
51
|
+
};
|
|
52
|
+
}>;
|
|
53
|
+
importFromProfile(profileData: unknown): Promise<void>;
|
|
54
|
+
setCurrentProfileName(profileName: string | null): void;
|
|
55
|
+
getCurrentProfileName(): string | null;
|
|
56
|
+
getDiagnosticsData(): Promise<Record<string, unknown>>;
|
|
57
|
+
onSettingsChanged(listener: (event: Record<string, unknown>) => void): () => void;
|
|
58
|
+
}
|
|
59
|
+
export {};
|