@muhkoo/connect 0.4.0-alpha.1 → 0.6.0-alpha.11
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 +40 -10
- package/dist/browser/index.js +895 -40
- package/dist/browser/index.js.map +1 -1
- package/dist/connect.d.ts +435 -10
- package/dist/server/index.js +895 -40
- package/dist/server/index.js.map +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Client SDK for the Muhkoo Accelerator. The headline surface is a single
|
|
4
4
|
**`Client`** that hangs everything off its namespaces —
|
|
5
|
-
`client.auth` / `client.kv` / `client.
|
|
6
|
-
`client.space` / `client.agents` / `client.functions` —
|
|
5
|
+
`client.auth` / `client.kv` / `client.db` / `client.storage` /
|
|
6
|
+
`client.message` / `client.space` / `client.agents` / `client.functions` —
|
|
7
|
+
backed by
|
|
7
8
|
end-to-end-encrypted messaging (fan-out group channels with history, plus Double
|
|
8
9
|
Ratchet + ECDH P-384 for direct messages), ZK identity + personal/shared spaces,
|
|
9
|
-
server-side Programmable Agents, developer-authored serverless functions, and
|
|
10
|
-
|
|
10
|
+
server-side Programmable Agents, developer-authored serverless functions, and an
|
|
11
|
+
edge-compatible Groth16 verifier — all bundled from a single
|
|
11
12
|
TypeScript source tree.
|
|
12
13
|
|
|
13
14
|
See [`CHANGELOG.md`](./CHANGELOG.md) for what's new.
|
|
@@ -18,10 +19,17 @@ See [`CHANGELOG.md`](./CHANGELOG.md) for what's new.
|
|
|
18
19
|
## What's in the box
|
|
19
20
|
|
|
20
21
|
- **`Client`** — the unified entry point. `new Client({ apiKey, baseUrl })`
|
|
21
|
-
exposes `auth` (ZK register/login), `
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
exposes, over one shared session: `auth` (ZK register/login), `kv` (per-user
|
|
23
|
+
encrypted key/value), `db` (the app's scalable database), `storage` (encrypted
|
|
24
|
+
files), `message` (pub/sub + E2E direct messages), `space` (fan-out group
|
|
25
|
+
channels with history), `agents` (server-side Programmable Agents), and
|
|
26
|
+
`functions` (developer-authored serverless functions). This is the supported
|
|
27
|
+
surface; everything below is a building block it composes.
|
|
28
|
+
|
|
29
|
+
- **App-describing decorators** — `@MuhkooAgent` / `@MuhkooSpace` / `@MuhkooDB` /
|
|
30
|
+
`@MuhkooFunction` annotate a plain class with your app's agent-facing surface;
|
|
31
|
+
`ejectAgentPrompt()` / `ejectAgentTools()` turn that into a `systemPrompt` +
|
|
32
|
+
tool allowlist for a Programmable Agent. See the [agents reference](https://docs.muhkoo.dev/reference/agents/).
|
|
25
33
|
|
|
26
34
|
- **`BroadcastChannel`** — multi-peer end-to-end-encrypted "room". Wires
|
|
27
35
|
`WSTransport` (socket lifecycle, reconnect, offline queue) together with
|
|
@@ -191,7 +199,7 @@ await client.space.roster(space.id); // member identity pubkeys
|
|
|
191
199
|
```
|
|
192
200
|
|
|
193
201
|
**Programmable Agents (`client.agents`).** Server-side "virtual users" backed by
|
|
194
|
-
|
|
202
|
+
the edge AI runtime: an app editor gives an agent a persona (system prompt), a
|
|
195
203
|
model, and **triggers** (e.g. reply on @-mention), then enables it per-Space;
|
|
196
204
|
members chat with it inside that Space. Management is session-authed (owner or
|
|
197
205
|
Space editor) and **paid-tier-only**. Enabling an agent on a Space makes that
|
|
@@ -202,7 +210,7 @@ blind.
|
|
|
202
210
|
const { config } = await client.agents.create(appId, {
|
|
203
211
|
handle: "@assistant",
|
|
204
212
|
displayName: "Assistant",
|
|
205
|
-
model: "
|
|
213
|
+
model: "meta/llama-3.1-8b-instruct",
|
|
206
214
|
systemPrompt: "You are a concise, friendly teammate in this Space.",
|
|
207
215
|
triggers: [{ type: "mention" }],
|
|
208
216
|
});
|
|
@@ -210,6 +218,28 @@ await client.agents.enable(appId, config.agentId, space.id); // per-Space opt-i
|
|
|
210
218
|
// list / update / delete / disable also available.
|
|
211
219
|
```
|
|
212
220
|
|
|
221
|
+
Give the agent **tools** (a function-calling loop over the app's database,
|
|
222
|
+
functions, and channels) by passing `tools` — requires a function-calling
|
|
223
|
+
`model`. Generate both the prompt and the tool allowlist from decorators:
|
|
224
|
+
|
|
225
|
+
```typescript
|
|
226
|
+
import { MuhkooAgent, MuhkooSpace, MuhkooDB, ejectAgentPrompt, ejectAgentTools } from "@muhkoo/connect";
|
|
227
|
+
|
|
228
|
+
@MuhkooAgent({ name: "Assistant", purpose: "A helpful teammate in this chat." })
|
|
229
|
+
class ChatApp {
|
|
230
|
+
@MuhkooSpace({ description: "Main team discussion." }) general!: string;
|
|
231
|
+
@MuhkooDB({ access: "read", description: "Chat message history." }) messages!: unknown;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
await client.agents.create(appId, {
|
|
235
|
+
handle: "@assistant",
|
|
236
|
+
displayName: "Assistant",
|
|
237
|
+
model: "openai/gpt-oss-120b", // a function-calling model
|
|
238
|
+
systemPrompt: ejectAgentPrompt(ChatApp),
|
|
239
|
+
tools: ejectAgentTools(ChatApp),
|
|
240
|
+
});
|
|
241
|
+
```
|
|
242
|
+
|
|
213
243
|
**Serverless Functions (`client.functions`).** Deploy your own code that runs on
|
|
214
244
|
the accelerator. A function is an untrusted single-module ES worker
|
|
215
245
|
(`export default { fetch }`) with two triggers: **HTTP** (reachable at its own
|