@openviking/openclaw-plugin 2026.5.26 → 2026.6.17-dev.1
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 +355 -355
- package/INSTALL-ZH.md +405 -345
- package/INSTALL.md +366 -362
- package/README.md +364 -338
- package/adapters/http-transport.ts +3 -0
- package/adapters/resource-packager.ts +141 -0
- package/auto-recall.ts +518 -257
- package/client.ts +963 -939
- package/commands/setup.ts +1169 -1002
- package/config/feature-gates.json +10 -0
- package/config.ts +819 -476
- package/context-engine.ts +408 -1737
- package/dist/adapters/http-transport.js +1 -0
- package/dist/adapters/resource-packager.js +114 -0
- package/dist/auto-recall.js +228 -32
- package/dist/client.js +125 -161
- package/dist/commands/setup.js +170 -32
- package/dist/config.js +285 -64
- package/dist/context-engine.js +64 -1179
- package/dist/index.js +209 -1470
- 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 +5 -17
- 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/dist/token-estimator.js +51 -0
- package/index.ts +408 -1985
- package/install-manifest.json +57 -47
- package/memory-ranking.ts +303 -267
- package/openclaw.plugin.json +497 -335
- package/package.json +86 -76
- 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 +41 -45
- 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/runtime-utils.ts +5 -5
- 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 +528 -530
- package/skills/install-openviking-memory/SKILL.md +752 -665
- package/skills/openviking-context-database/SKILL.md +286 -0
- package/text-utils.ts +488 -507
- package/token-estimator.ts +65 -0
- package/tool-call-id.ts +331 -331
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
type TokenCountableAgentMessage = {
|
|
2
|
+
role?: string;
|
|
3
|
+
content?: unknown;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
function isCjkCodePoint(codePoint: number): boolean {
|
|
7
|
+
return (
|
|
8
|
+
(codePoint >= 0x3400 && codePoint <= 0x4dbf) ||
|
|
9
|
+
(codePoint >= 0x4e00 && codePoint <= 0x9fff) ||
|
|
10
|
+
(codePoint >= 0xf900 && codePoint <= 0xfaff) ||
|
|
11
|
+
(codePoint >= 0x20000 && codePoint <= 0x2ebef) ||
|
|
12
|
+
(codePoint >= 0x3040 && codePoint <= 0x30ff) ||
|
|
13
|
+
(codePoint >= 0x31f0 && codePoint <= 0x31ff) ||
|
|
14
|
+
(codePoint >= 0xac00 && codePoint <= 0xd7af) ||
|
|
15
|
+
(codePoint >= 0x1100 && codePoint <= 0x11ff) ||
|
|
16
|
+
(codePoint >= 0x3130 && codePoint <= 0x318f) ||
|
|
17
|
+
(codePoint >= 0xff00 && codePoint <= 0xffef) ||
|
|
18
|
+
(codePoint >= 0x3000 && codePoint <= 0x303f)
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function codePointWeight(codePoint: number): number {
|
|
23
|
+
if (isCjkCodePoint(codePoint)) {
|
|
24
|
+
return 1.5;
|
|
25
|
+
}
|
|
26
|
+
if (codePoint > 0xffff) {
|
|
27
|
+
return 2;
|
|
28
|
+
}
|
|
29
|
+
return 0.25;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function estimateTextTokens(text: string | null | undefined): number {
|
|
33
|
+
if (!text) {
|
|
34
|
+
return 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let weightedTokens = 0;
|
|
38
|
+
for (const char of text) {
|
|
39
|
+
weightedTokens += codePointWeight(char.codePointAt(0) ?? 0);
|
|
40
|
+
}
|
|
41
|
+
return Math.ceil(weightedTokens);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function estimateSerializedTokens(value: unknown): number {
|
|
45
|
+
if (value === null || value === undefined) {
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
if (typeof value === "string") {
|
|
49
|
+
return estimateTextTokens(value);
|
|
50
|
+
}
|
|
51
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
52
|
+
return estimateTextTokens(String(value));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const serialized = JSON.stringify(value);
|
|
56
|
+
return estimateTextTokens(serialized ?? "");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function estimateAgentMessageTokens(message: TokenCountableAgentMessage): number {
|
|
60
|
+
return estimateSerializedTokens(message);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function estimateAgentMessagesTokens(messages: TokenCountableAgentMessage[]): number {
|
|
64
|
+
return estimateSerializedTokens(messages);
|
|
65
|
+
}
|