@mnemosyne_os/sdk 1.1.0 → 1.2.1
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 +56 -2
- package/dist/index.cjs +272 -3679
- package/dist/index.d.cts +501 -49
- package/dist/index.d.ts +501 -49
- package/dist/index.js +252 -3688
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -23,9 +23,10 @@ and exposes a WebSocket API for Layer 2 apps to tap into its cognitive engine.
|
|
|
23
23
|
|
|
24
24
|
| Package | Version | Role |
|
|
25
25
|
|---------|---------|------|
|
|
26
|
+
| [`@mnemosyne_os/mcp`](https://www.npmjs.com/package/@mnemosyne_os/mcp) | latest | MCP server — plug Claude / Cursor / any MCP agent into your vault |
|
|
26
27
|
| [`@mnemosyne_os/forge`](https://www.npmjs.com/package/@mnemosyne_os/forge) | `1.4.7` | CLI — scaffold, chronicles, MCP server |
|
|
27
28
|
| [`@mnemosyne_os/sync`](https://www.npmjs.com/package/@mnemosyne_os/sync) | `0.0.1` | P2P — multi-agent synchronization |
|
|
28
|
-
| **`@mnemosyne_os/sdk`** | **`1.
|
|
29
|
+
| **`@mnemosyne_os/sdk`** | **`1.2.0`** | **SDK — build Layer 2 apps** |
|
|
29
30
|
|
|
30
31
|
---
|
|
31
32
|
|
|
@@ -64,7 +65,7 @@ npm install @mnemosyne_os/sdk
|
|
|
64
65
|
"id": "my-layer2-app",
|
|
65
66
|
"name": "My Layer 2 App",
|
|
66
67
|
"version": "1.0.0",
|
|
67
|
-
"mnemosyne_sdk": "^1.
|
|
68
|
+
"mnemosyne_sdk": "^1.2.0",
|
|
68
69
|
"scopes": ["vault:read:DEV", "vault:write:DEV"],
|
|
69
70
|
"vaults": ["DEV"],
|
|
70
71
|
"intents": ["INGEST", "QUERY"]
|
|
@@ -128,6 +129,38 @@ await client.disconnect();
|
|
|
128
129
|
|
|
129
130
|
---
|
|
130
131
|
|
|
132
|
+
## Semantic Ranking (v1.2+)
|
|
133
|
+
|
|
134
|
+
By default `query()` returns the **N most recent chronicles** — fast (~5 ms) and good for "what changed lately" panes.
|
|
135
|
+
For agent-style relevance, opt into the **semantic branch**:
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
const result = await client.query('JWT auth refactor decisions', {
|
|
139
|
+
vault: 'DEV',
|
|
140
|
+
limit: 10,
|
|
141
|
+
semantic: true, // ← opt-in true semantic ranking
|
|
142
|
+
scope: 'SOURCE_CODE', // ← cognitive scope (boosts ARCHITECTURE / GIT / API)
|
|
143
|
+
spineTypeFilter: ['ARCHITECTURE', 'GIT'] // ← optional whitelist
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
console.log(result.chronicles);
|
|
147
|
+
// result._semantic = { used: true, vectorDim: 768, vaultSize: 5912 }
|
|
148
|
+
// ↑ confirms the semantic branch ran (vs. silent fallback to recent)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
| `QueryOptions` field | Default | What it does |
|
|
152
|
+
|---|---|---|
|
|
153
|
+
| `semantic` | `false` | Embeds the query and ranks by cosine × spineType weight. Without it: recent N. |
|
|
154
|
+
| `scope` | `'SOURCE_CODE'` | Cognitive scope that drives the type-weight table (ARCHITECTURE ×1.40, GIT ×1.35, etc.). |
|
|
155
|
+
| `spineTypeFilter` | `undefined` | Server-side SQL `IN` clause — restricts results to listed types. |
|
|
156
|
+
| `threshold` | `0.0` | Minimum cosine score (0–1) before type-weighting. |
|
|
157
|
+
|
|
158
|
+
The runtime applies an **exact-term boost** for identifier-like tokens in your query (uppercased words ≥4 chars, hyphenated codes, version numbers). Matching chronicles get `cosine × (1 + matchCount × 0.5)`, surfacing docs that contain rare identifiers verbatim — which dense embeddings alone tend to miss.
|
|
159
|
+
|
|
160
|
+
The optional `_semantic` field on `QueryResult` is your debug breadcrumb: it tells you whether the semantic branch ran, what dimension the query vector had, how many chronicles were in the target vault, and the error message if it silently fell back to "recent" (e.g. embedding provider not registered).
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
131
164
|
## Full API — `MnemoClientBrowser`
|
|
132
165
|
|
|
133
166
|
### Connection
|
|
@@ -284,6 +317,27 @@ if (!validation.valid) process.exit(1);
|
|
|
284
317
|
|
|
285
318
|
## Changelog
|
|
286
319
|
|
|
320
|
+
### v1.2.0 — 2026-06-07 — Semantic Bridge
|
|
321
|
+
|
|
322
|
+
- **NEW** `QueryOptions.semantic?: boolean` — opt-in true semantic ranking (server embeds query, ranks by cosine × spineType weight).
|
|
323
|
+
- **NEW** `QueryOptions.scope?: string` — cognitive scope for the type-weight table (default `'SOURCE_CODE'`, boosts ARCHITECTURE / GIT / API).
|
|
324
|
+
- **NEW** `QueryOptions.spineTypeFilter?: string[]` — server-side `IN` filter to restrict results to specific spineTypes.
|
|
325
|
+
- **NEW** `QueryResult._semantic?: QuerySemanticDebug` — breadcrumb that tells you whether the semantic branch ran, the vector dim used, and the vault size (or the fallback reason).
|
|
326
|
+
- **NEW** Exported `QuerySemanticDebug` type.
|
|
327
|
+
- **FIX** Bundle no longer crashes under pure Node ESM. v1.1.0 inlined `ws` and produced a tsup `__require2('events')` shim that threw `Dynamic require of "events" is not supported` at module load — making `npm install @mnemosyne_os/sdk` followed by `import` from any plain Node script crash on startup. `ws` is now an `optionalDependency`, marked external in the build, so the SDK loads cleanly in any ESM context (MCP servers, CLIs, Node services).
|
|
328
|
+
- **COMPAT** Fully backward-compatible: existing `query(text, options)` calls without the new fields behave exactly as in 1.1.0.
|
|
329
|
+
|
|
330
|
+
### v2.0.0 — 2026-05-01 — Phase 59 Active Cognitive Filter
|
|
331
|
+
|
|
332
|
+
- **NEW** `bridge:read` scope — unlocks `computeResonance`, `getBridgeHistory`, `getBridgeSessions`
|
|
333
|
+
- **UPGRADE** `computeResonance` now uses **true vector embedding** (Phase 59):
|
|
334
|
+
embed input text → cosine vs. stored bridge spine vectors → real similarity scores.
|
|
335
|
+
Falls back to keyword heuristic (Phase 58) when embedding model is offline.
|
|
336
|
+
- **NEW** `docs/BRIDGE_API.md` — full Bridge API reference
|
|
337
|
+
- **NEW** `docs/MANIFEST.md` — `mnemoapp.json` manifest specification
|
|
338
|
+
- **NEW** `mnemoapp.json` replaces `app.manifest.json` (old format still accepted, deprecated)
|
|
339
|
+
- **NEW** `api_version: "2.0"` field in manifest (replaces `mnemosyne_sdk`)
|
|
340
|
+
|
|
287
341
|
### v1.1.0 — 2026-04-27
|
|
288
342
|
- **NEW** `MnemoClientBrowser` — zero-dependency browser client (native WebSocket API)
|
|
289
343
|
- **NEW** `sdk.resonances.list` — fetch real Resonance objects from the vault
|