| Crates.io | aimo-note-agent |
| lib.rs | aimo-note-agent |
| version | 0.1.5 |
| created_at | 2025-07-13 08:43:26.148395+00 |
| updated_at | 2025-07-14 08:29:34.938588+00 |
| description | AIMO note app agent built with Amico |
| homepage | |
| repository | https://github.com/AIMOverse/note-agent |
| max_upload_size | |
| id | 1750175 |
| size | 566,880 |
# For example, build for AIMOverse npm package scope.
# This will produce `@aimoverse/aimo-app-amico`
wasm-pack build --target web --out-dir pkg-wasm --scope aimoverse
# Publish the package
cd pkg-wasm && npm publish --access public
See the ./example react project for example.
You can copy & paste ./example/src/hooks/useAmico.js or the following code into your hooks folder to start.
import { useState, useEffect } from "react";
/**
* Hook to initialize and manage the WASM module
* @returns {Object} { isReady, error, wasmModule }
*/
export function useAmico() {
const [isReady, setIsReady] = useState(false);
const [error, setError] = useState(null);
const [wasmModule, setWasmModule] = useState(null);
useEffect(() => {
const initWasm = async () => {
try {
setError(null);
// Dynamic import of WASM module and binary
const [wasmModule, wasmUrl] = await Promise.all([
import("@aimoverse/aimo-app-amico"),
import("@aimoverse/aimo-app-amico/aimo_app_amico_bg.wasm?url"),
]);
console.log("WASM module loaded:", wasmModule);
console.log("WASM binary URL:", wasmUrl.default);
// Initialize the WASM module with the proper binary URL
await wasmModule.default(wasmUrl.default);
console.log("WASM module initialized");
setWasmModule(wasmModule);
setIsReady(true);
} catch (err) {
console.error("Failed to initialize WASM:", err);
setError(err);
}
};
initWasm();
}, []);
return { isReady, error, wasmModule };
}
An example to use useAmico hook is in ./example/src/hooks/useAgent.js.