@openviking/openclaw-plugin 2026.8.13 → 2026.8.17
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/client.ts +6 -2
- package/dist/client.js +3 -1
- package/dist/plugin/openviking-memory-tools.js +23 -6
- package/dist/services/context-lifecycle-service.js +8 -4
- package/openclaw.plugin.json +10 -0
- package/package.json +1 -1
- package/plugin/openviking-memory-tools.ts +25 -6
- package/services/context-lifecycle-service.ts +12 -4
package/client.ts
CHANGED
|
@@ -378,13 +378,17 @@ export class OpenVikingClient {
|
|
|
378
378
|
const payload = (await response.json().catch(() => ({}))) as {
|
|
379
379
|
status?: string;
|
|
380
380
|
result?: T;
|
|
381
|
-
error?: { code?: string; message?: string };
|
|
381
|
+
error?: { code?: string; message?: string; trace_id?: string };
|
|
382
382
|
};
|
|
383
383
|
|
|
384
384
|
if (!response.ok || payload.status === "error") {
|
|
385
385
|
const code = payload.error?.code ? ` [${payload.error.code}]` : "";
|
|
386
386
|
const message = payload.error?.message ?? `HTTP ${response.status}`;
|
|
387
|
-
|
|
387
|
+
const traceId = payload.error?.trace_id;
|
|
388
|
+
throw new Error(
|
|
389
|
+
`OpenViking request failed${code}: ${message}` +
|
|
390
|
+
(traceId ? ` (trace_id=${traceId})` : ""),
|
|
391
|
+
);
|
|
388
392
|
}
|
|
389
393
|
|
|
390
394
|
return (payload.result ?? payload) as T;
|
package/dist/client.js
CHANGED
|
@@ -150,7 +150,9 @@ export class OpenVikingClient {
|
|
|
150
150
|
if (!response.ok || payload.status === "error") {
|
|
151
151
|
const code = payload.error?.code ? ` [${payload.error.code}]` : "";
|
|
152
152
|
const message = payload.error?.message ?? `HTTP ${response.status}`;
|
|
153
|
-
|
|
153
|
+
const traceId = payload.error?.trace_id;
|
|
154
|
+
throw new Error(`OpenViking request failed${code}: ${message}` +
|
|
155
|
+
(traceId ? ` (trace_id=${traceId})` : ""));
|
|
154
156
|
}
|
|
155
157
|
return (payload.result ?? payload);
|
|
156
158
|
}
|
|
@@ -55,27 +55,41 @@ export function registerOpenVikingMemoryTools(deps) {
|
|
|
55
55
|
});
|
|
56
56
|
const memoriesCount = totalCommitMemories(commitResult);
|
|
57
57
|
if (commitResult.status === "failed") {
|
|
58
|
-
deps.logger.warn(`openviking: memory_store commit failed (sessionId=${sessionId}):
|
|
58
|
+
deps.logger.warn(`openviking: memory_store commit failed (sessionId=${sessionId}): ` +
|
|
59
|
+
`${commitResult.error ?? "unknown"}, trace_id=${commitResult.trace_id ?? "none"}`);
|
|
59
60
|
return {
|
|
60
|
-
content: [{
|
|
61
|
+
content: [{
|
|
62
|
+
type: "text",
|
|
63
|
+
text: `Memory extraction failed for session ${sessionId}: ${commitResult.error ?? "unknown"}` +
|
|
64
|
+
(commitResult.trace_id ? ` (trace_id=${commitResult.trace_id})` : ""),
|
|
65
|
+
}],
|
|
61
66
|
details: {
|
|
62
67
|
action: "failed",
|
|
63
68
|
sessionId,
|
|
64
69
|
status: "failed",
|
|
65
70
|
error: commitResult.error,
|
|
71
|
+
traceId: commitResult.trace_id,
|
|
66
72
|
usedTempSession,
|
|
67
73
|
},
|
|
68
74
|
};
|
|
69
75
|
}
|
|
70
76
|
if (commitResult.status === "timeout") {
|
|
71
|
-
deps.logger.warn(`openviking: memory_store commit timed out (sessionId=${sessionId}),
|
|
77
|
+
deps.logger.warn(`openviking: memory_store commit timed out (sessionId=${sessionId}), ` +
|
|
78
|
+
`task_id=${commitResult.task_id ?? "none"}, trace_id=${commitResult.trace_id ?? "none"}. ` +
|
|
79
|
+
"Memories may still be extracting in background.");
|
|
72
80
|
return {
|
|
73
|
-
content: [{
|
|
81
|
+
content: [{
|
|
82
|
+
type: "text",
|
|
83
|
+
text: `Memory extraction timed out for session ${sessionId}. ` +
|
|
84
|
+
`It may still complete in the background (task_id=${commitResult.task_id ?? "none"}` +
|
|
85
|
+
`${commitResult.trace_id ? `, trace_id=${commitResult.trace_id}` : ""}).`,
|
|
86
|
+
}],
|
|
74
87
|
details: {
|
|
75
88
|
action: "timeout",
|
|
76
89
|
sessionId,
|
|
77
90
|
status: "timeout",
|
|
78
91
|
taskId: commitResult.task_id,
|
|
92
|
+
traceId: commitResult.trace_id,
|
|
79
93
|
usedTempSession,
|
|
80
94
|
},
|
|
81
95
|
};
|
|
@@ -85,13 +99,15 @@ export function registerOpenVikingMemoryTools(deps) {
|
|
|
85
99
|
"Check OpenViking server logs for embedding/extract errors (e.g. 401 API key, or extraction pipeline).");
|
|
86
100
|
}
|
|
87
101
|
else {
|
|
88
|
-
deps.logger.info?.(`openviking: memory_store committed, memories=${memoriesCount}`
|
|
102
|
+
deps.logger.info?.(`openviking: memory_store committed, memories=${memoriesCount}, ` +
|
|
103
|
+
`trace_id=${commitResult.trace_id ?? "none"}`);
|
|
89
104
|
}
|
|
90
105
|
return {
|
|
91
106
|
content: [
|
|
92
107
|
{
|
|
93
108
|
type: "text",
|
|
94
|
-
text: `Stored in OpenViking session ${sessionId} and committed ${memoriesCount} memories
|
|
109
|
+
text: `Stored in OpenViking session ${sessionId} and committed ${memoriesCount} memories.` +
|
|
110
|
+
(commitResult.trace_id ? ` (trace_id=${commitResult.trace_id})` : ""),
|
|
95
111
|
},
|
|
96
112
|
],
|
|
97
113
|
details: {
|
|
@@ -100,6 +116,7 @@ export function registerOpenVikingMemoryTools(deps) {
|
|
|
100
116
|
memoriesCount,
|
|
101
117
|
status: commitResult.status,
|
|
102
118
|
archived: commitResult.archived ?? false,
|
|
119
|
+
traceId: commitResult.trace_id,
|
|
103
120
|
usedTempSession,
|
|
104
121
|
},
|
|
105
122
|
};
|
|
@@ -160,11 +160,13 @@ export async function commitOpenVikingSession({ sessionId, sessionKey, getClient
|
|
|
160
160
|
});
|
|
161
161
|
const memCount = totalExtractedMemories(commitResult.memories_extracted);
|
|
162
162
|
if (commitResult.status === "failed") {
|
|
163
|
-
logger.warn?.(`openviking: commit Phase 2 failed for session=${sessionId}: ${commitResult.error ?? "unknown"}`
|
|
163
|
+
logger.warn?.(`openviking: commit Phase 2 failed for session=${sessionId}: ${commitResult.error ?? "unknown"}, ` +
|
|
164
|
+
`trace_id=${commitResult.trace_id ?? "none"}`);
|
|
164
165
|
return false;
|
|
165
166
|
}
|
|
166
167
|
if (commitResult.status === "timeout") {
|
|
167
|
-
logger.warn?.(`openviking: commit Phase 2 timed out for session=${sessionId},
|
|
168
|
+
logger.warn?.(`openviking: commit Phase 2 timed out for session=${sessionId}, ` +
|
|
169
|
+
`task_id=${commitResult.task_id ?? "none"}, trace_id=${commitResult.trace_id ?? "none"}`);
|
|
168
170
|
return false;
|
|
169
171
|
}
|
|
170
172
|
logger.info(`openviking: committed OV session=${sessionId} ovId=${ovId}, archived=${commitResult.archived ?? false}, memories=${memCount}, task_id=${commitResult.task_id ?? "none"}, trace_id=${commitResult.trace_id ?? "none"}`);
|
|
@@ -722,7 +724,8 @@ export async function compactOpenVikingSession({ sessionId, sessionKey, tokenBud
|
|
|
722
724
|
});
|
|
723
725
|
const memCount = totalExtractedMemories(commitResult.memories_extracted);
|
|
724
726
|
if (commitResult.status === "failed") {
|
|
725
|
-
logger.warn?.(`openviking: compact commit Phase 2 failed for session=${ovSessionId}:
|
|
727
|
+
logger.warn?.(`openviking: compact commit Phase 2 failed for session=${ovSessionId}: ` +
|
|
728
|
+
`${commitResult.error ?? "unknown"}, trace_id=${commitResult.trace_id ?? "none"}`);
|
|
726
729
|
diag("compact_result", ovSessionId, {
|
|
727
730
|
ok: false,
|
|
728
731
|
compacted: false,
|
|
@@ -735,7 +738,8 @@ export async function compactOpenVikingSession({ sessionId, sessionKey, tokenBud
|
|
|
735
738
|
return compactFailureResult("commit_failed", tokensBefore, { commit: commitResult });
|
|
736
739
|
}
|
|
737
740
|
if (commitResult.status === "timeout") {
|
|
738
|
-
logger.warn?.(`openviking: compact commit Phase 2 timed out for session=${ovSessionId},
|
|
741
|
+
logger.warn?.(`openviking: compact commit Phase 2 timed out for session=${ovSessionId}, ` +
|
|
742
|
+
`task_id=${commitResult.task_id ?? "none"}, trace_id=${commitResult.trace_id ?? "none"}`);
|
|
739
743
|
diag("compact_result", ovSessionId, {
|
|
740
744
|
ok: false,
|
|
741
745
|
compacted: false,
|
package/openclaw.plugin.json
CHANGED
|
@@ -261,6 +261,12 @@
|
|
|
261
261
|
"placeholder": "memory",
|
|
262
262
|
"help": "Agent-visible tool blocklist applied after enabledTools. Accepts the same tool names or groups.",
|
|
263
263
|
"advanced": true
|
|
264
|
+
},
|
|
265
|
+
"runtimeQueryConfigPath": {
|
|
266
|
+
"label": "Runtime Query Config Path",
|
|
267
|
+
"placeholder": "~/.openclaw/openviking/runtime-query-config.json",
|
|
268
|
+
"help": "Optional JSON file for /ov-query-config runtime overrides. Empty keeps overrides in memory only.",
|
|
269
|
+
"advanced": true
|
|
264
270
|
}
|
|
265
271
|
},
|
|
266
272
|
"configSchema": {
|
|
@@ -515,6 +521,10 @@
|
|
|
515
521
|
}
|
|
516
522
|
]
|
|
517
523
|
},
|
|
524
|
+
"runtimeQueryConfigPath": {
|
|
525
|
+
"type": "string",
|
|
526
|
+
"description": "Optional JSON file path for runtime query config overrides. Empty means in-memory only."
|
|
527
|
+
},
|
|
518
528
|
"agentExperience": {
|
|
519
529
|
"type": "object",
|
|
520
530
|
"additionalProperties": false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openviking/openclaw-plugin",
|
|
3
|
-
"version": "2026.8.
|
|
3
|
+
"version": "2026.8.17",
|
|
4
4
|
"displayName": "OpenViking",
|
|
5
5
|
"description": "OpenClaw context-engine plugin — OpenViking AI memory, long-term memory, knowledge base, semantic search, RAG, context engine. 长期记忆 · 知识库 · 语义检索 · 上下文引擎",
|
|
6
6
|
"type": "module",
|
|
@@ -132,30 +132,44 @@ export function registerOpenVikingMemoryTools(deps: OpenVikingMemoryToolsDeps):
|
|
|
132
132
|
const memoriesCount = totalCommitMemories(commitResult);
|
|
133
133
|
if (commitResult.status === "failed") {
|
|
134
134
|
deps.logger.warn(
|
|
135
|
-
`openviking: memory_store commit failed (sessionId=${sessionId}):
|
|
135
|
+
`openviking: memory_store commit failed (sessionId=${sessionId}): ` +
|
|
136
|
+
`${commitResult.error ?? "unknown"}, trace_id=${commitResult.trace_id ?? "none"}`,
|
|
136
137
|
);
|
|
137
138
|
return {
|
|
138
|
-
content: [{
|
|
139
|
+
content: [{
|
|
140
|
+
type: "text",
|
|
141
|
+
text: `Memory extraction failed for session ${sessionId}: ${commitResult.error ?? "unknown"}` +
|
|
142
|
+
(commitResult.trace_id ? ` (trace_id=${commitResult.trace_id})` : ""),
|
|
143
|
+
}],
|
|
139
144
|
details: {
|
|
140
145
|
action: "failed",
|
|
141
146
|
sessionId,
|
|
142
147
|
status: "failed",
|
|
143
148
|
error: commitResult.error,
|
|
149
|
+
traceId: commitResult.trace_id,
|
|
144
150
|
usedTempSession,
|
|
145
151
|
},
|
|
146
152
|
};
|
|
147
153
|
}
|
|
148
154
|
if (commitResult.status === "timeout") {
|
|
149
155
|
deps.logger.warn(
|
|
150
|
-
`openviking: memory_store commit timed out (sessionId=${sessionId}),
|
|
156
|
+
`openviking: memory_store commit timed out (sessionId=${sessionId}), ` +
|
|
157
|
+
`task_id=${commitResult.task_id ?? "none"}, trace_id=${commitResult.trace_id ?? "none"}. ` +
|
|
158
|
+
"Memories may still be extracting in background.",
|
|
151
159
|
);
|
|
152
160
|
return {
|
|
153
|
-
content: [{
|
|
161
|
+
content: [{
|
|
162
|
+
type: "text",
|
|
163
|
+
text: `Memory extraction timed out for session ${sessionId}. ` +
|
|
164
|
+
`It may still complete in the background (task_id=${commitResult.task_id ?? "none"}` +
|
|
165
|
+
`${commitResult.trace_id ? `, trace_id=${commitResult.trace_id}` : ""}).`,
|
|
166
|
+
}],
|
|
154
167
|
details: {
|
|
155
168
|
action: "timeout",
|
|
156
169
|
sessionId,
|
|
157
170
|
status: "timeout",
|
|
158
171
|
taskId: commitResult.task_id,
|
|
172
|
+
traceId: commitResult.trace_id,
|
|
159
173
|
usedTempSession,
|
|
160
174
|
},
|
|
161
175
|
};
|
|
@@ -166,13 +180,17 @@ export function registerOpenVikingMemoryTools(deps: OpenVikingMemoryToolsDeps):
|
|
|
166
180
|
"Check OpenViking server logs for embedding/extract errors (e.g. 401 API key, or extraction pipeline).",
|
|
167
181
|
);
|
|
168
182
|
} else {
|
|
169
|
-
deps.logger.info?.(
|
|
183
|
+
deps.logger.info?.(
|
|
184
|
+
`openviking: memory_store committed, memories=${memoriesCount}, ` +
|
|
185
|
+
`trace_id=${commitResult.trace_id ?? "none"}`,
|
|
186
|
+
);
|
|
170
187
|
}
|
|
171
188
|
return {
|
|
172
189
|
content: [
|
|
173
190
|
{
|
|
174
191
|
type: "text",
|
|
175
|
-
text: `Stored in OpenViking session ${sessionId} and committed ${memoriesCount} memories
|
|
192
|
+
text: `Stored in OpenViking session ${sessionId} and committed ${memoriesCount} memories.` +
|
|
193
|
+
(commitResult.trace_id ? ` (trace_id=${commitResult.trace_id})` : ""),
|
|
176
194
|
},
|
|
177
195
|
],
|
|
178
196
|
details: {
|
|
@@ -181,6 +199,7 @@ export function registerOpenVikingMemoryTools(deps: OpenVikingMemoryToolsDeps):
|
|
|
181
199
|
memoriesCount,
|
|
182
200
|
status: commitResult.status,
|
|
183
201
|
archived: commitResult.archived ?? false,
|
|
202
|
+
traceId: commitResult.trace_id,
|
|
184
203
|
usedTempSession,
|
|
185
204
|
},
|
|
186
205
|
};
|
|
@@ -368,11 +368,17 @@ export async function commitOpenVikingSession({
|
|
|
368
368
|
});
|
|
369
369
|
const memCount = totalExtractedMemories(commitResult.memories_extracted);
|
|
370
370
|
if (commitResult.status === "failed") {
|
|
371
|
-
logger.warn?.(
|
|
371
|
+
logger.warn?.(
|
|
372
|
+
`openviking: commit Phase 2 failed for session=${sessionId}: ${commitResult.error ?? "unknown"}, ` +
|
|
373
|
+
`trace_id=${commitResult.trace_id ?? "none"}`,
|
|
374
|
+
);
|
|
372
375
|
return false;
|
|
373
376
|
}
|
|
374
377
|
if (commitResult.status === "timeout") {
|
|
375
|
-
logger.warn?.(
|
|
378
|
+
logger.warn?.(
|
|
379
|
+
`openviking: commit Phase 2 timed out for session=${sessionId}, ` +
|
|
380
|
+
`task_id=${commitResult.task_id ?? "none"}, trace_id=${commitResult.trace_id ?? "none"}`,
|
|
381
|
+
);
|
|
376
382
|
return false;
|
|
377
383
|
}
|
|
378
384
|
logger.info(
|
|
@@ -1069,7 +1075,8 @@ export async function compactOpenVikingSession({
|
|
|
1069
1075
|
|
|
1070
1076
|
if (commitResult.status === "failed") {
|
|
1071
1077
|
logger.warn?.(
|
|
1072
|
-
`openviking: compact commit Phase 2 failed for session=${ovSessionId}:
|
|
1078
|
+
`openviking: compact commit Phase 2 failed for session=${ovSessionId}: ` +
|
|
1079
|
+
`${commitResult.error ?? "unknown"}, trace_id=${commitResult.trace_id ?? "none"}`,
|
|
1073
1080
|
);
|
|
1074
1081
|
diag("compact_result", ovSessionId, {
|
|
1075
1082
|
ok: false,
|
|
@@ -1085,7 +1092,8 @@ export async function compactOpenVikingSession({
|
|
|
1085
1092
|
|
|
1086
1093
|
if (commitResult.status === "timeout") {
|
|
1087
1094
|
logger.warn?.(
|
|
1088
|
-
`openviking: compact commit Phase 2 timed out for session=${ovSessionId},
|
|
1095
|
+
`openviking: compact commit Phase 2 timed out for session=${ovSessionId}, ` +
|
|
1096
|
+
`task_id=${commitResult.task_id ?? "none"}, trace_id=${commitResult.trace_id ?? "none"}`,
|
|
1089
1097
|
);
|
|
1090
1098
|
diag("compact_result", ovSessionId, {
|
|
1091
1099
|
ok: false,
|