@byte5ai/palaia 2.1.0 → 2.2.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/index.ts CHANGED
@@ -11,34 +11,53 @@
11
11
  * - agent_end: Auto-capture of significant exchanges (opt-in, Issue #64)
12
12
  * - palaia-recovery: WAL replay on startup
13
13
  *
14
+ * Phase 1.5: ContextEngine adapter support. When the host provides
15
+ * api.registerContextEngine, palaia registers as a ContextEngine.
16
+ * Otherwise, falls back to legacy hook-based integration.
17
+ *
14
18
  * Activation:
15
19
  * plugins: { slots: { memory: "palaia" } }
16
20
  */
17
21
 
18
22
  import { resolveConfig, type PalaiaPluginConfig } from "./src/config.js";
19
23
  import { registerTools } from "./src/tools.js";
20
- import { registerHooks } from "./src/hooks.js";
24
+ import { registerHooks } from "./src/hooks/index.js";
25
+ import { createPalaiaContextEngine } from "./src/context-engine.js";
26
+ import type { OpenClawPluginApi, OpenClawPluginEntry } from "./src/types.js";
27
+
28
+ // Plugin entry point compatible with OpenClaw plugin-sdk definePluginEntry
29
+ const palaiaPlugin: OpenClawPluginEntry = {
30
+ id: "palaia",
31
+ name: "Palaia Memory",
32
+ async register(api: OpenClawPluginApi) {
33
+ // Issue #66: Plugin config is currently resolved GLOBALLY via api.getConfig("palaia").
34
+ // OpenClaw does NOT provide per-agent config resolution — all agents share the same
35
+ // plugin config from openclaw.json → plugins.config.palaia.
36
+ // A per-agent resolver would require an OpenClaw upstream change where api.getConfig()
37
+ // accepts an agentId parameter or automatically scopes to the current agent context.
38
+ // See: https://github.com/iret77/palaia/issues/66
39
+ const rawConfig = api.getConfig?.("palaia") as
40
+ | Partial<PalaiaPluginConfig>
41
+ | undefined;
42
+ const config = resolveConfig(rawConfig);
21
43
 
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
29
- const rawConfig = api.getConfig?.("palaia") as
30
- | Partial<PalaiaPluginConfig>
31
- | undefined;
32
- const config = resolveConfig(rawConfig);
44
+ // If workspace not set, use agent workspace from context
45
+ if (!config.workspace && api.workspace) {
46
+ config.workspace = typeof api.workspace === "string"
47
+ ? api.workspace
48
+ : api.workspace.dir;
49
+ }
33
50
 
34
- // If workspace not set, use agent workspace from context
35
- if (!config.workspace && api.workspace) {
36
- config.workspace = api.workspace;
37
- }
51
+ // Register agent tools (memory_search, memory_get, memory_write)
52
+ registerTools(api, config);
38
53
 
39
- // Register agent tools (memory_search, memory_get, memory_write)
40
- registerTools(api, config);
54
+ // Register ContextEngine when available, otherwise use legacy hooks
55
+ if (api.registerContextEngine) {
56
+ api.registerContextEngine("palaia", createPalaiaContextEngine(api, config));
57
+ } else {
58
+ registerHooks(api, config); // Legacy fallback
59
+ }
60
+ },
61
+ };
41
62
 
42
- // Register lifecycle hooks (before_prompt_build, recovery service)
43
- registerHooks(api, config);
44
- }
63
+ export default palaiaPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byte5ai/palaia",
3
- "version": "2.1.0",
3
+ "version": "2.2.1",
4
4
  "description": "Palaia memory backend for OpenClaw",
5
5
  "main": "index.ts",
6
6
  "openclaw": {
@@ -29,7 +29,7 @@
29
29
  "directory": "packages/openclaw-plugin"
30
30
  },
31
31
  "peerDependencies": {
32
- "openclaw": ">=2025.1.0"
32
+ "openclaw": ">=2026.3.22"
33
33
  },
34
34
  "dependencies": {
35
35
  "@sinclair/typebox": "^0.32.0"