@remnic/plugin-openclaw 9.69.52 → 9.69.53
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 +19 -4
- package/openclaw.plugin.json +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -8147,15 +8147,26 @@ function cwdFrom(event, ctx, fallback) {
|
|
|
8147
8147
|
}
|
|
8148
8148
|
return fallback;
|
|
8149
8149
|
}
|
|
8150
|
+
function readRecallDegradation(candidate) {
|
|
8151
|
+
if (!("degradation" in candidate)) return void 0;
|
|
8152
|
+
const value = candidate.degradation;
|
|
8153
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
8154
|
+
const rec = value;
|
|
8155
|
+
if (typeof rec.state !== "string" || typeof rec.reason !== "string") return void 0;
|
|
8156
|
+
return value;
|
|
8157
|
+
}
|
|
8150
8158
|
function readContextComposition(response, fallbackContext) {
|
|
8151
8159
|
const candidate = response.contextComposition;
|
|
8152
8160
|
if (typeof candidate !== "object" || candidate === null || !("context" in candidate) || typeof candidate.context !== "string") {
|
|
8153
8161
|
return { context: fallbackContext };
|
|
8154
8162
|
}
|
|
8163
|
+
const composition = { context: candidate.context };
|
|
8155
8164
|
if ("footer" in candidate && typeof candidate.footer === "string") {
|
|
8156
|
-
|
|
8165
|
+
composition.footer = candidate.footer;
|
|
8157
8166
|
}
|
|
8158
|
-
|
|
8167
|
+
const degradation = readRecallDegradation(candidate);
|
|
8168
|
+
if (degradation) composition.degradation = degradation;
|
|
8169
|
+
return composition;
|
|
8159
8170
|
}
|
|
8160
8171
|
function registerDelegateRuntime(api, options) {
|
|
8161
8172
|
const { target, namespace, namespaceBindings } = options;
|
|
@@ -8296,8 +8307,9 @@ function registerDelegateRuntime(api, options) {
|
|
|
8296
8307
|
if (typeof rawContext !== "string" || rawContext.trim().length === 0) {
|
|
8297
8308
|
return void 0;
|
|
8298
8309
|
}
|
|
8310
|
+
const composition = readContextComposition(response ?? {}, rawContext);
|
|
8299
8311
|
const rendered = renderMemoryContextPrompt({
|
|
8300
|
-
...
|
|
8312
|
+
...composition,
|
|
8301
8313
|
maxChars: options.recallBudgetChars
|
|
8302
8314
|
});
|
|
8303
8315
|
if (!rendered) return void 0;
|
|
@@ -8306,7 +8318,10 @@ function registerDelegateRuntime(api, options) {
|
|
|
8306
8318
|
promptLinesBySession.set(sessionKey, rendered.lines);
|
|
8307
8319
|
return void 0;
|
|
8308
8320
|
}
|
|
8309
|
-
return {
|
|
8321
|
+
return {
|
|
8322
|
+
prependSystemContext: prompt,
|
|
8323
|
+
...composition.degradation ? { degradation: composition.degradation } : {}
|
|
8324
|
+
};
|
|
8310
8325
|
} catch (err) {
|
|
8311
8326
|
log7.warn(`delegate recall failed: ${String(err)}`);
|
|
8312
8327
|
return void 0;
|