@joshuaswarren/openclaw-engram 9.0.12 → 9.0.14
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 +32 -6
- package/dist/index.js.map +1 -1
- package/openclaw.plugin.json +39 -0
- package/package.json +1 -1
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)
|
|
@@ -980,6 +985,7 @@ var LocalLlmClient = class _LocalLlmClient {
|
|
|
980
985
|
consecutive400s = 0;
|
|
981
986
|
cooldownUntilMs = 0;
|
|
982
987
|
modelRegistry;
|
|
988
|
+
_disableThinking = false;
|
|
983
989
|
static HEALTH_CHECK_INTERVAL_MS = 6e4;
|
|
984
990
|
// 1 minute
|
|
985
991
|
static LMS_CACHE_INTERVAL_MS = 3e4;
|
|
@@ -988,6 +994,14 @@ var LocalLlmClient = class _LocalLlmClient {
|
|
|
988
994
|
this.config = config;
|
|
989
995
|
this.modelRegistry = modelRegistry;
|
|
990
996
|
}
|
|
997
|
+
/**
|
|
998
|
+
* Disable thinking/reasoning mode for models that support it (e.g. Qwen 3.5).
|
|
999
|
+
* When enabled, adds chat_template_kwargs to suppress chain-of-thought,
|
|
1000
|
+
* reducing latency for fast-tier operations.
|
|
1001
|
+
*/
|
|
1002
|
+
set disableThinking(value) {
|
|
1003
|
+
this._disableThinking = value;
|
|
1004
|
+
}
|
|
991
1005
|
resolveHomeDir() {
|
|
992
1006
|
return this.config.localLlmHomeDir || process.env.HOME || os.homedir();
|
|
993
1007
|
}
|
|
@@ -1427,6 +1441,9 @@ var LocalLlmClient = class _LocalLlmClient {
|
|
|
1427
1441
|
if (options.responseFormat?.type === "json_schema") {
|
|
1428
1442
|
requestBody.response_format = options.responseFormat;
|
|
1429
1443
|
}
|
|
1444
|
+
if (this._disableThinking) {
|
|
1445
|
+
requestBody.chat_template_kwargs = { enable_thinking: false };
|
|
1446
|
+
}
|
|
1430
1447
|
const baseUrl = this.config.localLlmUrl.replace("localhost", "127.0.0.1").replace(/\/+$/, "");
|
|
1431
1448
|
const chatUrl = `${baseUrl}/chat/completions`;
|
|
1432
1449
|
const requestBodyJson = JSON.stringify(requestBody);
|
|
@@ -16388,6 +16405,7 @@ var Orchestrator = class _Orchestrator {
|
|
|
16388
16405
|
sessionObserver;
|
|
16389
16406
|
summarizer;
|
|
16390
16407
|
localLlm;
|
|
16408
|
+
fastLlm;
|
|
16391
16409
|
modelRegistry;
|
|
16392
16410
|
relevance;
|
|
16393
16411
|
negatives;
|
|
@@ -16489,6 +16507,14 @@ var Orchestrator = class _Orchestrator {
|
|
|
16489
16507
|
this.policyRuntime = new PolicyRuntimeManager(config.memoryDir, config);
|
|
16490
16508
|
this.summarizer = new HourlySummarizer(config, config.gatewayConfig, this.modelRegistry, this.transcript);
|
|
16491
16509
|
this.localLlm = new LocalLlmClient(config, this.modelRegistry);
|
|
16510
|
+
this.fastLlm = config.localLlmFastEnabled ? (() => {
|
|
16511
|
+
const client = new LocalLlmClient(
|
|
16512
|
+
{ ...config, localLlmModel: config.localLlmFastModel || config.localLlmModel, localLlmUrl: config.localLlmFastUrl, localLlmTimeoutMs: config.localLlmFastTimeoutMs },
|
|
16513
|
+
this.modelRegistry
|
|
16514
|
+
);
|
|
16515
|
+
client.disableThinking = true;
|
|
16516
|
+
return client;
|
|
16517
|
+
})() : this.localLlm;
|
|
16492
16518
|
this.extraction = new ExtractionEngine(config, this.localLlm, config.gatewayConfig, this.modelRegistry);
|
|
16493
16519
|
this.threading = new ThreadingManager(
|
|
16494
16520
|
path30.join(config.memoryDir, "threads"),
|
|
@@ -17892,7 +17918,7 @@ ${tmtNode.summary}`);
|
|
|
17892
17918
|
id: r.path,
|
|
17893
17919
|
snippet: r.snippet || r.path
|
|
17894
17920
|
})),
|
|
17895
|
-
local: this.
|
|
17921
|
+
local: this.fastLlm,
|
|
17896
17922
|
enabled: true,
|
|
17897
17923
|
timeoutMs: this.config.rerankTimeoutMs,
|
|
17898
17924
|
maxCandidates: this.config.rerankMaxCandidates,
|
|
@@ -19383,7 +19409,7 @@ _Context: ${topQuestion.context}_`
|
|
|
19383
19409
|
try {
|
|
19384
19410
|
const factsText = entity.facts.slice(0, 10).join("; ");
|
|
19385
19411
|
const prompt = `Summarize this entity in one sentence. Entity: ${entity.name} (${entity.type}). Facts: ${factsText}`;
|
|
19386
|
-
const response = await this.
|
|
19412
|
+
const response = await this.fastLlm.chatCompletion(
|
|
19387
19413
|
[
|
|
19388
19414
|
{ role: "system", content: "Respond with a single concise sentence summarizing the entity. No JSON, just plain text." },
|
|
19389
19415
|
{ role: "user", content: prompt }
|
|
@@ -19485,7 +19511,7 @@ _Context: ${topQuestion.context}_`
|
|
|
19485
19511
|
const prompt = `You are a memory archivist. Summarize the following ${level}-level memories into 3\u20135 sentences, preserving key facts, decisions, and preferences.
|
|
19486
19512
|
|
|
19487
19513
|
${texts.map((t, i) => `[${i + 1}] ${t}`).join("\n\n")}`;
|
|
19488
|
-
const response = await this.
|
|
19514
|
+
const response = await this.fastLlm.chatCompletion(
|
|
19489
19515
|
[
|
|
19490
19516
|
{ role: "system", content: "Respond with a 3\u20135 sentence narrative summary. No JSON, just plain prose." },
|
|
19491
19517
|
{ role: "user", content: prompt }
|
|
@@ -19542,7 +19568,7 @@ ${texts.map((t, i) => `[${i + 1}] ${t}`).join("\n\n")}`;
|
|
|
19542
19568
|
"Input candidate:",
|
|
19543
19569
|
JSON.stringify(baseline)
|
|
19544
19570
|
].join("\n");
|
|
19545
|
-
const response = await this.
|
|
19571
|
+
const response = await this.fastLlm.chatCompletion(
|
|
19546
19572
|
[
|
|
19547
19573
|
{ role: "system", content: "Respond with strict JSON only. No markdown." },
|
|
19548
19574
|
{ role: "user", content: prompt }
|
|
@@ -20154,7 +20180,7 @@ ${lines.join("\n\n")}`;
|
|
|
20154
20180
|
id: r.path,
|
|
20155
20181
|
snippet: r.snippet || r.path
|
|
20156
20182
|
})),
|
|
20157
|
-
local: this.
|
|
20183
|
+
local: this.fastLlm,
|
|
20158
20184
|
enabled: true,
|
|
20159
20185
|
timeoutMs: this.config.rerankTimeoutMs,
|
|
20160
20186
|
maxCandidates: this.config.rerankMaxCandidates,
|
|
@@ -27726,7 +27752,7 @@ var index_default = {
|
|
|
27726
27752
|
});
|
|
27727
27753
|
initLogger(api.logger, cfg.debug);
|
|
27728
27754
|
log.info(
|
|
27729
|
-
`initialized (debug=${cfg.debug}, qmdEnabled=${cfg.qmdEnabled}, transcriptEnabled=${cfg.transcriptEnabled}, hourlySummariesEnabled=${cfg.hourlySummariesEnabled}, localLlmEnabled=${cfg.localLlmEnabled})`
|
|
27755
|
+
`initialized (debug=${cfg.debug}, qmdEnabled=${cfg.qmdEnabled}, transcriptEnabled=${cfg.transcriptEnabled}, hourlySummariesEnabled=${cfg.hourlySummariesEnabled}, localLlmEnabled=${cfg.localLlmEnabled}${cfg.localLlmFastEnabled ? `, fastLlm=${cfg.localLlmFastModel || "(primary)"}` : ""})`
|
|
27730
27756
|
);
|
|
27731
27757
|
const existing = globalThis.__openclawEngramOrchestrator;
|
|
27732
27758
|
const orchestrator = existing?.recall ? existing : new Orchestrator(cfg);
|