@byte5ai/palaia 1.8.1 → 2.0.2
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/index.ts +8 -1
- package/openclaw.plugin.json +86 -2
- package/package.json +8 -3
- package/src/config.ts +62 -3
- package/src/hooks.ts +1659 -25
- package/src/runner.ts +14 -1
- package/src/tools.ts +55 -2
package/index.ts
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* - memory_search: Semantic search over Palaia memory
|
|
8
8
|
* - memory_get: Read a specific memory entry
|
|
9
9
|
* - memory_write: Write new entries (optional, opt-in)
|
|
10
|
-
* - before_prompt_build:
|
|
10
|
+
* - before_prompt_build: Query-based contextual recall (opt-in, Issue #65)
|
|
11
|
+
* - agent_end: Auto-capture of significant exchanges (opt-in, Issue #64)
|
|
11
12
|
* - palaia-recovery: WAL replay on startup
|
|
12
13
|
*
|
|
13
14
|
* Activation:
|
|
@@ -19,6 +20,12 @@ import { registerTools } from "./src/tools.js";
|
|
|
19
20
|
import { registerHooks } from "./src/hooks.js";
|
|
20
21
|
|
|
21
22
|
export default function palaiaPlugin(api: any) {
|
|
23
|
+
// Issue #66: Plugin config is currently resolved GLOBALLY via api.getConfig("palaia").
|
|
24
|
+
// OpenClaw does NOT provide per-agent config resolution — all agents share the same
|
|
25
|
+
// plugin config from openclaw.json → plugins.config.palaia.
|
|
26
|
+
// A per-agent resolver would require an OpenClaw upstream change where api.getConfig()
|
|
27
|
+
// accepts an agentId parameter or automatically scopes to the current agent context.
|
|
28
|
+
// See: https://github.com/iret77/palaia/issues/66
|
|
22
29
|
const rawConfig = api.getConfig?.("palaia") as
|
|
23
30
|
| Partial<PalaiaPluginConfig>
|
|
24
31
|
| undefined;
|
package/openclaw.plugin.json
CHANGED
|
@@ -28,13 +28,73 @@
|
|
|
28
28
|
},
|
|
29
29
|
"memoryInject": {
|
|
30
30
|
"type": "boolean",
|
|
31
|
-
"default":
|
|
31
|
+
"default": true,
|
|
32
32
|
"description": "Inject HOT memory into agent context on prompt build"
|
|
33
33
|
},
|
|
34
34
|
"maxInjectedChars": {
|
|
35
35
|
"type": "number",
|
|
36
|
-
"default":
|
|
36
|
+
"default": 8000,
|
|
37
37
|
"description": "Max characters for injected memory context"
|
|
38
|
+
},
|
|
39
|
+
"autoCapture": {
|
|
40
|
+
"type": "boolean",
|
|
41
|
+
"default": true,
|
|
42
|
+
"description": "Enable automatic memory capture after agent exchanges"
|
|
43
|
+
},
|
|
44
|
+
"captureFrequency": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"enum": ["every", "significant"],
|
|
47
|
+
"default": "significant",
|
|
48
|
+
"description": "How often to capture: every exchange or only significant ones"
|
|
49
|
+
},
|
|
50
|
+
"captureMinTurns": {
|
|
51
|
+
"type": "number",
|
|
52
|
+
"default": 1,
|
|
53
|
+
"description": "Minimum exchange turns before capture is attempted"
|
|
54
|
+
},
|
|
55
|
+
"captureModel": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"description": "Model override for LLM-based extraction (e.g. 'anthropic/claude-haiku-4', 'cheap')"
|
|
58
|
+
},
|
|
59
|
+
"captureMinSignificance": {
|
|
60
|
+
"type": "number",
|
|
61
|
+
"default": 0.3,
|
|
62
|
+
"description": "Minimum significance score (0.0-1.0) for LLM-extracted items to be captured"
|
|
63
|
+
},
|
|
64
|
+
"captureScope": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"default": "team",
|
|
67
|
+
"description": "Static scope override for auto-capture (private|team|public|shared:<name>)"
|
|
68
|
+
},
|
|
69
|
+
"captureProject": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"description": "Static project override for auto-capture"
|
|
72
|
+
},
|
|
73
|
+
"showMemorySources": {
|
|
74
|
+
"type": "boolean",
|
|
75
|
+
"default": true,
|
|
76
|
+
"description": "Show memory source footnotes in agent responses"
|
|
77
|
+
},
|
|
78
|
+
"showCaptureConfirm": {
|
|
79
|
+
"type": "boolean",
|
|
80
|
+
"default": true,
|
|
81
|
+
"description": "Show capture confirmations in agent responses"
|
|
82
|
+
},
|
|
83
|
+
"recallMode": {
|
|
84
|
+
"type": "string",
|
|
85
|
+
"enum": ["list", "query"],
|
|
86
|
+
"default": "query",
|
|
87
|
+
"description": "Recall mode: list (context-independent) or query (context-relevant)"
|
|
88
|
+
},
|
|
89
|
+
"recallTypeWeight": {
|
|
90
|
+
"type": "object",
|
|
91
|
+
"default": { "process": 1.5, "task": 1.2, "memory": 1.0 },
|
|
92
|
+
"description": "Type-aware weighting for recall results",
|
|
93
|
+
"properties": {
|
|
94
|
+
"process": { "type": "number", "default": 1.5 },
|
|
95
|
+
"task": { "type": "number", "default": 1.2 },
|
|
96
|
+
"memory": { "type": "number", "default": 1.0 }
|
|
97
|
+
}
|
|
38
98
|
}
|
|
39
99
|
}
|
|
40
100
|
},
|
|
@@ -46,6 +106,30 @@
|
|
|
46
106
|
"workspace": {
|
|
47
107
|
"label": "Workspace Path",
|
|
48
108
|
"placeholder": "agent workspace"
|
|
109
|
+
},
|
|
110
|
+
"memoryInject": {
|
|
111
|
+
"label": "Memory Injection",
|
|
112
|
+
"description": "Inject relevant memories into agent context before each prompt (recommended: on)"
|
|
113
|
+
},
|
|
114
|
+
"maxInjectedChars": {
|
|
115
|
+
"label": "Max Injected Characters",
|
|
116
|
+
"description": "Maximum characters of memory context injected per prompt (recommended: 8000)"
|
|
117
|
+
},
|
|
118
|
+
"autoCapture": {
|
|
119
|
+
"label": "Auto-Capture",
|
|
120
|
+
"description": "Automatically capture significant exchanges as memories (recommended: on)"
|
|
121
|
+
},
|
|
122
|
+
"showMemorySources": {
|
|
123
|
+
"label": "Memory Source Footnotes",
|
|
124
|
+
"description": "Show which memories were used in agent responses (recommended: on)"
|
|
125
|
+
},
|
|
126
|
+
"showCaptureConfirm": {
|
|
127
|
+
"label": "Capture Confirmations",
|
|
128
|
+
"description": "Show confirmation when exchanges are saved to memory (recommended: on)"
|
|
129
|
+
},
|
|
130
|
+
"recallMode": {
|
|
131
|
+
"label": "Recall Mode",
|
|
132
|
+
"description": "How memories are retrieved: query (semantic) or list (tier-based)"
|
|
49
133
|
}
|
|
50
134
|
}
|
|
51
135
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byte5ai/palaia",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Palaia memory backend for OpenClaw",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"openclaw": {
|
|
7
|
-
"extensions": [
|
|
7
|
+
"extensions": [
|
|
8
|
+
"./index.ts"
|
|
9
|
+
]
|
|
8
10
|
},
|
|
9
11
|
"files": [
|
|
10
12
|
"index.ts",
|
|
@@ -28,8 +30,11 @@
|
|
|
28
30
|
"peerDependencies": {
|
|
29
31
|
"openclaw": ">=2025.1.0"
|
|
30
32
|
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@sinclair/typebox": "^0.32.0"
|
|
35
|
+
},
|
|
31
36
|
"devDependencies": {
|
|
32
|
-
"
|
|
37
|
+
"typescript": "^5.9.3",
|
|
33
38
|
"vitest": "^1.0.0"
|
|
34
39
|
}
|
|
35
40
|
}
|
package/src/config.ts
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
* Plugin configuration schema and defaults for @byte5ai/palaia.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
export interface RecallTypeWeights {
|
|
6
|
+
process: number;
|
|
7
|
+
task: number;
|
|
8
|
+
memory: number;
|
|
9
|
+
[key: string]: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
5
12
|
export interface PalaiaPluginConfig {
|
|
6
13
|
/** Path to palaia binary (default: auto-detect) */
|
|
7
14
|
binaryPath?: string;
|
|
@@ -17,14 +24,58 @@ export interface PalaiaPluginConfig {
|
|
|
17
24
|
memoryInject: boolean;
|
|
18
25
|
/** Max characters for injected memory context */
|
|
19
26
|
maxInjectedChars: number;
|
|
27
|
+
|
|
28
|
+
// ── Auto-Capture (Issue #64) ─────────────────────────────────
|
|
29
|
+
/** Enable automatic memory capture after agent exchanges */
|
|
30
|
+
autoCapture: boolean;
|
|
31
|
+
/** How often to capture: "every" | "significant" (default: "significant") */
|
|
32
|
+
captureFrequency: "every" | "significant";
|
|
33
|
+
/** Minimum exchange turns before capture is attempted */
|
|
34
|
+
captureMinTurns: number;
|
|
35
|
+
/** Model override for LLM-based extraction (e.g. "anthropic/claude-haiku-3", or "cheap") */
|
|
36
|
+
captureModel?: string;
|
|
37
|
+
/** Minimum significance score for LLM-extracted items (0.0-1.0, default: 0.3) */
|
|
38
|
+
captureMinSignificance: number;
|
|
39
|
+
|
|
40
|
+
// ── Metadata Overrides (Issue #81) ─────────────────────────
|
|
41
|
+
/** Static scope override for auto-capture (default: undefined → LLM detection) */
|
|
42
|
+
captureScope?: string;
|
|
43
|
+
/** Static project override for auto-capture (default: undefined → LLM detection) */
|
|
44
|
+
captureProject?: string;
|
|
45
|
+
|
|
46
|
+
// ── Transparency Features (Issue #87) ────────────────────────
|
|
47
|
+
/** Show memory source footnotes in agent responses (default: true) */
|
|
48
|
+
showMemorySources: boolean;
|
|
49
|
+
/** Show capture confirmation in agent responses (default: true) */
|
|
50
|
+
showCaptureConfirm: boolean;
|
|
51
|
+
|
|
52
|
+
// ── Query-based Recall (Issue #65) ───────────────────────────
|
|
53
|
+
/** Recall mode: "list" (context-independent) or "query" (context-relevant) */
|
|
54
|
+
recallMode: "list" | "query";
|
|
55
|
+
/** Type-aware weighting for recall results */
|
|
56
|
+
recallTypeWeight: RecallTypeWeights;
|
|
20
57
|
}
|
|
21
58
|
|
|
59
|
+
export const DEFAULT_RECALL_TYPE_WEIGHTS: RecallTypeWeights = {
|
|
60
|
+
process: 1.5,
|
|
61
|
+
task: 1.2,
|
|
62
|
+
memory: 1.0,
|
|
63
|
+
};
|
|
64
|
+
|
|
22
65
|
export const DEFAULT_CONFIG: PalaiaPluginConfig = {
|
|
23
66
|
tier: "hot",
|
|
24
67
|
maxResults: 10,
|
|
25
68
|
timeoutMs: 3000,
|
|
26
|
-
memoryInject:
|
|
27
|
-
maxInjectedChars:
|
|
69
|
+
memoryInject: true,
|
|
70
|
+
maxInjectedChars: 8000,
|
|
71
|
+
autoCapture: true,
|
|
72
|
+
captureFrequency: "significant",
|
|
73
|
+
captureMinTurns: 2,
|
|
74
|
+
captureMinSignificance: 0.3,
|
|
75
|
+
showMemorySources: true,
|
|
76
|
+
showCaptureConfirm: true,
|
|
77
|
+
recallMode: "query",
|
|
78
|
+
recallTypeWeight: { ...DEFAULT_RECALL_TYPE_WEIGHTS },
|
|
28
79
|
};
|
|
29
80
|
|
|
30
81
|
/**
|
|
@@ -33,5 +84,13 @@ export const DEFAULT_CONFIG: PalaiaPluginConfig = {
|
|
|
33
84
|
export function resolveConfig(
|
|
34
85
|
userConfig: Partial<PalaiaPluginConfig> | undefined
|
|
35
86
|
): PalaiaPluginConfig {
|
|
36
|
-
|
|
87
|
+
const base = { ...DEFAULT_CONFIG, ...userConfig };
|
|
88
|
+
// Deep-merge recallTypeWeight
|
|
89
|
+
if (userConfig?.recallTypeWeight) {
|
|
90
|
+
base.recallTypeWeight = {
|
|
91
|
+
...DEFAULT_RECALL_TYPE_WEIGHTS,
|
|
92
|
+
...userConfig.recallTypeWeight,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return base;
|
|
37
96
|
}
|