@elizaos/openclaw-adapter 0.1.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/README.md +133 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +100 -0
- package/dist/index.js.map +1 -0
- package/dist/src/action-to-tool.d.ts +25 -0
- package/dist/src/action-to-tool.d.ts.map +1 -0
- package/dist/src/action-to-tool.js +66 -0
- package/dist/src/action-to-tool.js.map +1 -0
- package/dist/src/config.d.ts +3 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +37 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/eliza-types.d.ts +527 -0
- package/dist/src/eliza-types.d.ts.map +1 -0
- package/dist/src/eliza-types.js +28 -0
- package/dist/src/eliza-types.js.map +1 -0
- package/dist/src/evaluator-to-hook.d.ts +13 -0
- package/dist/src/evaluator-to-hook.d.ts.map +1 -0
- package/dist/src/evaluator-to-hook.js +36 -0
- package/dist/src/evaluator-to-hook.js.map +1 -0
- package/dist/src/event-mapper.d.ts +4 -0
- package/dist/src/event-mapper.d.ts.map +1 -0
- package/dist/src/event-mapper.js +16 -0
- package/dist/src/event-mapper.js.map +1 -0
- package/dist/src/in-memory-store.d.ts +163 -0
- package/dist/src/in-memory-store.d.ts.map +1 -0
- package/dist/src/in-memory-store.js +605 -0
- package/dist/src/in-memory-store.js.map +1 -0
- package/dist/src/logger-adapter.d.ts +13 -0
- package/dist/src/logger-adapter.d.ts.map +1 -0
- package/dist/src/logger-adapter.js +14 -0
- package/dist/src/logger-adapter.js.map +1 -0
- package/dist/src/memory-builder.d.ts +12 -0
- package/dist/src/memory-builder.d.ts.map +1 -0
- package/dist/src/memory-builder.js +31 -0
- package/dist/src/memory-builder.js.map +1 -0
- package/dist/src/provider-to-hook.d.ts +9 -0
- package/dist/src/provider-to-hook.d.ts.map +1 -0
- package/dist/src/provider-to-hook.js +24 -0
- package/dist/src/provider-to-hook.js.map +1 -0
- package/dist/src/route-adapter.d.ts +9 -0
- package/dist/src/route-adapter.d.ts.map +1 -0
- package/dist/src/route-adapter.js +53 -0
- package/dist/src/route-adapter.js.map +1 -0
- package/dist/src/runtime-bridge.d.ts +189 -0
- package/dist/src/runtime-bridge.d.ts.map +1 -0
- package/dist/src/runtime-bridge.js +315 -0
- package/dist/src/runtime-bridge.js.map +1 -0
- package/dist/src/schema-converter.d.ts +14 -0
- package/dist/src/schema-converter.d.ts.map +1 -0
- package/dist/src/schema-converter.js +110 -0
- package/dist/src/schema-converter.js.map +1 -0
- package/dist/src/service-adapter.d.ts +7 -0
- package/dist/src/service-adapter.d.ts.map +1 -0
- package/dist/src/service-adapter.js +25 -0
- package/dist/src/service-adapter.js.map +1 -0
- package/dist/src/types.d.ts +16 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +7 -0
- package/dist/src/types.js.map +1 -0
- package/openclaw.plugin.json +37 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# @openclaw/eliza-adapter
|
|
2
|
+
|
|
3
|
+
Run [Eliza](https://github.com/elizaos/eliza) plugins inside [OpenClaw](https://github.com/openclaw/openclaw). Wraps Eliza actions as OpenClaw tools, providers as lifecycle hooks, services, routes, and evaluators — letting the two agent ecosystems interoperate.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
| Eliza concept | OpenClaw equivalent | How it works |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| Action | Tool | Parameters converted to TypeBox schema, handler wrapped in execute() |
|
|
10
|
+
| Provider | `before_agent_start` hook | Provider output injected as prepended context |
|
|
11
|
+
| Service | Service | Started eagerly, injected into RuntimeBridge for other components |
|
|
12
|
+
| Route | HTTP route | Request/response translated, paths prefixed with `/eliza` |
|
|
13
|
+
| Evaluator | `message_received` / `agent_end` hook | Pre-evaluators → message hooks, post-evaluators → agent-end hooks |
|
|
14
|
+
| Event | Lifecycle hook | Mapped where semantics align (MESSAGE_RECEIVED → message_received, etc.) |
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
### Inside the OpenClaw monorepo
|
|
19
|
+
|
|
20
|
+
Already in place at `extensions/eliza-adapter/`. Enable it in your OpenClaw config.
|
|
21
|
+
|
|
22
|
+
### Standalone (npm)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install @openclaw/eliza-adapter
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Then register as an OpenClaw extension (see Configuration below).
|
|
29
|
+
|
|
30
|
+
## Configuration
|
|
31
|
+
|
|
32
|
+
Add to your OpenClaw config:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"plugins": {
|
|
37
|
+
"eliza-adapter": {
|
|
38
|
+
"plugins": ["@elizaos/plugin-evm"],
|
|
39
|
+
"settings": {
|
|
40
|
+
"EVM_PRIVATE_KEY": "${EVM_PRIVATE_KEY}",
|
|
41
|
+
"EVM_PROVIDER_URL": "https://mainnet.infura.io/v3/YOUR_KEY"
|
|
42
|
+
},
|
|
43
|
+
"agentName": "WalletBot"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Config fields
|
|
50
|
+
|
|
51
|
+
| Field | Required | Description |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| `plugins` | Yes | Array of Eliza plugin package names or file paths to load |
|
|
54
|
+
| `settings` | No | Key-value settings passed to plugins via `runtime.getSetting()`. Supports `${ENV_VAR}` expansion. |
|
|
55
|
+
| `agentName` | No | Agent display name (default: `"Eliza"`) |
|
|
56
|
+
|
|
57
|
+
## What gets registered
|
|
58
|
+
|
|
59
|
+
When you configure `plugins: ["@elizaos/plugin-evm"]`, the adapter:
|
|
60
|
+
|
|
61
|
+
1. **Starts** the EVMService (connects wallet, sets up RPC)
|
|
62
|
+
2. **Registers tools**: `eliza_send_tokens`, `eliza_swap_tokens`, `eliza_cross_chain_transfer`, etc.
|
|
63
|
+
3. **Registers hooks**: Wallet balance and token balance injected into agent context before each run
|
|
64
|
+
4. **Registers routes**: Any HTTP endpoints the plugin exposes, under `/eliza/...`
|
|
65
|
+
|
|
66
|
+
The tools appear in OpenClaw's agent like any native tool. The agent can call `eliza_send_tokens` with `{ toAddress: "0x...", amount: "1.5", chain: "base" }` and the adapter handles execution through the Eliza plugin's action handler.
|
|
67
|
+
|
|
68
|
+
## Supported Eliza plugins
|
|
69
|
+
|
|
70
|
+
Any Eliza plugin that exports the standard `Plugin` shape works. Tested patterns:
|
|
71
|
+
|
|
72
|
+
- **Wallet plugins** (plugin-evm, plugin-solana) — actions become transfer/swap/bridge tools
|
|
73
|
+
- **Service plugins** — started and available via `runtime.getService()`
|
|
74
|
+
- **Provider plugins** — context injected into agent prompts
|
|
75
|
+
|
|
76
|
+
### Known limitations
|
|
77
|
+
|
|
78
|
+
- **LLM methods** (`useModel`, `generateText`) throw `NotImplementedError`. Actions that rely on conversational parameter extraction need explicit parameters or known schemas.
|
|
79
|
+
- **Channel plugins** (Discord, Telegram) register as tools only, not as native OpenClaw channels.
|
|
80
|
+
- **Database** is in-memory (10K memories/table cap with LRU eviction). No persistence.
|
|
81
|
+
- **Embeddings** are not generated. Vector search works if embeddings are provided but none are created automatically.
|
|
82
|
+
|
|
83
|
+
## Plugin resolution
|
|
84
|
+
|
|
85
|
+
Eliza plugins are loaded via dynamic `import()`. They must be resolvable from the OpenClaw runtime context:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Install the Eliza plugin you want to use
|
|
89
|
+
npm install @elizaos/plugin-evm
|
|
90
|
+
|
|
91
|
+
# Or use a file path
|
|
92
|
+
{
|
|
93
|
+
"plugins": ["./path/to/my-eliza-plugin/index.js"]
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Development
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Run tests (418 tests)
|
|
101
|
+
pnpm test
|
|
102
|
+
|
|
103
|
+
# Type-check
|
|
104
|
+
pnpm typecheck
|
|
105
|
+
|
|
106
|
+
# Build for publishing
|
|
107
|
+
pnpm build
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Architecture
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
index.ts Entry point — loads plugins, orchestrates registration
|
|
114
|
+
src/
|
|
115
|
+
runtime-bridge.ts IAgentRuntime implementation backed by InMemoryStore
|
|
116
|
+
in-memory-store.ts Full IDatabaseAdapter with eviction (memories, rooms, entities, etc.)
|
|
117
|
+
action-to-tool.ts Eliza Action → OpenClaw tool (with schema conversion)
|
|
118
|
+
provider-to-hook.ts Eliza Provider → before_agent_start hook
|
|
119
|
+
service-adapter.ts Eliza Service → OpenClaw service lifecycle
|
|
120
|
+
route-adapter.ts Eliza Route → OpenClaw HTTP route
|
|
121
|
+
evaluator-to-hook.ts Eliza Evaluator → message_received/agent_end hook
|
|
122
|
+
schema-converter.ts JSON Schema → TypeBox conversion + known wallet schemas
|
|
123
|
+
event-mapper.ts Eliza EventType → OpenClaw PluginHookName
|
|
124
|
+
config.ts Config parsing with ${ENV_VAR} resolution
|
|
125
|
+
eliza-types.ts Local type definitions (no @elizaos/core dependency)
|
|
126
|
+
logger-adapter.ts OpenClaw logger → Eliza logger shape
|
|
127
|
+
memory-builder.ts Memory object construction from OpenClaw contexts
|
|
128
|
+
types.ts Adapter config types + NotImplementedError
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## License
|
|
132
|
+
|
|
133
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Eliza Plugin Adapter for OpenClaw.
|
|
3
|
+
*
|
|
4
|
+
* ASSUMPTIONS & LIMITATIONS:
|
|
5
|
+
* - Eliza plugins must be importable from this context (npm-installed or path-resolvable)
|
|
6
|
+
* - eliza-types.ts manually mirrors @elizaos/core types — must be updated when Eliza core changes
|
|
7
|
+
* - InMemoryStore is ephemeral with no persistence and no eviction (unbounded growth)
|
|
8
|
+
* - Services are started eagerly during register(), not deferred to OpenClaw lifecycle
|
|
9
|
+
* - LLM methods (useModel, generateText) throw NotImplementedError — actions needing LLM extraction won't work
|
|
10
|
+
* - Connector plugins (Discord, Telegram) register as tools only, not as OpenClaw channels
|
|
11
|
+
* - Database adapter plugins are not bridged — the InMemoryStore is the only database
|
|
12
|
+
* - One RuntimeBridge per adapter registration — no multi-tenant support
|
|
13
|
+
*/
|
|
14
|
+
import type { OpenClawPluginApi } from "./src/eliza-types.js";
|
|
15
|
+
declare const _default: {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
register(api: OpenClawPluginApi): Promise<void>;
|
|
20
|
+
};
|
|
21
|
+
export default _default;
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAuC,MAAM,sBAAsB,CAAC;;;;;kBA2D7E,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;;AALvD,wBAuBE"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { parseAdapterConfig } from "./src/config.js";
|
|
2
|
+
import { RuntimeBridge } from "./src/runtime-bridge.js";
|
|
3
|
+
import { adaptActionToTool } from "./src/action-to-tool.js";
|
|
4
|
+
import { adaptProviderToHook } from "./src/provider-to-hook.js";
|
|
5
|
+
import { adaptService } from "./src/service-adapter.js";
|
|
6
|
+
import { adaptRoute } from "./src/route-adapter.js";
|
|
7
|
+
import { adaptEvaluatorToHook } from "./src/evaluator-to-hook.js";
|
|
8
|
+
import { mapElizaEventToOpenClawHook } from "./src/event-mapper.js";
|
|
9
|
+
async function loadElizaPlugin(specifier, logger) {
|
|
10
|
+
logger.info(`[eliza-adapter] Loading: ${specifier}`);
|
|
11
|
+
const mod = (await import(specifier));
|
|
12
|
+
if (mod["default"] && isPlugin(mod["default"]))
|
|
13
|
+
return mod["default"];
|
|
14
|
+
if (mod["plugin"] && isPlugin(mod["plugin"]))
|
|
15
|
+
return mod["plugin"];
|
|
16
|
+
for (const v of Object.values(mod)) {
|
|
17
|
+
if (isPlugin(v))
|
|
18
|
+
return v;
|
|
19
|
+
}
|
|
20
|
+
throw new Error(`[eliza-adapter] "${specifier}" has no valid Eliza Plugin export.`);
|
|
21
|
+
}
|
|
22
|
+
function isPlugin(v) {
|
|
23
|
+
return !!v && typeof v === "object" && typeof v["name"] === "string" && typeof v["description"] === "string";
|
|
24
|
+
}
|
|
25
|
+
async function registerElizaPlugin(plugin, bridge, api) {
|
|
26
|
+
const r = { pluginName: plugin.name, toolCount: 0, hookCount: 0, serviceCount: 0, routeCount: 0 };
|
|
27
|
+
// Start services immediately — Eliza plugins call getService() during init
|
|
28
|
+
for (const sc of plugin.services ?? []) {
|
|
29
|
+
const adapted = adaptService(sc, bridge);
|
|
30
|
+
await adapted.start({ stateDir: "", logger: bridge.logger, config: {} });
|
|
31
|
+
api.registerService({ id: adapted.id, start() { }, stop: adapted.stop });
|
|
32
|
+
r.serviceCount++;
|
|
33
|
+
}
|
|
34
|
+
if (plugin.init) {
|
|
35
|
+
await plugin.init((api.pluginConfig?.["settings"] ?? {}), bridge);
|
|
36
|
+
}
|
|
37
|
+
for (const action of plugin.actions ?? []) {
|
|
38
|
+
const t = adaptActionToTool(action, bridge);
|
|
39
|
+
api.registerTool(t, { name: t.name });
|
|
40
|
+
bridge.registerAction(action);
|
|
41
|
+
r.toolCount++;
|
|
42
|
+
}
|
|
43
|
+
for (const prov of plugin.providers ?? []) {
|
|
44
|
+
const a = adaptProviderToHook(prov, bridge);
|
|
45
|
+
api.on(a.hookName, a.handler);
|
|
46
|
+
bridge.registerProvider(prov);
|
|
47
|
+
r.hookCount++;
|
|
48
|
+
}
|
|
49
|
+
for (const ev of plugin.evaluators ?? []) {
|
|
50
|
+
const a = adaptEvaluatorToHook(ev, bridge);
|
|
51
|
+
api.on(a.hookName, a.handler);
|
|
52
|
+
bridge.registerEvaluator(ev);
|
|
53
|
+
r.hookCount++;
|
|
54
|
+
}
|
|
55
|
+
for (const route of plugin.routes ?? []) {
|
|
56
|
+
const a = adaptRoute(route, bridge);
|
|
57
|
+
if (a) {
|
|
58
|
+
api.registerHttpRoute(a);
|
|
59
|
+
r.routeCount++;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
for (const [eventName, handlers] of Object.entries(plugin.events ?? {})) {
|
|
63
|
+
if (!handlers)
|
|
64
|
+
continue;
|
|
65
|
+
const hookName = mapElizaEventToOpenClawHook(eventName);
|
|
66
|
+
if (!hookName) {
|
|
67
|
+
api.logger.debug?.(`[eliza-adapter] Unmapped event: ${eventName}`);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
for (const handler of handlers) {
|
|
71
|
+
api.on(hookName, async () => { await handler({}); });
|
|
72
|
+
r.hookCount++;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return r;
|
|
76
|
+
}
|
|
77
|
+
export default {
|
|
78
|
+
id: "eliza-adapter",
|
|
79
|
+
name: "Eliza Plugin Adapter",
|
|
80
|
+
description: "Wraps Eliza plugins as OpenClaw extensions",
|
|
81
|
+
async register(api) {
|
|
82
|
+
const config = parseAdapterConfig(api.pluginConfig);
|
|
83
|
+
api.logger.info(`[eliza-adapter] Loading ${config.plugins.length} plugin(s): ${config.plugins.join(", ")}`);
|
|
84
|
+
const bridge = new RuntimeBridge({ config, openclawLogger: api.logger });
|
|
85
|
+
await bridge.initialize();
|
|
86
|
+
let tools = 0, hooks = 0, services = 0, routes = 0;
|
|
87
|
+
for (const spec of config.plugins) {
|
|
88
|
+
const plugin = await loadElizaPlugin(spec, api.logger);
|
|
89
|
+
const r = await registerElizaPlugin(plugin, bridge, api);
|
|
90
|
+
tools += r.toolCount;
|
|
91
|
+
hooks += r.hookCount;
|
|
92
|
+
services += r.serviceCount;
|
|
93
|
+
routes += r.routeCount;
|
|
94
|
+
api.logger.info(`[eliza-adapter] "${plugin.name}": ${r.toolCount}T ${r.hookCount}H ${r.serviceCount}S ${r.routeCount}R`);
|
|
95
|
+
}
|
|
96
|
+
api.logger.info(`[eliza-adapter] Ready: ${tools}T ${hooks}H ${services}S ${routes}R`);
|
|
97
|
+
api.registerService({ id: "eliza-adapter-lifecycle", start() { }, stop: () => bridge.stop() });
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAGpE,KAAK,UAAU,eAAe,CAAC,SAAiB,EAAE,MAAmC;IACnF,MAAM,CAAC,IAAI,CAAC,4BAA4B,SAAS,EAAE,CAAC,CAAC;IACrD,MAAM,GAAG,GAAG,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC,CAA4B,CAAC;IACjE,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAAE,OAAO,GAAG,CAA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 @@
|
|
|
1
|
+
import type { Action } from "./eliza-types.js";
|
|
2
|
+
import type { RuntimeBridge } from "./runtime-bridge.js";
|
|
3
|
+
import type { TSchema } from "@sinclair/typebox";
|
|
4
|
+
type ToolResultContent = {
|
|
5
|
+
type: "text";
|
|
6
|
+
text: string;
|
|
7
|
+
} | {
|
|
8
|
+
type: "image";
|
|
9
|
+
data: string;
|
|
10
|
+
mimeType: string;
|
|
11
|
+
};
|
|
12
|
+
type ToolResult = {
|
|
13
|
+
content: ToolResultContent[];
|
|
14
|
+
details?: Record<string, unknown>;
|
|
15
|
+
};
|
|
16
|
+
export type AdaptedTool = {
|
|
17
|
+
name: string;
|
|
18
|
+
label: string;
|
|
19
|
+
description: string;
|
|
20
|
+
parameters: TSchema;
|
|
21
|
+
execute: (toolCallId: string, args: Record<string, unknown>) => Promise<ToolResult>;
|
|
22
|
+
};
|
|
23
|
+
export declare function adaptActionToTool(action: Action, bridge: RuntimeBridge): AdaptedTool;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=action-to-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-to-tool.d.ts","sourceRoot":"","sources":["../../src/action-to-tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAmE,MAAM,kBAAkB,CAAC;AAChH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,KAAK,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAC5G,KAAK,UAAU,GAAG;IAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC;AAEtF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACrF,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,WAAW,CA8CpF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { buildMemoryFromToolParams } from "./memory-builder.js";
|
|
2
|
+
import { convertActionParameters, fallbackActionSchema, KNOWN_ACTION_SCHEMAS } from "./schema-converter.js";
|
|
3
|
+
export function adaptActionToTool(action, bridge) {
|
|
4
|
+
let schema;
|
|
5
|
+
if (action.parameters && action.parameters.length > 0) {
|
|
6
|
+
schema = convertActionParameters(action.parameters);
|
|
7
|
+
}
|
|
8
|
+
else if (action.name in KNOWN_ACTION_SCHEMAS) {
|
|
9
|
+
schema = KNOWN_ACTION_SCHEMAS[action.name];
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
schema = fallbackActionSchema(action.description);
|
|
13
|
+
}
|
|
14
|
+
const toolName = `eliza_${action.name.toLowerCase().replace(/[^a-z0-9_]/g, "_")}`;
|
|
15
|
+
return {
|
|
16
|
+
name: toolName,
|
|
17
|
+
label: action.name.replace(/_/g, " "),
|
|
18
|
+
description: action.description,
|
|
19
|
+
parameters: schema,
|
|
20
|
+
async execute(_toolCallId, args) {
|
|
21
|
+
const message = buildMemoryFromToolParams(args, action.name, bridge.agentId);
|
|
22
|
+
if (!(await action.validate(bridge, message, undefined))) {
|
|
23
|
+
return {
|
|
24
|
+
content: [{ type: "text", text: `Action "${action.name}" validation failed. Check required settings.` }],
|
|
25
|
+
details: { error: "validation_failed", action: action.name },
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const state = await bridge.composeState(message);
|
|
29
|
+
const responses = [];
|
|
30
|
+
const callback = async (response) => {
|
|
31
|
+
const mem = { content: response, entityId: bridge.agentId, roomId: message.roomId, createdAt: Date.now() };
|
|
32
|
+
responses.push(mem);
|
|
33
|
+
return [mem];
|
|
34
|
+
};
|
|
35
|
+
let result;
|
|
36
|
+
try {
|
|
37
|
+
result = await action.handler(bridge, message, state, { parameters: args }, callback, responses);
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
bridge.logger.error(`[eliza-adapter] Action "${action.name}" threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
41
|
+
throw err;
|
|
42
|
+
}
|
|
43
|
+
return formatResult(action.name, result ?? undefined, responses);
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function formatResult(actionName, result, responses) {
|
|
48
|
+
const content = [];
|
|
49
|
+
const details = { action: actionName };
|
|
50
|
+
if (result?.text)
|
|
51
|
+
content.push({ type: "text", text: result.text });
|
|
52
|
+
for (const r of responses) {
|
|
53
|
+
if (r.content.text)
|
|
54
|
+
content.push({ type: "text", text: r.content.text });
|
|
55
|
+
}
|
|
56
|
+
if (content.length === 0) {
|
|
57
|
+
const status = result?.success !== false ? "completed" : "failed";
|
|
58
|
+
const err = result?.error instanceof Error ? result.error.message : result?.error;
|
|
59
|
+
content.push({ type: "text", text: err ? `Action "${actionName}" ${status}: ${err}` : `Action "${actionName}" ${status}.` });
|
|
60
|
+
}
|
|
61
|
+
if (result?.data)
|
|
62
|
+
details["data"] = result.data;
|
|
63
|
+
details["success"] = result?.success !== false;
|
|
64
|
+
return { content, details };
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=action-to-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-to-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AC/C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAQrD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,kBAAkB,CAkC/F"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const ENV_VAR_RE = /\$\{([^}]+)\}/g;
|
|
2
|
+
function resolveEnvVars(value) {
|
|
3
|
+
return value.replace(ENV_VAR_RE, (match, name) => process.env[name.trim()] ?? match);
|
|
4
|
+
}
|
|
5
|
+
export function parseAdapterConfig(raw) {
|
|
6
|
+
if (!raw)
|
|
7
|
+
throw new Error('eliza-adapter: missing config. Provide { "plugins": [...] }.');
|
|
8
|
+
const rawPlugins = raw["plugins"];
|
|
9
|
+
if (!Array.isArray(rawPlugins) || rawPlugins.length === 0) {
|
|
10
|
+
throw new Error('eliza-adapter: "plugins" must be a non-empty array.');
|
|
11
|
+
}
|
|
12
|
+
const plugins = [];
|
|
13
|
+
for (let i = 0; i < rawPlugins.length; i++) {
|
|
14
|
+
const entry = rawPlugins[i];
|
|
15
|
+
if (typeof entry !== "string" || entry.trim().length === 0) {
|
|
16
|
+
throw new Error(`eliza-adapter: plugins[${i}] must be a non-empty string, got ${typeof entry}.`);
|
|
17
|
+
}
|
|
18
|
+
plugins.push(entry.trim());
|
|
19
|
+
}
|
|
20
|
+
let settings = {};
|
|
21
|
+
const rawSettings = raw["settings"];
|
|
22
|
+
if (rawSettings !== undefined && rawSettings !== null) {
|
|
23
|
+
if (typeof rawSettings !== "object" || Array.isArray(rawSettings)) {
|
|
24
|
+
throw new Error('eliza-adapter: "settings" must be an object mapping string keys to string values.');
|
|
25
|
+
}
|
|
26
|
+
for (const [key, value] of Object.entries(rawSettings)) {
|
|
27
|
+
if (typeof value !== "string") {
|
|
28
|
+
throw new Error(`eliza-adapter: settings["${key}"] must be a string, got ${typeof value}.`);
|
|
29
|
+
}
|
|
30
|
+
settings[key] = resolveEnvVars(value);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const rawName = raw["agentName"];
|
|
34
|
+
const agentName = typeof rawName === "string" && rawName.trim() ? rawName.trim() : "Eliza";
|
|
35
|
+
return { plugins, settings, agentName };
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAEpC,SAAS,cAAc,CAAC,KAAa;IACnC,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC,CAAC;AAC/F,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,GAAwC;IACzE,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;IAE1F,MAAM,UAAU,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC;IAClC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC;IACD,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC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