koneck 2.30.0 → 2.31.1
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/ink-chat.d.ts.map +1 -1
- package/dist/ink-chat.js +24 -46
- package/dist/ink-chat.js.map +1 -1
- package/dist/model-catalog.d.ts +54 -0
- package/dist/model-catalog.d.ts.map +1 -0
- package/dist/model-catalog.js +95 -0
- package/dist/model-catalog.js.map +1 -0
- package/dist/providers.d.ts +26 -0
- package/dist/providers.d.ts.map +1 -1
- package/dist/providers.js +57 -0
- package/dist/providers.js.map +1 -1
- package/dist/web/api.d.ts.map +1 -1
- package/dist/web/api.js +186 -1
- package/dist/web/api.js.map +1 -1
- package/dist/web/ui-client.d.ts.map +1 -1
- package/dist/web/ui-client.js +157 -9
- package/dist/web/ui-client.js.map +1 -1
- package/dist/web/ui-css.d.ts.map +1 -1
- package/dist/web/ui-css.js +30 -0
- package/dist/web/ui-css.js.map +1 -1
- package/dist/web/ui.d.ts.map +1 -1
- package/dist/web/ui.js +31 -3
- package/dist/web/ui.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The model list for a provider, as one implementation.
|
|
3
|
+
*
|
|
4
|
+
* This was inside the TUI component, which meant the browser had no way to get at it and offered
|
|
5
|
+
* a text field instead — you had to already know the name of the model you wanted to type. The
|
|
6
|
+
* listing is the same OpenAI-compatible `/models` call either way, so it belongs out here where
|
|
7
|
+
* both front ends can ask for it.
|
|
8
|
+
*
|
|
9
|
+
* A provider that does not implement the endpoint is a normal outcome, not a failure: several
|
|
10
|
+
* gateways don't, and a virtual model like OmniRoute's `auto/best-coding` is routing instruction
|
|
11
|
+
* rather than a catalogue entry, so it will never appear in a listing. Both cases are reported as
|
|
12
|
+
* such so the interface can keep letting you name a model by hand.
|
|
13
|
+
*/
|
|
14
|
+
import type { AgentConfig } from './types.js';
|
|
15
|
+
import { type ModelInfo } from './usage.js';
|
|
16
|
+
/** One row, with everything already worked out that a picker needs to show. */
|
|
17
|
+
export interface CatalogEntry {
|
|
18
|
+
id: string;
|
|
19
|
+
/** Grouping key, which turns a flat several-hundred-entry list into something scannable. */
|
|
20
|
+
vendor: string;
|
|
21
|
+
/** The annotation line: cost, context, tool support, and how it answered last time. */
|
|
22
|
+
detail: string;
|
|
23
|
+
free: boolean;
|
|
24
|
+
local: boolean;
|
|
25
|
+
contextLength?: number;
|
|
26
|
+
maxOutput?: number;
|
|
27
|
+
toolCalling?: boolean;
|
|
28
|
+
state?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface Catalog {
|
|
31
|
+
provider: string;
|
|
32
|
+
entries: CatalogEntry[];
|
|
33
|
+
/** True when the provider answered with a list. False means name it by hand. */
|
|
34
|
+
listed: boolean;
|
|
35
|
+
/** Why the listing is empty, in words, when it is. */
|
|
36
|
+
note?: string;
|
|
37
|
+
}
|
|
38
|
+
/** The annotation beside a model name. Shared so the TUI and the browser read alike. */
|
|
39
|
+
export declare function detailFor(m: ModelInfo, local: boolean, state?: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Asks a provider what it serves.
|
|
42
|
+
*
|
|
43
|
+
* Never throws: an unreachable endpoint, a missing credential and an unimplemented route all
|
|
44
|
+
* come back as an empty catalogue carrying the reason, because every one of them still leaves you
|
|
45
|
+
* able to type a model name.
|
|
46
|
+
*/
|
|
47
|
+
export declare function listModels(config: AgentConfig): Promise<Catalog>;
|
|
48
|
+
/**
|
|
49
|
+
* The model a provider is configured to use by default, for pre-filling a picker.
|
|
50
|
+
*
|
|
51
|
+
* A declared provider may carry its own; otherwise the built-in default stands.
|
|
52
|
+
*/
|
|
53
|
+
export declare function defaultModelFor(provider: string): string;
|
|
54
|
+
//# sourceMappingURL=model-catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-catalog.d.ts","sourceRoot":"","sources":["../src/model-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9C,OAAO,EACoD,KAAK,SAAS,EACxE,MAAM,YAAY,CAAC;AAEpB,+EAA+E;AAC/E,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,4FAA4F;IAC5F,MAAM,EAAE,MAAM,CAAC;IACf,uFAAuF;IACvF,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,OAAO;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,gFAAgF;IAChF,MAAM,EAAE,OAAO,CAAC;IAChB,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wFAAwF;AACxF,wBAAgB,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAU9E;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAoDtE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExD"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The model list for a provider, as one implementation.
|
|
3
|
+
*
|
|
4
|
+
* This was inside the TUI component, which meant the browser had no way to get at it and offered
|
|
5
|
+
* a text field instead — you had to already know the name of the model you wanted to type. The
|
|
6
|
+
* listing is the same OpenAI-compatible `/models` call either way, so it belongs out here where
|
|
7
|
+
* both front ends can ask for it.
|
|
8
|
+
*
|
|
9
|
+
* A provider that does not implement the endpoint is a normal outcome, not a failure: several
|
|
10
|
+
* gateways don't, and a virtual model like OmniRoute's `auto/best-coding` is routing instruction
|
|
11
|
+
* rather than a catalogue entry, so it will never appear in a listing. Both cases are reported as
|
|
12
|
+
* such so the interface can keep letting you name a model by hand.
|
|
13
|
+
*/
|
|
14
|
+
import { buildClient } from './engine.js';
|
|
15
|
+
import { PROVIDERS, resolveProvider, needsNoCredential } from './providers.js';
|
|
16
|
+
import { modelInfoFrom, readModelStatus, stateLabel, humanTokens, } from './usage.js';
|
|
17
|
+
/** The annotation beside a model name. Shared so the TUI and the browser read alike. */
|
|
18
|
+
export function detailFor(m, local, state) {
|
|
19
|
+
return [
|
|
20
|
+
// "paid" is a claim about somebody's billing, and a model on your own hardware has no
|
|
21
|
+
// billing. The catalogue's free flag describes a gateway's tiers; it means nothing for a
|
|
22
|
+
// runtime you are running, and calling qwen3-coder on a LAN box "paid" is just wrong.
|
|
23
|
+
local ? 'local' : m.free ? 'free' : 'paid',
|
|
24
|
+
...(m.contextLength ? [`${humanTokens(m.contextLength)} ctx`] : []),
|
|
25
|
+
...(m.toolCalling === false ? ['no tools'] : []),
|
|
26
|
+
...(state ? [state] : []),
|
|
27
|
+
].join(' · ');
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Asks a provider what it serves.
|
|
31
|
+
*
|
|
32
|
+
* Never throws: an unreachable endpoint, a missing credential and an unimplemented route all
|
|
33
|
+
* come back as an empty catalogue carrying the reason, because every one of them still leaves you
|
|
34
|
+
* able to type a model name.
|
|
35
|
+
*/
|
|
36
|
+
export async function listModels(config) {
|
|
37
|
+
const provider = config.provider;
|
|
38
|
+
// The same resolution buildClient does, so what is reported is the endpoint actually called
|
|
39
|
+
// rather than the provider's suggested one.
|
|
40
|
+
const def = resolveProvider(provider, config.baseURL);
|
|
41
|
+
const local = needsNoCredential(def);
|
|
42
|
+
const statuses = readModelStatus();
|
|
43
|
+
let raw;
|
|
44
|
+
try {
|
|
45
|
+
const page = await buildClient(config).models.list();
|
|
46
|
+
raw = page.data;
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
const why = e instanceof Error ? e.message : String(e);
|
|
50
|
+
return {
|
|
51
|
+
provider,
|
|
52
|
+
entries: [],
|
|
53
|
+
listed: false,
|
|
54
|
+
note: /404|not found|unsupported|unrecognized/i.test(why)
|
|
55
|
+
? `${def.displayName} does not publish a model list — name the model yourself.`
|
|
56
|
+
: `Could not reach ${def.baseURL} to list models: ${why.slice(0, 160)}`,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const entries = raw
|
|
60
|
+
.map(m => modelInfoFrom(m, provider))
|
|
61
|
+
.filter(m => m.id)
|
|
62
|
+
.map((m) => {
|
|
63
|
+
const st = statuses[`${provider}:${m.id}`];
|
|
64
|
+
const state = st ? (st.state !== 'ok' ? stateLabel(st.state) : 'ready') : undefined;
|
|
65
|
+
return {
|
|
66
|
+
id: m.id,
|
|
67
|
+
vendor: m.vendor,
|
|
68
|
+
detail: detailFor(m, local, state),
|
|
69
|
+
free: m.free,
|
|
70
|
+
local,
|
|
71
|
+
...(m.contextLength !== undefined ? { contextLength: m.contextLength } : {}),
|
|
72
|
+
...(m.maxOutput !== undefined ? { maxOutput: m.maxOutput } : {}),
|
|
73
|
+
...(m.toolCalling !== undefined ? { toolCalling: m.toolCalling } : {}),
|
|
74
|
+
...(state !== undefined ? { state } : {}),
|
|
75
|
+
};
|
|
76
|
+
})
|
|
77
|
+
.sort((a, b) => a.id.localeCompare(b.id));
|
|
78
|
+
// A provider that answers with an empty list is not the same as one that refuses to answer,
|
|
79
|
+
// but for the person choosing a model it comes to the same thing.
|
|
80
|
+
return entries.length > 0
|
|
81
|
+
? { provider, entries, listed: true }
|
|
82
|
+
: {
|
|
83
|
+
provider, entries, listed: false,
|
|
84
|
+
note: `${def.displayName} returned an empty list — name the model yourself.`,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The model a provider is configured to use by default, for pre-filling a picker.
|
|
89
|
+
*
|
|
90
|
+
* A declared provider may carry its own; otherwise the built-in default stands.
|
|
91
|
+
*/
|
|
92
|
+
export function defaultModelFor(provider) {
|
|
93
|
+
return PROVIDERS[provider]?.defaultModel ?? '';
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=model-catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-catalog.js","sourceRoot":"","sources":["../src/model-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EACL,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,GACxD,MAAM,YAAY,CAAC;AA0BpB,wFAAwF;AACxF,MAAM,UAAU,SAAS,CAAC,CAAY,EAAE,KAAc,EAAE,KAAc;IACpE,OAAO;QACL,sFAAsF;QACtF,yFAAyF;QACzF,sFAAsF;QACtF,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;QAC1C,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACnE,GAAG,CAAC,CAAC,CAAC,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAChD,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1B,CAAC,IAAI,CAAC,KAAK,CAAC,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C;QACvB,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE;QACrC,CAAC,CAAC;YACE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK;YAChC,IAAI,EAAE,GAAG,GAAG,CAAC,WAAW,oDAAoD;SAC7E,CAAC;AACR,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,OAAO,SAAS,CAAC,QAAQ,CAAC,EAAE,YAAY,IAAI,EAAE,CAAC;AACjD,CAAC"}
|
package/dist/providers.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type EndpointLayer, type ResolvedEndpoint } from './endpoints.js';
|
|
1
2
|
export interface ProviderDef {
|
|
2
3
|
name: string;
|
|
3
4
|
displayName: string;
|
|
@@ -33,9 +34,34 @@ export interface ProviderDef {
|
|
|
33
34
|
export declare function userProvidersPath(home?: string): string;
|
|
34
35
|
/** Reads and validates declared providers. A malformed file is skipped, never fatal. */
|
|
35
36
|
export declare function readUserProviders(home?: string): Record<string, ProviderDef>;
|
|
37
|
+
/**
|
|
38
|
+
* The endpoint in force for a provider, with the provider's own definition supplying the fallbacks.
|
|
39
|
+
*
|
|
40
|
+
* The TUI had this inline, so the browser had nothing to call and reached for the registry's
|
|
41
|
+
* suggested address instead — which quietly discards a saved per-provider endpoint, the exact thing
|
|
42
|
+
* `/endpoint` exists to set. endpoints.ts stays free of dependencies, which is why the definition
|
|
43
|
+
* is looked up here and handed to it rather than read from inside it.
|
|
44
|
+
*/
|
|
45
|
+
export declare function endpointForProvider(provider: string, layers: readonly EndpointLayer[]): ResolvedEndpoint;
|
|
36
46
|
/** Persists a declared provider, merging it into the running registry immediately. */
|
|
37
47
|
export declare function addUserProvider(def: Omit<ProviderDef, 'userDefined'>, home?: string): ProviderDef;
|
|
48
|
+
/**
|
|
49
|
+
* Forgets a declared provider.
|
|
50
|
+
*
|
|
51
|
+
* Only a declared one: a built-in cannot be removed, and a declaration that was shadowing a
|
|
52
|
+
* built-in leaves the built-in behind rather than a hole where a provider used to be. Returns
|
|
53
|
+
* whether anything was actually removed, so an interface can say so.
|
|
54
|
+
*/
|
|
55
|
+
export declare function removeUserProvider(name: string, home?: string): boolean;
|
|
38
56
|
export declare const PROVIDERS: Record<string, ProviderDef>;
|
|
57
|
+
/**
|
|
58
|
+
* What KONECK ships with, taken before anything declared is merged over the top.
|
|
59
|
+
*
|
|
60
|
+
* A declaration may deliberately shadow a built-in — that is how a permanently relocated endpoint
|
|
61
|
+
* gets pinned. Withdrawing the declaration then has to put the built-in back, and since the merge
|
|
62
|
+
* below overwrites in place there would otherwise be nothing left to put back.
|
|
63
|
+
*/
|
|
64
|
+
export declare const BUILT_INS: Readonly<Record<string, ProviderDef>>;
|
|
39
65
|
export declare function resolveProvider(name: string, baseURLOverride?: string): ProviderDef;
|
|
40
66
|
/**
|
|
41
67
|
* Whether an endpoint needs a credential at all.
|
package/dist/providers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAE5F,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,mFAAmF;IACnF,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qFAAqF;IACrF,WAAW,CAAC,EAAE,OAAO,CAAC;C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AAa,IAAI,MAAM,GAAG,SAAS,CAKlD;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAoBrE;AAED,wBAAgB,aAAa,IAAI,MAAM,CAQtC"}
|
package/dist/providers.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs';
|
|
2
2
|
import os from 'os';
|
|
3
3
|
import path from 'path';
|
|
4
|
+
import { resolveEndpoint } from './endpoints.js';
|
|
4
5
|
/**
|
|
5
6
|
* Providers the user declares themselves, for anything KONECK does not ship with — OpenRouter,
|
|
6
7
|
* a company gateway, a vendor that launched last week. Declared entries behave exactly like
|
|
@@ -63,6 +64,22 @@ export function readUserProviders(home) {
|
|
|
63
64
|
}
|
|
64
65
|
return out;
|
|
65
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* The endpoint in force for a provider, with the provider's own definition supplying the fallbacks.
|
|
69
|
+
*
|
|
70
|
+
* The TUI had this inline, so the browser had nothing to call and reached for the registry's
|
|
71
|
+
* suggested address instead — which quietly discards a saved per-provider endpoint, the exact thing
|
|
72
|
+
* `/endpoint` exists to set. endpoints.ts stays free of dependencies, which is why the definition
|
|
73
|
+
* is looked up here and handed to it rather than read from inside it.
|
|
74
|
+
*/
|
|
75
|
+
export function endpointForProvider(provider, layers) {
|
|
76
|
+
const def = PROVIDERS[provider.trim().toLowerCase()];
|
|
77
|
+
return resolveEndpoint(provider, layers, {
|
|
78
|
+
fallback: def?.baseURL ?? '',
|
|
79
|
+
...(def?.baseURLEnv ? { baseURLEnv: def.baseURLEnv } : {}),
|
|
80
|
+
fallbackIsUserDeclared: def?.userDefined === true,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
66
83
|
/** Persists a declared provider, merging it into the running registry immediately. */
|
|
67
84
|
export function addUserProvider(def, home) {
|
|
68
85
|
const file = userProvidersPath(home);
|
|
@@ -88,6 +105,38 @@ export function addUserProvider(def, home) {
|
|
|
88
105
|
PROVIDERS[name] = merged;
|
|
89
106
|
return merged;
|
|
90
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Forgets a declared provider.
|
|
110
|
+
*
|
|
111
|
+
* Only a declared one: a built-in cannot be removed, and a declaration that was shadowing a
|
|
112
|
+
* built-in leaves the built-in behind rather than a hole where a provider used to be. Returns
|
|
113
|
+
* whether anything was actually removed, so an interface can say so.
|
|
114
|
+
*/
|
|
115
|
+
export function removeUserProvider(name, home) {
|
|
116
|
+
const key = name.trim().toLowerCase();
|
|
117
|
+
const file = userProvidersPath(home);
|
|
118
|
+
if (!existsSync(file))
|
|
119
|
+
return false;
|
|
120
|
+
let existing;
|
|
121
|
+
try {
|
|
122
|
+
existing = JSON.parse(readFileSync(file, 'utf-8'));
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
if (!(key in existing))
|
|
128
|
+
return false;
|
|
129
|
+
delete existing[key];
|
|
130
|
+
writeFileSync(file, JSON.stringify(existing, null, 2) + '\n', { encoding: 'utf-8', mode: 0o600 });
|
|
131
|
+
// The running registry had the declaration merged into it. A shadowed built-in has to come
|
|
132
|
+
// back, so the definition is rebuilt from BUILT_INS rather than simply deleted.
|
|
133
|
+
const builtIn = BUILT_INS[key];
|
|
134
|
+
if (builtIn)
|
|
135
|
+
PROVIDERS[key] = builtIn;
|
|
136
|
+
else
|
|
137
|
+
delete PROVIDERS[key];
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
91
140
|
export const PROVIDERS = {
|
|
92
141
|
omni: {
|
|
93
142
|
name: 'omni',
|
|
@@ -184,6 +233,14 @@ export const PROVIDERS = {
|
|
|
184
233
|
defaultModel: 'sonar-pro',
|
|
185
234
|
},
|
|
186
235
|
};
|
|
236
|
+
/**
|
|
237
|
+
* What KONECK ships with, taken before anything declared is merged over the top.
|
|
238
|
+
*
|
|
239
|
+
* A declaration may deliberately shadow a built-in — that is how a permanently relocated endpoint
|
|
240
|
+
* gets pinned. Withdrawing the declaration then has to put the built-in back, and since the merge
|
|
241
|
+
* below overwrites in place there would otherwise be nothing left to put back.
|
|
242
|
+
*/
|
|
243
|
+
export const BUILT_INS = { ...PROVIDERS };
|
|
187
244
|
// Declared providers are merged at load so every consumer — the picker, --list-providers,
|
|
188
245
|
// credential inference — sees one registry with no special-casing.
|
|
189
246
|
for (const [name, def] of Object.entries(readUserProviders()))
|
package/dist/providers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAgBxB;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE;IACnD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC;AACtD,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,iBAAiB,CAAC,IAAa;IAC7C,MAAM,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IACjC,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,EAAE,CAAC;IAAC,CAAC;IAC9E,IAAI,MAAM,IAAI,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC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7D,OAAO,GAAG,CAAC,SAAS,sCAAsC;QAC1D,YAAY,GAAG,CAAC,SAAS,oCAAoC;QAC7D,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,0CAA0C,GAAG,CAAC,UAAU,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CACnG,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAC5C,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;QAC/E,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QACpB,2BAA2B,iBAAiB,EAAE,KAAK;QACnD,kEAAkE;QAClE,uEAAuE,CAAC;AAC5E,CAAC"}
|
package/dist/web/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/web/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/web/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAkB/C,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAGrC,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oFAAoF;IACpF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AA6BD,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED,wBAAsB,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,SAAS,CAAC,CAuqBpG"}
|
package/dist/web/api.js
CHANGED
|
@@ -17,7 +17,7 @@ import { promises as fsp } from 'fs';
|
|
|
17
17
|
import os from 'os';
|
|
18
18
|
import path from 'path';
|
|
19
19
|
import { SessionRegistry } from './sessions.js';
|
|
20
|
-
import { PROVIDERS, resolveProvider, needsNoCredential } from '../providers.js';
|
|
20
|
+
import { PROVIDERS, BUILT_INS, resolveProvider, needsNoCredential, readUserProviders, addUserProvider, removeUserProvider, userProvidersPath, } from '../providers.js';
|
|
21
21
|
import { page } from './ui.js';
|
|
22
22
|
import { listPast, readPast } from './history.js';
|
|
23
23
|
import { summarise as summariseTrajectory } from '../trajectory.js';
|
|
@@ -78,6 +78,14 @@ export async function startWeb(baseConfig, options = {}) {
|
|
|
78
78
|
const html = page();
|
|
79
79
|
/** Event streams currently open, so shutting down does not wait on them for ever. */
|
|
80
80
|
const open = new Set();
|
|
81
|
+
/**
|
|
82
|
+
* Says something on the terminal the server was launched from.
|
|
83
|
+
*
|
|
84
|
+
* Silent under --quiet, which is what the tests run with; everywhere else the launching terminal
|
|
85
|
+
* is the one place a change made from a browser can be seen by the person who owns the machine.
|
|
86
|
+
*/
|
|
87
|
+
const announce = (line) => { if (!options.quiet)
|
|
88
|
+
console.log(line); };
|
|
81
89
|
const server = createServer(async (req, res) => {
|
|
82
90
|
const url = new URL(req.url ?? '/', `http://${host}:${port}`);
|
|
83
91
|
const route = url.pathname;
|
|
@@ -503,6 +511,183 @@ export async function startWeb(baseConfig, options = {}) {
|
|
|
503
511
|
return json(res, 401, { error: 'token required' });
|
|
504
512
|
return json(res, 200, await mcpServers(workspace));
|
|
505
513
|
}
|
|
514
|
+
/*
|
|
515
|
+
* What a provider actually serves.
|
|
516
|
+
*
|
|
517
|
+
* The dialog offered a text field, which means you could only choose a model whose name you
|
|
518
|
+
* already knew. This is the same OpenAI-compatible listing the TUI picker uses. A provider
|
|
519
|
+
* that does not publish one answers `listed: false` with the reason, and the dialog keeps
|
|
520
|
+
* its text field for that case — including for a virtual model like `auto/best-coding`,
|
|
521
|
+
* which is a routing instruction and appears in no catalogue.
|
|
522
|
+
*/
|
|
523
|
+
if (route === '/api/models' && req.method === 'GET') {
|
|
524
|
+
if (!mayAct)
|
|
525
|
+
return json(res, 401, { error: 'token required' });
|
|
526
|
+
const wanted = url.searchParams.get('provider') ?? baseConfig.provider;
|
|
527
|
+
if (!PROVIDERS[wanted])
|
|
528
|
+
return json(res, 404, { error: `unknown provider "${wanted}"` });
|
|
529
|
+
const { listModels } = await import('../model-catalog.js');
|
|
530
|
+
// The endpoint actually configured for that provider, not the registry's suggestion — a
|
|
531
|
+
// saved endpoint is the whole point of setting one, and asking localhost what a LAN box
|
|
532
|
+
// serves would answer for the wrong machine.
|
|
533
|
+
const sameProvider = wanted === baseConfig.provider;
|
|
534
|
+
let endpointURL;
|
|
535
|
+
if (sameProvider && baseConfig.baseURL) {
|
|
536
|
+
// The endpoint this run is actually using. It already carries anything given on the
|
|
537
|
+
// command line, which outranks the stored configuration — asking the saved address what
|
|
538
|
+
// it serves would answer for a different machine than the one being talked to.
|
|
539
|
+
endpointURL = baseConfig.baseURL;
|
|
540
|
+
}
|
|
541
|
+
else {
|
|
542
|
+
const { endpointForProvider } = await import('../providers.js');
|
|
543
|
+
const { loadKoneckConfig } = await import('../config-store.js');
|
|
544
|
+
endpointURL = endpointForProvider(wanted, [await loadKoneckConfig()]).url;
|
|
545
|
+
}
|
|
546
|
+
// A credential belongs to the provider that issued it. Carrying the running session's key
|
|
547
|
+
// across to a different provider would send it to a host it was never meant for, so it is
|
|
548
|
+
// dropped and resolved from that provider's own variable instead.
|
|
549
|
+
// Listing is a network call to somebody else's endpoint, so it gets a deadline rather
|
|
550
|
+
// than being allowed to hold the connection open.
|
|
551
|
+
const catalog = await Promise.race([
|
|
552
|
+
listModels({
|
|
553
|
+
...baseConfig,
|
|
554
|
+
provider: wanted,
|
|
555
|
+
baseURL: endpointURL,
|
|
556
|
+
...(sameProvider ? {} : { apiKey: undefined }),
|
|
557
|
+
}),
|
|
558
|
+
new Promise(resolve => setTimeout(() => resolve({
|
|
559
|
+
provider: wanted, entries: [], listed: false,
|
|
560
|
+
note: 'The provider did not answer within 15 seconds — name the model yourself.',
|
|
561
|
+
}), 15_000).unref?.()),
|
|
562
|
+
]);
|
|
563
|
+
return json(res, 200, catalog);
|
|
564
|
+
}
|
|
565
|
+
/*
|
|
566
|
+
* Providers you declare yourself, for anything KONECK does not ship with.
|
|
567
|
+
*
|
|
568
|
+
* Declaring one names an endpoint that code and prompts will be sent to, so it takes the
|
|
569
|
+
* acting token like any other change of consequence — and a credential is never accepted in
|
|
570
|
+
* the body. What is stored is the *name of an environment variable*; the value stays in the
|
|
571
|
+
* environment, or in Vaultwarden, and never travels through a request body or a log.
|
|
572
|
+
*/
|
|
573
|
+
if (route === '/api/providers' && req.method === 'GET') {
|
|
574
|
+
if (!mayRead)
|
|
575
|
+
return json(res, 401, { error: 'token required' });
|
|
576
|
+
const declared = readUserProviders();
|
|
577
|
+
return json(res, 200, {
|
|
578
|
+
file: userProvidersPath(),
|
|
579
|
+
providers: Object.values(PROVIDERS).map(p => ({
|
|
580
|
+
name: p.name,
|
|
581
|
+
label: p.displayName,
|
|
582
|
+
baseURL: p.baseURL,
|
|
583
|
+
apiKeyEnv: p.apiKeyEnv,
|
|
584
|
+
defaultModel: p.defaultModel,
|
|
585
|
+
keyless: needsNoCredential(p),
|
|
586
|
+
declared: p.userDefined === true,
|
|
587
|
+
// Whether the variable it wants is actually set. Not its value.
|
|
588
|
+
keyPresent: !!(p.apiKeyEnv && process.env[p.apiKeyEnv]),
|
|
589
|
+
shadowsBuiltIn: p.userDefined === true && BUILT_INS[p.name] !== undefined,
|
|
590
|
+
})),
|
|
591
|
+
declaredCount: Object.keys(declared).length,
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
if (route === '/api/providers' && req.method === 'POST') {
|
|
595
|
+
if (!mayAct)
|
|
596
|
+
return json(res, 401, { error: 'token required' });
|
|
597
|
+
const body = await readBody(req);
|
|
598
|
+
const name = String(body.name ?? '').trim().toLowerCase();
|
|
599
|
+
const baseURL = String(body.baseURL ?? '').trim();
|
|
600
|
+
if (!/^[a-z0-9][a-z0-9._-]{0,40}$/.test(name)) {
|
|
601
|
+
return json(res, 400, { error: 'a name may hold letters, digits, dot, dash, underscore' });
|
|
602
|
+
}
|
|
603
|
+
if (!/^https?:\/\/.+/i.test(baseURL)) {
|
|
604
|
+
return json(res, 400, { error: 'the endpoint must be an http or https URL' });
|
|
605
|
+
}
|
|
606
|
+
const keyEnv = String(body.apiKeyEnv ?? '').trim();
|
|
607
|
+
// A variable name, not a credential. Anything long and random is a pasted key, and taking
|
|
608
|
+
// it would write a secret into a JSON file and this request into whatever logs the path.
|
|
609
|
+
if (keyEnv && !/^[A-Za-z_][A-Za-z0-9_]{0,63}$/.test(keyEnv)) {
|
|
610
|
+
return json(res, 400, {
|
|
611
|
+
error: 'that looks like a key, not a variable name. Set the value in your environment '
|
|
612
|
+
+ 'or Vaultwarden and give the variable name here.',
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
/*
|
|
616
|
+
* Declaring a NEW name is additive: nothing that already worked changes, and the entry is
|
|
617
|
+
* visible as yours wherever providers are listed.
|
|
618
|
+
*
|
|
619
|
+
* Repointing a name KONECK ships with is a different act. `openai` is a name you already
|
|
620
|
+
* trust and already use; moving it to another host silently redirects everything that uses
|
|
621
|
+
* it — every future session, and the CLI as well as this browser. It is a legitimate thing
|
|
622
|
+
* to want (a company proxy in front of a vendor is exactly this) but not something to do by
|
|
623
|
+
* accident, so it takes a second, explicit request.
|
|
624
|
+
*
|
|
625
|
+
* This is not gated behind a launch flag. The token already permits /api/send, which runs
|
|
626
|
+
* an agent that writes files and executes commands — strictly more power than naming an
|
|
627
|
+
* endpoint. A flag here would restrict the configurable thing while leaving the dangerous
|
|
628
|
+
* one open, which is theatre rather than a boundary. What is worth having is that the
|
|
629
|
+
* change cannot happen silently: that is the confirmation here and the notice below.
|
|
630
|
+
*/
|
|
631
|
+
if (BUILT_INS[name] && body.replace !== true) {
|
|
632
|
+
return json(res, 409, {
|
|
633
|
+
error: `${name} ships with KONECK, pointing at ${BUILT_INS[name].baseURL}. `
|
|
634
|
+
+ `Replacing it sends everything that uses "${name}" to ${baseURL} instead, `
|
|
635
|
+
+ `in the CLI as well as here.`,
|
|
636
|
+
shadowsBuiltIn: name,
|
|
637
|
+
currentBaseURL: BUILT_INS[name].baseURL,
|
|
638
|
+
confirmWith: 'replace',
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
const headers = body.extraHeaders && typeof body.extraHeaders === 'object'
|
|
642
|
+
? Object.fromEntries(Object.entries(body.extraHeaders)
|
|
643
|
+
.filter(([k, v]) => typeof k === 'string' && typeof v === 'string' && k.trim() !== '')
|
|
644
|
+
.map(([k, v]) => [k.trim(), String(v)]))
|
|
645
|
+
: undefined;
|
|
646
|
+
const def = addUserProvider({
|
|
647
|
+
name,
|
|
648
|
+
displayName: String(body.label ?? '').trim() || name,
|
|
649
|
+
baseURL,
|
|
650
|
+
apiKeyEnv: keyEnv || name.toUpperCase().replace(/[^A-Z0-9]+/g, '_') + '_API_KEY',
|
|
651
|
+
defaultModel: String(body.defaultModel ?? '').trim() || 'default',
|
|
652
|
+
...(headers && Object.keys(headers).length > 0 ? { extraHeaders: headers } : {}),
|
|
653
|
+
});
|
|
654
|
+
// The terminal is where trust is granted in this design, so it is where a change of this
|
|
655
|
+
// kind is reported. A provider added from a browser should not be discoverable only by
|
|
656
|
+
// reading a JSON file afterwards.
|
|
657
|
+
announce(BUILT_INS[name]
|
|
658
|
+
? ` ⚠️ ${name} repointed from the browser → ${def.baseURL} (was ${BUILT_INS[name].baseURL})`
|
|
659
|
+
: ` Provider "${name}" declared from the browser → ${def.baseURL}`);
|
|
660
|
+
return json(res, 200, {
|
|
661
|
+
name: def.name,
|
|
662
|
+
label: def.displayName,
|
|
663
|
+
baseURL: def.baseURL,
|
|
664
|
+
apiKeyEnv: def.apiKeyEnv,
|
|
665
|
+
defaultModel: def.defaultModel,
|
|
666
|
+
keyless: needsNoCredential(def),
|
|
667
|
+
keyPresent: !!process.env[def.apiKeyEnv],
|
|
668
|
+
replacedBuiltIn: BUILT_INS[name] !== undefined,
|
|
669
|
+
file: userProvidersPath(),
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
if (route === '/api/providers' && req.method === 'DELETE') {
|
|
673
|
+
if (!mayAct)
|
|
674
|
+
return json(res, 401, { error: 'token required' });
|
|
675
|
+
const name = (url.searchParams.get('name') ?? '').trim().toLowerCase();
|
|
676
|
+
if (!name)
|
|
677
|
+
return json(res, 400, { error: 'which provider?' });
|
|
678
|
+
const removed = removeUserProvider(name);
|
|
679
|
+
if (!removed) {
|
|
680
|
+
return json(res, 404, {
|
|
681
|
+
error: BUILT_INS[name]
|
|
682
|
+
? `${name} ships with KONECK and cannot be removed`
|
|
683
|
+
: `${name} was not one you declared`,
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
announce(BUILT_INS[name]
|
|
687
|
+
? ` Provider "${name}" withdrawn from the browser — back to ${BUILT_INS[name].baseURL}`
|
|
688
|
+
: ` Provider "${name}" withdrawn from the browser`);
|
|
689
|
+
return json(res, 200, { removed: name, restoredBuiltIn: BUILT_INS[name] !== undefined });
|
|
690
|
+
}
|
|
506
691
|
if (route === '/api/model' && req.method === 'POST') {
|
|
507
692
|
if (!mayAct)
|
|
508
693
|
return json(res, 401, { error: 'token required' });
|