Open an aindrive drive as a read-only folder in Memona
Agents / bot (pull_request) Has been skipped
CI / checks (pull_request) Failing after 1m21s

The plugin reaches a drive through aindrive's remote MCP endpoint with
the drive's access token. Opening a connection asks which tools the
token may call, so it works while the drive's machine sleeps. Listing,
stat and reading map to list_files, stat and read_file; a read is
statted first, and a file whose length changed in between is refused as
a conflict. Reads decode only the window asked for, straight from the
reply pieces, so any 1 MiB slice of a file up to aindrive's 8 MiB limit
fits Memona's per-call fuel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 22:51:35 +09:00
parent 4ef9b217fa
commit 3c2cd123b7
17 changed files with 2536 additions and 2 deletions
+65 -2
View File
@@ -2,5 +2,68 @@
Opens an [aindrive](https://github.com/ainetwork-ai/aindrive) drive as a
folder inside Memona, so agents and the file manager work in it like any local
directory, from any machine. It reaches the drive through aindrive's remote MCP
endpoint with the drive's access token.
directory, from any machine. The plugin is a WASI component: it speaks no
sockets of its own and makes every request through the host's HTTP interface,
to the drive's remote MCP endpoint, with the drive's access token.
It registers one provider, `aindrive`, for the `aindrive` scheme.
This package requires a Memona version that supports plugin manifest schema 2.
## Connecting
In aindrive, open the drive and choose **MCP** in its sidebar. Copy the
**Server URL**, then under **Option B · Access token** generate a token and
copy it; aindrive shows it only once.
| Field | Meaning |
| --- | --- |
| Server URL | The drive's MCP server URL, for example `https://aindrive.ainetwork.ai/mcp/d/AbCdEf123456`. The drive's own page address, `…/d/AbCdEf123456`, works too, as does a self-hosted server. |
| Access token | The `aind_pat_…` token, stored as a secret |
Saving the connection checks the address and the token. It does not need the
machine that shares the drive to be online, but its files only answer while
that machine runs aindrive; until then they report the folder unavailable.
## What works
Browsing folders and reading files. aindrive reads a file whole, at most
8 MiB at a time, so a larger file is refused as unsupported rather than cut
short. A read is checked against the size the drive reported a moment before,
so a file that changes in between is a conflict rather than a mix of two
versions. Names the drive's machine allows but Memona cannot show, such as one
containing a backslash, are left out of listings.
Saving, creating folders, renaming and deleting are not supported yet, and
neither is change polling.
## Building
```sh
rustup target add wasm32-wasip2
cargo build --locked --release --target wasm32-wasip2
```
The component lands at
`target/wasm32-wasip2/release/memona_plugin_aindrive.wasm`.
`wit/filesystem.wit` is a copy of the canonical Memona filesystem contract, and
`src/sdk.rs` generates the guest bindings from it, so this repository builds
without a Memona checkout. Refresh the copy from `plugin_system/sdk/wit` in the
[Memona repository](https://git.capsulizers.com/lead/memona) when the contract
moves, and keep `apiVersion` in `manifest.json` in step.
## Packaging for the plugin store
A `.memona-plugin` package is a ZIP archive with the files at its root, never
inside a directory:
```sh
cargo build --locked --release --target wasm32-wasip2
cp target/wasm32-wasip2/release/memona_plugin_aindrive.wasm plugin.wasm
zip memona-plugin-aindrive.memona-plugin \
manifest.json plugin.wasm README.md LICENSE
```
`manifest.json` and `plugin.wasm` are required; `README.md` becomes the guide on
the plugin's public page and `LICENSE` is shown beside it.