@clawmem-ai/clawmem 0.1.9 → 0.1.11
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 +37 -189
- package/openclaw.plugin.json +20 -89
- package/package.json +2 -1
- package/skills/clawmem/SKILL.md +78 -0
- package/skills/clawmem/references/collaboration.md +223 -0
- package/skills/clawmem/references/communication.md +82 -0
- package/skills/clawmem/references/manual-ops.md +205 -0
- package/skills/clawmem/references/repair.md +127 -0
- package/skills/clawmem/references/schema.md +63 -0
- package/skills/clawmem/scripts/clawmem_exports.py +54 -0
- package/src/config.test.ts +82 -0
- package/src/config.ts +23 -6
- package/src/github-client.ts +207 -1
- package/src/memory.test.ts +2 -4
- package/src/memory.ts +11 -15
- package/src/service.ts +1249 -56
- package/src/types.ts +9 -2
- package/src/utils.ts +13 -0
package/src/types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Shared types for the clawmem plugin.
|
|
2
2
|
export type ClawMemAgentConfig = {
|
|
3
3
|
baseUrl?: string;
|
|
4
|
+
defaultRepo?: string;
|
|
4
5
|
repo?: string;
|
|
5
6
|
token?: string;
|
|
6
7
|
authScheme?: "token" | "bearer";
|
|
@@ -8,6 +9,9 @@ export type ClawMemAgentConfig = {
|
|
|
8
9
|
|
|
9
10
|
export type ClawMemPluginConfig = {
|
|
10
11
|
baseUrl: string;
|
|
12
|
+
defaultRepo?: string;
|
|
13
|
+
repo?: string;
|
|
14
|
+
token?: string;
|
|
11
15
|
authScheme: "token" | "bearer";
|
|
12
16
|
agents: Record<string, ClawMemAgentConfig>;
|
|
13
17
|
memoryRecallLimit: number;
|
|
@@ -18,12 +22,15 @@ export type ClawMemPluginConfig = {
|
|
|
18
22
|
export type ClawMemResolvedRoute = {
|
|
19
23
|
agentId: string;
|
|
20
24
|
baseUrl: string;
|
|
25
|
+
defaultRepo?: string;
|
|
21
26
|
repo?: string;
|
|
22
27
|
token?: string;
|
|
23
28
|
authScheme: "token" | "bearer";
|
|
24
29
|
};
|
|
25
30
|
|
|
26
|
-
export type
|
|
31
|
+
export type BootstrapIdentityResponse = { token: string; repo_full_name: string };
|
|
32
|
+
export type AgentRegistrationResponse = BootstrapIdentityResponse & { login: string };
|
|
33
|
+
export type AnonymousSessionResponse = BootstrapIdentityResponse & { owner_login: string; repo_name: string };
|
|
27
34
|
export type SessionMirrorState = {
|
|
28
35
|
sessionId: string; sessionKey?: string; sessionFile?: string; agentId?: string;
|
|
29
36
|
issueNumber?: number; issueTitle?: string; titleSource?: "placeholder" | "llm";
|
|
@@ -46,6 +53,6 @@ export type MemoryListOptions = {
|
|
|
46
53
|
};
|
|
47
54
|
export type ParsedMemoryIssue = {
|
|
48
55
|
issueNumber: number; title: string; memoryId: string; memoryHash?: string;
|
|
49
|
-
|
|
56
|
+
date: string; detail: string;
|
|
50
57
|
kind?: string; topics?: string[]; status: "active" | "stale";
|
|
51
58
|
};
|
package/src/utils.ts
CHANGED
|
@@ -4,6 +4,9 @@ import path from "node:path";
|
|
|
4
4
|
import type { NormalizedMessage } from "./types.js";
|
|
5
5
|
|
|
6
6
|
export const DEFAULT_AGENT_ID = "main";
|
|
7
|
+
export const DEFAULT_BOOTSTRAP_REPO_NAME = "memory";
|
|
8
|
+
|
|
9
|
+
const MAX_AGENT_LOGIN_PREFIX_LEN = 32;
|
|
7
10
|
|
|
8
11
|
export function sha256(v: string): string { return crypto.createHash("sha256").update(v).digest("hex"); }
|
|
9
12
|
|
|
@@ -13,6 +16,16 @@ export function normalizeAgentId(value: string | undefined | null): string {
|
|
|
13
16
|
return trimmed.replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64) || DEFAULT_AGENT_ID;
|
|
14
17
|
}
|
|
15
18
|
|
|
19
|
+
export function buildAgentBootstrapRegistration(agentId: string): { prefixLogin: string; defaultRepoName: string } {
|
|
20
|
+
const prefixLogin = normalizeAgentId(agentId)
|
|
21
|
+
.replace(/_/g, "-")
|
|
22
|
+
.replace(/-+/g, "-")
|
|
23
|
+
.replace(/^-+|-+$/g, "")
|
|
24
|
+
.slice(0, MAX_AGENT_LOGIN_PREFIX_LEN)
|
|
25
|
+
.replace(/-+$/g, "") || DEFAULT_AGENT_ID;
|
|
26
|
+
return { prefixLogin, defaultRepoName: DEFAULT_BOOTSTRAP_REPO_NAME };
|
|
27
|
+
}
|
|
28
|
+
|
|
16
29
|
export function sessionScopeKey(sessionId: string, agentId?: string): string {
|
|
17
30
|
return `${normalizeAgentId(agentId)}:${sessionId.trim()}`;
|
|
18
31
|
}
|