@joshuaswarren/openclaw-engram 9.0.91 → 9.0.92
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 +7 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36016,7 +36016,7 @@ var EngramAccessService = class {
|
|
|
36016
36016
|
if (request.skipExtraction !== true) {
|
|
36017
36017
|
const turns = request.messages.map((m) => ({
|
|
36018
36018
|
source: "openclaw",
|
|
36019
|
-
sessionKey:
|
|
36019
|
+
sessionKey: lcmSessionKey,
|
|
36020
36020
|
role: m.role,
|
|
36021
36021
|
content: m.content,
|
|
36022
36022
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -36050,11 +36050,12 @@ var EngramAccessService = class {
|
|
|
36050
36050
|
lcmEnabled: false
|
|
36051
36051
|
};
|
|
36052
36052
|
}
|
|
36053
|
-
const limit = request.limit ?? 10;
|
|
36053
|
+
const limit = Math.max(1, Math.min(request.limit ?? 10, 100));
|
|
36054
|
+
const lcmSessionKey = request.sessionKey && namespace !== this.orchestrator.config.defaultNamespace ? `${namespace}:${request.sessionKey}` : request.sessionKey;
|
|
36054
36055
|
const rawResults = await this.orchestrator.lcmEngine.searchContextFull(
|
|
36055
36056
|
request.query,
|
|
36056
36057
|
limit,
|
|
36057
|
-
|
|
36058
|
+
lcmSessionKey
|
|
36058
36059
|
);
|
|
36059
36060
|
const results = rawResults.map((r) => ({
|
|
36060
36061
|
sessionId: r.session_id,
|
|
@@ -36731,9 +36732,7 @@ var EngramAccessHttpServer = class {
|
|
|
36731
36732
|
this.ensureWriteRateLimitAvailable();
|
|
36732
36733
|
const response = await this.service.observe({
|
|
36733
36734
|
sessionKey: typeof body.sessionKey === "string" ? body.sessionKey : "",
|
|
36734
|
-
messages: Array.isArray(body.messages) ? body.messages
|
|
36735
|
-
(m) => typeof m === "object" && m !== null && (m.role === "user" || m.role === "assistant") && typeof m.content === "string"
|
|
36736
|
-
) : [],
|
|
36735
|
+
messages: Array.isArray(body.messages) ? body.messages : [],
|
|
36737
36736
|
namespace: typeof body.namespace === "string" ? body.namespace : void 0,
|
|
36738
36737
|
authenticatedPrincipal: this.resolveRequestPrincipal(req),
|
|
36739
36738
|
skipExtraction: body.skipExtraction === true
|
|
@@ -36920,8 +36919,9 @@ var EngramAccessHttpServer = class {
|
|
|
36920
36919
|
});
|
|
36921
36920
|
if (isMcpWrite && response !== null) {
|
|
36922
36921
|
const result = response.result;
|
|
36922
|
+
const isError = result?.isError === true;
|
|
36923
36923
|
const structured = result?.structuredContent;
|
|
36924
|
-
if (!structured
|
|
36924
|
+
if (!isError && structured && this.shouldCountWriteRateLimit(structured)) {
|
|
36925
36925
|
this.recordWriteRateLimitHit();
|
|
36926
36926
|
}
|
|
36927
36927
|
}
|