metainsight-context-engine 0.0.7 → 0.0.9
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/README.md +11 -0
- package/cos-bootstrap.ts +864 -0
- package/cos-operations.ts +780 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -4
- package/dist/index.js.map +1 -1
- package/engine.ts +259 -0
- package/index.ts +1497 -0
- package/local-memory-sync.ts +1361 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +4 -2
- package/types/openclaw-plugin-sdk.d.ts +103 -0
- package/types/pi-agent-core.d.ts +10 -0
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "metainsight-context-engine",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "Cloud-based context engine for token-efficient memory management (backed by Tencent COS CI)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"dist",
|
|
16
|
+
"*.ts",
|
|
17
|
+
"types",
|
|
16
18
|
"openclaw.plugin.json",
|
|
17
19
|
"README.md"
|
|
18
20
|
],
|
|
@@ -58,7 +60,7 @@
|
|
|
58
60
|
},
|
|
59
61
|
"openclaw": {
|
|
60
62
|
"extensions": [
|
|
61
|
-
"./index.
|
|
63
|
+
"./dist/index.js"
|
|
62
64
|
]
|
|
63
65
|
}
|
|
64
66
|
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal type stubs for openclaw/plugin-sdk/core
|
|
3
|
+
* (peer dependency — full types come from the actual package at runtime)
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface ContextEngineInfo {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
version: string;
|
|
10
|
+
ownsCompaction?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface BootstrapResult {
|
|
14
|
+
bootstrapped: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface IngestResult {
|
|
18
|
+
ingested: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface IngestBatchResult {
|
|
22
|
+
ingestedCount: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface AssembleResult {
|
|
26
|
+
messages: unknown[];
|
|
27
|
+
estimatedTokens: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface CompactResult {
|
|
31
|
+
ok: boolean;
|
|
32
|
+
compacted: boolean;
|
|
33
|
+
reason?: string;
|
|
34
|
+
result?: {
|
|
35
|
+
tokensBefore: number;
|
|
36
|
+
tokensAfter: number;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ContextEngineRuntimeContext {
|
|
41
|
+
[key: string]: unknown;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface ContextEngine {
|
|
45
|
+
info: ContextEngineInfo;
|
|
46
|
+
bootstrap(params: {
|
|
47
|
+
sessionId: string;
|
|
48
|
+
sessionKey?: string;
|
|
49
|
+
sessionFile: string;
|
|
50
|
+
}): Promise<BootstrapResult>;
|
|
51
|
+
ingest(params: {
|
|
52
|
+
sessionId: string;
|
|
53
|
+
sessionKey?: string;
|
|
54
|
+
message: unknown;
|
|
55
|
+
isHeartbeat?: boolean;
|
|
56
|
+
}): Promise<IngestResult>;
|
|
57
|
+
ingestBatch(params: {
|
|
58
|
+
sessionId: string;
|
|
59
|
+
sessionKey?: string;
|
|
60
|
+
messages: unknown[];
|
|
61
|
+
isHeartbeat?: boolean;
|
|
62
|
+
}): Promise<IngestBatchResult>;
|
|
63
|
+
assemble(params: {
|
|
64
|
+
sessionId: string;
|
|
65
|
+
sessionKey?: string;
|
|
66
|
+
messages: unknown[];
|
|
67
|
+
tokenBudget?: number;
|
|
68
|
+
}): Promise<AssembleResult>;
|
|
69
|
+
compact(params: {
|
|
70
|
+
sessionId: string;
|
|
71
|
+
sessionKey?: string;
|
|
72
|
+
sessionFile: string;
|
|
73
|
+
tokenBudget?: number;
|
|
74
|
+
force?: boolean;
|
|
75
|
+
currentTokenCount?: number;
|
|
76
|
+
compactionTarget?: 'budget' | 'threshold';
|
|
77
|
+
customInstructions?: string;
|
|
78
|
+
runtimeContext?: ContextEngineRuntimeContext;
|
|
79
|
+
}): Promise<CompactResult>;
|
|
80
|
+
afterTurn?(params: {
|
|
81
|
+
sessionId: string;
|
|
82
|
+
sessionKey?: string;
|
|
83
|
+
sessionFile: string;
|
|
84
|
+
messages: unknown[];
|
|
85
|
+
prePromptMessageCount: number;
|
|
86
|
+
autoCompactionSummary?: string;
|
|
87
|
+
isHeartbeat?: boolean;
|
|
88
|
+
tokenBudget?: number;
|
|
89
|
+
runtimeContext?: ContextEngineRuntimeContext;
|
|
90
|
+
}): Promise<void>;
|
|
91
|
+
dispose?(): Promise<void>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface OpenClawPluginApi {
|
|
95
|
+
pluginConfig?: unknown;
|
|
96
|
+
logger: {
|
|
97
|
+
info: (...args: unknown[]) => void;
|
|
98
|
+
warn: (...args: unknown[]) => void;
|
|
99
|
+
};
|
|
100
|
+
registerContextEngine(id: string, factory: () => ContextEngine): void;
|
|
101
|
+
registerTool(definition: unknown, options?: unknown): void;
|
|
102
|
+
on(event: string, handler: (...args: any[]) => any, options?: unknown): void;
|
|
103
|
+
}
|