clef-mcp 0.1.4 → 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/dist/cli.js CHANGED
@@ -853,6 +853,7 @@ var LlamaCppRuntime = class {
853
853
  this.host = opts.host ?? "127.0.0.1";
854
854
  this.loadTimeoutMs = opts.loadTimeoutMs ?? 12e4;
855
855
  this.requestTimeoutMs = opts.requestTimeoutMs ?? 6e4;
856
+ this.batchSize = opts.batchSize ?? (Number.parseInt(process.env.CLEF_LLAMA_BATCH ?? "", 10) || 8192);
856
857
  }
857
858
  opts;
858
859
  proc;
@@ -862,6 +863,7 @@ var LlamaCppRuntime = class {
862
863
  requestTimeoutMs;
863
864
  /** Serializes decide() calls: the llama.cpp clef path handles one sequence per batch. */
864
865
  queue = Promise.resolve();
866
+ batchSize;
865
867
  get endpoint() {
866
868
  if (!this.resolvedPort) throw new ClefError(ClefErrorCode.RUNTIME_INIT_FAILED, "Runtime is not started");
867
869
  return `http://${this.host}:${this.resolvedPort}`;
@@ -881,6 +883,10 @@ var LlamaCppRuntime = class {
881
883
  "--port",
882
884
  String(port),
883
885
  "--no-webui",
886
+ "-b",
887
+ String(this.batchSize),
888
+ "-ub",
889
+ String(this.batchSize),
884
890
  ...this.opts.alias ? ["--alias", this.opts.alias] : []
885
891
  ];
886
892
  this.opts.log?.debug("spawning llama-server", { bin: this.opts.serverBin, args });
@@ -998,7 +1004,8 @@ ${tail}` : ""),
998
1004
  }
999
1005
  throw new ClefError(
1000
1006
  ClefErrorCode.CLEF_INFERENCE_FAILED,
1001
- `Inference failed with HTTP ${res.status}: ${apiMessage.slice(0, 2e3)}`
1007
+ `Inference failed with HTTP ${res.status}: ${apiMessage.slice(0, 2e3)}`,
1008
+ /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
1002
1009
  );
1003
1010
  }
1004
1011
  if (!body || typeof body !== "object") {
@@ -1982,7 +1989,7 @@ async function removeManagedRuntime(cfg) {
1982
1989
  init_prompt();
1983
1990
 
1984
1991
  // src/version.ts
1985
- var VERSION = "0.1.4";
1992
+ var VERSION = "0.1.5";
1986
1993
 
1987
1994
  // src/cli/install.ts
1988
1995
  var OS_NAMES = {