open-index/open-npm huggingface dataset:
npm package: @mubit-ai/ai-sdk
Description: Vercel AI SDK middleware backed by MuBit memory engine
Author: MuBit AI
Latest version: 0.5.0

# `@mubit-ai/ai-sdk`

Vercel AI SDK middleware backed by [MuBit](https://mubit.ai) memory engine.

Wraps any AI SDK model with automatic memory injection and interaction capture.

## Install

```bash
npm install @mubit-ai/ai-sdk
```

## Usage

```js
import { wrapLanguageModel } from "ai";
import { mubitMemoryMiddleware } from "@mubit-ai/ai-sdk";

const model = wrapLanguageModel({
  model: openai("gpt-4o"),
  middleware: mubitMemoryMiddleware({
    apiKey: "mbt_...",
    sessionId: "session-1",
  }),
});

// All generateText/streamText calls through this model
// automatically get lessons injected + interactions captured
const { text } = await generateText({ model, prompt: "Hello" });
```

## How it works

The middleware has two hooks:

1. **`transformParams`** — Before each LLM call, fetches relevant lessons from MuBit and injects them into the system prompt
2. **`wrapGenerate`** — After each LLM call, captures the interaction and ingests it to MuBit (fire-and-forget)

## Options

| Option | Default | Description |
| --- | --- | --- |
| `apiKey` | `MUBIT_API_KEY` | MuBit API key |
| `endpoint` | `MUBIT_ENDPOINT` / `http://127.0.0.1:3000` | MuBit endpoint URL |
| `sessionId` | `"default"` | Session/run ID for scoping memory |
| `userId` | `""` | User ID for scoping memory |
| `agentId` | `"ai-sdk"` | Agent ID for attribution |
| `maxTokenBudget` | `2048` | Token budget for context retrieval |
| `entryTypes` | server default | Memory entry types to retrieve |
| `sections` | server default | Context sections to include |
| `injectLessons` | `true` | Whether to inject lessons before calls |
| `captureInteractions` | `true` | Whether to capture interactions after calls |
| `failOpen` | `true` | Proceed without lessons on error |
| `mubitClient` | auto-created | Pre-configured MuBit client |

## Features

- TTL-bounded in-memory cache (30s, 100 entries) for context retrieval
- Fail-open by default — LLM calls proceed even if MuBit is unreachable
- Fire-and-forget ingestion — doesn't block on capture
- Compatible with `generateText`, `streamText`, and any AI SDK model

## Development

```bash
node --test test/**/*.test.js
```

## License

Apache-2.0
npm package: @mubit-ai/langgraph
Description: LangGraph.js BaseStore backed by MuBit memory engine
Author: MuBit AI
Latest version: 0.5.0

# `@mubit-ai/langgraph`

LangGraph.js `BaseStore` backed by [MuBit](https://mubit.ai).

This adapter now uses the canonical JS SDK transport layer internally, while preserving the LangGraph store interface and adding MuBit-specific helpers for long-running MAS and coding-agent loops.

## Install

```bash
npm install @mubit-ai/langgraph @langchain/langgraph @mubit-ai/sdk
```

## Basic usage

```javascript
import { MubitStore } from "@mubit-ai/langgraph";

const store = new MubitStore({
  endpoint: "http://127.0.0.1:3000",
  apiKey: process.env.MUBIT_API_KEY,
});

await store.put(["memories", "user-1", "session-1"], "deploy-note", {
  text: "Canary before rollout.",
  intent: "lesson",
  source: "human",
});

const results = await store.search(["memories", "user-1"], {
  query: "What rollout lesson do we have?",
  limit: 5,
});
```

## Namespace mapping

| Namespace | MuBit scope |
| --- | --- |
| `["memories"]` | global |
| `["memories", userId]` | user-scoped |
| `["memories", userId, sessionId]` | user + session scoped |

## Store behavior

- `put()` writes through MuBit control ingest with `upsert_key`
- `get()` and `search()` use MuBit control query
- evidence metadata is normalized from current MuBit response fields
- `listNamespaces()` remains local cache based
- `delete()` remains a no-op because MuBit deletion is explicit and scope-based

## MuBit extension methods

Existing MAS helpers:

- `checkpoint(namespace, snapshot, options)`
- `recordOutcome(namespace, referenceId, outcome, options)`
- `surfaceStrategies(namespace, options)`

Current observability and coordination helpers:

- `getContext(namespace, options)`
- `memoryHealth(namespace, options)`
- `diagnose(namespace, options)`
- `archive(namespace, options)`
- `dereference(namespace, options)`
- `registerAgent(namespace, options)`
- `listAgents(namespace)`
- `handoff(namespace, options)`
- `feedback(namespace, options)`

## Config

| Option | Default | Purpose |
| --- | --- | --- |
| `endpoint` | `http://127.0.0.1:3000` | MuBit HTTP endpoint |
| `apiKey` / `api_key` | `""` | MuBit API key |

For tests or advanced embedding, you can inject `mubitClient` directly.

## Development

```bash
cd integrations/javascript/mubit-langgraph
npm install
npm test
```

## License

Apache-2.0