@muhkoo/connect 0.15.0-alpha.10 → 0.15.0-alpha.12
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 +45 -2
- package/dist/browser/index.js +4998 -1261
- package/dist/browser/index.js.map +1 -1
- package/dist/connect.d.ts +1384 -148
- package/dist/connect.workers.d.ts +306 -2
- package/dist/server/index.js +4998 -1261
- package/dist/server/index.js.map +1 -1
- package/dist/workers/index.js +325 -1
- package/dist/workers/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Client SDK for the Muhkoo Accelerator. The headline surface is a single
|
|
|
4
4
|
**`Client`** that hangs everything off its namespaces —
|
|
5
5
|
`client.auth` / `client.kv` / `client.db` / `client.storage` / `client.vfs` /
|
|
6
6
|
`client.vcs` / `client.message` / `client.space` / `client.agents` /
|
|
7
|
-
`client.functions` / `client.accessTokens` / `client.offline` — backed by
|
|
7
|
+
`client.functions` / `client.accessTokens` / `client.vectors` / `client.offline` — backed by
|
|
8
8
|
end-to-end-encrypted messaging (fan-out group channels with history, plus Double
|
|
9
9
|
Ratchet + ECDH P-384 for direct messages), ZK identity + personal/shared spaces,
|
|
10
10
|
server-side Programmable Agents, developer-authored serverless functions, and an
|
|
@@ -25,7 +25,8 @@ See [`CHANGELOG.md`](./CHANGELOG.md) for what's new.
|
|
|
25
25
|
(pub/sub + E2E direct messages), `space` (fan-out group channels with
|
|
26
26
|
history), `agents` (server-side Programmable Agents), `functions`
|
|
27
27
|
(developer-authored serverless functions), `accessTokens` (scoped machine
|
|
28
|
-
credentials),
|
|
28
|
+
credentials), `vectors` (vector search over the app's collections), and
|
|
29
|
+
`offline` (CRDT sync). This is the supported surface;
|
|
29
30
|
everything below is a building block it composes.
|
|
30
31
|
|
|
31
32
|
- **App-describing decorators** — `@MuhkooAgent` / `@MuhkooSpace` / `@MuhkooDB` /
|
|
@@ -444,6 +445,48 @@ cause. The limits, messages and every behaviour change are listed under
|
|
|
444
445
|
*Filesystem and version control* in [`API_REFERENCE.md`](./API_REFERENCE.md);
|
|
445
446
|
[`CHANGELOG.md`](./CHANGELOG.md) says why each one changed.
|
|
446
447
|
|
|
448
|
+
### Vector search (`client.vectors`)
|
|
449
|
+
|
|
450
|
+
Collections hold entries you search by meaning. In text mode Muhkoo makes the
|
|
451
|
+
vectors from your text; in vectors mode you send your own. The store is
|
|
452
|
+
**server-readable**: Muhkoo can read entries, text and data, so don't put
|
|
453
|
+
anything there you need kept from the server. The app owner creates collections
|
|
454
|
+
(`client.vectors.createCollection(appId, name, definition)` then
|
|
455
|
+
`waitForCollection`, which waits up to 10 minutes) or in the portal.
|
|
456
|
+
|
|
457
|
+
```ts
|
|
458
|
+
const docs = client.vectors.collection("docs");
|
|
459
|
+
|
|
460
|
+
// Writes are accepted at once and become searchable shortly after,
|
|
461
|
+
// usually within a minute or two.
|
|
462
|
+
const { mutationId } = await docs.upsert([
|
|
463
|
+
{ id: "a", text: "How to reset a password", data: { category: "help" } },
|
|
464
|
+
]);
|
|
465
|
+
await docs.waitFor(mutationId); // polls status; waits up to 5 minutes
|
|
466
|
+
|
|
467
|
+
const matches = await docs.query({ text: "forgot my password", topK: 5, filter: { category: "help" } });
|
|
468
|
+
|
|
469
|
+
// To wait on a ready notice instead of polling, the Space must be registered
|
|
470
|
+
// as a notice Space for the environment. The app owner does this once:
|
|
471
|
+
const space = await client.space.joinChannel("docs-updates");
|
|
472
|
+
await client.vectors.setNotices(appId, "docs", "live", { spaces: [space.id], defaultSpace: space.id });
|
|
473
|
+
|
|
474
|
+
// Name it with `notify` (or rely on the defaultSpace) and listen on it.
|
|
475
|
+
await docs.upsertAndWait([{ id: "b", text: "Changing your email" }], {
|
|
476
|
+
space,
|
|
477
|
+
notify: { space: space.id },
|
|
478
|
+
});
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
The server sends the ready notice only to a registered notice Space: the one named
|
|
482
|
+
in `notify.space`, or the environment's `defaultSpace`. Naming a Space that isn't
|
|
483
|
+
registered fails the upsert with a 400 `notice_space_not_registered`. Any other
|
|
484
|
+
Space you pass as `space` never receives the notice, so the wait still completes,
|
|
485
|
+
by polling, usually within a minute or two.
|
|
486
|
+
|
|
487
|
+
A wait that runs out throws `VectorWaitTimeoutError` (with the `mutationId`); the
|
|
488
|
+
write itself still went through, and `docs.status(mutationId)` tells you later.
|
|
489
|
+
|
|
447
490
|
> The sections below document the lower-level building blocks the client is
|
|
448
491
|
> composed from (`BroadcastChannel`, `EncryptedSession`, `PersonalSpaceClient`,
|
|
449
492
|
> the Groth16 verifier, …). Reach for them directly only when you need control
|