alaya-mcp 0.2.3 → 0.2.5
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 +2 -0
- package/lib/analytics.js +100 -0
- package/package.json +12 -12
- package/scripts/postinstall.js +3 -0
package/README.md
CHANGED
package/lib/analytics.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const https = require("https");
|
|
4
|
+
const http = require("http");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
|
|
7
|
+
// Scarf pixel endpoint for install tracking
|
|
8
|
+
const DEFAULT_ENDPOINT =
|
|
9
|
+
"https://static.scarf.sh/a.png?x-pxid=c18dc510-7aec-427a-868b-2753233f9a35";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Check if the user has opted out of install analytics.
|
|
13
|
+
*
|
|
14
|
+
* Respects:
|
|
15
|
+
* SCARF_ANALYTICS=false (Scarf standard)
|
|
16
|
+
* DO_NOT_TRACK=1 (W3C standard)
|
|
17
|
+
* ALAYA_TELEMETRY=false (project-specific)
|
|
18
|
+
*/
|
|
19
|
+
function isOptedOut() {
|
|
20
|
+
const env = process.env;
|
|
21
|
+
if (env.SCARF_ANALYTICS === "false") return true;
|
|
22
|
+
if (env.DO_NOT_TRACK === "1") return true;
|
|
23
|
+
if (env.ALAYA_TELEMETRY === "false") return true;
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Build a telemetry payload with zero PII.
|
|
29
|
+
* Only sends: package name, version, platform, arch, node version.
|
|
30
|
+
*/
|
|
31
|
+
function buildPayload() {
|
|
32
|
+
let version = "0.0.0";
|
|
33
|
+
try {
|
|
34
|
+
const pkg = require(path.join(__dirname, "..", "package.json"));
|
|
35
|
+
version = pkg.version || version;
|
|
36
|
+
} catch {
|
|
37
|
+
// package.json not readable — use fallback
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
package: "alaya-mcp",
|
|
42
|
+
version,
|
|
43
|
+
platform: process.platform,
|
|
44
|
+
arch: process.arch,
|
|
45
|
+
nodeVersion: process.version,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Report install event to Scarf. Fire-and-forget with timeout.
|
|
51
|
+
*
|
|
52
|
+
* Returns:
|
|
53
|
+
* "opted-out" — user opted out
|
|
54
|
+
* "sent" — request sent successfully
|
|
55
|
+
* "error" — request failed (swallowed)
|
|
56
|
+
*
|
|
57
|
+
* Options:
|
|
58
|
+
* endpoint — override the Scarf pixel URL
|
|
59
|
+
* timeout — HTTP timeout in ms (default 3000)
|
|
60
|
+
*/
|
|
61
|
+
function reportInstall(options = {}) {
|
|
62
|
+
return new Promise((resolve) => {
|
|
63
|
+
if (isOptedOut()) {
|
|
64
|
+
return resolve("opted-out");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const payload = buildPayload();
|
|
68
|
+
const endpoint = options.endpoint || DEFAULT_ENDPOINT;
|
|
69
|
+
const timeout = options.timeout || 3000;
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
const url = new URL(endpoint);
|
|
73
|
+
|
|
74
|
+
// Append payload as query params (Scarf pixel approach)
|
|
75
|
+
url.searchParams.set("package", payload.package);
|
|
76
|
+
url.searchParams.set("version", payload.version);
|
|
77
|
+
url.searchParams.set("platform", payload.platform);
|
|
78
|
+
url.searchParams.set("arch", payload.arch);
|
|
79
|
+
url.searchParams.set("node", payload.nodeVersion);
|
|
80
|
+
|
|
81
|
+
const transport = url.protocol === "https:" ? https : http;
|
|
82
|
+
|
|
83
|
+
const req = transport.get(url.toString(), { timeout }, (res) => {
|
|
84
|
+
// Consume response to free socket
|
|
85
|
+
res.resume();
|
|
86
|
+
resolve("sent");
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
req.on("error", () => resolve("error"));
|
|
90
|
+
req.on("timeout", () => {
|
|
91
|
+
req.destroy();
|
|
92
|
+
resolve("error");
|
|
93
|
+
});
|
|
94
|
+
} catch {
|
|
95
|
+
resolve("error");
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
module.exports = { isOptedOut, buildPayload, reportInstall };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alaya-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Alaya MCP Server — a memory engine for AI agents that remembers, forgets, and learns",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -14,28 +14,28 @@
|
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"bin/",
|
|
17
|
+
"lib/",
|
|
17
18
|
"scripts/",
|
|
18
19
|
"README.md"
|
|
19
20
|
],
|
|
20
21
|
"optionalDependencies": {
|
|
21
|
-
"@alaya-mcp/cli-linux-x64": "0.2.
|
|
22
|
-
"@alaya-mcp/cli-darwin-arm64": "0.2.
|
|
23
|
-
"@alaya-mcp/cli-darwin-x64": "0.2.
|
|
24
|
-
"@alaya-mcp/cli-win32-x64": "0.2.
|
|
22
|
+
"@alaya-mcp/cli-linux-x64": "0.2.5",
|
|
23
|
+
"@alaya-mcp/cli-darwin-arm64": "0.2.5",
|
|
24
|
+
"@alaya-mcp/cli-darwin-x64": "0.2.5",
|
|
25
|
+
"@alaya-mcp/cli-win32-x64": "0.2.5"
|
|
25
26
|
},
|
|
26
27
|
"scripts": {
|
|
27
|
-
"postinstall": "node scripts/postinstall.js"
|
|
28
|
+
"postinstall": "node scripts/postinstall.js",
|
|
29
|
+
"test": "node --test 'test/**/*.test.js'"
|
|
28
30
|
},
|
|
29
31
|
"keywords": [
|
|
30
|
-
"mcp",
|
|
31
|
-
"mcp-server",
|
|
32
|
-
"claude",
|
|
33
32
|
"memory",
|
|
34
33
|
"knowledge-graph",
|
|
34
|
+
"mcp",
|
|
35
|
+
"mcp-server",
|
|
35
36
|
"ai",
|
|
36
37
|
"agent",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"rag"
|
|
38
|
+
"sqlite",
|
|
39
|
+
"local"
|
|
40
40
|
]
|
|
41
41
|
}
|