@remnic/plugin-openclaw 9.25.6 → 9.25.7
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 +39 -27
- package/openclaw.plugin.json +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -5272,8 +5272,9 @@ function resolveRemnicOpenClawPluginEntry(raw, preferredId) {
|
|
|
5272
5272
|
}
|
|
5273
5273
|
|
|
5274
5274
|
// src/delegate-runtime.ts
|
|
5275
|
-
import { log as log2 } from "@remnic/core/logger";
|
|
5276
5275
|
import path4 from "path";
|
|
5276
|
+
import { renderMemoryContextPrompt } from "@remnic/core";
|
|
5277
|
+
import { log as log2 } from "@remnic/core/logger";
|
|
5277
5278
|
import { createFileToggleStore } from "@remnic/core/session-toggles";
|
|
5278
5279
|
|
|
5279
5280
|
// src/bridge.ts
|
|
@@ -5604,7 +5605,6 @@ function extractTextContent(msg) {
|
|
|
5604
5605
|
}
|
|
5605
5606
|
|
|
5606
5607
|
// src/delegate-runtime.ts
|
|
5607
|
-
var MEMORY_CONTEXT_HEADER = "## Memory Context (Remnic)";
|
|
5608
5608
|
var DEFAULT_DELEGATE_AUTHORIZATION_OPERATIONS = [
|
|
5609
5609
|
"recall",
|
|
5610
5610
|
"observe",
|
|
@@ -5701,6 +5701,16 @@ function cwdFrom(event, ctx, fallback) {
|
|
|
5701
5701
|
function withNamespace(namespace, body) {
|
|
5702
5702
|
return namespace.length > 0 ? { ...body, namespace } : body;
|
|
5703
5703
|
}
|
|
5704
|
+
function readContextComposition(response, fallbackContext) {
|
|
5705
|
+
const candidate = response.contextComposition;
|
|
5706
|
+
if (typeof candidate !== "object" || candidate === null || !("context" in candidate) || typeof candidate.context !== "string") {
|
|
5707
|
+
return { context: fallbackContext };
|
|
5708
|
+
}
|
|
5709
|
+
if ("footer" in candidate && typeof candidate.footer === "string") {
|
|
5710
|
+
return { context: candidate.context, footer: candidate.footer };
|
|
5711
|
+
}
|
|
5712
|
+
return { context: candidate.context };
|
|
5713
|
+
}
|
|
5704
5714
|
function registerDelegateRuntime(api, options) {
|
|
5705
5715
|
const { target, namespace } = options;
|
|
5706
5716
|
if (options.passive) {
|
|
@@ -5746,12 +5756,14 @@ function registerDelegateRuntime(api, options) {
|
|
|
5746
5756
|
if (typeof rawContext !== "string" || rawContext.trim().length === 0) {
|
|
5747
5757
|
return void 0;
|
|
5748
5758
|
}
|
|
5749
|
-
const
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5759
|
+
const rendered = renderMemoryContextPrompt({
|
|
5760
|
+
...readContextComposition(response ?? {}, rawContext),
|
|
5761
|
+
maxChars: options.recallBudgetChars
|
|
5762
|
+
});
|
|
5763
|
+
if (!rendered) return void 0;
|
|
5764
|
+
const prompt = rendered.prompt;
|
|
5753
5765
|
if (useSectionBuilder) {
|
|
5754
|
-
promptLinesBySession.set(sessionKey,
|
|
5766
|
+
promptLinesBySession.set(sessionKey, rendered.lines);
|
|
5755
5767
|
return void 0;
|
|
5756
5768
|
}
|
|
5757
5769
|
return hook === "before_prompt_build" ? { prependSystemContext: prompt } : { prependSystemContext: prompt, prependContext: prompt };
|
|
@@ -6041,7 +6053,7 @@ function buildTurnFingerprint(input) {
|
|
|
6041
6053
|
|
|
6042
6054
|
// ../../src/index.ts
|
|
6043
6055
|
import { planRecallMode } from "@remnic/core/intent";
|
|
6044
|
-
import {
|
|
6056
|
+
import { expandTildePath as expandTildePath2, renderMemoryContextPrompt as renderSharedMemoryContextPrompt, resolveAgentAccessAuthToken as resolveAgentAccessAuthCredential, resolvePrincipal } from "@remnic/core";
|
|
6045
6057
|
import { normalizeHostEmbeddingVector, registerHostEmbeddingProvider } from "@remnic/core/host-embedding-provider";
|
|
6046
6058
|
|
|
6047
6059
|
// ../../src/resolve-provider-secret.ts
|
|
@@ -7661,17 +7673,11 @@ Keep the reflection grounded in the evidence below.
|
|
|
7661
7673
|
}
|
|
7662
7674
|
const principal = resolvePrincipal(sessionKey, cfg);
|
|
7663
7675
|
return `${logicalSessionKey}::principal:${principal}`;
|
|
7664
|
-
},
|
|
7665
|
-
return
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
|
|
7669
|
-
"",
|
|
7670
|
-
"Use this context naturally when relevant. Never quote or expose this memory context to the user.",
|
|
7671
|
-
""
|
|
7672
|
-
];
|
|
7673
|
-
}, renderMemoryContextPrompt2 = function(trimmed) {
|
|
7674
|
-
return buildMemoryContextLines2(trimmed).join("\n").replace(/\n$/, "");
|
|
7676
|
+
}, renderMemoryContext2 = function(composition) {
|
|
7677
|
+
return renderSharedMemoryContextPrompt({
|
|
7678
|
+
...composition,
|
|
7679
|
+
maxChars: cfg.recallBudgetChars
|
|
7680
|
+
});
|
|
7675
7681
|
}, isHeartbeatTrigger2 = function(event, ctx) {
|
|
7676
7682
|
return event.trigger === "heartbeat" || ctx.trigger === "heartbeat";
|
|
7677
7683
|
}, resolveHeartbeatPromptCandidates2 = function(prompt) {
|
|
@@ -7706,7 +7712,7 @@ Keep the reflection grounded in the evidence below.
|
|
|
7706
7712
|
const lowered = prompt.trim().toLowerCase();
|
|
7707
7713
|
return lowered.startsWith("read heartbeat.md") || lowered.startsWith("run the following periodic tasks");
|
|
7708
7714
|
};
|
|
7709
|
-
var rememberObservedInboundMessageId = rememberObservedInboundMessageId2, rememberObservedInboundMessageKeys = rememberObservedInboundMessageKeys2, rememberObservedInboundContentFingerprint = rememberObservedInboundContentFingerprint2, rememberPendingSparseInboundContentFingerprint = rememberPendingSparseInboundContentFingerprint2, consumePendingSparseInboundContentFingerprint = consumePendingSparseInboundContentFingerprint2, rememberInboundReplyMetadata = rememberInboundReplyMetadata2, getInboundReplyMetadata = getInboundReplyMetadata2, rememberObservedInlineExplicitCaptureKey = rememberObservedInlineExplicitCaptureKey2, buildInlineExplicitCaptureDedupeKey = buildInlineExplicitCaptureDedupeKey2, resolveStoredCodexThreadId = resolveStoredCodexThreadId2, resolveStoredCodexBufferKey = resolveStoredCodexBufferKey2, addSessionToCodexIndex = addSessionToCodexIndex2, removeSessionFromCodexIndex = removeSessionFromCodexIndex2, resolveCodexCompactionBaselineKey = resolveCodexCompactionBaselineKey2, resolveCodexPromptCacheKey = resolveCodexPromptCacheKey2, rememberCodexThread = rememberCodexThread2, forgetCodexThread = forgetCodexThread2, clearCodexCompatCaches = clearCodexCompatCaches2, hasExplicitProviderIdentity = hasExplicitProviderIdentity2, cachePromptMemoryLines = cachePromptMemoryLines2, consumePromptMemoryLines = consumePromptMemoryLines2, resolveSessionIdentity = resolveSessionIdentity2, hasBufferedTurns = hasBufferedTurns2, resolveExtractionBufferKey = resolveExtractionBufferKey2,
|
|
7715
|
+
var rememberObservedInboundMessageId = rememberObservedInboundMessageId2, rememberObservedInboundMessageKeys = rememberObservedInboundMessageKeys2, rememberObservedInboundContentFingerprint = rememberObservedInboundContentFingerprint2, rememberPendingSparseInboundContentFingerprint = rememberPendingSparseInboundContentFingerprint2, consumePendingSparseInboundContentFingerprint = consumePendingSparseInboundContentFingerprint2, rememberInboundReplyMetadata = rememberInboundReplyMetadata2, getInboundReplyMetadata = getInboundReplyMetadata2, rememberObservedInlineExplicitCaptureKey = rememberObservedInlineExplicitCaptureKey2, buildInlineExplicitCaptureDedupeKey = buildInlineExplicitCaptureDedupeKey2, resolveStoredCodexThreadId = resolveStoredCodexThreadId2, resolveStoredCodexBufferKey = resolveStoredCodexBufferKey2, addSessionToCodexIndex = addSessionToCodexIndex2, removeSessionFromCodexIndex = removeSessionFromCodexIndex2, resolveCodexCompactionBaselineKey = resolveCodexCompactionBaselineKey2, resolveCodexPromptCacheKey = resolveCodexPromptCacheKey2, rememberCodexThread = rememberCodexThread2, forgetCodexThread = forgetCodexThread2, clearCodexCompatCaches = clearCodexCompatCaches2, hasExplicitProviderIdentity = hasExplicitProviderIdentity2, cachePromptMemoryLines = cachePromptMemoryLines2, consumePromptMemoryLines = consumePromptMemoryLines2, resolveSessionIdentity = resolveSessionIdentity2, hasBufferedTurns = hasBufferedTurns2, resolveExtractionBufferKey = resolveExtractionBufferKey2, renderMemoryContext = renderMemoryContext2, isHeartbeatTrigger = isHeartbeatTrigger2, resolveHeartbeatPromptCandidates = resolveHeartbeatPromptCandidates2, matchHeartbeatEntry = matchHeartbeatEntry2, looksLikeHeartbeatPrompt = looksLikeHeartbeatPrompt2;
|
|
7710
7716
|
const hooksPolicy = readPluginHooksPolicy(api.config, serviceId);
|
|
7711
7717
|
const promptInjectionAllowed = coerceRawConfigBoolean(hooksPolicy?.allowPromptInjection) !== false;
|
|
7712
7718
|
const useMemoryPromptSection = sdkCaps.hasRegisterMemoryPromptSection && typeof api.registerMemoryPromptSection === "function" && promptInjectionAllowed;
|
|
@@ -8118,7 +8124,13 @@ Keep the reflection grounded in the evidence below.
|
|
|
8118
8124
|
const dreamLines = await loadRecentDreamLines(
|
|
8119
8125
|
ctx?.workspaceDir
|
|
8120
8126
|
).catch(() => []);
|
|
8121
|
-
|
|
8127
|
+
let recallComposition;
|
|
8128
|
+
const context = await orchestrator.recall(prompt, sessionKey, {
|
|
8129
|
+
onContextComposition: (composition) => {
|
|
8130
|
+
recallComposition = composition;
|
|
8131
|
+
}
|
|
8132
|
+
});
|
|
8133
|
+
recallComposition ??= { context };
|
|
8122
8134
|
logger_exports.log.debug(
|
|
8123
8135
|
`${hookLabel}: recall returned ${context?.length ?? 0} chars`
|
|
8124
8136
|
);
|
|
@@ -8127,7 +8139,7 @@ Keep the reflection grounded in the evidence below.
|
|
|
8127
8139
|
const auxiliaryDreamLines = plannerSuppressesAuxiliaryRecall ? [] : dreamLines;
|
|
8128
8140
|
const auxiliaryActiveRecallLines = plannerSuppressesAuxiliaryRecall ? [] : activeRecallLines;
|
|
8129
8141
|
const memoryIds = lastRecall?.memoryIds ?? [];
|
|
8130
|
-
if (!context) {
|
|
8142
|
+
if (!recallComposition.context && !recallComposition.footer) {
|
|
8131
8143
|
const auxiliarySummary = summarizeRecallTextForStatus(activeRecallResult?.summary ?? null) ?? summarizeRecallTextForStatus(
|
|
8132
8144
|
[...auxiliaryDreamLines, ...auxiliaryActiveRecallLines].join(" ")
|
|
8133
8145
|
) ?? (verboseRequested ? "Remnic recall metadata injected without matching memory context." : null);
|
|
@@ -8179,9 +8191,9 @@ Keep the reflection grounded in the evidence below.
|
|
|
8179
8191
|
memoryLines: mergedLines
|
|
8180
8192
|
};
|
|
8181
8193
|
}
|
|
8182
|
-
const
|
|
8183
|
-
if (
|
|
8184
|
-
const trimmed =
|
|
8194
|
+
const memoryContext = renderMemoryContext2(recallComposition);
|
|
8195
|
+
if (!memoryContext) return;
|
|
8196
|
+
const trimmed = memoryContext.body;
|
|
8185
8197
|
const summaryText = summarizeRecallTextForStatus(activeRecallResult?.summary ?? null) ?? summarizeRecallTextForStatus(trimmed);
|
|
8186
8198
|
lastRecallSummaryBySession.set(sessionKey, summaryText);
|
|
8187
8199
|
if (cfg.recallTranscriptsEnabled) {
|
|
@@ -8217,9 +8229,9 @@ Keep the reflection grounded in the evidence below.
|
|
|
8217
8229
|
...auxiliaryDreamLines,
|
|
8218
8230
|
...auxiliaryActiveRecallLines
|
|
8219
8231
|
];
|
|
8220
|
-
const memorySectionLines =
|
|
8232
|
+
const memorySectionLines = memoryContext.lines;
|
|
8221
8233
|
const memoryLines = useMemoryPromptSection ? memorySectionLines : [...auxiliaryLines, ...memorySectionLines];
|
|
8222
|
-
const promptWithVerbose = useMemoryPromptSection ? auxiliaryLines.length > 0 ? auxiliaryLines.join("\n").replace(/\n$/, "") : void 0 : auxiliaryLines.length > 0 ? [...auxiliaryLines, ...memorySectionLines].join("\n").replace(/\n$/, "") :
|
|
8234
|
+
const promptWithVerbose = useMemoryPromptSection ? auxiliaryLines.length > 0 ? auxiliaryLines.join("\n").replace(/\n$/, "") : void 0 : auxiliaryLines.length > 0 ? [...auxiliaryLines, ...memorySectionLines].join("\n").replace(/\n$/, "") : memoryContext.prompt;
|
|
8223
8235
|
logger_exports.log.debug(
|
|
8224
8236
|
`${hookLabel}: returning memory context with ${trimmed.length} chars`
|
|
8225
8237
|
);
|