@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.
Files changed (108) hide show
  1. package/INSTALL-AGENT.md +4 -4
  2. package/INSTALL-ZH.md +68 -8
  3. package/INSTALL.md +12 -8
  4. package/README.md +45 -35
  5. package/adapters/http-transport.ts +3 -0
  6. package/adapters/resource-packager.ts +141 -0
  7. package/auto-recall.ts +258 -27
  8. package/client.ts +201 -177
  9. package/commands/setup.ts +200 -33
  10. package/config/feature-gates.json +10 -0
  11. package/config.ts +428 -85
  12. package/context-engine.ts +71 -1402
  13. package/dist/adapters/http-transport.js +1 -0
  14. package/dist/adapters/resource-packager.js +114 -0
  15. package/dist/auto-recall.js +201 -25
  16. package/dist/client.js +125 -161
  17. package/dist/commands/setup.js +170 -32
  18. package/dist/config.js +285 -64
  19. package/dist/context-engine.js +62 -1173
  20. package/dist/index.js +209 -1489
  21. package/dist/memory-ranking.js +35 -12
  22. package/dist/plugin/command-registration.js +5 -0
  23. package/dist/plugin/openviking-archive-tools.js +210 -0
  24. package/dist/plugin/openviking-bypass-runtime.js +8 -0
  25. package/dist/plugin/openviking-client-runtime.js +28 -0
  26. package/dist/plugin/openviking-command-args.js +146 -0
  27. package/dist/plugin/openviking-command-definitions.js +206 -0
  28. package/dist/plugin/openviking-context-engine-ref.js +11 -0
  29. package/dist/plugin/openviking-context-engine-registration.js +23 -0
  30. package/dist/plugin/openviking-feature-gates.js +250 -0
  31. package/dist/plugin/openviking-import-runtime.js +50 -0
  32. package/dist/plugin/openviking-import-tools.js +86 -0
  33. package/dist/plugin/openviking-lifecycle-hooks.js +33 -0
  34. package/dist/plugin/openviking-memory-recall-tools.js +233 -0
  35. package/dist/plugin/openviking-memory-tools.js +199 -0
  36. package/dist/plugin/openviking-query-config-command.js +203 -0
  37. package/dist/plugin/openviking-query-runtime.js +367 -0
  38. package/dist/plugin/openviking-query-tools.js +91 -0
  39. package/dist/plugin/openviking-recall-trace-runtime.js +387 -0
  40. package/dist/plugin/openviking-recall-trace-tools.js +38 -0
  41. package/dist/plugin/openviking-runtime-state.js +26 -0
  42. package/dist/plugin/openviking-runtime-utils.js +62 -0
  43. package/dist/plugin/openviking-services.js +20 -0
  44. package/dist/plugin/openviking-session-routing-runtime.js +61 -0
  45. package/dist/plugin/openviking-tool-result-tools.js +268 -0
  46. package/dist/plugin/recall-trace-routes.js +77 -0
  47. package/dist/plugin/tool-registration.js +23 -0
  48. package/dist/process-manager.js +1 -1
  49. package/dist/query-config.js +336 -0
  50. package/dist/recall-trace.js +309 -0
  51. package/dist/registries/recall-resource-types.js +58 -0
  52. package/dist/routing/identity-routing.js +152 -0
  53. package/dist/routing/memory-uri.js +7 -0
  54. package/dist/services/context-lifecycle-service.js +847 -0
  55. package/dist/services/context-message-adapter.js +340 -0
  56. package/dist/session-transcript-repair.js +0 -1
  57. package/dist/text-utils.js +14 -31
  58. package/index.ts +271 -1873
  59. package/install-manifest.json +10 -1
  60. package/memory-ranking.ts +46 -10
  61. package/openclaw.plugin.json +198 -36
  62. package/package.json +14 -4
  63. package/plugin/command-registration.ts +34 -0
  64. package/plugin/openviking-archive-tools.ts +301 -0
  65. package/plugin/openviking-bypass-runtime.ts +26 -0
  66. package/plugin/openviking-client-runtime.ts +74 -0
  67. package/plugin/openviking-command-args.ts +187 -0
  68. package/plugin/openviking-command-definitions.ts +294 -0
  69. package/plugin/openviking-context-engine-ref.ts +16 -0
  70. package/plugin/openviking-context-engine-registration.ts +97 -0
  71. package/plugin/openviking-feature-gates.ts +335 -0
  72. package/plugin/openviking-import-runtime.ts +105 -0
  73. package/plugin/openviking-import-tools.ts +133 -0
  74. package/plugin/openviking-lifecycle-hooks.ts +65 -0
  75. package/plugin/openviking-memory-recall-tools.ts +368 -0
  76. package/plugin/openviking-memory-tools.ts +299 -0
  77. package/plugin/openviking-query-config-command.ts +230 -0
  78. package/plugin/openviking-query-formatters.ts +108 -0
  79. package/plugin/openviking-query-runtime.ts +476 -0
  80. package/plugin/openviking-query-tools.ts +161 -0
  81. package/plugin/openviking-recall-trace-runtime.ts +482 -0
  82. package/plugin/openviking-recall-trace-tools.ts +99 -0
  83. package/plugin/openviking-runtime-state.ts +52 -0
  84. package/plugin/openviking-runtime-utils.ts +67 -0
  85. package/plugin/openviking-services.ts +49 -0
  86. package/plugin/openviking-session-routing-runtime.ts +105 -0
  87. package/plugin/openviking-tool-result-tools.ts +397 -0
  88. package/plugin/recall-trace-routes.ts +133 -0
  89. package/plugin/tool-registration.ts +51 -0
  90. package/process-manager.ts +1 -1
  91. package/query-config.ts +400 -0
  92. package/recall-trace.ts +442 -0
  93. package/registries/openviking-tools.ts +84 -0
  94. package/registries/recall-resource-types.ts +74 -0
  95. package/routing/identity-routing.ts +210 -0
  96. package/routing/memory-uri.ts +8 -0
  97. package/services/context-lifecycle-service.ts +1209 -0
  98. package/services/context-message-adapter.ts +375 -0
  99. package/services/setup/config-writer.ts +125 -0
  100. package/services/setup/exit-utils.ts +5 -0
  101. package/services/setup/package-metadata.ts +56 -0
  102. package/services/setup/probe-service.ts +143 -0
  103. package/services/setup/setup-flow.ts +306 -0
  104. package/services/setup/version-compatibility.ts +41 -0
  105. package/session-transcript-repair.ts +0 -2
  106. package/skills/install-openviking-memory/SKILL.md +123 -50
  107. package/skills/openviking-context-database/SKILL.md +286 -0
  108. 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