@joshuaswarren/openclaw-engram 9.0.12 → 9.0.13

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/index.js CHANGED
@@ -325,6 +325,11 @@ function parseConfig(raw) {
325
325
  localLlmRetryBackoffMs: typeof cfg.localLlmRetryBackoffMs === "number" ? cfg.localLlmRetryBackoffMs : 400,
326
326
  localLlm400TripThreshold: typeof cfg.localLlm400TripThreshold === "number" ? cfg.localLlm400TripThreshold : 5,
327
327
  localLlm400CooldownMs: typeof cfg.localLlm400CooldownMs === "number" ? cfg.localLlm400CooldownMs : 12e4,
328
+ // Local LLM fast tier (v9.1)
329
+ localLlmFastEnabled: cfg.localLlmFastEnabled === true,
330
+ localLlmFastModel: typeof cfg.localLlmFastModel === "string" && cfg.localLlmFastModel.length > 0 ? cfg.localLlmFastModel : "",
331
+ localLlmFastUrl: typeof cfg.localLlmFastUrl === "string" && cfg.localLlmFastUrl.length > 0 ? cfg.localLlmFastUrl : typeof cfg.localLlmUrl === "string" && cfg.localLlmUrl.length > 0 ? cfg.localLlmUrl : "http://localhost:1234/v1",
332
+ localLlmFastTimeoutMs: typeof cfg.localLlmFastTimeoutMs === "number" ? cfg.localLlmFastTimeoutMs : 15e3,
328
333
  // Gateway config (passed from index.ts for fallback AI)
329
334
  gatewayConfig: cfg.gatewayConfig,
330
335
  // v3.0 namespaces (default off)
@@ -16388,6 +16393,7 @@ var Orchestrator = class _Orchestrator {
16388
16393
  sessionObserver;
16389
16394
  summarizer;
16390
16395
  localLlm;
16396
+ fastLlm;
16391
16397
  modelRegistry;
16392
16398
  relevance;
16393
16399
  negatives;
@@ -16489,6 +16495,10 @@ var Orchestrator = class _Orchestrator {
16489
16495
  this.policyRuntime = new PolicyRuntimeManager(config.memoryDir, config);
16490
16496
  this.summarizer = new HourlySummarizer(config, config.gatewayConfig, this.modelRegistry, this.transcript);
16491
16497
  this.localLlm = new LocalLlmClient(config, this.modelRegistry);
16498
+ this.fastLlm = config.localLlmFastEnabled ? new LocalLlmClient(
16499
+ { ...config, localLlmModel: config.localLlmFastModel || config.localLlmModel, localLlmUrl: config.localLlmFastUrl, localLlmTimeoutMs: config.localLlmFastTimeoutMs },
16500
+ this.modelRegistry
16501
+ ) : this.localLlm;
16492
16502
  this.extraction = new ExtractionEngine(config, this.localLlm, config.gatewayConfig, this.modelRegistry);
16493
16503
  this.threading = new ThreadingManager(
16494
16504
  path30.join(config.memoryDir, "threads"),
@@ -17892,7 +17902,7 @@ ${tmtNode.summary}`);
17892
17902
  id: r.path,
17893
17903
  snippet: r.snippet || r.path
17894
17904
  })),
17895
- local: this.localLlm,
17905
+ local: this.fastLlm,
17896
17906
  enabled: true,
17897
17907
  timeoutMs: this.config.rerankTimeoutMs,
17898
17908
  maxCandidates: this.config.rerankMaxCandidates,
@@ -19383,7 +19393,7 @@ _Context: ${topQuestion.context}_`
19383
19393
  try {
19384
19394
  const factsText = entity.facts.slice(0, 10).join("; ");
19385
19395
  const prompt = `Summarize this entity in one sentence. Entity: ${entity.name} (${entity.type}). Facts: ${factsText}`;
19386
- const response = await this.localLlm.chatCompletion(
19396
+ const response = await this.fastLlm.chatCompletion(
19387
19397
  [
19388
19398
  { role: "system", content: "Respond with a single concise sentence summarizing the entity. No JSON, just plain text." },
19389
19399
  { role: "user", content: prompt }
@@ -19485,7 +19495,7 @@ _Context: ${topQuestion.context}_`
19485
19495
  const prompt = `You are a memory archivist. Summarize the following ${level}-level memories into 3\u20135 sentences, preserving key facts, decisions, and preferences.
19486
19496
 
19487
19497
  ${texts.map((t, i) => `[${i + 1}] ${t}`).join("\n\n")}`;
19488
- const response = await this.localLlm.chatCompletion(
19498
+ const response = await this.fastLlm.chatCompletion(
19489
19499
  [
19490
19500
  { role: "system", content: "Respond with a 3\u20135 sentence narrative summary. No JSON, just plain prose." },
19491
19501
  { role: "user", content: prompt }
@@ -19542,7 +19552,7 @@ ${texts.map((t, i) => `[${i + 1}] ${t}`).join("\n\n")}`;
19542
19552
  "Input candidate:",
19543
19553
  JSON.stringify(baseline)
19544
19554
  ].join("\n");
19545
- const response = await this.localLlm.chatCompletion(
19555
+ const response = await this.fastLlm.chatCompletion(
19546
19556
  [
19547
19557
  { role: "system", content: "Respond with strict JSON only. No markdown." },
19548
19558
  { role: "user", content: prompt }
@@ -20154,7 +20164,7 @@ ${lines.join("\n\n")}`;
20154
20164
  id: r.path,
20155
20165
  snippet: r.snippet || r.path
20156
20166
  })),
20157
- local: this.localLlm,
20167
+ local: this.fastLlm,
20158
20168
  enabled: true,
20159
20169
  timeoutMs: this.config.rerankTimeoutMs,
20160
20170
  maxCandidates: this.config.rerankMaxCandidates,
@@ -27726,7 +27736,7 @@ var index_default = {
27726
27736
  });
27727
27737
  initLogger(api.logger, cfg.debug);
27728
27738
  log.info(
27729
- `initialized (debug=${cfg.debug}, qmdEnabled=${cfg.qmdEnabled}, transcriptEnabled=${cfg.transcriptEnabled}, hourlySummariesEnabled=${cfg.hourlySummariesEnabled}, localLlmEnabled=${cfg.localLlmEnabled})`
27739
+ `initialized (debug=${cfg.debug}, qmdEnabled=${cfg.qmdEnabled}, transcriptEnabled=${cfg.transcriptEnabled}, hourlySummariesEnabled=${cfg.hourlySummariesEnabled}, localLlmEnabled=${cfg.localLlmEnabled}${cfg.localLlmFastEnabled ? `, fastLlm=${cfg.localLlmFastModel || "(primary)"}` : ""})`
27730
27740
  );
27731
27741
  const existing = globalThis.__openclawEngramOrchestrator;
27732
27742
  const orchestrator = existing?.recall ? existing : new Orchestrator(cfg);