@kodax-ai/kodax 0.7.42 → 0.7.44
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/CHANGELOG.md +65 -6
- package/README.md +87 -56
- package/README_CN.md +46 -25
- package/dist/chunks/chunk-35BDEEC5.js +2 -0
- package/dist/chunks/chunk-4YPL2UVZ.js +848 -0
- package/dist/chunks/chunk-DI2G3YWL.js +31 -0
- package/dist/chunks/chunk-HHQ7YTGM.js +425 -0
- package/dist/chunks/chunk-QHILHQBB.js +519 -0
- package/dist/chunks/{chunk-IYJ5EPRV.js → chunk-RUDYNAK7.js} +1 -1
- package/dist/chunks/compaction-config-NAPRF7XR.js +2 -0
- package/dist/chunks/{construction-bootstrap-J2WOCYEK.js → construction-bootstrap-PHTGBRNU.js} +4 -4
- package/dist/chunks/dist-CCYBJJZY.js +2 -0
- package/dist/chunks/dist-RHIHZAYX.js +2 -0
- package/dist/chunks/utils-TV3UYCHQ.js +2 -0
- package/dist/index.d.ts +11 -11
- package/dist/index.js +2 -2
- package/dist/kodax_cli.js +1159 -1102
- package/dist/provider-capabilities.json +167 -0
- package/dist/sdk-agent.d.ts +905 -48
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +995 -755
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-llm.d.ts +5 -3
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.d.ts +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-repl.d.ts +10 -9
- package/dist/sdk-repl.js +1 -1
- package/dist/sdk-session.d.ts +23 -11
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/types-chunks/{cost-tracker.d-B6vMoLLF.d.ts → base.d-FUJahC0i.d.ts} +2 -110
- package/dist/types-chunks/{bash-prefix-extractor.d-CkhaqKkg.d.ts → bash-prefix-extractor.d-DdoSeghD.d.ts} +442 -131
- package/dist/types-chunks/cost-tracker.d-wRtyEW9d.d.ts +110 -0
- package/dist/types-chunks/file-tracker.d-DOfaoCbJ.d.ts +633 -0
- package/dist/types-chunks/manager.d-87belpiS.d.ts +370 -0
- package/dist/types-chunks/{resolver.d-DX9au4NJ.d.ts → resolver.d-B7ZnVuuf.d.ts} +157 -10
- package/dist/types-chunks/{session-storage.d-Cci897iM.d.ts → storage.d-DFD9ln5c.d.ts} +49 -2
- package/dist/types-chunks/{history-cleanup.d-DznrzEiU.d.ts → types.d-DM8zEJgF.d.ts} +1084 -282
- package/dist/types-chunks/{types.d-mM8vqvhT.d.ts → types.d-HBbWT-iA.d.ts} +41 -3
- package/dist/types-chunks/{storage.d-Bc5DoAwp.d.ts → utils.d-C5fzCE9W.d.ts} +25 -47
- package/package.json +7 -6
- package/dist/chunks/chunk-3RKBXWZS.js +0 -2
- package/dist/chunks/chunk-7JLYVWAF.js +0 -1033
- package/dist/chunks/chunk-CD3R5YBH.js +0 -16
- package/dist/chunks/chunk-DKXUY5F2.js +0 -209
- package/dist/chunks/chunk-HMYEQJGT.js +0 -31
- package/dist/chunks/chunk-KUX5LRPP.js +0 -2
- package/dist/chunks/chunk-OWSKU55I.js +0 -13
- package/dist/chunks/chunk-ZZ4KRK2B.js +0 -465
- package/dist/chunks/compaction-config-FIFFP4FT.js +0 -2
- package/dist/chunks/dist-2ZHWDXMQ.js +0 -2
- package/dist/chunks/dist-W4CJWLIH.js +0 -2
- package/dist/chunks/utils-A5MWDTWZ.js +0 -2
- package/dist/types-chunks/instance-discovery.d-BsKnIwpg.d.ts +0 -990
- package/dist/types-chunks/transport.d-DuyjG30t.d.ts +0 -180
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { a as McpServerConfig, b as McpServersConfig, M as McpConnectMode } from './config.d-BfJUXxC0.js';
|
|
2
|
+
import { a as CapabilityProvider, C as CapabilityKind, b as CapabilityResult } from './capability.d-3C62G8Eq.js';
|
|
3
|
+
|
|
4
|
+
type McpCapabilityKind = 'tool' | 'resource' | 'prompt';
|
|
5
|
+
type McpCapabilityRisk = 'read' | 'write' | 'network' | 'exec';
|
|
6
|
+
interface McpCatalogItem {
|
|
7
|
+
id: string;
|
|
8
|
+
serverId: string;
|
|
9
|
+
kind: McpCapabilityKind;
|
|
10
|
+
name: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
summary: string;
|
|
13
|
+
tags?: string[];
|
|
14
|
+
risk?: McpCapabilityRisk;
|
|
15
|
+
annotations?: Record<string, unknown>;
|
|
16
|
+
cachedAt: string;
|
|
17
|
+
}
|
|
18
|
+
interface McpCapabilityDescriptor extends McpCatalogItem {
|
|
19
|
+
inputSchema?: unknown;
|
|
20
|
+
outputSchema?: unknown;
|
|
21
|
+
promptArgsSchema?: unknown;
|
|
22
|
+
uri?: string;
|
|
23
|
+
mimeType?: string;
|
|
24
|
+
}
|
|
25
|
+
interface McpServerCatalogSnapshot {
|
|
26
|
+
serverId: string;
|
|
27
|
+
items: McpCatalogItem[];
|
|
28
|
+
descriptors: McpCapabilityDescriptor[];
|
|
29
|
+
updatedAt: string;
|
|
30
|
+
}
|
|
31
|
+
interface McpCatalogSearchOptions {
|
|
32
|
+
kind?: McpCapabilityKind;
|
|
33
|
+
limit?: number;
|
|
34
|
+
}
|
|
35
|
+
declare function defaultMcpCacheDir(): string;
|
|
36
|
+
declare function createMcpCapabilityId(serverId: string, kind: McpCapabilityKind, name: string): string;
|
|
37
|
+
declare function parseMcpCapabilityId(id: string): {
|
|
38
|
+
serverId: string;
|
|
39
|
+
kind: McpCapabilityKind;
|
|
40
|
+
name: string;
|
|
41
|
+
};
|
|
42
|
+
declare function searchMcpCatalog(items: readonly McpCatalogItem[], query: string, options?: McpCatalogSearchOptions): McpCatalogItem[];
|
|
43
|
+
declare function getMcpCachePaths(cacheDir: string, serverId: string): {
|
|
44
|
+
catalogDir: string;
|
|
45
|
+
indexPath: string;
|
|
46
|
+
itemsPath: string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
interface McpServerRuntimeDiagnostics {
|
|
50
|
+
serverId: string;
|
|
51
|
+
connect: 'lazy' | 'prewarm' | 'disabled';
|
|
52
|
+
status: 'idle' | 'connecting' | 'ready' | 'error' | 'disabled';
|
|
53
|
+
dirty: boolean;
|
|
54
|
+
lastError?: string;
|
|
55
|
+
cachedAt?: string;
|
|
56
|
+
tools: number;
|
|
57
|
+
resources: number;
|
|
58
|
+
prompts: number;
|
|
59
|
+
}
|
|
60
|
+
declare class McpServerRuntime {
|
|
61
|
+
private readonly serverId;
|
|
62
|
+
private readonly config;
|
|
63
|
+
private readonly cacheDir;
|
|
64
|
+
private transport?;
|
|
65
|
+
private readonly pending;
|
|
66
|
+
private nextRequestId;
|
|
67
|
+
private initialized;
|
|
68
|
+
private connectPromise?;
|
|
69
|
+
private catalog?;
|
|
70
|
+
private diagnostics;
|
|
71
|
+
constructor(serverId: string, config: McpServerConfig, cacheDir: string);
|
|
72
|
+
getDiagnostics(): McpServerRuntimeDiagnostics;
|
|
73
|
+
prewarmIfNeeded(): Promise<void>;
|
|
74
|
+
/** Load catalog from memory or disk only — never triggers a lazy connection. */
|
|
75
|
+
getCachedCatalog(): Promise<McpServerCatalogSnapshot | undefined>;
|
|
76
|
+
getCatalog(forceRefresh?: boolean): Promise<McpServerCatalogSnapshot>;
|
|
77
|
+
describeCapability(capabilityId: string): Promise<McpCapabilityDescriptor | undefined>;
|
|
78
|
+
callTool(name: string, args: Record<string, unknown>): Promise<{
|
|
79
|
+
content?: string;
|
|
80
|
+
structuredContent?: unknown;
|
|
81
|
+
metadata?: Record<string, unknown>;
|
|
82
|
+
}>;
|
|
83
|
+
readResource(name: string, options: Record<string, unknown>): Promise<{
|
|
84
|
+
content?: string;
|
|
85
|
+
structuredContent?: unknown;
|
|
86
|
+
metadata?: Record<string, unknown>;
|
|
87
|
+
}>;
|
|
88
|
+
getPrompt(name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
89
|
+
refreshCatalog(forceReconnect?: boolean): Promise<void>;
|
|
90
|
+
/** Public teardown — clears everything including the connect lock. */
|
|
91
|
+
dispose(): Promise<void>;
|
|
92
|
+
/** Internal transport teardown — does NOT clear connectPromise so the
|
|
93
|
+
* retry loop inside doConnect() can safely call it between attempts. */
|
|
94
|
+
private resetTransport;
|
|
95
|
+
private connect;
|
|
96
|
+
private doConnect;
|
|
97
|
+
private listDescriptors;
|
|
98
|
+
private request;
|
|
99
|
+
private notify;
|
|
100
|
+
private handleMessage;
|
|
101
|
+
private failPending;
|
|
102
|
+
private applyCatalogSnapshot;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* `McpCapabilityProvider` — implements the Layer A `CapabilityProvider`
|
|
107
|
+
* contract for an MCP server fleet.
|
|
108
|
+
*
|
|
109
|
+
* FEATURE_082 (v0.7.24): moved from
|
|
110
|
+
* `@kodax-ai/coding/src/capabilities/providers/mcp/provider.ts` to this package.
|
|
111
|
+
* The coding-specific `registerConfiguredMcpCapabilityProvider` adapter (which
|
|
112
|
+
* pulls in `KodaXExtensionRuntime`) lives in
|
|
113
|
+
* `@kodax-ai/coding/src/capabilities/providers/mcp-adapter.ts`.
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
interface McpProviderOptions {
|
|
117
|
+
cacheDir?: string;
|
|
118
|
+
}
|
|
119
|
+
declare class McpCapabilityProvider implements CapabilityProvider {
|
|
120
|
+
readonly id = "mcp";
|
|
121
|
+
readonly kinds: CapabilityProvider['kinds'];
|
|
122
|
+
private readonly runtimes;
|
|
123
|
+
private readonly cacheDir;
|
|
124
|
+
/**
|
|
125
|
+
* Construct an MCP capability provider.
|
|
126
|
+
*
|
|
127
|
+
* **Cache-dir capture warning (v0.7.35.1 FEATURE_145)** — when
|
|
128
|
+
* `options.cacheDir` is omitted, this constructor resolves
|
|
129
|
+
* `defaultMcpCacheDir()` ONCE at instantiation time and threads the
|
|
130
|
+
* result into every `McpServerRuntime` it spawns. If a substrate
|
|
131
|
+
* consumer plans to redirect the agent config home via
|
|
132
|
+
* `setAgentConfigHome()` from `@kodax-ai/agent`, that call MUST happen
|
|
133
|
+
* BEFORE constructing this provider. Late calls have no effect on
|
|
134
|
+
* already-constructed runtimes.
|
|
135
|
+
*
|
|
136
|
+
* To bypass the agent-home resolver entirely, pass
|
|
137
|
+
* `options.cacheDir` explicitly — that path wins unconditionally.
|
|
138
|
+
*/
|
|
139
|
+
constructor(servers: McpServersConfig | undefined, options?: McpProviderOptions);
|
|
140
|
+
hasActiveServers(): boolean;
|
|
141
|
+
/**
|
|
142
|
+
* v0.7.42 — read-only accessor for the enabled server id list.
|
|
143
|
+
* Used by {@link McpManager} to drive popout-shape `listServers /
|
|
144
|
+
* startServer / stopServer / logs / tools` operations without
|
|
145
|
+
* exposing the internal runtimes Map.
|
|
146
|
+
*/
|
|
147
|
+
getServerIds(): readonly string[];
|
|
148
|
+
/**
|
|
149
|
+
* v0.7.42 — single-server runtime accessor. Returns `undefined`
|
|
150
|
+
* for unknown / disabled servers. Use {@link McpManager} for
|
|
151
|
+
* higher-level lifecycle control.
|
|
152
|
+
*/
|
|
153
|
+
getRuntime(serverId: string): McpServerRuntime | undefined;
|
|
154
|
+
prewarm(): Promise<void>;
|
|
155
|
+
search(query: string, options?: {
|
|
156
|
+
kind?: CapabilityKind;
|
|
157
|
+
limit?: number;
|
|
158
|
+
server?: string;
|
|
159
|
+
}): Promise<unknown[]>;
|
|
160
|
+
describe(id: string): Promise<unknown>;
|
|
161
|
+
execute(id: string, input: Record<string, unknown>): Promise<CapabilityResult>;
|
|
162
|
+
read(id: string, options?: Record<string, unknown>): Promise<CapabilityResult>;
|
|
163
|
+
getPrompt(id: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
164
|
+
getPromptContext(): Promise<string | undefined>;
|
|
165
|
+
getDiagnostics(): Record<string, unknown> | undefined;
|
|
166
|
+
refresh(): Promise<void>;
|
|
167
|
+
dispose(): Promise<void>;
|
|
168
|
+
private collectCatalogItems;
|
|
169
|
+
private listServerDiagnostics;
|
|
170
|
+
private requireRuntime;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
interface McpTransportEvents {
|
|
174
|
+
/** Called with a complete JSON-RPC message (raw JSON string). */
|
|
175
|
+
onMessage(raw: string): void;
|
|
176
|
+
onError(error: Error): void;
|
|
177
|
+
onClose(reason: string): void;
|
|
178
|
+
}
|
|
179
|
+
interface McpTransport {
|
|
180
|
+
open(events: McpTransportEvents): Promise<void>;
|
|
181
|
+
/** Send a JSON string. The transport handles framing. */
|
|
182
|
+
send(json: string): Promise<void>;
|
|
183
|
+
close(): Promise<void>;
|
|
184
|
+
readonly connected: boolean;
|
|
185
|
+
}
|
|
186
|
+
type StdioFraming = 'content-length' | 'ndjson';
|
|
187
|
+
interface McpTransportOptions {
|
|
188
|
+
stdioFraming?: StdioFraming;
|
|
189
|
+
}
|
|
190
|
+
declare function createMcpTransport(config: McpServerConfig, options?: McpTransportOptions): McpTransport;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* McpManager — v0.7.42 (extends FEATURE_186 MCP popout surface).
|
|
194
|
+
*
|
|
195
|
+
* `McpCapabilityProvider` (`./provider.ts`) is the capability-provider-
|
|
196
|
+
* shaped object KodaX uses internally to plug MCP into the agent runtime
|
|
197
|
+
* — its public methods are `search` / `describe` / `execute` / `read` /
|
|
198
|
+
* `getPrompt` / `getDiagnostics` / `refresh` / `dispose`, which is the
|
|
199
|
+
* shape the substrate consumes but NOT the shape a popout UI wants.
|
|
200
|
+
*
|
|
201
|
+
* KodaX Space reported that `@kodax-ai/kodax/mcp` only exposed "types +
|
|
202
|
+
* helpers, no manager-shape API" — concretely they wanted a thin
|
|
203
|
+
* `listServers / startServer / stopServer / getServerLogs / listTools`
|
|
204
|
+
* surface to drive a popout panel:
|
|
205
|
+
*
|
|
206
|
+
* - One row per configured MCP server with live status
|
|
207
|
+
* - "Start" / "Stop" buttons that map to refreshCatalog(true) / dispose
|
|
208
|
+
* - Server logs (last error + status) so users can debug failures
|
|
209
|
+
* - Per-server tool list (filtered descriptors) for the "what does
|
|
210
|
+
* this MCP server expose" pane
|
|
211
|
+
*
|
|
212
|
+
* `McpManager` is the thin wrapper. It owns one `McpCapabilityProvider`
|
|
213
|
+
* instance internally, so all the existing lifecycle invariants
|
|
214
|
+
* (cache-dir capture, refresh, dispose, server-config validation) are
|
|
215
|
+
* preserved verbatim. The capability-provider-shaped methods stay
|
|
216
|
+
* available via `manager.provider()` as an escape hatch.
|
|
217
|
+
*
|
|
218
|
+
* Trust boundary: same as the rest of FEATURE_186 — KodaX is a
|
|
219
|
+
* single-user CLI, last-write-wins on the server-config-vs-active-
|
|
220
|
+
* runtime path; a Space popout that swaps configs hot would still need
|
|
221
|
+
* to construct a fresh `McpManager` (or call `dispose()` then
|
|
222
|
+
* `createMcpManager` again) to pick up the new wire.
|
|
223
|
+
*/
|
|
224
|
+
|
|
225
|
+
interface McpServerStatus {
|
|
226
|
+
readonly serverId: string;
|
|
227
|
+
readonly config: McpServerConfig;
|
|
228
|
+
readonly connect: McpConnectMode;
|
|
229
|
+
readonly status: McpServerRuntimeDiagnostics['status'];
|
|
230
|
+
readonly tools: number;
|
|
231
|
+
readonly resources: number;
|
|
232
|
+
readonly prompts: number;
|
|
233
|
+
readonly dirty: boolean;
|
|
234
|
+
readonly cachedAt?: string;
|
|
235
|
+
readonly lastError?: string;
|
|
236
|
+
}
|
|
237
|
+
interface McpServerLogs {
|
|
238
|
+
readonly serverId: string;
|
|
239
|
+
readonly status: McpServerRuntimeDiagnostics['status'];
|
|
240
|
+
readonly connect: McpConnectMode;
|
|
241
|
+
readonly lastError?: string;
|
|
242
|
+
readonly cachedAt?: string;
|
|
243
|
+
}
|
|
244
|
+
interface McpServerToolList {
|
|
245
|
+
readonly serverId: string;
|
|
246
|
+
readonly tools: readonly McpCapabilityDescriptor[];
|
|
247
|
+
readonly cachedAt?: string;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Full catalog snapshot for a server — tools + resources + prompts.
|
|
251
|
+
* Use {@link McpManager.getCatalog} when the popout needs to render
|
|
252
|
+
* all three capability kinds (not just tools).
|
|
253
|
+
*
|
|
254
|
+
* `cachedAt` matches the naming used by {@link McpServerStatus},
|
|
255
|
+
* {@link McpServerLogs}, and {@link McpServerToolList} for consistency
|
|
256
|
+
* across the manager surface (all are renames of the underlying
|
|
257
|
+
* `McpServerCatalogSnapshot.updatedAt` field).
|
|
258
|
+
*/
|
|
259
|
+
interface McpServerCatalog {
|
|
260
|
+
readonly serverId: string;
|
|
261
|
+
readonly items: readonly McpCatalogItem[];
|
|
262
|
+
readonly descriptors: readonly McpCapabilityDescriptor[];
|
|
263
|
+
readonly cachedAt: string;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Manager-shape facade over {@link McpCapabilityProvider}. Construct
|
|
267
|
+
* via the {@link createMcpManager} factory or `new McpManager(...)`
|
|
268
|
+
* directly.
|
|
269
|
+
*/
|
|
270
|
+
declare class McpManager {
|
|
271
|
+
private readonly capabilityProvider;
|
|
272
|
+
private readonly serversConfig;
|
|
273
|
+
constructor(servers: McpServersConfig | undefined, options?: McpProviderOptions);
|
|
274
|
+
/**
|
|
275
|
+
* Escape hatch — returns the underlying {@link McpCapabilityProvider}
|
|
276
|
+
* for callers that need the search / describe / execute / read /
|
|
277
|
+
* getPrompt API (e.g. embedding into a custom agent runtime).
|
|
278
|
+
*/
|
|
279
|
+
provider(): McpCapabilityProvider;
|
|
280
|
+
/**
|
|
281
|
+
* One status row per configured server (lazy / prewarm / disabled
|
|
282
|
+
* all included). Returned objects are plain readonly snapshots —
|
|
283
|
+
* mutating them does NOT affect runtime state.
|
|
284
|
+
*/
|
|
285
|
+
listServers(): McpServerStatus[];
|
|
286
|
+
/**
|
|
287
|
+
* Force a connection + catalog refresh for `serverId`. Returns the
|
|
288
|
+
* post-start status row. Throws if `serverId` is not configured.
|
|
289
|
+
*
|
|
290
|
+
* For lazy servers, this is the explicit "connect now" trigger —
|
|
291
|
+
* useful when a popout user clicks "Start" before any tool call has
|
|
292
|
+
* forced the lazy connection.
|
|
293
|
+
*/
|
|
294
|
+
startServer(serverId: string): Promise<McpServerStatus>;
|
|
295
|
+
/**
|
|
296
|
+
* Disconnect `serverId` — closes the transport, drops the pending
|
|
297
|
+
* request queue, but keeps the server in the config so a subsequent
|
|
298
|
+
* `startServer` / `listTools` can reconnect. Returns the post-stop
|
|
299
|
+
* status (`status: 'idle'`).
|
|
300
|
+
*/
|
|
301
|
+
stopServer(serverId: string): Promise<McpServerStatus>;
|
|
302
|
+
/**
|
|
303
|
+
* Return the most recent runtime diagnostic envelope for `serverId`
|
|
304
|
+
* — status, last error, last cached timestamp. Designed as the data
|
|
305
|
+
* source for a popout "Logs" pane.
|
|
306
|
+
*
|
|
307
|
+
* Logs API is intentionally conservative in v0.7.42: only the last
|
|
308
|
+
* error message + status are exposed. A future iteration may add a
|
|
309
|
+
* ring buffer of recent events; the field shape will extend (add
|
|
310
|
+
* fields), never break (rename / remove).
|
|
311
|
+
*/
|
|
312
|
+
getServerLogs(serverId: string): McpServerLogs;
|
|
313
|
+
/**
|
|
314
|
+
* Return the tool descriptors for `serverId`. Triggers a lazy
|
|
315
|
+
* connect + catalog fetch if the catalog has not yet been built;
|
|
316
|
+
* pass `{ forceRefresh: true }` to force a fresh catalog regardless
|
|
317
|
+
* of cache state.
|
|
318
|
+
*
|
|
319
|
+
* Only `kind === 'tool'` descriptors are returned (filters out
|
|
320
|
+
* resources + prompts so popout consumers can render a clean
|
|
321
|
+
* "tools" table). Use the underlying `provider().describe(id)` for
|
|
322
|
+
* full descriptor introspection including resources + prompts.
|
|
323
|
+
*/
|
|
324
|
+
listTools(serverId: string, options?: {
|
|
325
|
+
forceRefresh?: boolean;
|
|
326
|
+
}): Promise<McpServerToolList>;
|
|
327
|
+
/**
|
|
328
|
+
* Return the full catalog snapshot for `serverId` — every tool,
|
|
329
|
+
* resource, and prompt the server exposes — plus lightweight catalog
|
|
330
|
+
* items for menu rendering. `listTools` is the tools-only fast path;
|
|
331
|
+
* use this when the popout needs to render resources / prompts panes
|
|
332
|
+
* alongside tools.
|
|
333
|
+
*
|
|
334
|
+
* Triggers a lazy connect + catalog fetch if the catalog has not yet
|
|
335
|
+
* been built; pass `{ forceRefresh: true }` to force a fresh catalog
|
|
336
|
+
* regardless of cache state.
|
|
337
|
+
*/
|
|
338
|
+
getCatalog(serverId: string, options?: {
|
|
339
|
+
forceRefresh?: boolean;
|
|
340
|
+
}): Promise<McpServerCatalog>;
|
|
341
|
+
/**
|
|
342
|
+
* Dispose all runtimes. After calling, the manager is no longer
|
|
343
|
+
* usable for `startServer` / `listTools` (they would reconnect, but
|
|
344
|
+
* the consumer should construct a fresh manager instead).
|
|
345
|
+
*/
|
|
346
|
+
dispose(): Promise<void>;
|
|
347
|
+
/** v0.7.42 — escape hatch for advanced uses; usually consumers use the typed methods above. */
|
|
348
|
+
search(query: string, options?: {
|
|
349
|
+
kind?: CapabilityKind;
|
|
350
|
+
limit?: number;
|
|
351
|
+
server?: string;
|
|
352
|
+
}): Promise<readonly McpCatalogItem[]>;
|
|
353
|
+
/** v0.7.42 — escape hatch for advanced uses; usually consumers use {@link listTools}. */
|
|
354
|
+
describe(id: string): Promise<McpCapabilityDescriptor | undefined>;
|
|
355
|
+
/** v0.7.42 — invoke a tool by capability id (`mcp://<serverId>/<kind>/<name>`). */
|
|
356
|
+
execute(id: string, input: Record<string, unknown>): Promise<CapabilityResult>;
|
|
357
|
+
/** v0.7.42 — read a resource by capability id. */
|
|
358
|
+
read(id: string, options?: Record<string, unknown>): Promise<CapabilityResult>;
|
|
359
|
+
private requireRuntime;
|
|
360
|
+
private buildStatus;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Convenience factory matching the rest of the FEATURE_186 surface
|
|
364
|
+
* naming (`createSessionControl`, etc.). Equivalent to
|
|
365
|
+
* `new McpManager(servers, options)`.
|
|
366
|
+
*/
|
|
367
|
+
declare function createMcpManager(servers: McpServersConfig | undefined, options?: McpProviderOptions): McpManager;
|
|
368
|
+
|
|
369
|
+
export { McpCapabilityProvider as b, McpManager as e, McpServerRuntime as j, createMcpCapabilityId as p, createMcpManager as q, createMcpTransport as r, defaultMcpCacheDir as s, getMcpCachePaths as t, parseMcpCapabilityId as u, searchMcpCatalog as v };
|
|
370
|
+
export type { McpCapabilityDescriptor as M, McpCapabilityKind as a, McpCapabilityRisk as c, McpCatalogItem as d, McpProviderOptions as f, McpServerCatalog as g, McpServerCatalogSnapshot as h, McpServerLogs as i, McpServerRuntimeDiagnostics as k, McpServerStatus as l, McpServerToolList as m, McpTransport as n, McpTransportEvents as o };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as KodaXReasoningMode, U as KodaXThinkingBudgetMap, V as KodaXThinkingDepth, r as KodaXProviderConfig, C as KodaXReasoningCapability, F as KodaXReasoningRequest, Q as KodaXTaskType, E as KodaXReasoningOverride, X as KodaXToolDefinition, m as KodaXMessage, z as KodaXProviderStreamOptions, J as KodaXStreamResult, q as KodaXProviderCapabilityProfile, h as KodaXCustomProviderConfig } from './types.d-B1uGoVTE.js';
|
|
1
|
+
import { D as KodaXReasoningMode, U as KodaXThinkingBudgetMap, V as KodaXThinkingDepth, r as KodaXProviderConfig, C as KodaXReasoningCapability, F as KodaXReasoningRequest, Q as KodaXTaskType, E as KodaXReasoningOverride, X as KodaXToolDefinition, m as KodaXMessage, z as KodaXProviderStreamOptions, J as KodaXStreamResult, n as KodaXModelDescriptor, q as KodaXProviderCapabilityProfile, h as KodaXCustomProviderConfig } from './types.d-B1uGoVTE.js';
|
|
2
2
|
import Anthropic from '@anthropic-ai/sdk';
|
|
3
|
-
import { K as KodaXBaseProvider } from './
|
|
3
|
+
import { K as KodaXBaseProvider } from './base.d-FUJahC0i.js';
|
|
4
4
|
import OpenAI from 'openai';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -155,13 +155,44 @@ declare abstract class KodaXOpenAICompatProvider extends KodaXBaseProvider {
|
|
|
155
155
|
*/
|
|
156
156
|
|
|
157
157
|
type ProviderName = 'anthropic' | 'openai' | 'deepseek' | 'kimi' | 'kimi-code' | 'qwen' | 'zhipu' | 'zhipu-coding' | 'minimax-coding' | 'mimo-coding' | 'ark-coding' | 'gemini-cli' | 'codex-cli';
|
|
158
|
+
/**
|
|
159
|
+
* Per-provider static metadata. v0.7.43 promoted this from a partial
|
|
160
|
+
* descriptor (`models: string[]`) to the full capability surface so
|
|
161
|
+
* SDK consumers can read context windows / max output tokens /
|
|
162
|
+
* thinking-budget caps / per-model descriptors without instantiating
|
|
163
|
+
* a Provider class (which previously required a valid API key just
|
|
164
|
+
* to read static metadata).
|
|
165
|
+
*
|
|
166
|
+
* v0.7.44 FEATURE_198 moved the data into a separate JSON file
|
|
167
|
+
* (`provider-capabilities.json`) so it can be patched without a
|
|
168
|
+
* KodaX release. The structural type below mirrors the JSON-resolved
|
|
169
|
+
* shape and remains the single source of truth for capability data;
|
|
170
|
+
* Provider classes derive their runtime `config` from it via
|
|
171
|
+
* `buildProviderConfig`.
|
|
172
|
+
*/
|
|
158
173
|
type ProviderSnapshot = {
|
|
159
|
-
model: string;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
174
|
+
readonly model: string;
|
|
175
|
+
/**
|
|
176
|
+
* Alternative model descriptors beyond the default `model`. Carries
|
|
177
|
+
* per-model capability overrides (`contextWindow` / `maxOutputTokens` /
|
|
178
|
+
* `thinkingBudgetCap` / `reasoningCapability` / `replayReasoningContent` /
|
|
179
|
+
* `strictThinkingSignature`). Provider-level defaults below fill any
|
|
180
|
+
* gaps a descriptor leaves unset. The default model has no descriptor
|
|
181
|
+
* entry — it inherits provider-level defaults directly.
|
|
182
|
+
*/
|
|
183
|
+
readonly models?: readonly KodaXModelDescriptor[];
|
|
184
|
+
readonly apiKeyEnv: string;
|
|
185
|
+
readonly reasoningCapability: KodaXReasoningCapability;
|
|
186
|
+
readonly modelReasoningCapabilities?: Readonly<Record<string, KodaXReasoningCapability>>;
|
|
187
|
+
readonly capabilityProfile: KodaXProviderCapabilityProfile;
|
|
188
|
+
/** Maximum input context window (tokens). Provider-level default. */
|
|
189
|
+
readonly contextWindow?: number;
|
|
190
|
+
/** Per-turn output token cap KodaX requests. Provider-level default. */
|
|
191
|
+
readonly maxOutputTokens?: number;
|
|
192
|
+
/** Upper bound on `thinking_budget` for native-budget reasoning providers. */
|
|
193
|
+
readonly thinkingBudgetCap?: number;
|
|
194
|
+
/** Whether the provider supports `thinking_budget` / native reasoning. */
|
|
195
|
+
readonly supportsThinking?: boolean;
|
|
165
196
|
};
|
|
166
197
|
declare const KODAX_PROVIDER_SNAPSHOTS: Record<ProviderName, ProviderSnapshot>;
|
|
167
198
|
declare const KODAX_PROVIDERS: Record<string, () => KodaXBaseProvider>;
|
|
@@ -181,6 +212,82 @@ declare function getProviderList(): Array<{
|
|
|
181
212
|
}>;
|
|
182
213
|
declare function getProviderModels(name: string): string[];
|
|
183
214
|
declare function isProviderName(name: string): name is ProviderName;
|
|
215
|
+
/**
|
|
216
|
+
* Effective per-model capability surface. v0.7.43 SDK exposure.
|
|
217
|
+
*
|
|
218
|
+
* Values are resolved with the cascade:
|
|
219
|
+
* 1. Per-model descriptor override (`KodaXModelDescriptor` field)
|
|
220
|
+
* 2. Provider-level default (`KODAX_PROVIDER_SNAPSHOTS[name].*`)
|
|
221
|
+
* 3. `undefined` (the field is genuinely not advertised for this model)
|
|
222
|
+
*
|
|
223
|
+
* `displayName` falls back to `id` when not set; never undefined.
|
|
224
|
+
*
|
|
225
|
+
* **All fields below are KodaX-maintained values** — they reflect what
|
|
226
|
+
* KodaX itself uses at runtime (the per-turn `max_tokens` we request,
|
|
227
|
+
* the thinking budget we cap at, etc.), benchmarked against the upstream
|
|
228
|
+
* model so they are honest representations of the agent's behavior. They
|
|
229
|
+
* are deliberately NOT sourced from upstream `/models` API responses,
|
|
230
|
+
* which a 2026-05 cross-provider probe confirmed are sparse and often
|
|
231
|
+
* empty (see docs/SDK_EMBEDDER_GUIDE.md §9). Embedders showing these
|
|
232
|
+
* values in a popout UI can trust them.
|
|
233
|
+
*/
|
|
234
|
+
interface KodaXModelCapabilities {
|
|
235
|
+
/** Provider name (`anthropic`, `kimi`, `ark-coding`, or any custom name). */
|
|
236
|
+
provider: string;
|
|
237
|
+
/** Model id (the value `runKodaX(... { model } ...)` accepts). */
|
|
238
|
+
model: string;
|
|
239
|
+
/** Human-readable label — falls back to `model` when no descriptor entry. */
|
|
240
|
+
displayName: string;
|
|
241
|
+
/** Whether the provider supports `thinking_budget` / native reasoning. */
|
|
242
|
+
supportsThinking: boolean;
|
|
243
|
+
/** Effective reasoning capability for THIS model (per-model override aware). */
|
|
244
|
+
reasoningCapability: KodaXReasoningCapability;
|
|
245
|
+
/** Maximum input context window (tokens). `undefined` for CLI-bridge providers. */
|
|
246
|
+
contextWindow?: number;
|
|
247
|
+
/**
|
|
248
|
+
* Per-turn `max_tokens` KodaX requests. KodaX-side decision —
|
|
249
|
+
* benchmarked against each provider (kill-windows, decode rate, cost
|
|
250
|
+
* predictability). NOT the upstream "theoretical maximum" — providers
|
|
251
|
+
* often advertise inflated ceilings; this value reflects what KodaX
|
|
252
|
+
* actually asks for. If you display "expected output size" in your UI,
|
|
253
|
+
* use this. Long generations escalate through the L5 continuation
|
|
254
|
+
* meta path, not by raising this number per-turn.
|
|
255
|
+
*/
|
|
256
|
+
maxOutputTokens?: number;
|
|
257
|
+
/** Upper bound on `thinking_budget` (native-budget providers only). */
|
|
258
|
+
thinkingBudgetCap?: number;
|
|
259
|
+
/** True when the model is the provider's default (the `model` field on the snapshot). */
|
|
260
|
+
isDefault: boolean;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* List all model descriptors for a built-in provider — default model first,
|
|
264
|
+
* then alternatives. No API key required (reads from KODAX_PROVIDER_SNAPSHOTS).
|
|
265
|
+
*
|
|
266
|
+
* Returns an empty array for unknown provider names so SDK consumers can
|
|
267
|
+
* iterate `[...KODAX_PROVIDER_LIST, ...customNames]` without a guard per name.
|
|
268
|
+
*/
|
|
269
|
+
declare function getProviderModelDescriptors(name: string): KodaXModelDescriptor[];
|
|
270
|
+
/**
|
|
271
|
+
* Effective per-model capability surface for a built-in provider. Returns
|
|
272
|
+
* `undefined` for unknown provider name or unknown model under a known
|
|
273
|
+
* provider — caller should fall back to `DEFAULT_CONTEXT_WINDOW` from
|
|
274
|
+
* `@kodax-ai/kodax/agent` when nothing is advertised.
|
|
275
|
+
*
|
|
276
|
+
* No API key required.
|
|
277
|
+
*/
|
|
278
|
+
declare function getModelCapabilities(providerName: string, modelId: string): KodaXModelCapabilities | undefined;
|
|
279
|
+
/**
|
|
280
|
+
* Full capability listing for every built-in provider/model pair. Default
|
|
281
|
+
* model comes first per provider, in the order providers appear in
|
|
282
|
+
* `KODAX_PROVIDERS`. Use this for popout UIs that enumerate all models
|
|
283
|
+
* without filtering by `configured` (the consumer can filter post-hoc by
|
|
284
|
+
* checking `process.env[snapshot.apiKeyEnv]` themselves, or just present
|
|
285
|
+
* everything for selection).
|
|
286
|
+
*
|
|
287
|
+
* Custom-provider models are exposed via the equivalent helper in
|
|
288
|
+
* `custom-registry.ts` (`getCustomProviderModelCapabilities`).
|
|
289
|
+
*/
|
|
290
|
+
declare function listBuiltinModelCapabilities(): KodaXModelCapabilities[];
|
|
184
291
|
|
|
185
292
|
/**
|
|
186
293
|
* Custom Provider Factory
|
|
@@ -230,6 +337,25 @@ declare function getCustomProviderList(): Array<{
|
|
|
230
337
|
* Returns undefined if not a custom provider.
|
|
231
338
|
*/
|
|
232
339
|
declare function getCustomProviderModels(name: string): string[] | undefined;
|
|
340
|
+
/**
|
|
341
|
+
* List all model descriptors for a custom provider. Default model first,
|
|
342
|
+
* then alternatives. Returns undefined when the name doesn't match any
|
|
343
|
+
* registered custom provider — caller can fall through to the built-in
|
|
344
|
+
* `getProviderModelDescriptors`.
|
|
345
|
+
*/
|
|
346
|
+
declare function getCustomProviderModelDescriptors(name: string): KodaXModelDescriptor[] | undefined;
|
|
347
|
+
/**
|
|
348
|
+
* Effective per-model capability surface for a custom provider. Returns
|
|
349
|
+
* undefined when the provider name is not a registered custom provider,
|
|
350
|
+
* OR when the model id doesn't appear under that provider. The same
|
|
351
|
+
* descriptor-then-provider cascade as the built-in counterpart.
|
|
352
|
+
*/
|
|
353
|
+
declare function getCustomModelCapabilities(providerName: string, modelId: string): KodaXModelCapabilities | undefined;
|
|
354
|
+
/**
|
|
355
|
+
* Full capability listing for every registered custom provider / model.
|
|
356
|
+
* Mirrors `listBuiltinModelCapabilities`. Default model first per provider.
|
|
357
|
+
*/
|
|
358
|
+
declare function listCustomProviderModelCapabilities(): KodaXModelCapabilities[];
|
|
233
359
|
|
|
234
360
|
type ModelProviderFactory = () => KodaXBaseProvider;
|
|
235
361
|
declare function registerModelProvider(name: string, factory: ModelProviderFactory): () => void;
|
|
@@ -258,6 +384,27 @@ declare function isKnownProvider(name: string): boolean;
|
|
|
258
384
|
* Get all available provider names (built-in + custom).
|
|
259
385
|
*/
|
|
260
386
|
declare function getAvailableProviderNames(): string[];
|
|
387
|
+
/**
|
|
388
|
+
* Model descriptors for any registered provider (built-in or custom).
|
|
389
|
+
* Default model first, then alternatives. Empty array if name unknown.
|
|
390
|
+
*/
|
|
391
|
+
declare function resolveProviderModelDescriptors(name: string): KodaXModelDescriptor[];
|
|
392
|
+
/**
|
|
393
|
+
* Effective capabilities for a single provider/model pair. Built-in
|
|
394
|
+
* lookup first, then custom. Returns undefined when neither has it.
|
|
395
|
+
*/
|
|
396
|
+
declare function resolveModelCapabilities(providerName: string, modelId: string): KodaXModelCapabilities | undefined;
|
|
397
|
+
/**
|
|
398
|
+
* Every model capability KodaX knows about — built-in + custom — in
|
|
399
|
+
* a single flat list. Built-in providers come first (in `KODAX_PROVIDERS`
|
|
400
|
+
* declaration order), then custom providers (in registration order).
|
|
401
|
+
* Within each provider, default model first.
|
|
402
|
+
*
|
|
403
|
+
* Use for popout UIs that need a single source for a model picker.
|
|
404
|
+
* No filtering by `configured` — consumers can subset themselves by
|
|
405
|
+
* checking `process.env[snapshot.apiKeyEnv]` if they care.
|
|
406
|
+
*/
|
|
407
|
+
declare function listAllModelCapabilities(): KodaXModelCapabilities[];
|
|
261
408
|
|
|
262
|
-
export {
|
|
263
|
-
export type { ProviderName as P };
|
|
409
|
+
export { registerCustomProviders as $, getModelCapabilities as A, getProvider as B, getProviderConfiguredCapabilityProfile as C, getProviderConfiguredReasoningCapability as D, getProviderList as E, getProviderModel as F, getProviderModelDescriptors as G, getProviderModels as H, getReasoningCapability as I, getRuntimeModelProvider as J, KODAX_DEFAULT_PROVIDER as K, getRuntimeModelProviderNames as L, isCustomProviderName as M, isKnownProvider as N, isProviderConfigured as O, isProviderName as Q, isReasoningEnabled as R, isRuntimeModelProviderName as S, listAllModelCapabilities as T, listBuiltinModelCapabilities as U, listCustomProviderModelCapabilities as V, loadReasoningOverride as W, mapDepthToOpenAIReasoningEffort as X, normalizeReasoningRequest as Y, reasoningCapabilityToOverride as Z, reasoningOverrideToCapability as _, KODAX_DEFAULT_THINKING_BUDGETS as a, registerModelProvider as a0, resolveModelCapabilities as a1, resolveProvider as a2, resolveProviderModelDescriptors as a3, resolveThinkingBudget as a4, saveReasoningOverride as a5, validateCustomProviderConfig as a6, KODAX_PROVIDERS as b, KODAX_PROVIDER_SNAPSHOTS as c, KODAX_REASONING_MODE_SEQUENCE as d, KODAX_REASONING_SAFETY_RESERVE as e, KodaXAnthropicCompatProvider as f, KodaXError as g, KodaXNetworkError as i, KodaXOpenAICompatProvider as j, KodaXProviderError as k, KodaXRateLimitError as l, KodaXToolCallIdError as m, buildReasoningOverrideKey as n, clampThinkingBudget as o, clearReasoningOverride as p, clearRuntimeModelProviders as q, createCustomProvider as r, getAvailableProviderNames as s, getCustomModelCapabilities as t, getCustomProvider as u, getCustomProviderList as v, getCustomProviderModelDescriptors as w, getCustomProviderModels as x, getCustomProviderNames as y, getDefaultThinkingDepthForMode as z };
|
|
410
|
+
export type { ProviderName as P, KodaXModelCapabilities as h };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as KodaXSessionData, s as KodaXSessionLineage, v as KodaXSessionNavigationOptions, w as KodaXSessionRuntimeInfo, y as KodaXSessionStorage } from './types.d-HBbWT-iA.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Session Storage - Session storage abstraction layer
|
|
@@ -64,5 +64,52 @@ declare class MemorySessionStorage implements SessionStorage {
|
|
|
64
64
|
}
|
|
65
65
|
declare function createMemorySessionStorage(): SessionStorage;
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
/**
|
|
68
|
+
* KodaX session storage - filesystem implementation.
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
declare class FileSessionStorage implements KodaXSessionStorage {
|
|
72
|
+
private readonly sessionsDir;
|
|
73
|
+
constructor(opts?: {
|
|
74
|
+
sessionsDir?: string;
|
|
75
|
+
});
|
|
76
|
+
private writeQueues;
|
|
77
|
+
private serializedWrite;
|
|
78
|
+
private appendState;
|
|
79
|
+
/** Update watermarks. Only overwrites fields the caller actually provided. */
|
|
80
|
+
private syncAppendState;
|
|
81
|
+
private getSessionFilePath;
|
|
82
|
+
private getArchiveFilePath;
|
|
83
|
+
private readSession;
|
|
84
|
+
private writeSessionInternal;
|
|
85
|
+
private mergeAndWriteInternal;
|
|
86
|
+
appendSessionDelta(id: string, data: SessionData): Promise<void>;
|
|
87
|
+
private shouldRunMaintenance;
|
|
88
|
+
private runMaintenance;
|
|
89
|
+
save(id: string, data: SessionData): Promise<void>;
|
|
90
|
+
load(id: string): Promise<SessionData | null>;
|
|
91
|
+
getLineage(id: string): Promise<KodaXSessionLineage | null>;
|
|
92
|
+
setActiveEntry(id: string, selector: string, options?: {
|
|
93
|
+
summarizeCurrentBranch?: boolean;
|
|
94
|
+
}): Promise<SessionData | null>;
|
|
95
|
+
rewind(id: string, selector?: string): Promise<SessionData | null>;
|
|
96
|
+
setLabel(id: string, selector: string, label?: string): Promise<SessionData | null>;
|
|
97
|
+
fork(id: string, selector?: string, options?: {
|
|
98
|
+
sessionId?: string;
|
|
99
|
+
title?: string;
|
|
100
|
+
}): Promise<{
|
|
101
|
+
sessionId: string;
|
|
102
|
+
data: SessionData;
|
|
103
|
+
} | null>;
|
|
104
|
+
list(gitRoot?: string): Promise<Array<{
|
|
105
|
+
id: string;
|
|
106
|
+
title: string;
|
|
107
|
+
msgCount: number;
|
|
108
|
+
runtimeInfo?: KodaXSessionRuntimeInfo;
|
|
109
|
+
}>>;
|
|
110
|
+
delete(id: string): Promise<void>;
|
|
111
|
+
deleteAll(gitRoot?: string): Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export { FileSessionStorage as F, MemorySessionStorage as M, createMemorySessionStorage as c };
|
|
68
115
|
export type { SessionData as S, SessionStorage as a };
|