@namzu/cli 1.0.1 → 2.0.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/cli.d.ts.map +1 -1
- package/dist/cli.js +0 -2
- package/dist/cli.js.map +1 -1
- package/dist/cli.test.js +9 -1
- package/dist/cli.test.js.map +1 -1
- package/dist/integrations/providers/index.d.ts +0 -3
- package/dist/integrations/providers/index.d.ts.map +1 -1
- package/dist/integrations/providers/index.js +0 -5
- package/dist/integrations/providers/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/commands/providers.d.ts +0 -17
- package/dist/commands/providers.d.ts.map +0 -1
- package/dist/commands/providers.js +0 -274
- package/dist/commands/providers.js.map +0 -1
- package/dist/integrations/providers/mask.d.ts +0 -7
- package/dist/integrations/providers/mask.d.ts.map +0 -1
- package/dist/integrations/providers/mask.js +0 -14
- package/dist/integrations/providers/mask.js.map +0 -1
- package/dist/integrations/providers/mask.test.d.ts +0 -2
- package/dist/integrations/providers/mask.test.d.ts.map +0 -1
- package/dist/integrations/providers/mask.test.js +0 -20
- package/dist/integrations/providers/mask.test.js.map +0 -1
- package/dist/integrations/providers/schema.d.ts +0 -73
- package/dist/integrations/providers/schema.d.ts.map +0 -1
- package/dist/integrations/providers/schema.js +0 -70
- package/dist/integrations/providers/schema.js.map +0 -1
- package/dist/integrations/providers/schema.test.d.ts +0 -2
- package/dist/integrations/providers/schema.test.d.ts.map +0 -1
- package/dist/integrations/providers/schema.test.js +0 -43
- package/dist/integrations/providers/schema.test.js.map +0 -1
- package/dist/integrations/providers/store.d.ts +0 -32
- package/dist/integrations/providers/store.d.ts.map +0 -1
- package/dist/integrations/providers/store.js +0 -133
- package/dist/integrations/providers/store.js.map +0 -1
- package/dist/integrations/providers/store.test.d.ts +0 -2
- package/dist/integrations/providers/store.test.d.ts.map +0 -1
- package/dist/integrations/providers/store.test.js +0 -135
- package/dist/integrations/providers/store.test.js.map +0 -1
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA+CH,MAAM,WAAW,aAAa;IAC7B,iFAAiF;IACjF,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAChC;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAwGjE"}
|
package/dist/cli.js
CHANGED
|
@@ -12,7 +12,6 @@ import { fileURLToPath } from 'node:url';
|
|
|
12
12
|
import { Command, CommanderError } from 'commander';
|
|
13
13
|
import { doctorCommand } from './commands/doctor.js';
|
|
14
14
|
import { evalCommand } from './commands/eval.js';
|
|
15
|
-
import { providersCommand } from './commands/providers.js';
|
|
16
15
|
import { registerAll } from './commands/registry.js';
|
|
17
16
|
import { historyCommand, providersJSONCommand, runStreamCommand, skillsJSONCommand, } from './commands/run-stream.js';
|
|
18
17
|
import { runCommand } from './commands/run.js';
|
|
@@ -75,7 +74,6 @@ export async function runCli(opts) {
|
|
|
75
74
|
};
|
|
76
75
|
registerAll(program, [
|
|
77
76
|
doctorCommand,
|
|
78
|
-
providersCommand,
|
|
79
77
|
runCommand,
|
|
80
78
|
evalCommand,
|
|
81
79
|
runStreamCommand,
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,E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AC,CAAA;QAC9B,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CACnB,UAAU,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAC7E,CAAA;QACD,OAAO,mBAAmB,CAAA;IAC3B,CAAC;AACF,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAmB;IAC7C,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,yBAAyB,CAAC;QAC/B,KAAK,gBAAgB,CAAC;QACtB,KAAK,mBAAmB;YACvB,OAAO,CAAC,CAAA;QACT,KAAK,0BAA0B,CAAC;QAChC,KAAK,yBAAyB,CAAC;QAC/B,KAAK,2BAA2B,CAAC;QACjC,KAAK,uCAAuC,CAAC;QAC7C,KAAK,2BAA2B,CAAC;QACjC,KAAK,iCAAiC,CAAC;QACvC,KAAK,2BAA2B;YAC/B,OAAO,QAAQ,CAAA;QAChB;YACC,OAAO,mBAAmB,CAAA;IAC5B,CAAC;AACF,CAAC"}
|
package/dist/cli.test.js
CHANGED
|
@@ -30,7 +30,15 @@ describe('runCli', () => {
|
|
|
30
30
|
// Commander prints help to stdout.
|
|
31
31
|
expect(stdout).toContain('namzu');
|
|
32
32
|
expect(stdout).toContain('doctor');
|
|
33
|
-
|
|
33
|
+
// `providers-json` is a command; bare `providers` is not, and the
|
|
34
|
+
// difference is invisible to `toContain('providers')` — that assertion
|
|
35
|
+
// stayed green through the removal of the `providers` profile command
|
|
36
|
+
// because `providers-json` contains it as a prefix. This is the same
|
|
37
|
+
// trap `tools` fell into below, so it is anchored the same way: the
|
|
38
|
+
// sibling must be present, and the removed command must be absent as a
|
|
39
|
+
// command rather than as a substring.
|
|
40
|
+
expect(stdout).toMatch(/^\s+providers-json\b/m);
|
|
41
|
+
expect(stdout).not.toMatch(/^\s+providers\s/m);
|
|
34
42
|
expect(stdout).toContain('skills');
|
|
35
43
|
expect(stdout).toContain('serve');
|
|
36
44
|
// `tools` was asserted here until the peer-daemon removal deleted the
|
package/dist/cli.test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.test.js","sourceRoot":"","sources":["../src/cli.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEpE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACvB,IAAI,MAAc,CAAA;IAClB,IAAI,MAAc,CAAA;IAClB,IAAI,mBAAgD,CAAA;IACpD,IAAI,mBAAgD,CAAA;IAEpD,UAAU,CAAC,GAAG,EAAE;QACf,MAAM,GAAG,EAAE,CAAA;QACX,MAAM,GAAG,EAAE,CAAA;QACX,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAC/D,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAC/D,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,KAA0B,EAAW,EAAE;YAC/D,MAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;YACjF,OAAO,IAAI,CAAA;QACZ,CAAC,CAAgC,CAAA;QACjC,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,KAA0B,EAAW,EAAE;YAC/D,MAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CA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AE,CAAC,CAAA;QACrB,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,8BAA8B,CAAC,CAAA;IACzD,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
export { type DetectedProvider, type DetectionSource, type DiscoverOptions, discoverProviders, findDetected, } from './discover.js';
|
|
2
2
|
export { type AgentOAuthCredential, isAnthropicOAuthToken, readAgentKeychainCredential, } from './keychain.js';
|
|
3
|
-
export { maskSecret } from './mask.js';
|
|
4
3
|
export { ensureFreshAnthropicToken, type OAuthMetadata, refreshAgentOAuthToken, } from './oauth.js';
|
|
5
4
|
export { type Preferences, PREFERENCES_FILE_VERSION, PreferencesError, preferencesPath, type ReadResult, readPreferences, writePreferences, } from './preferences.js';
|
|
6
5
|
export { ALL_PROVIDER_IDS, PROVIDER_REGISTRY, type ProviderId, type ProviderRegistryEntry, type SdkProviderType, } from './registry.js';
|
|
7
|
-
export { type AnthropicProfile, type BaseProfile, type BedrockProfile, type HttpProfile, type LMStudioProfile, type OllamaProfile, type OpenAIProfile, type OpenRouterProfile, PROVIDER_TYPES, type ProviderProfile, type ProviderType, type ProvidersFile, PROVIDERS_FILE_VERSION, ProfileValidationError, TYPE_ENV_FALLBACK, isProviderType, validateProfile, } from './schema.js';
|
|
8
|
-
export { ProvidersStoreError, assertInvariants, findDefault, providersPath, readProfiles, resolveApiKey, writeProfiles, } from './store.js';
|
|
9
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,iBAAiB,EACjB,YAAY,GACZ,MAAM,eAAe,CAAA;AACtB,OAAO,EACN,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,2BAA2B,GAC3B,MAAM,eAAe,CAAA;AACtB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,iBAAiB,EACjB,YAAY,GACZ,MAAM,eAAe,CAAA;AACtB,OAAO,EACN,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,2BAA2B,GAC3B,MAAM,eAAe,CAAA;AACtB,OAAO,EACN,yBAAyB,EACzB,KAAK,aAAa,EAClB,sBAAsB,GACtB,MAAM,YAAY,CAAA;AACnB,OAAO,EACN,KAAK,WAAW,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,KAAK,UAAU,EACf,eAAe,EACf,gBAAgB,GAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACN,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,eAAe,GACpB,MAAM,eAAe,CAAA"}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
export { discoverProviders, findDetected, } from './discover.js';
|
|
2
2
|
export { isAnthropicOAuthToken, readAgentKeychainCredential, } from './keychain.js';
|
|
3
|
-
export { maskSecret } from './mask.js';
|
|
4
3
|
export { ensureFreshAnthropicToken, refreshAgentOAuthToken, } from './oauth.js';
|
|
5
4
|
export { PREFERENCES_FILE_VERSION, PreferencesError, preferencesPath, readPreferences, writePreferences, } from './preferences.js';
|
|
6
5
|
export { ALL_PROVIDER_IDS, PROVIDER_REGISTRY, } from './registry.js';
|
|
7
|
-
// Manual-profile escape hatch — kept for users who configure providers
|
|
8
|
-
// by API key directly without going through the auto-discovery picker.
|
|
9
|
-
export { PROVIDER_TYPES, PROVIDERS_FILE_VERSION, ProfileValidationError, TYPE_ENV_FALLBACK, isProviderType, validateProfile, } from './schema.js';
|
|
10
|
-
export { ProvidersStoreError, assertInvariants, findDefault, providersPath, readProfiles, resolveApiKey, writeProfiles, } from './store.js';
|
|
11
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,iBAAiB,EACjB,YAAY,GACZ,MAAM,eAAe,CAAA;AACtB,OAAO,EAEN,qBAAqB,EACrB,2BAA2B,GAC3B,MAAM,eAAe,CAAA;AACtB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,iBAAiB,EACjB,YAAY,GACZ,MAAM,eAAe,CAAA;AACtB,OAAO,EAEN,qBAAqB,EACrB,2BAA2B,GAC3B,MAAM,eAAe,CAAA;AACtB,OAAO,EACN,yBAAyB,EAEzB,sBAAsB,GACtB,MAAM,YAAY,CAAA;AACnB,OAAO,EAEN,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EAEf,eAAe,EACf,gBAAgB,GAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACN,gBAAgB,EAChB,iBAAiB,GAIjB,MAAM,eAAe,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@namzu/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Operator CLI for the Namzu agent platform — namzu doctor + future commands. Dual-purpose: standalone bin (`namzu doctor`) and library (`import { runDoctor } from '@namzu/cli'`).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"namzu",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"react": "^19.2.6",
|
|
41
41
|
"yaml": "^2.9.0",
|
|
42
42
|
"@namzu/anthropic": "3.1.0",
|
|
43
|
-
"@namzu/ollama": "2.0.0",
|
|
44
43
|
"@namzu/openai": "1.1.0",
|
|
44
|
+
"@namzu/ollama": "2.0.0",
|
|
45
45
|
"@namzu/openrouter": "2.0.0",
|
|
46
46
|
"@namzu/sdk": "^14.0.7"
|
|
47
47
|
},
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `namzu providers` — real implementation, replacing the M0 stub.
|
|
3
|
-
*
|
|
4
|
-
* Subcommands:
|
|
5
|
-
* - `ls` List configured profiles (mask secrets by default).
|
|
6
|
-
* - `add <name>` Persist a new profile.
|
|
7
|
-
* - `remove <name>` Drop a profile from the store.
|
|
8
|
-
* - `default <name>` Flip the `default` flag onto one profile.
|
|
9
|
-
* - `path` Print the store path (useful for env automation).
|
|
10
|
-
*
|
|
11
|
-
* Passthrough mode + inner Commander instance — same pattern as `tools`.
|
|
12
|
-
* Live provider instantiation (calling `ProviderRegistry.create`) is M3
|
|
13
|
-
* work and not done here; M2's job is purely "store + retrieve + display".
|
|
14
|
-
*/
|
|
15
|
-
import type { CommandDef } from './types.js';
|
|
16
|
-
export declare const providersCommand: CommandDef;
|
|
17
|
-
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/commands/providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAmBH,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,YAAY,CAAA;AA0M5D,eAAO,MAAM,gBAAgB,EAAE,UAiF9B,CAAA"}
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `namzu providers` — real implementation, replacing the M0 stub.
|
|
3
|
-
*
|
|
4
|
-
* Subcommands:
|
|
5
|
-
* - `ls` List configured profiles (mask secrets by default).
|
|
6
|
-
* - `add <name>` Persist a new profile.
|
|
7
|
-
* - `remove <name>` Drop a profile from the store.
|
|
8
|
-
* - `default <name>` Flip the `default` flag onto one profile.
|
|
9
|
-
* - `path` Print the store path (useful for env automation).
|
|
10
|
-
*
|
|
11
|
-
* Passthrough mode + inner Commander instance — same pattern as `tools`.
|
|
12
|
-
* Live provider instantiation (calling `ProviderRegistry.create`) is M3
|
|
13
|
-
* work and not done here; M2's job is purely "store + retrieve + display".
|
|
14
|
-
*/
|
|
15
|
-
import { Command, CommanderError } from 'commander';
|
|
16
|
-
import { PROVIDER_TYPES, ProfileValidationError, ProvidersStoreError, findDefault, isProviderType, maskSecret, providersPath, readProfiles, resolveApiKey, validateProfile, writeProfiles, } from '../integrations/providers/index.js';
|
|
17
|
-
async function runLs(ctx, opts) {
|
|
18
|
-
let profiles;
|
|
19
|
-
try {
|
|
20
|
-
profiles = readProfiles();
|
|
21
|
-
}
|
|
22
|
-
catch (err) {
|
|
23
|
-
ctx.formatter.error({
|
|
24
|
-
message: err instanceof Error ? err.message : String(err),
|
|
25
|
-
});
|
|
26
|
-
return 70;
|
|
27
|
-
}
|
|
28
|
-
let filtered = profiles;
|
|
29
|
-
if (opts.type) {
|
|
30
|
-
if (!isProviderType(opts.type)) {
|
|
31
|
-
ctx.formatter.error({
|
|
32
|
-
message: `--type must be one of: ${PROVIDER_TYPES.join(', ')}`,
|
|
33
|
-
});
|
|
34
|
-
return 64;
|
|
35
|
-
}
|
|
36
|
-
filtered = profiles.filter((p) => p.type === opts.type);
|
|
37
|
-
}
|
|
38
|
-
const rows = filtered.map((p) => {
|
|
39
|
-
const apiKey = resolveApiKey(p);
|
|
40
|
-
return {
|
|
41
|
-
name: p.name,
|
|
42
|
-
type: p.type,
|
|
43
|
-
model: p.model ?? null,
|
|
44
|
-
apiKey: opts.showSecrets ? apiKey : maskSecret(apiKey),
|
|
45
|
-
default: p.default === true,
|
|
46
|
-
source: keySource(p, apiKey),
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
ctx.formatter.print({
|
|
50
|
-
path: providersPath(),
|
|
51
|
-
count: rows.length,
|
|
52
|
-
default: findDefault(profiles)?.name ?? null,
|
|
53
|
-
profiles: rows,
|
|
54
|
-
});
|
|
55
|
-
return 0;
|
|
56
|
-
}
|
|
57
|
-
async function runAdd(ctx, name, opts) {
|
|
58
|
-
if (!isProviderType(opts.type)) {
|
|
59
|
-
ctx.formatter.error({
|
|
60
|
-
message: `--type must be one of: ${PROVIDER_TYPES.join(', ')}`,
|
|
61
|
-
});
|
|
62
|
-
return 64;
|
|
63
|
-
}
|
|
64
|
-
const type = opts.type;
|
|
65
|
-
let candidate;
|
|
66
|
-
switch (type) {
|
|
67
|
-
case 'openai':
|
|
68
|
-
candidate = pruneUndefined({
|
|
69
|
-
name,
|
|
70
|
-
type,
|
|
71
|
-
apiKey: opts.apiKey,
|
|
72
|
-
baseUrl: opts.baseUrl,
|
|
73
|
-
model: opts.model,
|
|
74
|
-
organization: opts.organization,
|
|
75
|
-
project: opts.project,
|
|
76
|
-
default: opts.default,
|
|
77
|
-
});
|
|
78
|
-
break;
|
|
79
|
-
case 'anthropic':
|
|
80
|
-
case 'openrouter':
|
|
81
|
-
candidate = pruneUndefined({
|
|
82
|
-
name,
|
|
83
|
-
type,
|
|
84
|
-
apiKey: opts.apiKey,
|
|
85
|
-
baseUrl: opts.baseUrl,
|
|
86
|
-
model: opts.model,
|
|
87
|
-
default: opts.default,
|
|
88
|
-
});
|
|
89
|
-
break;
|
|
90
|
-
case 'ollama':
|
|
91
|
-
case 'lmstudio':
|
|
92
|
-
candidate = pruneUndefined({
|
|
93
|
-
name,
|
|
94
|
-
type,
|
|
95
|
-
host: opts.host,
|
|
96
|
-
model: opts.model,
|
|
97
|
-
default: opts.default,
|
|
98
|
-
});
|
|
99
|
-
break;
|
|
100
|
-
case 'bedrock':
|
|
101
|
-
candidate = pruneUndefined({
|
|
102
|
-
name,
|
|
103
|
-
type,
|
|
104
|
-
region: opts.region,
|
|
105
|
-
model: opts.model,
|
|
106
|
-
default: opts.default,
|
|
107
|
-
});
|
|
108
|
-
break;
|
|
109
|
-
case 'http':
|
|
110
|
-
if (!opts.baseUrl) {
|
|
111
|
-
ctx.formatter.error({ message: '--base-url is required for type=http' });
|
|
112
|
-
return 64;
|
|
113
|
-
}
|
|
114
|
-
candidate = pruneUndefined({
|
|
115
|
-
name,
|
|
116
|
-
type,
|
|
117
|
-
baseUrl: opts.baseUrl,
|
|
118
|
-
apiKey: opts.apiKey,
|
|
119
|
-
model: opts.model,
|
|
120
|
-
dialect: opts.dialect,
|
|
121
|
-
default: opts.default,
|
|
122
|
-
});
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
let profile;
|
|
126
|
-
try {
|
|
127
|
-
profile = validateProfile(candidate);
|
|
128
|
-
}
|
|
129
|
-
catch (err) {
|
|
130
|
-
if (err instanceof ProfileValidationError) {
|
|
131
|
-
ctx.formatter.error({ message: err.message });
|
|
132
|
-
return 64;
|
|
133
|
-
}
|
|
134
|
-
throw err;
|
|
135
|
-
}
|
|
136
|
-
const existing = readProfiles();
|
|
137
|
-
if (existing.some((p) => p.name === name)) {
|
|
138
|
-
ctx.formatter.error({
|
|
139
|
-
message: `profile "${name}" already exists; use \`namzu providers remove ${name}\` first`,
|
|
140
|
-
});
|
|
141
|
-
return 64;
|
|
142
|
-
}
|
|
143
|
-
const merged = opts.default
|
|
144
|
-
? [...existing.map((p) => ({ ...p, default: false })), profile]
|
|
145
|
-
: [...existing, profile];
|
|
146
|
-
try {
|
|
147
|
-
writeProfiles(merged);
|
|
148
|
-
}
|
|
149
|
-
catch (err) {
|
|
150
|
-
if (err instanceof ProvidersStoreError) {
|
|
151
|
-
ctx.formatter.error({ message: err.message });
|
|
152
|
-
return 70;
|
|
153
|
-
}
|
|
154
|
-
throw err;
|
|
155
|
-
}
|
|
156
|
-
ctx.formatter.info(`added profile "${name}" (${type})${opts.default ? ' as default' : ''}`);
|
|
157
|
-
return 0;
|
|
158
|
-
}
|
|
159
|
-
async function runRemove(ctx, name) {
|
|
160
|
-
const existing = readProfiles();
|
|
161
|
-
if (!existing.some((p) => p.name === name)) {
|
|
162
|
-
ctx.formatter.error({ message: `no profile named "${name}"` });
|
|
163
|
-
return 64;
|
|
164
|
-
}
|
|
165
|
-
writeProfiles(existing.filter((p) => p.name !== name));
|
|
166
|
-
ctx.formatter.info(`removed profile "${name}"`);
|
|
167
|
-
return 0;
|
|
168
|
-
}
|
|
169
|
-
async function runDefault(ctx, name) {
|
|
170
|
-
const existing = readProfiles();
|
|
171
|
-
if (!existing.some((p) => p.name === name)) {
|
|
172
|
-
ctx.formatter.error({ message: `no profile named "${name}"` });
|
|
173
|
-
return 64;
|
|
174
|
-
}
|
|
175
|
-
const updated = existing.map((p) => ({ ...p, default: p.name === name }));
|
|
176
|
-
writeProfiles(updated);
|
|
177
|
-
ctx.formatter.info(`default provider set to "${name}"`);
|
|
178
|
-
return 0;
|
|
179
|
-
}
|
|
180
|
-
function runPath(ctx) {
|
|
181
|
-
ctx.formatter.print(providersPath());
|
|
182
|
-
return 0;
|
|
183
|
-
}
|
|
184
|
-
function keySource(p, resolved) {
|
|
185
|
-
if (resolved === null)
|
|
186
|
-
return 'none';
|
|
187
|
-
const onDisk = p.apiKey;
|
|
188
|
-
if (onDisk && onDisk === resolved)
|
|
189
|
-
return 'file';
|
|
190
|
-
return 'env';
|
|
191
|
-
}
|
|
192
|
-
function pruneUndefined(obj) {
|
|
193
|
-
const out = {};
|
|
194
|
-
for (const [k, v] of Object.entries(obj)) {
|
|
195
|
-
if (v !== undefined)
|
|
196
|
-
out[k] = v;
|
|
197
|
-
}
|
|
198
|
-
return out;
|
|
199
|
-
}
|
|
200
|
-
export const providersCommand = {
|
|
201
|
-
name: 'providers',
|
|
202
|
-
description: 'Manage LLM provider profiles (stored at ~/.namzu/providers.json)',
|
|
203
|
-
passThrough: true,
|
|
204
|
-
async handler({ ctx, rawArgs }) {
|
|
205
|
-
let exitCode = 0;
|
|
206
|
-
const program = new Command('providers')
|
|
207
|
-
.description('Manage LLM provider profiles')
|
|
208
|
-
.exitOverride()
|
|
209
|
-
.helpOption('-h, --help', 'Show this help');
|
|
210
|
-
program
|
|
211
|
-
.command('ls')
|
|
212
|
-
.description('List configured provider profiles')
|
|
213
|
-
.option('--show-secrets', 'Print API keys in the clear (default: mask)')
|
|
214
|
-
.option('--type <type>', `Filter by provider type (${PROVIDER_TYPES.join('|')})`)
|
|
215
|
-
.action(async (opts) => {
|
|
216
|
-
exitCode = await runLs(ctx, opts);
|
|
217
|
-
});
|
|
218
|
-
program
|
|
219
|
-
.command('add <name>')
|
|
220
|
-
.description('Persist a new provider profile')
|
|
221
|
-
.requiredOption('--type <type>', `Provider type (${PROVIDER_TYPES.join('|')})`)
|
|
222
|
-
.option('--api-key <key>', 'API key (also reads NAMZU_<NAME>_API_KEY / <TYPE>_API_KEY env)')
|
|
223
|
-
.option('--base-url <url>', 'Override base URL (required for type=http)')
|
|
224
|
-
.option('--model <model>', 'Default model identifier')
|
|
225
|
-
.option('--organization <org>', 'OpenAI organization id')
|
|
226
|
-
.option('--project <proj>', 'OpenAI project id')
|
|
227
|
-
.option('--host <host>', 'Local server host (ollama, lmstudio)')
|
|
228
|
-
.option('--region <region>', 'AWS region (bedrock)')
|
|
229
|
-
.option('--dialect <dialect>', "HTTP shim dialect ('openai' | 'anthropic')")
|
|
230
|
-
.option('--default', 'Mark as the default profile (unsets any prior default)')
|
|
231
|
-
.action(async (name, opts) => {
|
|
232
|
-
exitCode = await runAdd(ctx, name, opts);
|
|
233
|
-
});
|
|
234
|
-
program
|
|
235
|
-
.command('remove <name>')
|
|
236
|
-
.description('Drop a profile from the store')
|
|
237
|
-
.action(async (name) => {
|
|
238
|
-
exitCode = await runRemove(ctx, name);
|
|
239
|
-
});
|
|
240
|
-
program
|
|
241
|
-
.command('default <name>')
|
|
242
|
-
.description('Mark a profile as the default')
|
|
243
|
-
.action(async (name) => {
|
|
244
|
-
exitCode = await runDefault(ctx, name);
|
|
245
|
-
});
|
|
246
|
-
program
|
|
247
|
-
.command('path')
|
|
248
|
-
.description('Print the profile store path')
|
|
249
|
-
.action(() => {
|
|
250
|
-
exitCode = runPath(ctx);
|
|
251
|
-
});
|
|
252
|
-
if (rawArgs.length === 0) {
|
|
253
|
-
program.outputHelp();
|
|
254
|
-
return 0;
|
|
255
|
-
}
|
|
256
|
-
try {
|
|
257
|
-
await program.parseAsync(rawArgs, { from: 'user' });
|
|
258
|
-
return exitCode;
|
|
259
|
-
}
|
|
260
|
-
catch (err) {
|
|
261
|
-
if (err instanceof CommanderError) {
|
|
262
|
-
if (err.code === 'commander.help' ||
|
|
263
|
-
err.code === 'commander.helpDisplayed' ||
|
|
264
|
-
err.code === 'commander.version') {
|
|
265
|
-
return 0;
|
|
266
|
-
}
|
|
267
|
-
return 64;
|
|
268
|
-
}
|
|
269
|
-
ctx.formatter.error({ message: err instanceof Error ? err.message : String(err) });
|
|
270
|
-
return 70;
|
|
271
|
-
}
|
|
272
|
-
},
|
|
273
|
-
};
|
|
274
|
-
//# sourceMappingURL=providers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../src/commands/providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAEnD,OAAO,EACN,cAAc,EACd,sBAAsB,EAGtB,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,UAAU,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,eAAe,EACf,aAAa,GACb,MAAM,oCAAoC,CAAA;AAgB3C,KAAK,UAAU,KAAK,CACnB,GAAmB,EACnB,IAA8C;IAE9C,IAAI,QAAoC,CAAA;IACxC,IAAI,CAAC;QACJ,QAAQ,GAAG,YAAY,EAAE,CAAA;IAC1B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC;YACnB,OAAO,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;SACzD,CAAC,CAAA;QACF,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AAC,EAAE,CAAC;YAC1B,OAAO,CAAC,UAAU,EAAE,CAAA;YACpB,OAAO,CAAC,CAAA;QACT,CAAC;QAED,IAAI,CAAC;YACJ,MAAM,OAAO,CAAC,UAAU,CAAC,OAAmB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAA;YAC/D,OAAO,QAAQ,CAAA;QAChB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,IAAI,GAAG,YAAY,cAAc,EAAE,CAAC;gBACnC,IACC,GAAG,CAAC,IAAI,KAAK,gBAAgB;oBAC7B,GAAG,CAAC,IAAI,KAAK,yBAAyB;oBACtC,GAAG,CAAC,IAAI,KAAK,mBAAmB,EAC/B,CAAC;oBACF,OAAO,CAAC,CAAA;gBACT,CAAC;gBACD,OAAO,EAAE,CAAA;YACV,CAAC;YACD,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;YAClF,OAAO,EAAE,CAAA;QACV,CAAC;IACF,CAAC;CACD,CAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mask a secret for terminal display. Default keeps the last 4 chars
|
|
3
|
-
* (familiar from `aws configure list-profiles` / `gh auth status`).
|
|
4
|
-
* Returns `null` for null/empty inputs (so callers can render "—").
|
|
5
|
-
*/
|
|
6
|
-
export declare function maskSecret(secret: string | null | undefined, keep?: number): string | null;
|
|
7
|
-
//# sourceMappingURL=mask.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/mask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,IAAI,SAAI,GAAG,MAAM,GAAG,IAAI,CAKrF"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mask a secret for terminal display. Default keeps the last 4 chars
|
|
3
|
-
* (familiar from `aws configure list-profiles` / `gh auth status`).
|
|
4
|
-
* Returns `null` for null/empty inputs (so callers can render "—").
|
|
5
|
-
*/
|
|
6
|
-
export function maskSecret(secret, keep = 4) {
|
|
7
|
-
if (!secret)
|
|
8
|
-
return null;
|
|
9
|
-
if (secret.length <= keep)
|
|
10
|
-
return '***';
|
|
11
|
-
const tail = secret.slice(-keep);
|
|
12
|
-
return `***${tail}`;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=mask.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mask.js","sourceRoot":"","sources":["../../../src/integrations/providers/mask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,MAAiC,EAAE,IAAI,GAAG,CAAC;IACrE,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IACxB,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI;QAAE,OAAO,KAAK,CAAA;IACvC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAA;IAChC,OAAO,MAAM,IAAI,EAAE,CAAA;AACpB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mask.test.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/mask.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { maskSecret } from './mask.js';
|
|
3
|
-
describe('maskSecret', () => {
|
|
4
|
-
it('returns null for null / undefined / empty', () => {
|
|
5
|
-
expect(maskSecret(null)).toBeNull();
|
|
6
|
-
expect(maskSecret(undefined)).toBeNull();
|
|
7
|
-
expect(maskSecret('')).toBeNull();
|
|
8
|
-
});
|
|
9
|
-
it('returns *** for secrets shorter than the keep window', () => {
|
|
10
|
-
expect(maskSecret('abc', 4)).toBe('***');
|
|
11
|
-
expect(maskSecret('abcd', 4)).toBe('***');
|
|
12
|
-
});
|
|
13
|
-
it('keeps the last N characters by default', () => {
|
|
14
|
-
expect(maskSecret('sk-ant-deadbeef1234')).toBe('***1234');
|
|
15
|
-
});
|
|
16
|
-
it('honors a custom keep length', () => {
|
|
17
|
-
expect(maskSecret('sk-ant-deadbeef1234', 6)).toBe('***ef1234');
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
//# sourceMappingURL=mask.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mask.test.js","sourceRoot":"","sources":["../../../src/integrations/providers/mask.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEtC,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACpD,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;QACnC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;QACxC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC/D,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACxC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QACjD,MAAM,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAC1D,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACtC,MAAM,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;IAC/D,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `ProviderProfile` discriminated union.
|
|
3
|
-
*
|
|
4
|
-
* Each provider type mirrors a `@namzu/<type>` package the SDK ships. The
|
|
5
|
-
* shapes are the *minimum* the CLI persists; richer per-type knobs (Bedrock
|
|
6
|
-
* IAM role assumption, OpenRouter routing rules, Anthropic `maxTokens`,
|
|
7
|
-
* etc.) come in as additive optional fields when M3+ surface needs them.
|
|
8
|
-
*
|
|
9
|
-
* Validation is intentionally hand-rolled (no Zod) — we want zero-runtime-dep
|
|
10
|
-
* config IO in M2; a future session can introduce a schema library when
|
|
11
|
-
* provider-package-specific knobs start to collide.
|
|
12
|
-
*/
|
|
13
|
-
export type ProviderType = 'openai' | 'anthropic' | 'openrouter' | 'ollama' | 'bedrock' | 'http' | 'lmstudio';
|
|
14
|
-
export declare const PROVIDER_TYPES: readonly ProviderType[];
|
|
15
|
-
/**
|
|
16
|
-
* Per-type API-key env-var fallback. Order checked: `NAMZU_<NAME>_API_KEY`
|
|
17
|
-
* (per-profile override) → entry below (per-type vendor default) → empty.
|
|
18
|
-
* Mirrors what users already have set in CI / shells for other tools.
|
|
19
|
-
*/
|
|
20
|
-
export declare const TYPE_ENV_FALLBACK: Readonly<Record<ProviderType, string | null>>;
|
|
21
|
-
export interface BaseProfile {
|
|
22
|
-
readonly name: string;
|
|
23
|
-
readonly default?: boolean;
|
|
24
|
-
readonly model?: string;
|
|
25
|
-
}
|
|
26
|
-
export interface OpenAIProfile extends BaseProfile {
|
|
27
|
-
readonly type: 'openai';
|
|
28
|
-
readonly apiKey?: string;
|
|
29
|
-
readonly baseUrl?: string;
|
|
30
|
-
readonly organization?: string;
|
|
31
|
-
readonly project?: string;
|
|
32
|
-
}
|
|
33
|
-
export interface AnthropicProfile extends BaseProfile {
|
|
34
|
-
readonly type: 'anthropic';
|
|
35
|
-
readonly apiKey?: string;
|
|
36
|
-
readonly baseUrl?: string;
|
|
37
|
-
}
|
|
38
|
-
export interface OpenRouterProfile extends BaseProfile {
|
|
39
|
-
readonly type: 'openrouter';
|
|
40
|
-
readonly apiKey?: string;
|
|
41
|
-
readonly baseUrl?: string;
|
|
42
|
-
}
|
|
43
|
-
export interface OllamaProfile extends BaseProfile {
|
|
44
|
-
readonly type: 'ollama';
|
|
45
|
-
readonly host?: string;
|
|
46
|
-
}
|
|
47
|
-
export interface BedrockProfile extends BaseProfile {
|
|
48
|
-
readonly type: 'bedrock';
|
|
49
|
-
readonly region?: string;
|
|
50
|
-
}
|
|
51
|
-
export interface HttpProfile extends BaseProfile {
|
|
52
|
-
readonly type: 'http';
|
|
53
|
-
readonly baseUrl: string;
|
|
54
|
-
readonly apiKey?: string;
|
|
55
|
-
readonly dialect?: 'openai' | 'anthropic';
|
|
56
|
-
}
|
|
57
|
-
export interface LMStudioProfile extends BaseProfile {
|
|
58
|
-
readonly type: 'lmstudio';
|
|
59
|
-
readonly host?: string;
|
|
60
|
-
}
|
|
61
|
-
export type ProviderProfile = OpenAIProfile | AnthropicProfile | OpenRouterProfile | OllamaProfile | BedrockProfile | HttpProfile | LMStudioProfile;
|
|
62
|
-
export interface ProvidersFile {
|
|
63
|
-
readonly version: 1;
|
|
64
|
-
readonly profiles: readonly ProviderProfile[];
|
|
65
|
-
}
|
|
66
|
-
export declare const PROVIDERS_FILE_VERSION: 1;
|
|
67
|
-
export declare class ProfileValidationError extends Error {
|
|
68
|
-
constructor(message: string);
|
|
69
|
-
}
|
|
70
|
-
/** Strict at-the-boundary validator. Throws `ProfileValidationError` on bad input. */
|
|
71
|
-
export declare function validateProfile(value: unknown): ProviderProfile;
|
|
72
|
-
export declare function isProviderType(value: unknown): value is ProviderType;
|
|
73
|
-
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,YAAY,GACrB,QAAQ,GACR,WAAW,GACX,YAAY,GACZ,QAAQ,GACR,SAAS,GACT,MAAM,GACN,UAAU,CAAA;AAEb,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EAQxC,CAAA;AAEV;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC,CAQ1E,CAAA;AAEF,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,aAAc,SAAQ,WAAW;IACjD,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACpD,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ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AI3B;AAED,sFAAsF;AACtF,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAsB/D;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `ProviderProfile` discriminated union.
|
|
3
|
-
*
|
|
4
|
-
* Each provider type mirrors a `@namzu/<type>` package the SDK ships. The
|
|
5
|
-
* shapes are the *minimum* the CLI persists; richer per-type knobs (Bedrock
|
|
6
|
-
* IAM role assumption, OpenRouter routing rules, Anthropic `maxTokens`,
|
|
7
|
-
* etc.) come in as additive optional fields when M3+ surface needs them.
|
|
8
|
-
*
|
|
9
|
-
* Validation is intentionally hand-rolled (no Zod) — we want zero-runtime-dep
|
|
10
|
-
* config IO in M2; a future session can introduce a schema library when
|
|
11
|
-
* provider-package-specific knobs start to collide.
|
|
12
|
-
*/
|
|
13
|
-
export const PROVIDER_TYPES = [
|
|
14
|
-
'openai',
|
|
15
|
-
'anthropic',
|
|
16
|
-
'openrouter',
|
|
17
|
-
'ollama',
|
|
18
|
-
'bedrock',
|
|
19
|
-
'http',
|
|
20
|
-
'lmstudio',
|
|
21
|
-
];
|
|
22
|
-
/**
|
|
23
|
-
* Per-type API-key env-var fallback. Order checked: `NAMZU_<NAME>_API_KEY`
|
|
24
|
-
* (per-profile override) → entry below (per-type vendor default) → empty.
|
|
25
|
-
* Mirrors what users already have set in CI / shells for other tools.
|
|
26
|
-
*/
|
|
27
|
-
export const TYPE_ENV_FALLBACK = Object.freeze({
|
|
28
|
-
openai: 'OPENAI_API_KEY',
|
|
29
|
-
anthropic: 'ANTHROPIC_API_KEY',
|
|
30
|
-
openrouter: 'OPENROUTER_API_KEY',
|
|
31
|
-
ollama: null, // local server; no API key concept
|
|
32
|
-
bedrock: null, // AWS SDK credential chain; handled in M3
|
|
33
|
-
http: null, // generic; user supplies via apiKey or per-profile env
|
|
34
|
-
lmstudio: null, // local server
|
|
35
|
-
});
|
|
36
|
-
export const PROVIDERS_FILE_VERSION = 1;
|
|
37
|
-
export class ProfileValidationError extends Error {
|
|
38
|
-
constructor(message) {
|
|
39
|
-
super(message);
|
|
40
|
-
this.name = 'ProfileValidationError';
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/** Strict at-the-boundary validator. Throws `ProfileValidationError` on bad input. */
|
|
44
|
-
export function validateProfile(value) {
|
|
45
|
-
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
46
|
-
throw new ProfileValidationError('profile must be a JSON object');
|
|
47
|
-
}
|
|
48
|
-
const v = value;
|
|
49
|
-
if (typeof v.name !== 'string' || v.name.length === 0) {
|
|
50
|
-
throw new ProfileValidationError('profile.name is required');
|
|
51
|
-
}
|
|
52
|
-
if (!isProviderType(v.type)) {
|
|
53
|
-
throw new ProfileValidationError(`profile.type must be one of: ${PROVIDER_TYPES.join(', ')}`);
|
|
54
|
-
}
|
|
55
|
-
if (v.default !== undefined && typeof v.default !== 'boolean') {
|
|
56
|
-
throw new ProfileValidationError('profile.default must be a boolean');
|
|
57
|
-
}
|
|
58
|
-
if (v.model !== undefined && typeof v.model !== 'string') {
|
|
59
|
-
throw new ProfileValidationError('profile.model must be a string');
|
|
60
|
-
}
|
|
61
|
-
// http requires baseUrl; others optional. We trust the discriminator.
|
|
62
|
-
if (v.type === 'http' && (typeof v.baseUrl !== 'string' || v.baseUrl.length === 0)) {
|
|
63
|
-
throw new ProfileValidationError('profile.baseUrl is required when type=http');
|
|
64
|
-
}
|
|
65
|
-
return v;
|
|
66
|
-
}
|
|
67
|
-
export function isProviderType(value) {
|
|
68
|
-
return typeof value === 'string' && PROVIDER_TYPES.includes(value);
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/integrations/providers/schema.ts"],"names":[],"mappings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CAAC,gCAAgC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC9F,CAAC;IACD,IAAI,CAAC,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC/D,MAAM,IAAI,sBAAsB,CAAC,mCAAmC,CAAC,CAAA;IACtE,CAAC;IACD,IAAI,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC1D,MAAM,IAAI,sBAAsB,CAAC,gCAAgC,CAAC,CAAA;IACnE,CAAC;IACD,sEAAsE;IACtE,IAAI,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;QACpF,MAAM,IAAI,sBAAsB,CAAC,4CAA4C,CAAC,CAAA;IAC/E,CAAC;IACD,OAAO,CAA+B,CAAA;AACvC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAc;IAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,cAAoC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC1F,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.test.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/schema.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { PROVIDER_TYPES, ProfileValidationError, isProviderType, validateProfile, } from './schema.js';
|
|
3
|
-
describe('isProviderType', () => {
|
|
4
|
-
it('accepts every shipped type', () => {
|
|
5
|
-
for (const t of PROVIDER_TYPES)
|
|
6
|
-
expect(isProviderType(t)).toBe(true);
|
|
7
|
-
});
|
|
8
|
-
it('rejects unknown types', () => {
|
|
9
|
-
expect(isProviderType('gemini')).toBe(false);
|
|
10
|
-
expect(isProviderType(undefined)).toBe(false);
|
|
11
|
-
expect(isProviderType(42)).toBe(false);
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
describe('validateProfile', () => {
|
|
15
|
-
it('passes a minimal anthropic profile', () => {
|
|
16
|
-
const p = validateProfile({ name: 'work', type: 'anthropic' });
|
|
17
|
-
expect(p.name).toBe('work');
|
|
18
|
-
expect(p.type).toBe('anthropic');
|
|
19
|
-
});
|
|
20
|
-
it('rejects missing name', () => {
|
|
21
|
-
expect(() => validateProfile({ type: 'anthropic' })).toThrow(ProfileValidationError);
|
|
22
|
-
});
|
|
23
|
-
it('rejects unknown type with a helpful message', () => {
|
|
24
|
-
expect(() => validateProfile({ name: 'x', type: 'gpt-5-pro' })).toThrowError(/must be one of/);
|
|
25
|
-
});
|
|
26
|
-
it('rejects non-boolean default', () => {
|
|
27
|
-
expect(() => validateProfile({ name: 'x', type: 'openai', default: 'yes' })).toThrow(ProfileValidationError);
|
|
28
|
-
});
|
|
29
|
-
it('requires baseUrl when type=http', () => {
|
|
30
|
-
expect(() => validateProfile({ name: 'h', type: 'http' })).toThrowError(/baseUrl is required/);
|
|
31
|
-
const ok = validateProfile({ name: 'h', type: 'http', baseUrl: 'https://example.com' });
|
|
32
|
-
expect(ok.type).toBe('http');
|
|
33
|
-
});
|
|
34
|
-
it('rejects non-string model', () => {
|
|
35
|
-
expect(() => validateProfile({ name: 'x', type: 'openai', model: 42 })).toThrow(ProfileValidationError);
|
|
36
|
-
});
|
|
37
|
-
it('rejects non-object inputs', () => {
|
|
38
|
-
expect(() => validateProfile(null)).toThrow(ProfileValidationError);
|
|
39
|
-
expect(() => validateProfile('string')).toThrow(ProfileValidationError);
|
|
40
|
-
expect(() => validateProfile([])).toThrow(ProfileValidationError);
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
//# sourceMappingURL=schema.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAE,CAAC,CAAC,CAAC,OAAO,CAC9E,sBAAsB,CACtB,CAAA;IACF,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACpC,MAAM,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAA;QACnE,MAAM,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAA;QACvE,MAAM,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAA;IAClE,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `~/.namzu/providers.json` store.
|
|
3
|
-
*
|
|
4
|
-
* - Reads return `[]` (not error) when the file is missing — first-run UX.
|
|
5
|
-
* - Writes are atomic: temp file + rename. Mode 0600 enforced on every write.
|
|
6
|
-
* - `resolveApiKey(profile, env)` cascades `NAMZU_<NAME>_API_KEY` (per-
|
|
7
|
-
* profile override) → per-type vendor default (`OPENAI_API_KEY` etc.)
|
|
8
|
-
* → profile.apiKey on-disk → null.
|
|
9
|
-
* - Uniqueness invariants enforced on write: no duplicate `name`; at most
|
|
10
|
-
* one profile with `default: true`.
|
|
11
|
-
*/
|
|
12
|
-
import { type ProviderProfile } from './schema.js';
|
|
13
|
-
export declare class ProvidersStoreError extends Error {
|
|
14
|
-
constructor(message: string);
|
|
15
|
-
}
|
|
16
|
-
export interface StoreLocation {
|
|
17
|
-
readonly path: string;
|
|
18
|
-
}
|
|
19
|
-
export declare function providersPath(home?: string): string;
|
|
20
|
-
export declare function readProfiles(home?: string): ProviderProfile[];
|
|
21
|
-
export declare function writeProfiles(profiles: readonly ProviderProfile[], home?: string): void;
|
|
22
|
-
export declare function assertInvariants(profiles: readonly ProviderProfile[]): void;
|
|
23
|
-
/**
|
|
24
|
-
* Resolve the live API key for a profile, honoring overrides:
|
|
25
|
-
* 1. `NAMZU_<UPPERCASE_NAME>_API_KEY` (per-profile override)
|
|
26
|
-
* 2. Per-type vendor default (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, etc.)
|
|
27
|
-
* 3. `profile.apiKey` (on-disk)
|
|
28
|
-
* 4. `null` (no key — caller decides whether that's fatal)
|
|
29
|
-
*/
|
|
30
|
-
export declare function resolveApiKey(profile: ProviderProfile, env?: NodeJS.ProcessEnv): string | null;
|
|
31
|
-
export declare function findDefault(profiles: readonly ProviderProfile[]): ProviderProfile | null;
|
|
32
|
-
//# sourceMappingURL=store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH,OAAO,EAGN,KAAK,eAAe,EAIpB,MAAM,aAAa,CAAA;AAKpB,qBAAa,mBAAoB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAI3B;AAED,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACrB;AAED,wBAAgB,aAAa,CAAC,IAAI,GAAE,MAAkB,GAAG,MAAM,CAE9D;AAED,wBAAgB,YAAY,CAAC,IAAI,GAAE,MAAkB,GAAG,eAAe,EAAE,CA2CxE;AAED,wBAAgB,aAAa,CAC5B,QAAQ,EAAE,SAAS,eAAe,EAAE,EACpC,IAAI,GAAE,MAAkB,GACtB,IAAI,CAmBN;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,GAAG,IAAI,CAa3E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC5B,OAAO,EAAE,eAAe,EACxB,GAAG,GAAE,MAAM,CAAC,UAAwB,GAClC,MAAM,GAAG,IAAI,CAWf;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,GAAG,eAAe,GAAG,IAAI,CAExF"}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `~/.namzu/providers.json` store.
|
|
3
|
-
*
|
|
4
|
-
* - Reads return `[]` (not error) when the file is missing — first-run UX.
|
|
5
|
-
* - Writes are atomic: temp file + rename. Mode 0600 enforced on every write.
|
|
6
|
-
* - `resolveApiKey(profile, env)` cascades `NAMZU_<NAME>_API_KEY` (per-
|
|
7
|
-
* profile override) → per-type vendor default (`OPENAI_API_KEY` etc.)
|
|
8
|
-
* → profile.apiKey on-disk → null.
|
|
9
|
-
* - Uniqueness invariants enforced on write: no duplicate `name`; at most
|
|
10
|
-
* one profile with `default: true`.
|
|
11
|
-
*/
|
|
12
|
-
import { randomBytes } from 'node:crypto';
|
|
13
|
-
import { chmodSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
14
|
-
import { homedir } from 'node:os';
|
|
15
|
-
import { dirname, join } from 'node:path';
|
|
16
|
-
import { PROVIDERS_FILE_VERSION, ProfileValidationError, TYPE_ENV_FALLBACK, validateProfile, } from './schema.js';
|
|
17
|
-
const FILE_MODE = 0o600;
|
|
18
|
-
const DIR_MODE = 0o700;
|
|
19
|
-
export class ProvidersStoreError extends Error {
|
|
20
|
-
constructor(message) {
|
|
21
|
-
super(message);
|
|
22
|
-
this.name = 'ProvidersStoreError';
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export function providersPath(home = homedir()) {
|
|
26
|
-
return join(home, '.namzu', 'providers.json');
|
|
27
|
-
}
|
|
28
|
-
export function readProfiles(home = homedir()) {
|
|
29
|
-
const path = providersPath(home);
|
|
30
|
-
let raw;
|
|
31
|
-
try {
|
|
32
|
-
raw = readFileSync(path, 'utf8');
|
|
33
|
-
}
|
|
34
|
-
catch (err) {
|
|
35
|
-
if (err.code === 'ENOENT')
|
|
36
|
-
return [];
|
|
37
|
-
throw new ProvidersStoreError(`could not read ${path}: ${err instanceof Error ? err.message : String(err)}`);
|
|
38
|
-
}
|
|
39
|
-
let parsed;
|
|
40
|
-
try {
|
|
41
|
-
parsed = JSON.parse(raw);
|
|
42
|
-
}
|
|
43
|
-
catch (err) {
|
|
44
|
-
throw new ProvidersStoreError(`${path} is not valid JSON: ${err instanceof Error ? err.message : String(err)}`);
|
|
45
|
-
}
|
|
46
|
-
if (typeof parsed !== 'object' || parsed === null) {
|
|
47
|
-
throw new ProvidersStoreError(`${path} top-level must be an object`);
|
|
48
|
-
}
|
|
49
|
-
const file = parsed;
|
|
50
|
-
if (file.version !== PROVIDERS_FILE_VERSION) {
|
|
51
|
-
throw new ProvidersStoreError(`${path} has unsupported version ${String(file.version)}; expected ${PROVIDERS_FILE_VERSION}. Upgrade @namzu/cli, or back up the file and re-create your profiles with \`namzu providers add\`.`);
|
|
52
|
-
}
|
|
53
|
-
if (!Array.isArray(file.profiles)) {
|
|
54
|
-
throw new ProvidersStoreError(`${path}.profiles must be an array`);
|
|
55
|
-
}
|
|
56
|
-
const validated = [];
|
|
57
|
-
for (const entry of file.profiles) {
|
|
58
|
-
try {
|
|
59
|
-
validated.push(validateProfile(entry));
|
|
60
|
-
}
|
|
61
|
-
catch (err) {
|
|
62
|
-
if (err instanceof ProfileValidationError) {
|
|
63
|
-
throw new ProvidersStoreError(`${path}: invalid profile — ${err.message}`);
|
|
64
|
-
}
|
|
65
|
-
throw err;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return validated;
|
|
69
|
-
}
|
|
70
|
-
export function writeProfiles(profiles, home = homedir()) {
|
|
71
|
-
assertInvariants(profiles);
|
|
72
|
-
const path = providersPath(home);
|
|
73
|
-
const dir = dirname(path);
|
|
74
|
-
mkdirSync(dir, { recursive: true, mode: DIR_MODE });
|
|
75
|
-
const payload = { version: PROVIDERS_FILE_VERSION, profiles: [...profiles] };
|
|
76
|
-
const body = `${JSON.stringify(payload, null, 2)}\n`;
|
|
77
|
-
// PID alone is not enough — two concurrent writes in the same process
|
|
78
|
-
// (Promise.all on `providers add` from a script, for example) would
|
|
79
|
-
// collide on the temp file and one mutation could be lost. Append a
|
|
80
|
-
// random suffix so each writer has its own temp path; the final
|
|
81
|
-
// `renameSync` is atomic per-rename so the last successful rename
|
|
82
|
-
// wins (caller's responsibility to serialize semantically distinct
|
|
83
|
-
// mutations — see assertInvariants for the in-memory check).
|
|
84
|
-
const tmp = `${path}.tmp.${process.pid}.${randomBytes(4).toString('hex')}`;
|
|
85
|
-
writeFileSync(tmp, body, { mode: FILE_MODE });
|
|
86
|
-
// Ensure mode even when umask interfered.
|
|
87
|
-
chmodSync(tmp, FILE_MODE);
|
|
88
|
-
renameSync(tmp, path);
|
|
89
|
-
}
|
|
90
|
-
export function assertInvariants(profiles) {
|
|
91
|
-
const seen = new Set();
|
|
92
|
-
let defaults = 0;
|
|
93
|
-
for (const p of profiles) {
|
|
94
|
-
if (seen.has(p.name)) {
|
|
95
|
-
throw new ProvidersStoreError(`duplicate profile name: ${p.name}`);
|
|
96
|
-
}
|
|
97
|
-
seen.add(p.name);
|
|
98
|
-
if (p.default === true)
|
|
99
|
-
defaults += 1;
|
|
100
|
-
}
|
|
101
|
-
if (defaults > 1) {
|
|
102
|
-
throw new ProvidersStoreError(`at most one profile may have default: true (got ${defaults})`);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Resolve the live API key for a profile, honoring overrides:
|
|
107
|
-
* 1. `NAMZU_<UPPERCASE_NAME>_API_KEY` (per-profile override)
|
|
108
|
-
* 2. Per-type vendor default (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, etc.)
|
|
109
|
-
* 3. `profile.apiKey` (on-disk)
|
|
110
|
-
* 4. `null` (no key — caller decides whether that's fatal)
|
|
111
|
-
*/
|
|
112
|
-
export function resolveApiKey(profile, env = process.env) {
|
|
113
|
-
const namedEnv = env[`NAMZU_${nameToEnv(profile.name)}_API_KEY`];
|
|
114
|
-
if (namedEnv && namedEnv.length > 0)
|
|
115
|
-
return namedEnv;
|
|
116
|
-
const fallbackName = TYPE_ENV_FALLBACK[profile.type];
|
|
117
|
-
if (fallbackName) {
|
|
118
|
-
const v = env[fallbackName];
|
|
119
|
-
if (v && v.length > 0)
|
|
120
|
-
return v;
|
|
121
|
-
}
|
|
122
|
-
const onDisk = profile.apiKey;
|
|
123
|
-
if (onDisk && onDisk.length > 0)
|
|
124
|
-
return onDisk;
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
export function findDefault(profiles) {
|
|
128
|
-
return profiles.find((p) => p.default === true) ?? null;
|
|
129
|
-
}
|
|
130
|
-
function nameToEnv(name) {
|
|
131
|
-
return name.toUpperCase().replace(/[^A-Z0-9]/g, '_');
|
|
132
|
-
}
|
|
133
|
-
//# sourceMappingURL=store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/integrations/providers/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvF,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EACN,sBAAsB,EACtB,sBAAsB,EAGtB,iBAAiB,EACjB,eAAe,GACf,MAAM,aAAa,CAAA;AAEpB,MAAM,SAAS,GAAG,KAAK,CAAA;AACvB,MAAM,QAAQ,GAAG,KAAK,CAAA;AAEtB,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC7C,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;IAClC,C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AAC,CAAA;IAChE,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,QAAQ,CAAA;IACpD,MAAM,YAAY,GAAG,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACpD,IAAI,YAAY,EAAE,CAAC;QAClB,MAAM,CAAC,GAAG,GAAG,CAAC,YAAY,CAAC,CAAA;QAC3B,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,CAAC,CAAA;IAChC,CAAC;IACD,MAAM,MAAM,GAAI,OAA+B,CAAC,MAAM,CAAA;IACtD,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,MAAM,CAAA;IAC9C,OAAO,IAAI,CAAA;AACZ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,QAAoC;IAC/D,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC,IAAI,IAAI,CAAA;AACxD,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC9B,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,CAAA;AACrD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.test.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/store.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { mkdirSync, mkdtempSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { tmpdir } from 'node:os';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { describe, expect, it } from 'vitest';
|
|
5
|
-
import { ProvidersStoreError, assertInvariants, findDefault, providersPath, readProfiles, resolveApiKey, writeProfiles, } from './store.js';
|
|
6
|
-
/**
|
|
7
|
-
* POSIX file modes do not exist on Windows: `chmod` is a no-op there and
|
|
8
|
-
* `fs.stat().mode` reports a fixed value, so these cases assert a
|
|
9
|
-
* permission the platform cannot enforce. Skipping keeps the suite
|
|
10
|
-
* meaningful on Windows instead of permanently red — the behavior itself
|
|
11
|
-
* is still covered on Linux and macOS, where it actually matters.
|
|
12
|
-
*/
|
|
13
|
-
const IS_WINDOWS = process.platform === 'win32';
|
|
14
|
-
function tmpHome() {
|
|
15
|
-
return mkdtempSync(join(tmpdir(), 'namzu-providers-'));
|
|
16
|
-
}
|
|
17
|
-
const anthropic = (over = {}) => ({
|
|
18
|
-
name: 'a',
|
|
19
|
-
type: 'anthropic',
|
|
20
|
-
apiKey: 'sk-ant-deadbeef',
|
|
21
|
-
...over,
|
|
22
|
-
});
|
|
23
|
-
const openai = (over = {}) => ({
|
|
24
|
-
name: 'o',
|
|
25
|
-
type: 'openai',
|
|
26
|
-
apiKey: 'sk-openai-cafebabe',
|
|
27
|
-
...over,
|
|
28
|
-
});
|
|
29
|
-
describe('readProfiles', () => {
|
|
30
|
-
it('returns an empty array when the file is missing', () => {
|
|
31
|
-
expect(readProfiles(tmpHome())).toEqual([]);
|
|
32
|
-
});
|
|
33
|
-
it('throws ProvidersStoreError on malformed JSON', () => {
|
|
34
|
-
const home = tmpHome();
|
|
35
|
-
mkdirSync(join(home, '.namzu'));
|
|
36
|
-
writeFileSync(join(home, '.namzu', 'providers.json'), '{not json}');
|
|
37
|
-
expect(() => readProfiles(home)).toThrow(ProvidersStoreError);
|
|
38
|
-
});
|
|
39
|
-
it('throws on wrong version', () => {
|
|
40
|
-
const home = tmpHome();
|
|
41
|
-
mkdirSync(join(home, '.namzu'));
|
|
42
|
-
writeFileSync(join(home, '.namzu', 'providers.json'), JSON.stringify({ version: 99, profiles: [] }));
|
|
43
|
-
expect(() => readProfiles(home)).toThrowError(/unsupported version/);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
describe('writeProfiles', () => {
|
|
47
|
-
it('round-trips a profile through disk', () => {
|
|
48
|
-
const home = tmpHome();
|
|
49
|
-
writeProfiles([anthropic()], home);
|
|
50
|
-
expect(readProfiles(home)).toEqual([anthropic()]);
|
|
51
|
-
});
|
|
52
|
-
it.skipIf(IS_WINDOWS)('enforces mode 0600 on the file and 0700 on the directory', () => {
|
|
53
|
-
const home = tmpHome();
|
|
54
|
-
writeProfiles([anthropic()], home);
|
|
55
|
-
const fileStat = statSync(providersPath(home));
|
|
56
|
-
const dirStat = statSync(join(home, '.namzu'));
|
|
57
|
-
expect(fileStat.mode & 0o777).toBe(0o600);
|
|
58
|
-
expect(dirStat.mode & 0o777).toBe(0o700);
|
|
59
|
-
});
|
|
60
|
-
it('writes valid JSON that includes the version header', () => {
|
|
61
|
-
const home = tmpHome();
|
|
62
|
-
writeProfiles([anthropic()], home);
|
|
63
|
-
const raw = readFileSync(providersPath(home), 'utf8');
|
|
64
|
-
const parsed = JSON.parse(raw);
|
|
65
|
-
expect(parsed.version).toBe(1);
|
|
66
|
-
expect(Array.isArray(parsed.profiles)).toBe(true);
|
|
67
|
-
});
|
|
68
|
-
it('rejects duplicate names', () => {
|
|
69
|
-
expect(() => writeProfiles([anthropic(), anthropic()], tmpHome())).toThrowError(/duplicate profile name/);
|
|
70
|
-
});
|
|
71
|
-
it('rejects more than one default', () => {
|
|
72
|
-
expect(() => writeProfiles([anthropic({ default: true }), openai({ name: 'o', default: true })], tmpHome())).toThrowError(/at most one/);
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
describe('concurrent writes', () => {
|
|
76
|
-
it('two simultaneous writeProfiles calls do not collide on the temp file', async () => {
|
|
77
|
-
const home = tmpHome();
|
|
78
|
-
// Fire two writes in parallel. Each carries a different profile set
|
|
79
|
-
// so we can tell which one won the final rename — the important
|
|
80
|
-
// guarantee is that NEITHER throws (no temp-path collision) and
|
|
81
|
-
// the final on-disk state is exactly one of the two valid inputs
|
|
82
|
-
// (no half-written, no merged garbage).
|
|
83
|
-
const a = anthropic({ name: 'one' });
|
|
84
|
-
const b = openai({ name: 'two' });
|
|
85
|
-
await Promise.all([
|
|
86
|
-
Promise.resolve().then(() => writeProfiles([a], home)),
|
|
87
|
-
Promise.resolve().then(() => writeProfiles([b], home)),
|
|
88
|
-
]);
|
|
89
|
-
const final = readProfiles(home);
|
|
90
|
-
expect(final.length).toBe(1);
|
|
91
|
-
expect(['one', 'two']).toContain(final[0]?.name);
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
describe('assertInvariants', () => {
|
|
95
|
-
it('passes for an empty store', () => {
|
|
96
|
-
expect(() => assertInvariants([])).not.toThrow();
|
|
97
|
-
});
|
|
98
|
-
it('passes for a single profile with default=true', () => {
|
|
99
|
-
expect(() => assertInvariants([anthropic({ default: true })])).not.toThrow();
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
describe('resolveApiKey', () => {
|
|
103
|
-
it('returns null when no key is anywhere', () => {
|
|
104
|
-
const p = { name: 'x', type: 'anthropic' };
|
|
105
|
-
expect(resolveApiKey(p, {})).toBeNull();
|
|
106
|
-
});
|
|
107
|
-
it('reads from profile.apiKey when no env override', () => {
|
|
108
|
-
expect(resolveApiKey(anthropic(), {})).toBe('sk-ant-deadbeef');
|
|
109
|
-
});
|
|
110
|
-
it('per-type env (ANTHROPIC_API_KEY) wins over file', () => {
|
|
111
|
-
expect(resolveApiKey(anthropic(), { ANTHROPIC_API_KEY: 'env-key' })).toBe('env-key');
|
|
112
|
-
});
|
|
113
|
-
it('per-profile env (NAMZU_<NAME>_API_KEY) wins over per-type', () => {
|
|
114
|
-
expect(resolveApiKey(anthropic({ name: 'work' }), {
|
|
115
|
-
ANTHROPIC_API_KEY: 'type-key',
|
|
116
|
-
NAMZU_WORK_API_KEY: 'profile-key',
|
|
117
|
-
})).toBe('profile-key');
|
|
118
|
-
});
|
|
119
|
-
it('normalizes profile names with non-alphanumerics in env lookup', () => {
|
|
120
|
-
expect(resolveApiKey(anthropic({ name: 'work-1' }), { NAMZU_WORK_1_API_KEY: 'normalized' })).toBe('normalized');
|
|
121
|
-
});
|
|
122
|
-
it('returns null for ollama (no api-key concept) when nothing is set', () => {
|
|
123
|
-
expect(resolveApiKey({ name: 'local', type: 'ollama' }, {})).toBeNull();
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
describe('findDefault', () => {
|
|
127
|
-
it('returns the profile with default=true', () => {
|
|
128
|
-
const list = [anthropic(), openai({ default: true })];
|
|
129
|
-
expect(findDefault(list)?.name).toBe('o');
|
|
130
|
-
});
|
|
131
|
-
it('returns null when nothing is marked default', () => {
|
|
132
|
-
expect(findDefault([anthropic(), openai()])).toBeNull();
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
//# sourceMappingURL=store.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.test.js","sourceRoot":"","sources":["../../../src/integrations/providers/store.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAG7C,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,GACb,MAAM,YAAY,CAAA;AAEnB;;;;;;GAMG;AACH,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAA;AAE/C,SAAS,OAAO;IACf,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAA;AACvD,CAAC;AAED,MAAM,SAAS,GAAG,CAAC,OAAkC,EAAE,EAAoB,EAAE,CAAC,CAAC;IAC9E,IAAI,EAAE,GAAG;IACT,IAAI,E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