@slashml/memory 1.0.6 → 1.0.7
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 +7 -1
- package/bin/cli.js +14 -5
- package/dist/index.js +1 -1
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/src/index.ts +2 -2
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# `@slashml/memory`
|
|
1
|
+
# `@slashml/memory` -- TypeScript / Node.js SDK
|
|
2
2
|
|
|
3
3
|
Official TypeScript & Node.js client and MCP launcher for the **/ ml** Memory Cloud API (`https://api.slashml.ai`).
|
|
4
4
|
|
|
@@ -89,3 +89,9 @@ const decision = await client.intervene("aws ec2 run-instances --placement Avail
|
|
|
89
89
|
userId: "team_infra",
|
|
90
90
|
});
|
|
91
91
|
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
Apache-2.0
|
package/bin/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* @slashml/memory
|
|
3
|
+
* @slashml/memory -- Self-Contained CLI & MCP Stdio Server (/ml-memory)
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const fs = require("fs");
|
|
@@ -10,10 +10,10 @@ const readline = require("readline");
|
|
|
10
10
|
|
|
11
11
|
const DEFAULT_BASE_URL = "https://api.slashml.ai";
|
|
12
12
|
const DEFAULT_CONSOLE_URL = "https://app.slashml.ai";
|
|
13
|
-
const PACKAGE_VERSION = "1.0.
|
|
13
|
+
const PACKAGE_VERSION = "1.0.7";
|
|
14
14
|
|
|
15
15
|
function printHelp() {
|
|
16
|
-
console.log(`@slashml/memory v${PACKAGE_VERSION}
|
|
16
|
+
console.log(`@slashml/memory v${PACKAGE_VERSION} -- Official CLI & MCP Stdio Server for / ml (SlashML · https://slashml.ai)
|
|
17
17
|
Publisher: SlashML (https://slashml.ai)
|
|
18
18
|
|
|
19
19
|
Usage:
|
|
@@ -1330,7 +1330,7 @@ const STANDARD_TOOLS = [
|
|
|
1330
1330
|
{
|
|
1331
1331
|
name: "add_memory",
|
|
1332
1332
|
description:
|
|
1333
|
-
"Explicitly store a memory in `/ ml` Cloud ONLY when the user directly asks you to call `add_memory`. Do NOT call `add_memory` proactively on normal user prompts, rules, or preferences
|
|
1333
|
+
"Explicitly store a memory in `/ ml` Cloud ONLY when the user directly asks you to call `add_memory`. Do NOT call `add_memory` proactively on normal user prompts, rules, or preferences -- ambient lifecycle hooks automatically assimilate user rules, constraints, and state mutations in the background.",
|
|
1334
1334
|
inputSchema: {
|
|
1335
1335
|
type: "object",
|
|
1336
1336
|
properties: {
|
|
@@ -1661,15 +1661,24 @@ async function dispatchTool(opts, name, args = {}) {
|
|
|
1661
1661
|
}
|
|
1662
1662
|
if (name === "search_memories") {
|
|
1663
1663
|
const k = Number(args.limit || args.top_k || 5);
|
|
1664
|
+
const mergedFilters = {
|
|
1665
|
+
...(args.filters && typeof args.filters === "object" ? args.filters : {}),
|
|
1666
|
+
...(args.include_code !== undefined ? { include_code: Boolean(args.include_code) } : {}),
|
|
1667
|
+
...(args.kind ? { kind: String(args.kind) } : {}),
|
|
1668
|
+
};
|
|
1664
1669
|
return apiRequest(opts, "POST", "/v1/memories/search", {
|
|
1665
1670
|
query: args.query,
|
|
1666
1671
|
user_id: uid,
|
|
1667
1672
|
limit: k,
|
|
1668
1673
|
top_k: k,
|
|
1674
|
+
...(Object.keys(mergedFilters).length > 0 ? { filters: mergedFilters } : {}),
|
|
1669
1675
|
});
|
|
1670
1676
|
}
|
|
1671
1677
|
if (name === "get_memories") {
|
|
1672
|
-
const
|
|
1678
|
+
const paramsObj = { user_id: uid, limit: String(args.limit || 50) };
|
|
1679
|
+
if (args.include_code !== undefined) paramsObj.include_code = String(Boolean(args.include_code));
|
|
1680
|
+
if (args.kind) paramsObj.kind = String(args.kind);
|
|
1681
|
+
const q = new URLSearchParams(paramsObj);
|
|
1673
1682
|
return apiRequest(opts, "GET", `/v1/memories?${q.toString()}`);
|
|
1674
1683
|
}
|
|
1675
1684
|
if (name === "forget_memory") {
|
package/dist/index.js
CHANGED
|
@@ -182,7 +182,7 @@ class MemoryClient {
|
|
|
182
182
|
const headers = {
|
|
183
183
|
Accept: "application/json",
|
|
184
184
|
"Content-Type": "application/json",
|
|
185
|
-
"User-Agent": "slashml-memory-ts/1.0.
|
|
185
|
+
"User-Agent": "slashml-memory-ts/1.0.7",
|
|
186
186
|
};
|
|
187
187
|
if (this.apiKey) {
|
|
188
188
|
headers.Authorization = `Bearer ${this.apiKey}`;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @slashml/memory
|
|
2
|
+
* @slashml/memory -- Official TypeScript / Node.js SDK for the / ml Memory API (ESM)
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
export const DEFAULT_BASE_URL = "https://api.slashml.ai";
|
|
@@ -184,7 +184,7 @@ export class MemoryClient {
|
|
|
184
184
|
const headers = {
|
|
185
185
|
Accept: "application/json",
|
|
186
186
|
"Content-Type": "application/json",
|
|
187
|
-
"User-Agent": "slashml-memory-ts/1.0.
|
|
187
|
+
"User-Agent": "slashml-memory-ts/1.0.7",
|
|
188
188
|
};
|
|
189
189
|
if (this.apiKey) {
|
|
190
190
|
headers.Authorization = `Bearer ${this.apiKey}`;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @slashml/memory
|
|
2
|
+
* @slashml/memory -- Official TypeScript / Node.js SDK for the / ml Memory API
|
|
3
3
|
*
|
|
4
4
|
* 100% drop-in replacement for `mem0ai` (`MemoryClient`, `AsyncMemoryClient`, `Memory`, `AsyncMemory`).
|
|
5
5
|
* Zero external runtime dependencies (uses native Node.js 18+ / Web `fetch`).
|
|
@@ -330,7 +330,7 @@ export class MemoryClient {
|
|
|
330
330
|
const headers: Record<string, string> = {
|
|
331
331
|
Accept: "application/json",
|
|
332
332
|
"Content-Type": "application/json",
|
|
333
|
-
"User-Agent": "slashml-memory-ts/1.0.
|
|
333
|
+
"User-Agent": "slashml-memory-ts/1.0.7",
|
|
334
334
|
};
|
|
335
335
|
if (this.apiKey) {
|
|
336
336
|
headers.Authorization = `Bearer ${this.apiKey}`;
|