@gralkor/openclaw 4.0.0
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/.env.example +32 -0
- package/README.md +77 -0
- package/config.yaml +16 -0
- package/dist/config.d.ts +33 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +49 -0
- package/dist/config.js.map +1 -0
- package/dist/ctx-to-messages.d.ts +36 -0
- package/dist/ctx-to-messages.d.ts.map +1 -0
- package/dist/ctx-to-messages.js +120 -0
- package/dist/ctx-to-messages.js.map +1 -0
- package/dist/ctx-to-turn.d.ts +32 -0
- package/dist/ctx-to-turn.d.ts.map +1 -0
- package/dist/ctx-to-turn.js +55 -0
- package/dist/ctx-to-turn.js.map +1 -0
- package/dist/gralkor/client/http.d.ts +55 -0
- package/dist/gralkor/client/http.d.ts.map +1 -0
- package/dist/gralkor/client/http.js +150 -0
- package/dist/gralkor/client/http.js.map +1 -0
- package/dist/gralkor/client/in-memory.d.ts +38 -0
- package/dist/gralkor/client/in-memory.d.ts.map +1 -0
- package/dist/gralkor/client/in-memory.js +72 -0
- package/dist/gralkor/client/in-memory.js.map +1 -0
- package/dist/gralkor/client.d.ts +64 -0
- package/dist/gralkor/client.d.ts.map +1 -0
- package/dist/gralkor/client.js +32 -0
- package/dist/gralkor/client.js.map +1 -0
- package/dist/gralkor/config.d.ts +33 -0
- package/dist/gralkor/config.d.ts.map +1 -0
- package/dist/gralkor/config.js +58 -0
- package/dist/gralkor/config.js.map +1 -0
- package/dist/gralkor/connection.d.ts +20 -0
- package/dist/gralkor/connection.d.ts.map +1 -0
- package/dist/gralkor/connection.js +31 -0
- package/dist/gralkor/connection.js.map +1 -0
- package/dist/gralkor/index.d.ts +11 -0
- package/dist/gralkor/index.d.ts.map +1 -0
- package/dist/gralkor/index.js +6 -0
- package/dist/gralkor/index.js.map +1 -0
- package/dist/gralkor/server-env.d.ts +11 -0
- package/dist/gralkor/server-env.d.ts.map +1 -0
- package/dist/gralkor/server-env.js +26 -0
- package/dist/gralkor/server-env.js.map +1 -0
- package/dist/gralkor/server-manager.d.ts +58 -0
- package/dist/gralkor/server-manager.d.ts.map +1 -0
- package/dist/gralkor/server-manager.js +390 -0
- package/dist/gralkor/server-manager.js.map +1 -0
- package/dist/gralkor/testing.d.ts +10 -0
- package/dist/gralkor/testing.d.ts.map +1 -0
- package/dist/gralkor/testing.js +10 -0
- package/dist/gralkor/testing.js.map +1 -0
- package/dist/hooks/agent-end.d.ts +25 -0
- package/dist/hooks/agent-end.d.ts.map +1 -0
- package/dist/hooks/agent-end.js +51 -0
- package/dist/hooks/agent-end.js.map +1 -0
- package/dist/hooks/before-prompt-build.d.ts +12 -0
- package/dist/hooks/before-prompt-build.d.ts.map +1 -0
- package/dist/hooks/before-prompt-build.js +15 -0
- package/dist/hooks/before-prompt-build.js.map +1 -0
- package/dist/hooks/session-end.d.ts +18 -0
- package/dist/hooks/session-end.d.ts.map +1 -0
- package/dist/hooks/session-end.js +19 -0
- package/dist/hooks/session-end.js.map +1 -0
- package/dist/index.d.ts +130 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +133 -0
- package/dist/index.js.map +1 -0
- package/dist/native-indexer.d.ts +43 -0
- package/dist/native-indexer.d.ts.map +1 -0
- package/dist/native-indexer.js +107 -0
- package/dist/native-indexer.js.map +1 -0
- package/dist/register.d.ts +25 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +184 -0
- package/dist/register.js.map +1 -0
- package/dist/session-map.d.ts +13 -0
- package/dist/session-map.d.ts.map +1 -0
- package/dist/session-map.js +32 -0
- package/dist/session-map.js.map +1 -0
- package/dist/tools/memory-add.d.ts +15 -0
- package/dist/tools/memory-add.d.ts.map +1 -0
- package/dist/tools/memory-add.js +15 -0
- package/dist/tools/memory-add.js.map +1 -0
- package/dist/tools/memory-build-communities.d.ts +19 -0
- package/dist/tools/memory-build-communities.d.ts.map +1 -0
- package/dist/tools/memory-build-communities.js +18 -0
- package/dist/tools/memory-build-communities.js.map +1 -0
- package/dist/tools/memory-build-indices.d.ts +12 -0
- package/dist/tools/memory-build-indices.d.ts.map +1 -0
- package/dist/tools/memory-build-indices.js +11 -0
- package/dist/tools/memory-build-indices.js.map +1 -0
- package/dist/tools/memory-search.d.ts +20 -0
- package/dist/tools/memory-search.d.ts.map +1 -0
- package/dist/tools/memory-search.js +18 -0
- package/dist/tools/memory-search.js.map +1 -0
- package/dist/types.d.ts +62 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/openclaw.plugin.json +130 -0
- package/package.json +75 -0
- package/server/server/.python-version +1 -0
- package/server/server/main.py +902 -0
- package/server/server/pipelines/__init__.py +0 -0
- package/server/server/pipelines/capture_buffer.py +170 -0
- package/server/server/pipelines/distill.py +122 -0
- package/server/server/pipelines/formatting.py +48 -0
- package/server/server/pipelines/interpret.py +165 -0
- package/server/server/pipelines/messages.py +13 -0
- package/server/server/pyproject.toml +19 -0
- package/server/server/pytest.ini +4 -0
- package/server/server/requirements-dev.txt +3 -0
- package/server/server/requirements.txt +5 -0
- package/server/server/uv.lock +1162 -0
- package/server/wheels/falkordblite-0.9.0-py3-none-manylinux_2_36_aarch64.whl +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { GralkorClient, Result } from "../gralkor/index.js";
|
|
2
|
+
export interface SessionEndCtx {
|
|
3
|
+
sessionKey: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* `session_end` hook: an OpenClaw-owned signal that a conversation is
|
|
7
|
+
* over. We forward it to Gralkor's `/session_end` endpoint so the
|
|
8
|
+
* server flushes that session's capture buffer immediately rather than
|
|
9
|
+
* waiting for lifespan shutdown. Server handles the graph write async
|
|
10
|
+
* and returns 204, so this call is effectively fire-and-forget from a
|
|
11
|
+
* latency standpoint.
|
|
12
|
+
*
|
|
13
|
+
* If the sessionKey was never seen by `before_prompt_build` (e.g.
|
|
14
|
+
* session_end fires on a fresh process with no prior activity), there
|
|
15
|
+
* is nothing to flush — skip the HTTP call and return ok.
|
|
16
|
+
*/
|
|
17
|
+
export declare function runSessionEnd(client: GralkorClient, ctx: SessionEndCtx): Promise<Result<true>>;
|
|
18
|
+
//# sourceMappingURL=session-end.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-end.d.ts","sourceRoot":"","sources":["../../src/hooks/session-end.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGjE,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,aAAa,EACrB,GAAG,EAAE,aAAa,GACjB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAGvB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getSessionGroup } from "../session-map.js";
|
|
2
|
+
/**
|
|
3
|
+
* `session_end` hook: an OpenClaw-owned signal that a conversation is
|
|
4
|
+
* over. We forward it to Gralkor's `/session_end` endpoint so the
|
|
5
|
+
* server flushes that session's capture buffer immediately rather than
|
|
6
|
+
* waiting for lifespan shutdown. Server handles the graph write async
|
|
7
|
+
* and returns 204, so this call is effectively fire-and-forget from a
|
|
8
|
+
* latency standpoint.
|
|
9
|
+
*
|
|
10
|
+
* If the sessionKey was never seen by `before_prompt_build` (e.g.
|
|
11
|
+
* session_end fires on a fresh process with no prior activity), there
|
|
12
|
+
* is nothing to flush — skip the HTTP call and return ok.
|
|
13
|
+
*/
|
|
14
|
+
export async function runSessionEnd(client, ctx) {
|
|
15
|
+
if (getSessionGroup(ctx.sessionKey) === null)
|
|
16
|
+
return { ok: true };
|
|
17
|
+
return client.endSession(ctx.sessionKey);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=session-end.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-end.js","sourceRoot":"","sources":["../../src/hooks/session-end.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAMpD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAqB,EACrB,GAAkB;IAElB,IAAI,eAAe,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,IAAI;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IAClE,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { MemoryPluginApi } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Parse a GitHub `owner/repo` slug from a package.json `repository.url` field.
|
|
4
|
+
* The slug is passed to `createServerManager` as `wheelRepo` and to the
|
|
5
|
+
* `falkordblite` wheel URL the server-manager downloads at boot — the same
|
|
6
|
+
* slug the publish script (`scripts/publish-clawhub.sh`) uploads to via
|
|
7
|
+
* `gh release upload`. Deriving both sides from one source (this field)
|
|
8
|
+
* keeps publish and runtime in lockstep.
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseGithubRepoSlug(repositoryUrl: string): string;
|
|
11
|
+
export declare function resetRegistrationForTests(): void;
|
|
12
|
+
export declare const id = "@gralkor/openclaw";
|
|
13
|
+
export declare const name = "Gralkor Memory (OpenClaw)";
|
|
14
|
+
export declare const description = "Persistent, temporally-aware memory via Graphiti knowledge graphs and FalkorDB";
|
|
15
|
+
export declare const kind: "memory";
|
|
16
|
+
export declare const tools: string[];
|
|
17
|
+
export declare const configSchema: {
|
|
18
|
+
type: "object";
|
|
19
|
+
required: readonly ["agentName"];
|
|
20
|
+
properties: {
|
|
21
|
+
agentName: {
|
|
22
|
+
type: "string";
|
|
23
|
+
minLength: number;
|
|
24
|
+
};
|
|
25
|
+
search: {
|
|
26
|
+
type: "object";
|
|
27
|
+
properties: {
|
|
28
|
+
maxResults: {
|
|
29
|
+
type: "number";
|
|
30
|
+
default: 20;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
dataDir: {
|
|
35
|
+
type: "string";
|
|
36
|
+
description: string;
|
|
37
|
+
};
|
|
38
|
+
workspaceDir: {
|
|
39
|
+
type: "string";
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
test: {
|
|
43
|
+
type: "boolean";
|
|
44
|
+
default: boolean;
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
googleApiKey: {
|
|
48
|
+
type: "string";
|
|
49
|
+
description: string;
|
|
50
|
+
};
|
|
51
|
+
openaiApiKey: {
|
|
52
|
+
type: "string";
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
anthropicApiKey: {
|
|
56
|
+
type: "string";
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
groqApiKey: {
|
|
60
|
+
type: "string";
|
|
61
|
+
description: string;
|
|
62
|
+
};
|
|
63
|
+
interpretMaxOutputTokens: {
|
|
64
|
+
type: "number";
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export declare function register(api: MemoryPluginApi): void;
|
|
70
|
+
declare const _default: {
|
|
71
|
+
id: string;
|
|
72
|
+
name: string;
|
|
73
|
+
description: string;
|
|
74
|
+
kind: "memory";
|
|
75
|
+
configSchema: {
|
|
76
|
+
type: "object";
|
|
77
|
+
required: readonly ["agentName"];
|
|
78
|
+
properties: {
|
|
79
|
+
agentName: {
|
|
80
|
+
type: "string";
|
|
81
|
+
minLength: number;
|
|
82
|
+
};
|
|
83
|
+
search: {
|
|
84
|
+
type: "object";
|
|
85
|
+
properties: {
|
|
86
|
+
maxResults: {
|
|
87
|
+
type: "number";
|
|
88
|
+
default: 20;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
dataDir: {
|
|
93
|
+
type: "string";
|
|
94
|
+
description: string;
|
|
95
|
+
};
|
|
96
|
+
workspaceDir: {
|
|
97
|
+
type: "string";
|
|
98
|
+
description: string;
|
|
99
|
+
};
|
|
100
|
+
test: {
|
|
101
|
+
type: "boolean";
|
|
102
|
+
default: boolean;
|
|
103
|
+
description: string;
|
|
104
|
+
};
|
|
105
|
+
googleApiKey: {
|
|
106
|
+
type: "string";
|
|
107
|
+
description: string;
|
|
108
|
+
};
|
|
109
|
+
openaiApiKey: {
|
|
110
|
+
type: "string";
|
|
111
|
+
description: string;
|
|
112
|
+
};
|
|
113
|
+
anthropicApiKey: {
|
|
114
|
+
type: "string";
|
|
115
|
+
description: string;
|
|
116
|
+
};
|
|
117
|
+
groqApiKey: {
|
|
118
|
+
type: "string";
|
|
119
|
+
description: string;
|
|
120
|
+
};
|
|
121
|
+
interpretMaxOutputTokens: {
|
|
122
|
+
type: "number";
|
|
123
|
+
description: string;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
register: typeof register;
|
|
128
|
+
};
|
|
129
|
+
export default _default;
|
|
130
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAmBlD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAQjE;AAID,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD;AAED,eAAO,MAAM,EAAE,sBAAsB,CAAC;AACtC,eAAO,MAAM,IAAI,8BAA8B,CAAC;AAChD,eAAO,MAAM,WAAW,mFAC0D,CAAC;AACnF,eAAO,MAAM,IAAI,EAAG,QAAiB,CAAC;AAEtC,eAAO,MAAM,KAAK,UAKjB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDxB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI,CAiDnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED,wBAAuE"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { GralkorHttpClient, GRALKOR_URL, validateOntologyConfig, } from "./gralkor/index.js";
|
|
5
|
+
import { resolveConfig, defaultConfig, } from "./config.js";
|
|
6
|
+
import { registerTools, registerHooks, registerServerService, registerMemoryCapability, resetServerManagerForTests, } from "./register.js";
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = dirname(__filename);
|
|
9
|
+
const pluginDir = join(__dirname, ".."); // dist/ → plugin root
|
|
10
|
+
const pkgJson = JSON.parse(readFileSync(join(pluginDir, "package.json"), "utf-8"));
|
|
11
|
+
const version = pkgJson.version;
|
|
12
|
+
/**
|
|
13
|
+
* Parse a GitHub `owner/repo` slug from a package.json `repository.url` field.
|
|
14
|
+
* The slug is passed to `createServerManager` as `wheelRepo` and to the
|
|
15
|
+
* `falkordblite` wheel URL the server-manager downloads at boot — the same
|
|
16
|
+
* slug the publish script (`scripts/publish-clawhub.sh`) uploads to via
|
|
17
|
+
* `gh release upload`. Deriving both sides from one source (this field)
|
|
18
|
+
* keeps publish and runtime in lockstep.
|
|
19
|
+
*/
|
|
20
|
+
export function parseGithubRepoSlug(repositoryUrl) {
|
|
21
|
+
const match = repositoryUrl.match(/github\.com[:/]([^/]+)\/([^/.]+?)(?:\.git)?$/);
|
|
22
|
+
if (!match) {
|
|
23
|
+
throw new Error(`Cannot parse GitHub owner/repo from repository.url=${JSON.stringify(repositoryUrl)} — expected a github.com URL`);
|
|
24
|
+
}
|
|
25
|
+
return `${match[1]}/${match[2]}`;
|
|
26
|
+
}
|
|
27
|
+
const wheelRepo = parseGithubRepoSlug(pkgJson.repository?.url ?? "");
|
|
28
|
+
export function resetRegistrationForTests() {
|
|
29
|
+
resetServerManagerForTests();
|
|
30
|
+
}
|
|
31
|
+
export const id = "@gralkor/openclaw";
|
|
32
|
+
export const name = "Gralkor Memory (OpenClaw)";
|
|
33
|
+
export const description = "Persistent, temporally-aware memory via Graphiti knowledge graphs and FalkorDB";
|
|
34
|
+
export const kind = "memory";
|
|
35
|
+
export const tools = [
|
|
36
|
+
"memory_search",
|
|
37
|
+
"memory_add",
|
|
38
|
+
"memory_build_indices",
|
|
39
|
+
"memory_build_communities",
|
|
40
|
+
];
|
|
41
|
+
export const configSchema = {
|
|
42
|
+
type: "object",
|
|
43
|
+
required: ["agentName"],
|
|
44
|
+
properties: {
|
|
45
|
+
agentName: {
|
|
46
|
+
type: "string",
|
|
47
|
+
minLength: 1,
|
|
48
|
+
},
|
|
49
|
+
search: {
|
|
50
|
+
type: "object",
|
|
51
|
+
properties: {
|
|
52
|
+
maxResults: {
|
|
53
|
+
type: "number",
|
|
54
|
+
default: defaultConfig.search.maxResults,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
dataDir: {
|
|
59
|
+
type: "string",
|
|
60
|
+
description: "Required. Directory for persistent backend data (venv, FalkorDB database). Operator must set this path.",
|
|
61
|
+
},
|
|
62
|
+
workspaceDir: {
|
|
63
|
+
type: "string",
|
|
64
|
+
description: "Native memory workspace root. Scanned at startup for MD files to index into the graph. Defaults to ~/.openclaw/workspace.",
|
|
65
|
+
},
|
|
66
|
+
test: {
|
|
67
|
+
type: "boolean",
|
|
68
|
+
default: false,
|
|
69
|
+
description: "Enable test mode — logs full episode bodies and search results for debugging.",
|
|
70
|
+
},
|
|
71
|
+
googleApiKey: {
|
|
72
|
+
type: "string",
|
|
73
|
+
description: "Google API key for Gemini LLM and embeddings",
|
|
74
|
+
},
|
|
75
|
+
openaiApiKey: {
|
|
76
|
+
type: "string",
|
|
77
|
+
description: "OpenAI API key; also needed for embeddings with Anthropic/Groq providers",
|
|
78
|
+
},
|
|
79
|
+
anthropicApiKey: {
|
|
80
|
+
type: "string",
|
|
81
|
+
description: "Anthropic API key for Claude-based LLM extraction",
|
|
82
|
+
},
|
|
83
|
+
groqApiKey: {
|
|
84
|
+
type: "string",
|
|
85
|
+
description: "Groq API key for Groq-hosted LLM extraction",
|
|
86
|
+
},
|
|
87
|
+
interpretMaxOutputTokens: {
|
|
88
|
+
type: "number",
|
|
89
|
+
description: "Optional positive integer. Output-token budget the server passes to its interpret pipeline on every recall. Unset → server default (2000). Raise for wide-recall workloads where the default truncates and surfaces as InterpretParseFailed in the server logs.",
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
export function register(api) {
|
|
94
|
+
if (api.registrationMode && api.registrationMode !== "full")
|
|
95
|
+
return;
|
|
96
|
+
try {
|
|
97
|
+
const config = resolveConfig((api.pluginConfig ?? {}));
|
|
98
|
+
validateOntologyConfig(config.ontology);
|
|
99
|
+
console.log(`[gralkor] boot: plugin loaded (v${version})`);
|
|
100
|
+
if (config.test) {
|
|
101
|
+
console.log(`[gralkor] raw pluginConfig: ${JSON.stringify(api.pluginConfig)}`);
|
|
102
|
+
}
|
|
103
|
+
const llmSummary = config.llm
|
|
104
|
+
? `${config.llm.provider}/${config.llm.model}`
|
|
105
|
+
: "server-default";
|
|
106
|
+
const embedderSummary = config.embedder
|
|
107
|
+
? `${config.embedder.provider}/${config.embedder.model}`
|
|
108
|
+
: "server-default";
|
|
109
|
+
const ontologySummary = config.ontology
|
|
110
|
+
? `${Object.keys(config.ontology.entities ?? {}).length} entities, ${Object.keys(config.ontology.edges ?? {}).length} edges`
|
|
111
|
+
: "none";
|
|
112
|
+
console.log(`[gralkor] config:` +
|
|
113
|
+
` llm=${llmSummary}` +
|
|
114
|
+
` embedder=${embedderSummary}` +
|
|
115
|
+
` ontology=${ontologySummary}` +
|
|
116
|
+
` test=${config.test}` +
|
|
117
|
+
` dataDir=${config.dataDir ?? "default"}`);
|
|
118
|
+
const client = new GralkorHttpClient({
|
|
119
|
+
baseUrl: GRALKOR_URL,
|
|
120
|
+
interpretMaxOutputTokens: config.interpretMaxOutputTokens,
|
|
121
|
+
});
|
|
122
|
+
registerTools(api, client, config);
|
|
123
|
+
registerHooks(api, client, config);
|
|
124
|
+
registerServerService(api, config, version, wheelRepo);
|
|
125
|
+
registerMemoryCapability(api);
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
console.error(`[gralkor] boot: register() failed:`, err instanceof Error ? err.message : err);
|
|
129
|
+
throw err;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
export default { id, name, description, kind, configSchema, register };
|
|
133
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,aAAa,EACb,aAAa,GAEd,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AAEvB,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACtC,MAAM,SAA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AAO,EAAE,SAAS,CAAC,CAAC;QACvD,wBAAwB,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CACX,oCAAoC,EACpC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CACzC,CAAC;QACF,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED,eAAe,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { GralkorClient } from "./gralkor/index.js";
|
|
2
|
+
export declare const GRALKOR_MARKER = "<!-- GRALKOR:INDEXED -->";
|
|
3
|
+
export interface DiscoveredFile {
|
|
4
|
+
absPath: string;
|
|
5
|
+
relPath: string;
|
|
6
|
+
groupId: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Discover native OpenClaw memory files under workspaceDir.
|
|
10
|
+
*
|
|
11
|
+
* Paths scanned:
|
|
12
|
+
* {workspaceDir}/MEMORY.md → groupId (provided by caller)
|
|
13
|
+
* {workspaceDir}/memory/*.md → groupId (provided by caller)
|
|
14
|
+
*
|
|
15
|
+
* The caller (before_prompt_build) knows the agentId and thus the correct
|
|
16
|
+
* group — no routing logic needed here.
|
|
17
|
+
*/
|
|
18
|
+
export declare function discoverFiles(workspaceDir: string, groupId: string): Promise<DiscoveredFile[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Index a single native memory file into the graph via the Gralkor client.
|
|
21
|
+
*
|
|
22
|
+
* Marker semantics:
|
|
23
|
+
* - No marker: ingest entire content, append marker at EOF.
|
|
24
|
+
* - Marker at EOF: skip (nothing new).
|
|
25
|
+
* - Marker mid-file: ingest content after marker, move marker to EOF.
|
|
26
|
+
*
|
|
27
|
+
* If the memoryAdd call fails, the file is NOT modified — next run will
|
|
28
|
+
* retry. Returns true if content was ingested, false if skipped, and
|
|
29
|
+
* propagates client errors as thrown exceptions so the caller can decide
|
|
30
|
+
* per-file whether to continue.
|
|
31
|
+
*/
|
|
32
|
+
export declare function indexFile(client: GralkorClient, file: DiscoveredFile): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Scan the workspace for native memory files and index any new content
|
|
35
|
+
* into the graph. Fire-and-forget safe — per-file errors are caught and
|
|
36
|
+
* logged; the loop continues.
|
|
37
|
+
*
|
|
38
|
+
* Called from before_prompt_build on each session start. Already-indexed
|
|
39
|
+
* files (marker at EOF) cost only a disk read + string search, so
|
|
40
|
+
* calling every session is cheap.
|
|
41
|
+
*/
|
|
42
|
+
export declare function runNativeIndexer(client: GralkorClient, workspaceDir: string, groupId: string): Promise<void>;
|
|
43
|
+
//# sourceMappingURL=native-indexer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-indexer.d.ts","sourceRoot":"","sources":["../src/native-indexer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,eAAO,MAAM,cAAc,6BAA6B,CAAC;AAEzD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,cAAc,EAAE,CAAC,CA6B3B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,OAAO,CAAC,CAuBlB;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,aAAa,EACrB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAiCf"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { readdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
export const GRALKOR_MARKER = "<!-- GRALKOR:INDEXED -->";
|
|
5
|
+
/**
|
|
6
|
+
* Discover native OpenClaw memory files under workspaceDir.
|
|
7
|
+
*
|
|
8
|
+
* Paths scanned:
|
|
9
|
+
* {workspaceDir}/MEMORY.md → groupId (provided by caller)
|
|
10
|
+
* {workspaceDir}/memory/*.md → groupId (provided by caller)
|
|
11
|
+
*
|
|
12
|
+
* The caller (before_prompt_build) knows the agentId and thus the correct
|
|
13
|
+
* group — no routing logic needed here.
|
|
14
|
+
*/
|
|
15
|
+
export async function discoverFiles(workspaceDir, groupId) {
|
|
16
|
+
if (!existsSync(workspaceDir))
|
|
17
|
+
return [];
|
|
18
|
+
const files = [];
|
|
19
|
+
const rootMemory = join(workspaceDir, "MEMORY.md");
|
|
20
|
+
if (existsSync(rootMemory)) {
|
|
21
|
+
files.push({ absPath: rootMemory, relPath: "MEMORY.md", groupId });
|
|
22
|
+
}
|
|
23
|
+
const memoryDir = join(workspaceDir, "memory");
|
|
24
|
+
if (existsSync(memoryDir)) {
|
|
25
|
+
try {
|
|
26
|
+
const entries = await readdir(memoryDir);
|
|
27
|
+
for (const entry of entries.sort()) {
|
|
28
|
+
if (entry.endsWith(".md")) {
|
|
29
|
+
files.push({
|
|
30
|
+
absPath: join(memoryDir, entry),
|
|
31
|
+
relPath: `memory/${entry}`,
|
|
32
|
+
groupId,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
/* ignore */
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return files;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Index a single native memory file into the graph via the Gralkor client.
|
|
45
|
+
*
|
|
46
|
+
* Marker semantics:
|
|
47
|
+
* - No marker: ingest entire content, append marker at EOF.
|
|
48
|
+
* - Marker at EOF: skip (nothing new).
|
|
49
|
+
* - Marker mid-file: ingest content after marker, move marker to EOF.
|
|
50
|
+
*
|
|
51
|
+
* If the memoryAdd call fails, the file is NOT modified — next run will
|
|
52
|
+
* retry. Returns true if content was ingested, false if skipped, and
|
|
53
|
+
* propagates client errors as thrown exceptions so the caller can decide
|
|
54
|
+
* per-file whether to continue.
|
|
55
|
+
*/
|
|
56
|
+
export async function indexFile(client, file) {
|
|
57
|
+
const raw = await readFile(file.absPath, "utf8");
|
|
58
|
+
const markerPos = raw.indexOf(GRALKOR_MARKER);
|
|
59
|
+
const newContent = markerPos === -1
|
|
60
|
+
? raw.trim()
|
|
61
|
+
: raw.slice(markerPos + GRALKOR_MARKER.length).trim();
|
|
62
|
+
const prefix = markerPos === -1 ? raw.trimEnd() : raw.slice(0, markerPos).trimEnd();
|
|
63
|
+
if (!newContent)
|
|
64
|
+
return false;
|
|
65
|
+
const result = await client.memoryAdd(file.groupId, newContent, file.relPath);
|
|
66
|
+
if ("error" in result) {
|
|
67
|
+
throw new Error(`memoryAdd failed for ${file.relPath}: ${JSON.stringify(result.error)}`);
|
|
68
|
+
}
|
|
69
|
+
const body = markerPos === -1 ? prefix : `${prefix}\n${newContent}`;
|
|
70
|
+
await writeFile(file.absPath, `${body}\n${GRALKOR_MARKER}\n`);
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Scan the workspace for native memory files and index any new content
|
|
75
|
+
* into the graph. Fire-and-forget safe — per-file errors are caught and
|
|
76
|
+
* logged; the loop continues.
|
|
77
|
+
*
|
|
78
|
+
* Called from before_prompt_build on each session start. Already-indexed
|
|
79
|
+
* files (marker at EOF) cost only a disk read + string search, so
|
|
80
|
+
* calling every session is cheap.
|
|
81
|
+
*/
|
|
82
|
+
export async function runNativeIndexer(client, workspaceDir, groupId) {
|
|
83
|
+
if (!existsSync(workspaceDir)) {
|
|
84
|
+
console.log(`[gralkor] native-index: workspaceDir not found (${workspaceDir}) — skipping`);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const files = await discoverFiles(workspaceDir, groupId);
|
|
88
|
+
if (files.length === 0)
|
|
89
|
+
return;
|
|
90
|
+
let indexed = 0;
|
|
91
|
+
for (const file of files) {
|
|
92
|
+
try {
|
|
93
|
+
const ingested = await indexFile(client, file);
|
|
94
|
+
if (ingested) {
|
|
95
|
+
indexed++;
|
|
96
|
+
console.log(`[gralkor] native-index: indexed ${file.relPath} → ${file.groupId}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
console.log(`[gralkor] native-index: error on ${file.relPath} — ${err instanceof Error ? err.message : err}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (indexed > 0) {
|
|
104
|
+
console.log(`[gralkor] native-index: done — ${indexed} file(s) ingested`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=native-indexer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-indexer.js","sourceRoot":"","sources":["../src/native-indexer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,MAAM,CAAC,MAAM,cAAc,GAAG,0BAA0B,CAAC;AAQzD;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,YAAoB,EACpB,OAAe;IAEf,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;QAAE,OAAO,EAAE,CAAC;IAEzC,MAAM,KAAK,GAAqB,EAAE,CAAC;IAEnC,MAAM,UAAU,GAA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AE,CAAC;QACzB,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC/C,IAAI,QAAQ,EAAE,CAAC;gBACb,OAAO,EAAE,CAAC;gBACV,OAAO,CAAC,GAAG,CACT,mCAAmC,IAAI,CAAC,OAAO,MAAM,IAAI,CAAC,OAAO,EAAE,CACpE,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CACT,oCAAoC,IAAI,CAAC,OAAO,MAC9C,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GACvC,EAAE,CACH,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,kCAAkC,OAAO,mBAAmB,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type GralkorClient, type ServerManager } from "./gralkor/index.js";
|
|
2
|
+
import { type GralkorPluginConfig } from "./config.js";
|
|
3
|
+
import type { MemoryPluginApi } from "./types.js";
|
|
4
|
+
export interface RegisterContext {
|
|
5
|
+
api: MemoryPluginApi;
|
|
6
|
+
config: GralkorPluginConfig;
|
|
7
|
+
version: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function registerTools(api: MemoryPluginApi, client: GralkorClient, config: GralkorPluginConfig): void;
|
|
10
|
+
export declare function registerHooks(api: MemoryPluginApi, client: GralkorClient, config: GralkorPluginConfig): void;
|
|
11
|
+
export declare function resetServerManagerForTests(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Declares this plugin as the active memory capability for OpenClaw 2026.5.x+.
|
|
14
|
+
* Once registered, `openclaw plugins info` reports `Shape: memory capability`
|
|
15
|
+
* and OpenClaw routes the `plugins.slots.memory` slot through this plugin.
|
|
16
|
+
*
|
|
17
|
+
* The capability is intentionally minimal — capture/recall is hook+tool-driven
|
|
18
|
+
* (see registerHooks / registerTools). The promptBuilder only contributes the
|
|
19
|
+
* static usage hints that the agent reads alongside the tool definitions, and
|
|
20
|
+
* flushPlanResolver opts out of OpenClaw's compaction-flush turn (we capture
|
|
21
|
+
* per agent_end, so a follow-up flush turn would duplicate the work).
|
|
22
|
+
*/
|
|
23
|
+
export declare function registerMemoryCapability(api: MemoryPluginApi): void;
|
|
24
|
+
export declare function registerServerService(api: MemoryPluginApi, config: GralkorPluginConfig, version: string, wheelRepo: string): ServerManager;
|
|
25
|
+
//# sourceMappingURL=register.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAWlD,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,eAAe,CAAC;IACrB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,aAAa,CAC3B,GAAG,EAAE,eAAe,EACpB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,mBAAmB,GAC1B,IAAI,CA6EN;AAgBD,wBAAgB,aAAa,CAC3B,GAAG,EAAE,eAAe,EACpB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,mBAAmB,GAC1B,IAAI,CA+CN;AAID,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD;AAQD;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI,CAMnE;AAED,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,eAAe,EACpB,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,aAAa,CAmCf"}
|