@openviking/openclaw-plugin 2026.6.2 → 2026.6.17-dev.2
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/INSTALL-AGENT.md +4 -4
- package/INSTALL-ZH.md +68 -8
- package/INSTALL.md +12 -8
- package/README.md +45 -35
- package/adapters/http-transport.ts +3 -0
- package/adapters/resource-packager.ts +141 -0
- package/auto-recall.ts +258 -27
- package/client.ts +201 -177
- package/commands/setup.ts +200 -33
- package/config/feature-gates.json +10 -0
- package/config.ts +428 -85
- package/context-engine.ts +71 -1402
- package/dist/adapters/http-transport.js +1 -0
- package/dist/adapters/resource-packager.js +114 -0
- package/dist/auto-recall.js +201 -25
- package/dist/client.js +125 -161
- package/dist/commands/setup.js +170 -32
- package/dist/config.js +285 -64
- package/dist/context-engine.js +62 -1173
- package/dist/index.js +209 -1489
- package/dist/memory-ranking.js +35 -12
- package/dist/plugin/command-registration.js +5 -0
- package/dist/plugin/openviking-archive-tools.js +210 -0
- package/dist/plugin/openviking-bypass-runtime.js +8 -0
- package/dist/plugin/openviking-client-runtime.js +28 -0
- package/dist/plugin/openviking-command-args.js +146 -0
- package/dist/plugin/openviking-command-definitions.js +206 -0
- package/dist/plugin/openviking-context-engine-ref.js +11 -0
- package/dist/plugin/openviking-context-engine-registration.js +23 -0
- package/dist/plugin/openviking-feature-gates.js +250 -0
- package/dist/plugin/openviking-import-runtime.js +50 -0
- package/dist/plugin/openviking-import-tools.js +86 -0
- package/dist/plugin/openviking-lifecycle-hooks.js +33 -0
- package/dist/plugin/openviking-memory-recall-tools.js +233 -0
- package/dist/plugin/openviking-memory-tools.js +199 -0
- package/dist/plugin/openviking-query-config-command.js +203 -0
- package/dist/plugin/openviking-query-runtime.js +367 -0
- package/dist/plugin/openviking-query-tools.js +91 -0
- package/dist/plugin/openviking-recall-trace-runtime.js +387 -0
- package/dist/plugin/openviking-recall-trace-tools.js +38 -0
- package/dist/plugin/openviking-runtime-state.js +26 -0
- package/dist/plugin/openviking-runtime-utils.js +62 -0
- package/dist/plugin/openviking-services.js +20 -0
- package/dist/plugin/openviking-session-routing-runtime.js +61 -0
- package/dist/plugin/openviking-tool-result-tools.js +268 -0
- package/dist/plugin/recall-trace-routes.js +77 -0
- package/dist/plugin/tool-registration.js +23 -0
- package/dist/process-manager.js +1 -1
- package/dist/query-config.js +336 -0
- package/dist/recall-trace.js +309 -0
- package/dist/registries/recall-resource-types.js +58 -0
- package/dist/routing/identity-routing.js +152 -0
- package/dist/routing/memory-uri.js +7 -0
- package/dist/services/context-lifecycle-service.js +847 -0
- package/dist/services/context-message-adapter.js +340 -0
- package/dist/session-transcript-repair.js +0 -1
- package/dist/text-utils.js +14 -31
- package/index.ts +271 -1873
- package/install-manifest.json +10 -1
- package/memory-ranking.ts +46 -10
- package/openclaw.plugin.json +198 -36
- package/package.json +14 -4
- package/plugin/command-registration.ts +34 -0
- package/plugin/openviking-archive-tools.ts +301 -0
- package/plugin/openviking-bypass-runtime.ts +26 -0
- package/plugin/openviking-client-runtime.ts +74 -0
- package/plugin/openviking-command-args.ts +187 -0
- package/plugin/openviking-command-definitions.ts +294 -0
- package/plugin/openviking-context-engine-ref.ts +16 -0
- package/plugin/openviking-context-engine-registration.ts +97 -0
- package/plugin/openviking-feature-gates.ts +335 -0
- package/plugin/openviking-import-runtime.ts +105 -0
- package/plugin/openviking-import-tools.ts +133 -0
- package/plugin/openviking-lifecycle-hooks.ts +65 -0
- package/plugin/openviking-memory-recall-tools.ts +368 -0
- package/plugin/openviking-memory-tools.ts +299 -0
- package/plugin/openviking-query-config-command.ts +230 -0
- package/plugin/openviking-query-formatters.ts +108 -0
- package/plugin/openviking-query-runtime.ts +476 -0
- package/plugin/openviking-query-tools.ts +161 -0
- package/plugin/openviking-recall-trace-runtime.ts +482 -0
- package/plugin/openviking-recall-trace-tools.ts +99 -0
- package/plugin/openviking-runtime-state.ts +52 -0
- package/plugin/openviking-runtime-utils.ts +67 -0
- package/plugin/openviking-services.ts +49 -0
- package/plugin/openviking-session-routing-runtime.ts +105 -0
- package/plugin/openviking-tool-result-tools.ts +397 -0
- package/plugin/recall-trace-routes.ts +133 -0
- package/plugin/tool-registration.ts +51 -0
- package/process-manager.ts +1 -1
- package/query-config.ts +400 -0
- package/recall-trace.ts +442 -0
- package/registries/openviking-tools.ts +84 -0
- package/registries/recall-resource-types.ts +74 -0
- package/routing/identity-routing.ts +210 -0
- package/routing/memory-uri.ts +8 -0
- package/services/context-lifecycle-service.ts +1209 -0
- package/services/context-message-adapter.ts +375 -0
- package/services/setup/config-writer.ts +125 -0
- package/services/setup/exit-utils.ts +5 -0
- package/services/setup/package-metadata.ts +56 -0
- package/services/setup/probe-service.ts +143 -0
- package/services/setup/setup-flow.ts +306 -0
- package/services/setup/version-compatibility.ts +41 -0
- package/session-transcript-repair.ts +0 -2
- package/skills/install-openviking-memory/SKILL.md +123 -50
- package/skills/openviking-context-database/SKILL.md +286 -0
- package/text-utils.ts +15 -34
package/text-utils.ts
CHANGED
|
@@ -12,6 +12,7 @@ export const MEMORY_TRIGGERS = [
|
|
|
12
12
|
|
|
13
13
|
const CJK_CHAR_REGEX = /[\u3040-\u30ff\u3400-\u9fff\uf900-\ufaff\uac00-\ud7af]/;
|
|
14
14
|
const RELEVANT_MEMORIES_BLOCK_RE = /<relevant-memories>[\s\S]*?<\/relevant-memories>/gi;
|
|
15
|
+
const OPENVIKING_CONTEXT_BLOCK_RE = /<openviking-context\b[^>]*>[\s\S]*?<\/openviking-context>/gi;
|
|
15
16
|
const CONVERSATION_METADATA_BLOCK_RE =
|
|
16
17
|
/(?:^|\n)\s*(?:Conversation info|Conversation metadata|会话信息|对话信息)\s*(?:\([^)]+\))?\s*:\s*```[\s\S]*?```/gi;
|
|
17
18
|
/** Strips "Sender (untrusted metadata): ```json ... ```" so capture sends clean text to OpenViking extract. */
|
|
@@ -44,12 +45,17 @@ function looksLikeMetadataJsonBlock(content: string): boolean {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
const HEARTBEAT_RE = /\bHEARTBEAT(?:\.md|_OK)\b/;
|
|
48
|
+
const TOOL_PLACEHOLDER_RE = /^\s*\[tool(?::\s*|Use:\s*)[^\]]+\]\s*$/i;
|
|
47
49
|
|
|
48
50
|
export function sanitizeUserTextForCapture(text: string): string {
|
|
49
51
|
// 过滤 HEARTBEAT 健康检查消息
|
|
50
52
|
if (HEARTBEAT_RE.test(text)) {
|
|
51
53
|
return "";
|
|
52
54
|
}
|
|
55
|
+
// Drop legacy synthetic tool placeholders before they reach memory extraction.
|
|
56
|
+
if (TOOL_PLACEHOLDER_RE.test(text)) {
|
|
57
|
+
return "";
|
|
58
|
+
}
|
|
53
59
|
// 处理 Compactor 系统消息,提取实际用户输入
|
|
54
60
|
// 格式: "System: [时间] Compacted ... Context ... [时间] 实际内容"
|
|
55
61
|
if (COMPACTED_SYSTEM_MSG_RE.test(text)) {
|
|
@@ -60,6 +66,7 @@ export function sanitizeUserTextForCapture(text: string): string {
|
|
|
60
66
|
return "";
|
|
61
67
|
}
|
|
62
68
|
return text
|
|
69
|
+
.replace(OPENVIKING_CONTEXT_BLOCK_RE, " ")
|
|
63
70
|
.replace(RELEVANT_MEMORIES_BLOCK_RE, " ")
|
|
64
71
|
.replace(CONVERSATION_METADATA_BLOCK_RE, " ")
|
|
65
72
|
.replace(SENDER_METADATA_BLOCK_RE, " ")
|
|
@@ -73,6 +80,14 @@ export function sanitizeUserTextForCapture(text: string): string {
|
|
|
73
80
|
.trim();
|
|
74
81
|
}
|
|
75
82
|
|
|
83
|
+
export function stripOpenVikingContextInjection(text: string): string {
|
|
84
|
+
return text
|
|
85
|
+
.replace(OPENVIKING_CONTEXT_BLOCK_RE, " ")
|
|
86
|
+
.replace(RELEVANT_MEMORIES_BLOCK_RE, " ")
|
|
87
|
+
.replace(/\s+/g, " ")
|
|
88
|
+
.trim();
|
|
89
|
+
}
|
|
90
|
+
|
|
76
91
|
export function looksLikeQuestionOnlyText(text: string): boolean {
|
|
77
92
|
if (!QUESTION_CUE_RE.test(text) || MEMORY_INTENT_RE.test(text)) {
|
|
78
93
|
return false;
|
|
@@ -426,40 +441,6 @@ export function extractNewTurnMessages(
|
|
|
426
441
|
}],
|
|
427
442
|
});
|
|
428
443
|
}
|
|
429
|
-
} else {
|
|
430
|
-
/// 如果原始消息有 toolCall,提取所有工具名并生成占位符
|
|
431
|
-
if (role === "assistant" && Array.isArray(content)) {
|
|
432
|
-
const toolNames: string[] = [];
|
|
433
|
-
|
|
434
|
-
// 收集所有 toolCall 的 tool_name
|
|
435
|
-
for (const block of content) {
|
|
436
|
-
const b = block as Record<string, unknown>;
|
|
437
|
-
const blockType = b?.type as string;
|
|
438
|
-
if (
|
|
439
|
-
blockType === "toolCall" ||
|
|
440
|
-
blockType === "toolUse" ||
|
|
441
|
-
blockType === "tool_use" ||
|
|
442
|
-
blockType === "tool_call"
|
|
443
|
-
) {
|
|
444
|
-
const name = b?.name as string || b?.toolName as string;
|
|
445
|
-
if (name && typeof name === "string" && name.trim()) {
|
|
446
|
-
toolNames.push(name.trim());
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
// 只有找到 toolCall 时才添加占位符
|
|
452
|
-
if (toolNames.length > 0) {
|
|
453
|
-
const toolNamesStr = toolNames.join(", ");
|
|
454
|
-
result.push({
|
|
455
|
-
role: "assistant",
|
|
456
|
-
parts: [{
|
|
457
|
-
type: "text",
|
|
458
|
-
text: `[tool: ${toolNamesStr}]`,
|
|
459
|
-
}],
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
444
|
}
|
|
464
445
|
}
|
|
465
446
|
|