clef-mcp 0.1.3 → 0.1.5
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/README.md +12 -7
- package/dist/cli.js +311 -49
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -191,6 +191,12 @@ interface LlamaCppRuntimeOptions {
|
|
|
191
191
|
loadTimeoutMs?: number;
|
|
192
192
|
/** Per-request timeout for /v1/systemone. */
|
|
193
193
|
requestTimeoutMs?: number;
|
|
194
|
+
/**
|
|
195
|
+
* llama.cpp physical batch size (`-b`/`-ub`). The clef decision path scores
|
|
196
|
+
* all questions in one sequence, so multi-question requests need more than
|
|
197
|
+
* the default 512; the clef-mcp limit is 64 questions (~6-8k tokens).
|
|
198
|
+
*/
|
|
199
|
+
batchSize?: number;
|
|
194
200
|
log?: Logger;
|
|
195
201
|
}
|
|
196
202
|
declare class LlamaCppRuntime implements ClefRuntime {
|
|
@@ -202,6 +208,7 @@ declare class LlamaCppRuntime implements ClefRuntime {
|
|
|
202
208
|
private readonly requestTimeoutMs;
|
|
203
209
|
/** Serializes decide() calls: the llama.cpp clef path handles one sequence per batch. */
|
|
204
210
|
private queue;
|
|
211
|
+
private readonly batchSize;
|
|
205
212
|
constructor(opts: LlamaCppRuntimeOptions);
|
|
206
213
|
get endpoint(): string;
|
|
207
214
|
get running(): boolean;
|
|
@@ -426,6 +433,6 @@ declare function clefDecideOutputSchema(): z.ZodObject<{
|
|
|
426
433
|
/** `state` cannot be size-checked inside zod (it is `unknown`), so it is validated separately. */
|
|
427
434
|
declare function validateStateSize(state: unknown, limits: Limits): void;
|
|
428
435
|
|
|
429
|
-
declare const VERSION = "0.1.
|
|
436
|
+
declare const VERSION = "0.1.5";
|
|
430
437
|
|
|
431
438
|
export { CLEF_FLASH, type ClefConfig, type ClefDecideInput, type ClefDecideOutput, type ClefDecisionAnswer, ClefError, ClefErrorCode, type ClefQuestion, type ClefRuntime, type ClefServerDeps, DEFAULT_LIMITS, type DownloadProgress, type InstallModelResult, type Limits, LlamaCppRuntime, type LlamaCppRuntimeOptions, type LogLevel, type Logger, MODELS, type ModelManifest, type ModelSpec, type PlatformInfo, type ProbeResult, type QuantSpec, type QuestionType, type ResolvedBinary, type RunningClefServer, type RuntimeHealth, SERVER_INSTRUCTIONS, StderrLogger, type SystemOneRequest, type SystemOneResponse, TOOL_NAME, VERSION, assertSupportedPlatform, clefDecideInputSchema, clefDecideOutputSchema, createClefServer, createLogger, deepVerifyChecksum, defaultClefHome, detectPlatform, downloadFile, downloadManagedLlama, ensureLlamaRuntime, errorJson, exitCodeFor, fetchFileInfo, findInstalledManifest, formatBytes, fromSystemOneResponse, getModelSpec, getQuantSpec, installModel, limitsFromEnv, loadConfig, manifestPathFor, modelQuantDir, pathsFor, pickQuant, probeInference, readModelManifest, removeManagedRuntime, resolveLlamaServerBinary, toSystemOneRequest, validateStateSize, verifyModelFiles, writeModelManifest };
|
package/dist/index.js
CHANGED
|
@@ -394,6 +394,7 @@ var LlamaCppRuntime = class {
|
|
|
394
394
|
this.host = opts.host ?? "127.0.0.1";
|
|
395
395
|
this.loadTimeoutMs = opts.loadTimeoutMs ?? 12e4;
|
|
396
396
|
this.requestTimeoutMs = opts.requestTimeoutMs ?? 6e4;
|
|
397
|
+
this.batchSize = opts.batchSize ?? (Number.parseInt(process.env.CLEF_LLAMA_BATCH ?? "", 10) || 8192);
|
|
397
398
|
}
|
|
398
399
|
opts;
|
|
399
400
|
proc;
|
|
@@ -403,6 +404,7 @@ var LlamaCppRuntime = class {
|
|
|
403
404
|
requestTimeoutMs;
|
|
404
405
|
/** Serializes decide() calls: the llama.cpp clef path handles one sequence per batch. */
|
|
405
406
|
queue = Promise.resolve();
|
|
407
|
+
batchSize;
|
|
406
408
|
get endpoint() {
|
|
407
409
|
if (!this.resolvedPort) throw new ClefError(ClefErrorCode.RUNTIME_INIT_FAILED, "Runtime is not started");
|
|
408
410
|
return `http://${this.host}:${this.resolvedPort}`;
|
|
@@ -422,6 +424,10 @@ var LlamaCppRuntime = class {
|
|
|
422
424
|
"--port",
|
|
423
425
|
String(port),
|
|
424
426
|
"--no-webui",
|
|
427
|
+
"-b",
|
|
428
|
+
String(this.batchSize),
|
|
429
|
+
"-ub",
|
|
430
|
+
String(this.batchSize),
|
|
425
431
|
...this.opts.alias ? ["--alias", this.opts.alias] : []
|
|
426
432
|
];
|
|
427
433
|
this.opts.log?.debug("spawning llama-server", { bin: this.opts.serverBin, args });
|
|
@@ -539,7 +545,8 @@ ${tail}` : ""),
|
|
|
539
545
|
}
|
|
540
546
|
throw new ClefError(
|
|
541
547
|
ClefErrorCode.CLEF_INFERENCE_FAILED,
|
|
542
|
-
`Inference failed with HTTP ${res.status}: ${apiMessage.slice(0, 2e3)}
|
|
548
|
+
`Inference failed with HTTP ${res.status}: ${apiMessage.slice(0, 2e3)}`,
|
|
549
|
+
/physical batch size/i.test(apiMessage) ? "Too many/too large questions for one request. Split into several calls, reduce criteria text, or raise the batch with CLEF_LLAMA_BATCH." : void 0
|
|
543
550
|
);
|
|
544
551
|
}
|
|
545
552
|
if (!body || typeof body !== "object") {
|
|
@@ -1425,7 +1432,7 @@ function createClefServer(deps = {}) {
|
|
|
1425
1432
|
}
|
|
1426
1433
|
|
|
1427
1434
|
// src/version.ts
|
|
1428
|
-
var VERSION = "0.1.
|
|
1435
|
+
var VERSION = "0.1.5";
|
|
1429
1436
|
export {
|
|
1430
1437
|
CLEF_FLASH,
|
|
1431
1438
|
ClefError,
|