@elizaos/interop 2.0.0-alpha

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.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +436 -0
  3. package/dist/packages/interop/tsconfig.tsbuildinfo +1 -0
  4. package/dist/tsconfig.tsbuildinfo +1 -0
  5. package/dist/typescript/index.d.ts +33 -0
  6. package/dist/typescript/index.d.ts.map +1 -0
  7. package/dist/typescript/index.js +121 -0
  8. package/dist/typescript/python-bridge.d.ts +80 -0
  9. package/dist/typescript/python-bridge.d.ts.map +1 -0
  10. package/dist/typescript/python-bridge.js +334 -0
  11. package/dist/typescript/types.d.ts +301 -0
  12. package/dist/typescript/types.d.ts.map +1 -0
  13. package/dist/typescript/types.js +10 -0
  14. package/dist/typescript/wasm-loader.d.ts +32 -0
  15. package/dist/typescript/wasm-loader.d.ts.map +1 -0
  16. package/dist/typescript/wasm-loader.js +269 -0
  17. package/package.json +43 -0
  18. package/python/__init__.py +50 -0
  19. package/python/__pycache__/__init__.cpython-313.pyc +0 -0
  20. package/python/__pycache__/rust_ffi.cpython-313.pyc +0 -0
  21. package/python/__pycache__/ts_bridge.cpython-313.pyc +0 -0
  22. package/python/__pycache__/wasm_loader.cpython-313.pyc +0 -0
  23. package/python/bridge_server.py +505 -0
  24. package/python/rust_ffi.py +418 -0
  25. package/python/tests/__init__.py +1 -0
  26. package/python/tests/__pycache__/__init__.cpython-313.pyc +0 -0
  27. package/python/tests/__pycache__/test_bridge_server.cpython-313-pytest-9.0.2.pyc +0 -0
  28. package/python/tests/__pycache__/test_interop.cpython-313-pytest-9.0.2.pyc +0 -0
  29. package/python/tests/__pycache__/test_rust_ffi.cpython-313-pytest-9.0.2.pyc +0 -0
  30. package/python/tests/__pycache__/test_rust_ffi_loader.cpython-313-pytest-9.0.2.pyc +0 -0
  31. package/python/tests/test_bridge_server.py +525 -0
  32. package/python/tests/test_interop.py +319 -0
  33. package/python/tests/test_rust_ffi.py +352 -0
  34. package/python/tests/test_rust_ffi_loader.py +71 -0
  35. package/python/ts_bridge.py +452 -0
  36. package/python/ts_bridge_runner.mjs +284 -0
  37. package/python/wasm_loader.py +517 -0
  38. package/rust/ffi_exports.rs +362 -0
  39. package/rust/mod.rs +21 -0
  40. package/rust/py_loader.rs +412 -0
  41. package/rust/ts_loader.rs +467 -0
  42. package/rust/wasm_plugin.rs +320 -0
@@ -0,0 +1,334 @@
1
+ /**
2
+ * Python Plugin Bridge for elizaOS
3
+ *
4
+ * Loads Python plugins via subprocess IPC and adapts them
5
+ * to the TypeScript Plugin interface.
6
+ */
7
+ import { EventEmitter } from "node:events";
8
+ /**
9
+ * Python plugin bridge that communicates via subprocess
10
+ */
11
+ export class PythonPluginBridge extends EventEmitter {
12
+ options;
13
+ process = null;
14
+ pendingRequests = new Map();
15
+ messageBuffer = "";
16
+ manifest = null;
17
+ initialized = false;
18
+ requestCounter = 0;
19
+ constructor(options) {
20
+ super();
21
+ this.options = options;
22
+ }
23
+ /**
24
+ * Start the Python subprocess
25
+ */
26
+ async start() {
27
+ const { spawn } = await import("node:child_process");
28
+ const pythonPath = this.options.pythonPath ?? "python3";
29
+ const bridgeScript = this.options.bridgeScriptPath ??
30
+ new URL("../python/bridge_server.py", import.meta.url).pathname;
31
+ this.process = spawn(pythonPath, ["-u", bridgeScript, "--module", this.options.moduleName], {
32
+ cwd: this.options.cwd,
33
+ env: { ...process.env, ...this.options.env },
34
+ stdio: ["pipe", "pipe", "pipe"],
35
+ });
36
+ // Handle stdout (JSON-RPC messages)
37
+ if (this.process.stdout) {
38
+ this.process.stdout.on("data", (data) => {
39
+ this.handleData(data.toString());
40
+ });
41
+ }
42
+ // Handle stderr (logging)
43
+ if (this.process.stderr) {
44
+ this.process.stderr.on("data", (data) => {
45
+ console.error(`[Python Plugin ${this.options.moduleName}]`, data.toString());
46
+ });
47
+ }
48
+ // Handle process exit
49
+ this.process.on("exit", (code, signal) => {
50
+ this.emit("exit", { code, signal });
51
+ this.cleanup();
52
+ });
53
+ this.process.on("error", (error) => {
54
+ this.emit("error", error);
55
+ });
56
+ // Wait for the ready message with manifest
57
+ await this.waitForReady();
58
+ this.initialized = true;
59
+ }
60
+ /**
61
+ * Wait for the Python process to send ready message
62
+ */
63
+ async waitForReady() {
64
+ const timeout = this.options.timeout ?? 30000;
65
+ return new Promise((resolve, reject) => {
66
+ const timer = setTimeout(() => {
67
+ reject(new Error(`Python plugin startup timeout after ${timeout}ms`));
68
+ }, timeout);
69
+ const handler = (msg) => {
70
+ if (msg.type === "ready" && "manifest" in msg) {
71
+ clearTimeout(timer);
72
+ this.manifest = msg.manifest;
73
+ resolve();
74
+ }
75
+ };
76
+ this.once("message", handler);
77
+ });
78
+ }
79
+ /**
80
+ * Handle incoming data from subprocess
81
+ */
82
+ handleData(data) {
83
+ this.messageBuffer += data;
84
+ // Process complete JSON messages (newline-delimited)
85
+ const lines = this.messageBuffer.split("\n");
86
+ this.messageBuffer = lines.pop() ?? "";
87
+ for (const line of lines) {
88
+ if (line.trim()) {
89
+ try {
90
+ const message = JSON.parse(line);
91
+ this.handleMessage(message);
92
+ }
93
+ catch (error) {
94
+ console.error("Failed to parse IPC message:", line, error);
95
+ }
96
+ }
97
+ }
98
+ }
99
+ /**
100
+ * Handle a parsed IPC message
101
+ */
102
+ handleMessage(message) {
103
+ this.emit("message", message);
104
+ // Check if this is a response to a pending request
105
+ if (message.id && this.pendingRequests.has(message.id)) {
106
+ const pending = this.pendingRequests.get(message.id);
107
+ if (!pending)
108
+ return;
109
+ this.pendingRequests.delete(message.id);
110
+ clearTimeout(pending.timeout);
111
+ if (message.type === "error") {
112
+ pending.reject(new Error(message.error));
113
+ }
114
+ else {
115
+ pending.resolve(message);
116
+ }
117
+ }
118
+ }
119
+ /**
120
+ * Send a request and wait for response
121
+ */
122
+ async sendRequest(request) {
123
+ if (!this.process || !this.initialized) {
124
+ throw new Error("Python bridge not started");
125
+ }
126
+ const id = `req_${++this.requestCounter}`;
127
+ const requestWithId = { ...request, id };
128
+ return new Promise((resolve, reject) => {
129
+ const timeout = setTimeout(() => {
130
+ this.pendingRequests.delete(id);
131
+ reject(new Error(`Request timeout for ${request.type}`));
132
+ }, this.options.timeout ?? 30000);
133
+ this.pendingRequests.set(id, {
134
+ resolve: resolve,
135
+ reject,
136
+ timeout,
137
+ });
138
+ const json = `${JSON.stringify(requestWithId)}\n`;
139
+ if (this.process?.stdin) {
140
+ this.process.stdin.write(json);
141
+ }
142
+ });
143
+ }
144
+ /**
145
+ * Get the plugin manifest
146
+ */
147
+ getManifest() {
148
+ return this.manifest;
149
+ }
150
+ /**
151
+ * Stop the Python subprocess
152
+ */
153
+ async stop() {
154
+ if (this.process) {
155
+ this.process.kill("SIGTERM");
156
+ // Wait for graceful shutdown
157
+ await new Promise((resolve) => {
158
+ const timeout = setTimeout(() => {
159
+ if (this.process) {
160
+ this.process.kill("SIGKILL");
161
+ }
162
+ resolve();
163
+ }, 5000);
164
+ if (this.process) {
165
+ this.process.on("exit", () => {
166
+ clearTimeout(timeout);
167
+ resolve();
168
+ });
169
+ }
170
+ else {
171
+ resolve();
172
+ }
173
+ });
174
+ }
175
+ this.cleanup();
176
+ }
177
+ /**
178
+ * Cleanup resources
179
+ */
180
+ cleanup() {
181
+ this.process = null;
182
+ this.initialized = false;
183
+ // Reject all pending requests
184
+ for (const pending of this.pendingRequests.values()) {
185
+ clearTimeout(pending.timeout);
186
+ pending.reject(new Error("Bridge closed"));
187
+ }
188
+ this.pendingRequests.clear();
189
+ }
190
+ }
191
+ /**
192
+ * Load a Python plugin and return an elizaOS Plugin interface
193
+ */
194
+ export async function loadPythonPlugin(options) {
195
+ const bridge = new PythonPluginBridge(options);
196
+ await bridge.start();
197
+ const manifest = bridge.getManifest();
198
+ if (!manifest) {
199
+ throw new Error("Failed to get plugin manifest");
200
+ }
201
+ return createPluginFromBridge(manifest, bridge);
202
+ }
203
+ /**
204
+ * Create a Plugin from a Python bridge
205
+ */
206
+ function createPluginFromBridge(manifest, bridge) {
207
+ // Create action wrappers
208
+ const actions = (manifest.actions ?? []).map((actionDef) => ({
209
+ name: actionDef.name,
210
+ description: actionDef.description,
211
+ similes: actionDef.similes,
212
+ examples: actionDef.examples,
213
+ validate: async (_runtime, message, state) => {
214
+ const response = await bridge.sendRequest({
215
+ type: "action.validate",
216
+ id: "",
217
+ action: actionDef.name,
218
+ memory: message,
219
+ state: state ?? null,
220
+ });
221
+ return response.valid;
222
+ },
223
+ handler: async (_runtime, message, state, options, _callback) => {
224
+ const response = await bridge.sendRequest({
225
+ type: "action.invoke",
226
+ id: "",
227
+ action: actionDef.name,
228
+ memory: message,
229
+ state: state ?? null,
230
+ options: options ?? null,
231
+ });
232
+ const result = response.result;
233
+ return {
234
+ success: result.success,
235
+ text: result.text,
236
+ error: result.error ? new Error(result.error) : undefined,
237
+ data: result.data,
238
+ values: result.values,
239
+ };
240
+ },
241
+ }));
242
+ // Create provider wrappers
243
+ const providers = (manifest.providers ?? []).map((providerDef) => ({
244
+ name: providerDef.name,
245
+ description: providerDef.description,
246
+ dynamic: providerDef.dynamic,
247
+ position: providerDef.position,
248
+ private: providerDef.private,
249
+ get: async (_runtime, message, state) => {
250
+ const response = await bridge.sendRequest({
251
+ type: "provider.get",
252
+ id: "",
253
+ provider: providerDef.name,
254
+ memory: message,
255
+ state: state,
256
+ });
257
+ return {
258
+ text: response.result.text,
259
+ values: response.result.values,
260
+ data: response.result.data,
261
+ };
262
+ },
263
+ }));
264
+ // Create evaluator wrappers
265
+ const evaluators = (manifest.evaluators ?? []).map((evalDef) => ({
266
+ name: evalDef.name,
267
+ description: evalDef.description,
268
+ alwaysRun: evalDef.alwaysRun,
269
+ similes: evalDef.similes,
270
+ examples: [],
271
+ validate: async (_runtime, message, state) => {
272
+ const response = await bridge.sendRequest({
273
+ type: "action.validate",
274
+ id: "",
275
+ action: evalDef.name,
276
+ memory: message,
277
+ state: state ?? null,
278
+ });
279
+ return response.valid;
280
+ },
281
+ handler: async (_runtime, message, state) => {
282
+ const response = await bridge.sendRequest({
283
+ type: "evaluator.invoke",
284
+ id: "",
285
+ evaluator: evalDef.name,
286
+ memory: message,
287
+ state: state ?? null,
288
+ });
289
+ if (!response.result) {
290
+ return undefined;
291
+ }
292
+ return {
293
+ success: response.result.success,
294
+ text: response.result.text,
295
+ error: response.result.error
296
+ ? new Error(response.result.error)
297
+ : undefined,
298
+ data: response.result.data,
299
+ values: response.result.values,
300
+ };
301
+ },
302
+ }));
303
+ // Store bridge reference for cleanup
304
+ const bridgeRef = { current: bridge };
305
+ return {
306
+ name: manifest.name,
307
+ description: manifest.description,
308
+ config: manifest.config ?? {},
309
+ dependencies: manifest.dependencies,
310
+ actions,
311
+ providers,
312
+ evaluators,
313
+ routes: [],
314
+ services: [],
315
+ async init(config) {
316
+ await bridge.sendRequest({
317
+ type: "plugin.init",
318
+ id: "",
319
+ config,
320
+ });
321
+ },
322
+ // Extension for cleanup
323
+ _bridge: bridgeRef,
324
+ };
325
+ }
326
+ /**
327
+ * Stop a Python plugin bridge
328
+ */
329
+ export async function stopPythonPlugin(plugin) {
330
+ const extended = plugin;
331
+ if (extended._bridge?.current) {
332
+ await extended._bridge.current.stop();
333
+ }
334
+ }
@@ -0,0 +1,301 @@
1
+ /**
2
+ * Cross-language interop types for elizaOS
3
+ *
4
+ * These types define the wire format for communication between
5
+ * different language runtimes (Rust, TypeScript, Python).
6
+ *
7
+ * Standalone definitions matching proto schemas in /schemas/eliza/v1/ipc.proto.
8
+ * For full proto-generated types, import from @elizaos/core.
9
+ */
10
+ import type { Content, Memory, State } from "@elizaos/core";
11
+ /**
12
+ * Supported interop protocols
13
+ */
14
+ export type InteropProtocol = "wasm" | "ffi" | "ipc" | "native";
15
+ /**
16
+ * Supported plugin languages
17
+ */
18
+ export type PluginLanguage = "typescript" | "rust" | "python";
19
+ /**
20
+ * Plugin interop configuration
21
+ */
22
+ export interface PluginInteropConfig {
23
+ /** Communication protocol */
24
+ protocol: InteropProtocol;
25
+ /** Path to WASM module (for wasm protocol) */
26
+ wasmPath?: string;
27
+ /** Path to shared library (for ffi protocol) */
28
+ sharedLibPath?: string;
29
+ /** IPC command to spawn subprocess */
30
+ ipcCommand?: string;
31
+ /** IPC port for TCP communication */
32
+ ipcPort?: number;
33
+ /** Working directory for subprocess */
34
+ cwd?: string;
35
+ }
36
+ /**
37
+ * Cross-language plugin manifest
38
+ */
39
+ export interface PluginManifest {
40
+ name: string;
41
+ description: string;
42
+ version: string;
43
+ language: PluginLanguage;
44
+ interop?: PluginInteropConfig;
45
+ config?: Record<string, string | number | boolean | null>;
46
+ dependencies?: string[];
47
+ actions?: ActionManifest[];
48
+ providers?: ProviderManifest[];
49
+ evaluators?: EvaluatorManifest[];
50
+ services?: ServiceManifest[];
51
+ routes?: RouteManifest[];
52
+ events?: Record<string, string[]>;
53
+ }
54
+ /**
55
+ * Action manifest (metadata only, no handlers)
56
+ */
57
+ export interface ActionManifest {
58
+ name: string;
59
+ description: string;
60
+ similes?: string[];
61
+ examples?: ActionExample[][];
62
+ }
63
+ /**
64
+ * Action example for documentation
65
+ */
66
+ export interface ActionExample {
67
+ name: string;
68
+ content: Content;
69
+ }
70
+ /**
71
+ * Provider manifest
72
+ */
73
+ export interface ProviderManifest {
74
+ name: string;
75
+ description?: string;
76
+ dynamic?: boolean;
77
+ position?: number;
78
+ private?: boolean;
79
+ }
80
+ /**
81
+ * Evaluator manifest
82
+ */
83
+ export interface EvaluatorManifest {
84
+ name: string;
85
+ description: string;
86
+ alwaysRun?: boolean;
87
+ similes?: string[];
88
+ }
89
+ /**
90
+ * Service manifest
91
+ */
92
+ export interface ServiceManifest {
93
+ type: string;
94
+ description?: string;
95
+ }
96
+ /**
97
+ * Route manifest
98
+ */
99
+ export interface RouteManifest {
100
+ path: string;
101
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "STATIC";
102
+ name?: string;
103
+ public?: boolean;
104
+ isMultipart?: boolean;
105
+ }
106
+ /**
107
+ * Base IPC message
108
+ */
109
+ export interface IPCMessage {
110
+ type: string;
111
+ id: string;
112
+ }
113
+ /**
114
+ * Action invocation request
115
+ */
116
+ export interface ActionInvokeRequest extends IPCMessage {
117
+ type: "action.invoke";
118
+ action: string;
119
+ memory: Memory;
120
+ state: State | null;
121
+ options: Record<string, unknown> | null;
122
+ }
123
+ /**
124
+ * Action result response
125
+ */
126
+ export interface ActionResultResponse extends IPCMessage {
127
+ type: "action.result";
128
+ result: ActionResultPayload;
129
+ }
130
+ /**
131
+ * Action result payload
132
+ */
133
+ export interface ActionResultPayload {
134
+ success: boolean;
135
+ text?: string;
136
+ error?: string;
137
+ data?: Record<string, unknown>;
138
+ values?: Record<string, unknown>;
139
+ }
140
+ /**
141
+ * Action validation request
142
+ */
143
+ export interface ActionValidateRequest extends IPCMessage {
144
+ type: "action.validate";
145
+ action: string;
146
+ memory: Memory;
147
+ state: State | null;
148
+ }
149
+ /**
150
+ * Validation result response
151
+ */
152
+ export interface ValidationResponse extends IPCMessage {
153
+ type: "validate.result";
154
+ valid: boolean;
155
+ }
156
+ /**
157
+ * Provider get request
158
+ */
159
+ export interface ProviderGetRequest extends IPCMessage {
160
+ type: "provider.get";
161
+ provider: string;
162
+ memory: Memory;
163
+ state: State;
164
+ }
165
+ /**
166
+ * Provider result response
167
+ */
168
+ export interface ProviderResultResponse extends IPCMessage {
169
+ type: "provider.result";
170
+ result: ProviderResultPayload;
171
+ }
172
+ /**
173
+ * Provider result payload
174
+ */
175
+ export interface ProviderResultPayload {
176
+ text?: string;
177
+ values?: Record<string, unknown>;
178
+ data?: Record<string, unknown>;
179
+ }
180
+ /**
181
+ * Evaluator invocation request
182
+ */
183
+ export interface EvaluatorInvokeRequest extends IPCMessage {
184
+ type: "evaluator.invoke";
185
+ evaluator: string;
186
+ memory: Memory;
187
+ state: State | null;
188
+ }
189
+ /**
190
+ * Service start request
191
+ */
192
+ export interface ServiceStartRequest extends IPCMessage {
193
+ type: "service.start";
194
+ service: string;
195
+ }
196
+ /**
197
+ * Service stop request
198
+ */
199
+ export interface ServiceStopRequest extends IPCMessage {
200
+ type: "service.stop";
201
+ service: string;
202
+ }
203
+ /**
204
+ * Service response
205
+ */
206
+ export interface ServiceResponse extends IPCMessage {
207
+ type: "service.response";
208
+ success: boolean;
209
+ error?: string;
210
+ }
211
+ /**
212
+ * Route handler request
213
+ */
214
+ export interface RouteHandlerRequest extends IPCMessage {
215
+ type: "route.handle";
216
+ path: string;
217
+ method: string;
218
+ body?: unknown;
219
+ params?: Record<string, string>;
220
+ query?: Record<string, unknown>;
221
+ headers?: Record<string, string | string[]>;
222
+ }
223
+ /**
224
+ * Route handler response
225
+ */
226
+ export interface RouteHandlerResponse extends IPCMessage {
227
+ type: "route.response";
228
+ status: number;
229
+ headers?: Record<string, string | string[]>;
230
+ body?: unknown;
231
+ }
232
+ /**
233
+ * Plugin initialization request
234
+ */
235
+ export interface PluginInitRequest extends IPCMessage {
236
+ type: "plugin.init";
237
+ config: Record<string, string>;
238
+ }
239
+ /**
240
+ * Plugin initialization response
241
+ */
242
+ export interface PluginInitResponse extends IPCMessage {
243
+ type: "plugin.init.result";
244
+ success: boolean;
245
+ error?: string;
246
+ }
247
+ /**
248
+ * Error response
249
+ */
250
+ export interface ErrorResponse extends IPCMessage {
251
+ type: "error";
252
+ error: string;
253
+ details?: unknown;
254
+ }
255
+ /**
256
+ * All possible IPC request types
257
+ */
258
+ export type IPCRequest = ActionInvokeRequest | ActionValidateRequest | ProviderGetRequest | EvaluatorInvokeRequest | ServiceStartRequest | ServiceStopRequest | RouteHandlerRequest | PluginInitRequest;
259
+ /**
260
+ * All possible IPC response types
261
+ */
262
+ export type IPCResponse = ActionResultResponse | ValidationResponse | ProviderResultResponse | ServiceResponse | RouteHandlerResponse | PluginInitResponse | ErrorResponse;
263
+ /**
264
+ * WASM plugin exports interface
265
+ */
266
+ export interface WasmPluginExports {
267
+ /** Get plugin manifest as JSON string */
268
+ get_manifest(): string;
269
+ /** Initialize the plugin with config JSON */
270
+ init(config_json: string): void;
271
+ /** Validate an action (returns boolean) */
272
+ validate_action(action: string, memory_json: string, state_json: string): boolean;
273
+ /** Invoke an action (returns result JSON) */
274
+ invoke_action(action: string, memory_json: string, state_json: string, options_json: string): string;
275
+ /** Get provider data (returns result JSON) */
276
+ get_provider(provider: string, memory_json: string, state_json: string): string;
277
+ /** Validate an evaluator */
278
+ validate_evaluator(evaluator: string, memory_json: string, state_json: string): boolean;
279
+ /** Invoke an evaluator (returns result JSON) */
280
+ invoke_evaluator(evaluator: string, memory_json: string, state_json: string): string;
281
+ /** Handle a route (returns response JSON) */
282
+ handle_route(path: string, method: string, request_json: string): string;
283
+ /** Memory allocation for passing strings */
284
+ alloc(size: number): number;
285
+ /** Memory deallocation */
286
+ dealloc(ptr: number, size: number): void;
287
+ }
288
+ /**
289
+ * WASM memory interface
290
+ */
291
+ export interface WasmMemory {
292
+ buffer: ArrayBuffer;
293
+ }
294
+ /**
295
+ * WASM instance with memory and exports
296
+ */
297
+ export interface WasmPluginInstance {
298
+ exports: WasmPluginExports;
299
+ memory: WasmMemory;
300
+ }
301
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../typescript/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,6BAA6B;IAC7B,QAAQ,EAAE,eAAe,CAAC;IAC1B,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,aAAa,CAAC,EAAE,M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AAM,GACjB,MAAM,CAAC;IAEV,6CAA6C;IAC7C,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IAEzE,4CAA4C;IAC5C,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAE5B,0BAA0B;IAC1B,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE,UAAU,CAAC;CACpB"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Cross-language interop types for elizaOS
3
+ *
4
+ * These types define the wire format for communication between
5
+ * different language runtimes (Rust, TypeScript, Python).
6
+ *
7
+ * Standalone definitions matching proto schemas in /schemas/eliza/v1/ipc.proto.
8
+ * For full proto-generated types, import from @elizaos/core.
9
+ */
10
+ export {};
@@ -0,0 +1,32 @@
1
+ /**
2
+ * WASM Plugin Loader for elizaOS
3
+ *
4
+ * Loads Rust (or other) plugins compiled to WebAssembly and adapts them
5
+ * to the TypeScript Plugin interface.
6
+ */
7
+ import type { Plugin } from "@elizaos/core";
8
+ import type { PluginManifest } from "./types";
9
+ /**
10
+ * Options for loading a WASM plugin
11
+ */
12
+ export interface WasmLoaderOptions {
13
+ /** Path or URL to the WASM file */
14
+ wasmPath: string;
15
+ /** Optional path to plugin.json manifest (auto-detected if not provided) */
16
+ manifestPath?: string;
17
+ /** Import object for WASM instantiation */
18
+ imports?: WebAssembly.Imports;
19
+ }
20
+ /**
21
+ * Load a WASM plugin and return an elizaOS Plugin interface
22
+ */
23
+ export declare function loadWasmPlugin(options: WasmLoaderOptions): Promise<Plugin>;
24
+ /**
25
+ * Preload and validate a WASM plugin without fully loading it
26
+ */
27
+ export declare function validateWasmPlugin(wasmPath: string): Promise<{
28
+ valid: boolean;
29
+ manifest?: PluginManifest;
30
+ error?: string;
31
+ }>;
32
+ //# sourceMappingURL=wasm-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm-loader.d.ts","sourceRoot":"","sources":["../../typescript/wasm-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EASV,MAAM,EAKP,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAEV,cAAc,EAIf,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC;CAC/B;AAQD;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,MAAM,CAAC,CAkBjB;AAsTD;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAClE,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAkBD"}