mcp-use 1.11.0-canary.17 → 1.11.0-canary.18
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/dist/.tsbuildinfo +1 -1
- package/dist/{chunk-LQJZY6OD.js → chunk-6TCXBLDE.js} +2 -2
- package/dist/{chunk-744QI6FX.js → chunk-BUUAJ4ZA.js} +1 -1
- package/dist/{chunk-XZM65NMN.js → chunk-DKK3OEIY.js} +1 -1
- package/dist/{chunk-ETMSIR6K.js → chunk-I3NZCYBR.js} +2 -2
- package/dist/{chunk-QEEFUZ22.js → chunk-M6HG2X4Q.js} +1 -1
- package/dist/{chunk-JQMHLTXF.js → chunk-MIY5EBAT.js} +82 -43
- package/dist/{chunk-NTB5TTZW.js → chunk-OD724W55.js} +2 -2
- package/dist/{chunk-HNNUDW4Q.js → chunk-SRXA64QS.js} +2 -2
- package/dist/index.cjs +82 -43
- package/dist/index.js +7 -7
- package/dist/src/agents/index.cjs +82 -43
- package/dist/src/agents/index.js +5 -5
- package/dist/src/browser.cjs +82 -43
- package/dist/src/browser.js +5 -5
- package/dist/src/client.cjs +82 -43
- package/dist/src/client.js +3 -3
- package/dist/src/react/index.cjs +82 -43
- package/dist/src/react/index.js +4 -4
- package/dist/src/server/index.cjs +87 -49
- package/dist/src/server/index.js +10 -11
- package/dist/src/server/types/widget.d.ts +4 -4
- package/dist/src/server/types/widget.d.ts.map +1 -1
- package/dist/src/telemetry/telemetry.d.ts +1 -0
- package/dist/src/telemetry/telemetry.d.ts.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/{tool-execution-helpers-F56E75XW.js → tool-execution-helpers-YTLQZ7KG.js} +2 -2
- package/package.json +3 -3
|
@@ -1417,7 +1417,7 @@ __name(generateUUID, "generateUUID");
|
|
|
1417
1417
|
init_logging();
|
|
1418
1418
|
|
|
1419
1419
|
// src/version.ts
|
|
1420
|
-
var VERSION = "1.11.0-canary.
|
|
1420
|
+
var VERSION = "1.11.0-canary.18";
|
|
1421
1421
|
function getPackageVersion() {
|
|
1422
1422
|
return VERSION;
|
|
1423
1423
|
}
|
|
@@ -1587,12 +1587,26 @@ var Telemetry = class _Telemetry {
|
|
|
1587
1587
|
"Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false to disable."
|
|
1588
1588
|
);
|
|
1589
1589
|
this._posthogLoading = this._initPostHog();
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1590
|
+
if (this._runtimeEnvironment !== "browser") {
|
|
1591
|
+
try {
|
|
1592
|
+
this._scarfClient = new ScarfEventLogger(
|
|
1593
|
+
this.SCARF_GATEWAY_URL,
|
|
1594
|
+
3e3
|
|
1595
|
+
);
|
|
1596
|
+
} catch (e) {
|
|
1597
|
+
logger.warn(`Failed to initialize Scarf telemetry: ${e}`);
|
|
1598
|
+
this._scarfClient = null;
|
|
1599
|
+
}
|
|
1600
|
+
} else {
|
|
1594
1601
|
this._scarfClient = null;
|
|
1595
1602
|
}
|
|
1603
|
+
if (this._storageCapability === "filesystem" && this._scarfClient) {
|
|
1604
|
+
setTimeout(() => {
|
|
1605
|
+
this.trackPackageDownload({ triggered_by: "initialization" }).catch(
|
|
1606
|
+
(e) => logger.debug(`Failed to track package download: ${e}`)
|
|
1607
|
+
);
|
|
1608
|
+
}, 0);
|
|
1609
|
+
}
|
|
1596
1610
|
}
|
|
1597
1611
|
}
|
|
1598
1612
|
_checkTelemetryDisabled() {
|
|
@@ -1717,47 +1731,65 @@ var Telemetry = class _Telemetry {
|
|
|
1717
1731
|
break;
|
|
1718
1732
|
case "session-only":
|
|
1719
1733
|
default:
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1734
|
+
try {
|
|
1735
|
+
this._currUserId = `session-${generateUUID()}`;
|
|
1736
|
+
} catch (uuidError) {
|
|
1737
|
+
this._currUserId = `session-${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
1738
|
+
}
|
|
1724
1739
|
break;
|
|
1725
1740
|
}
|
|
1726
|
-
if (this._storageCapability === "filesystem" && this._currUserId) {
|
|
1727
|
-
this._trackPackageDownloadInternal(this._currUserId, {
|
|
1728
|
-
triggered_by: "user_id_property"
|
|
1729
|
-
}).catch((e) => logger.debug(`Failed to track package download: ${e}`));
|
|
1730
|
-
}
|
|
1731
1741
|
} catch (e) {
|
|
1732
|
-
logger.debug(`Failed to get/create user ID: ${e}`);
|
|
1733
1742
|
this._currUserId = this.UNKNOWN_USER_ID;
|
|
1734
1743
|
}
|
|
1735
1744
|
return this._currUserId;
|
|
1736
1745
|
}
|
|
1737
1746
|
/**
|
|
1738
1747
|
* Get or create user ID from filesystem (Node.js/Bun)
|
|
1748
|
+
* Falls back to session ID if filesystem operations fail
|
|
1739
1749
|
*/
|
|
1740
1750
|
_getUserIdFromFilesystem() {
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1751
|
+
try {
|
|
1752
|
+
let fs2, os, path2;
|
|
1753
|
+
try {
|
|
1754
|
+
fs2 = require("fs");
|
|
1755
|
+
os = require("os");
|
|
1756
|
+
path2 = require("path");
|
|
1757
|
+
} catch (requireError) {
|
|
1758
|
+
try {
|
|
1759
|
+
const sessionId = `session-${generateUUID()}`;
|
|
1760
|
+
return sessionId;
|
|
1761
|
+
} catch (uuidError) {
|
|
1762
|
+
return `session-${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
if (!this._userIdPath) {
|
|
1766
|
+
this._userIdPath = path2.join(
|
|
1767
|
+
this._getCacheHome(os, path2),
|
|
1768
|
+
"mcp_use_3",
|
|
1769
|
+
"telemetry_user_id"
|
|
1770
|
+
);
|
|
1771
|
+
}
|
|
1772
|
+
const isFirstTime = !fs2.existsSync(this._userIdPath);
|
|
1773
|
+
if (isFirstTime) {
|
|
1774
|
+
fs2.mkdirSync(path2.dirname(this._userIdPath), { recursive: true });
|
|
1775
|
+
let newUserId;
|
|
1776
|
+
try {
|
|
1777
|
+
newUserId = generateUUID();
|
|
1778
|
+
} catch (uuidError) {
|
|
1779
|
+
newUserId = `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
1780
|
+
}
|
|
1781
|
+
fs2.writeFileSync(this._userIdPath, newUserId);
|
|
1782
|
+
return newUserId;
|
|
1783
|
+
}
|
|
1784
|
+
const userId = fs2.readFileSync(this._userIdPath, "utf-8").trim();
|
|
1785
|
+
return userId;
|
|
1786
|
+
} catch (e) {
|
|
1787
|
+
try {
|
|
1788
|
+
return `session-${generateUUID()}`;
|
|
1789
|
+
} catch (uuidError) {
|
|
1790
|
+
return `session-${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
1791
|
+
}
|
|
1759
1792
|
}
|
|
1760
|
-
return fs2.readFileSync(this._userIdPath, "utf-8").trim();
|
|
1761
1793
|
}
|
|
1762
1794
|
/**
|
|
1763
1795
|
* Get or create user ID from localStorage (Browser)
|
|
@@ -1766,14 +1798,22 @@ var Telemetry = class _Telemetry {
|
|
|
1766
1798
|
try {
|
|
1767
1799
|
let userId = localStorage.getItem(USER_ID_STORAGE_KEY);
|
|
1768
1800
|
if (!userId) {
|
|
1769
|
-
|
|
1801
|
+
try {
|
|
1802
|
+
userId = generateUUID();
|
|
1803
|
+
} catch (uuidError) {
|
|
1804
|
+
userId = `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
1805
|
+
}
|
|
1770
1806
|
localStorage.setItem(USER_ID_STORAGE_KEY, userId);
|
|
1771
|
-
logger.debug(`Created new browser user ID`);
|
|
1772
1807
|
}
|
|
1773
1808
|
return userId;
|
|
1774
1809
|
} catch (e) {
|
|
1775
|
-
|
|
1776
|
-
|
|
1810
|
+
let sessionId;
|
|
1811
|
+
try {
|
|
1812
|
+
sessionId = `session-${generateUUID()}`;
|
|
1813
|
+
} catch (uuidError) {
|
|
1814
|
+
sessionId = `session-${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
1815
|
+
}
|
|
1816
|
+
return sessionId;
|
|
1777
1817
|
}
|
|
1778
1818
|
}
|
|
1779
1819
|
_getCacheHome(os, path2) {
|
|
@@ -1802,6 +1842,7 @@ var Telemetry = class _Telemetry {
|
|
|
1802
1842
|
if (!this._posthogNodeClient && !this._posthogBrowserClient && !this._scarfClient) {
|
|
1803
1843
|
return;
|
|
1804
1844
|
}
|
|
1845
|
+
const currentUserId = this.userId;
|
|
1805
1846
|
const properties = { ...event.properties };
|
|
1806
1847
|
properties.mcp_use_version = getPackageVersion();
|
|
1807
1848
|
properties.language = "typescript";
|
|
@@ -1809,9 +1850,8 @@ var Telemetry = class _Telemetry {
|
|
|
1809
1850
|
properties.runtime = this._runtimeEnvironment;
|
|
1810
1851
|
if (this._posthogNodeClient) {
|
|
1811
1852
|
try {
|
|
1812
|
-
logger.debug(`CAPTURE: PostHog Node Event ${event.name}`);
|
|
1813
1853
|
this._posthogNodeClient.capture({
|
|
1814
|
-
distinctId:
|
|
1854
|
+
distinctId: currentUserId,
|
|
1815
1855
|
event: event.name,
|
|
1816
1856
|
properties
|
|
1817
1857
|
});
|
|
@@ -1821,10 +1861,9 @@ var Telemetry = class _Telemetry {
|
|
|
1821
1861
|
}
|
|
1822
1862
|
if (this._posthogBrowserClient) {
|
|
1823
1863
|
try {
|
|
1824
|
-
logger.debug(`CAPTURE: PostHog Browser Event ${event.name}`);
|
|
1825
1864
|
this._posthogBrowserClient.capture(event.name, {
|
|
1826
1865
|
...properties,
|
|
1827
|
-
distinct_id:
|
|
1866
|
+
distinct_id: currentUserId
|
|
1828
1867
|
});
|
|
1829
1868
|
} catch (e) {
|
|
1830
1869
|
logger.debug(
|
|
@@ -1836,7 +1875,7 @@ var Telemetry = class _Telemetry {
|
|
|
1836
1875
|
try {
|
|
1837
1876
|
const scarfProperties = {
|
|
1838
1877
|
...properties,
|
|
1839
|
-
user_id:
|
|
1878
|
+
user_id: currentUserId,
|
|
1840
1879
|
event: event.name
|
|
1841
1880
|
};
|
|
1842
1881
|
await this._scarfClient.logEvent(scarfProperties);
|
package/dist/src/agents/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseAgent,
|
|
3
3
|
PROMPTS
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-DKK3OEIY.js";
|
|
5
5
|
import {
|
|
6
6
|
MCPAgent,
|
|
7
7
|
RemoteAgent
|
|
8
|
-
} from "../../chunk-
|
|
8
|
+
} from "../../chunk-6TCXBLDE.js";
|
|
9
9
|
import "../../chunk-JRGQRPTN.js";
|
|
10
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-I3NZCYBR.js";
|
|
11
11
|
import "../../chunk-MFSO5PUW.js";
|
|
12
|
-
import "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
12
|
+
import "../../chunk-M6HG2X4Q.js";
|
|
13
|
+
import "../../chunk-MIY5EBAT.js";
|
|
14
14
|
import "../../chunk-FRUZDWXH.js";
|
|
15
15
|
import "../../chunk-3GQAWCBQ.js";
|
|
16
16
|
export {
|
package/dist/src/browser.cjs
CHANGED
|
@@ -1651,7 +1651,7 @@ __name(generateUUID, "generateUUID");
|
|
|
1651
1651
|
init_logging();
|
|
1652
1652
|
|
|
1653
1653
|
// src/version.ts
|
|
1654
|
-
var VERSION = "1.11.0-canary.
|
|
1654
|
+
var VERSION = "1.11.0-canary.18";
|
|
1655
1655
|
function getPackageVersion() {
|
|
1656
1656
|
return VERSION;
|
|
1657
1657
|
}
|
|
@@ -1821,12 +1821,26 @@ var Telemetry = class _Telemetry {
|
|
|
1821
1821
|
"Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false to disable."
|
|
1822
1822
|
);
|
|
1823
1823
|
this._posthogLoading = this._initPostHog();
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1824
|
+
if (this._runtimeEnvironment !== "browser") {
|
|
1825
|
+
try {
|
|
1826
|
+
this._scarfClient = new ScarfEventLogger(
|
|
1827
|
+
this.SCARF_GATEWAY_URL,
|
|
1828
|
+
3e3
|
|
1829
|
+
);
|
|
1830
|
+
} catch (e) {
|
|
1831
|
+
logger.warn(`Failed to initialize Scarf telemetry: ${e}`);
|
|
1832
|
+
this._scarfClient = null;
|
|
1833
|
+
}
|
|
1834
|
+
} else {
|
|
1828
1835
|
this._scarfClient = null;
|
|
1829
1836
|
}
|
|
1837
|
+
if (this._storageCapability === "filesystem" && this._scarfClient) {
|
|
1838
|
+
setTimeout(() => {
|
|
1839
|
+
this.trackPackageDownload({ triggered_by: "initialization" }).catch(
|
|
1840
|
+
(e) => logger.debug(`Failed to track package download: ${e}`)
|
|
1841
|
+
);
|
|
1842
|
+
}, 0);
|
|
1843
|
+
}
|
|
1830
1844
|
}
|
|
1831
1845
|
}
|
|
1832
1846
|
_checkTelemetryDisabled() {
|
|
@@ -1951,47 +1965,65 @@ var Telemetry = class _Telemetry {
|
|
|
1951
1965
|
break;
|
|
1952
1966
|
case "session-only":
|
|
1953
1967
|
default:
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1968
|
+
try {
|
|
1969
|
+
this._currUserId = `session-${generateUUID()}`;
|
|
1970
|
+
} catch (uuidError) {
|
|
1971
|
+
this._currUserId = `session-${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
1972
|
+
}
|
|
1958
1973
|
break;
|
|
1959
1974
|
}
|
|
1960
|
-
if (this._storageCapability === "filesystem" && this._currUserId) {
|
|
1961
|
-
this._trackPackageDownloadInternal(this._currUserId, {
|
|
1962
|
-
triggered_by: "user_id_property"
|
|
1963
|
-
}).catch((e) => logger.debug(`Failed to track package download: ${e}`));
|
|
1964
|
-
}
|
|
1965
1975
|
} catch (e) {
|
|
1966
|
-
logger.debug(`Failed to get/create user ID: ${e}`);
|
|
1967
1976
|
this._currUserId = this.UNKNOWN_USER_ID;
|
|
1968
1977
|
}
|
|
1969
1978
|
return this._currUserId;
|
|
1970
1979
|
}
|
|
1971
1980
|
/**
|
|
1972
1981
|
* Get or create user ID from filesystem (Node.js/Bun)
|
|
1982
|
+
* Falls back to session ID if filesystem operations fail
|
|
1973
1983
|
*/
|
|
1974
1984
|
_getUserIdFromFilesystem() {
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1985
|
+
try {
|
|
1986
|
+
let fs2, os, path2;
|
|
1987
|
+
try {
|
|
1988
|
+
fs2 = require("fs");
|
|
1989
|
+
os = require("os");
|
|
1990
|
+
path2 = require("path");
|
|
1991
|
+
} catch (requireError) {
|
|
1992
|
+
try {
|
|
1993
|
+
const sessionId = `session-${generateUUID()}`;
|
|
1994
|
+
return sessionId;
|
|
1995
|
+
} catch (uuidError) {
|
|
1996
|
+
return `session-${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
if (!this._userIdPath) {
|
|
2000
|
+
this._userIdPath = path2.join(
|
|
2001
|
+
this._getCacheHome(os, path2),
|
|
2002
|
+
"mcp_use_3",
|
|
2003
|
+
"telemetry_user_id"
|
|
2004
|
+
);
|
|
2005
|
+
}
|
|
2006
|
+
const isFirstTime = !fs2.existsSync(this._userIdPath);
|
|
2007
|
+
if (isFirstTime) {
|
|
2008
|
+
fs2.mkdirSync(path2.dirname(this._userIdPath), { recursive: true });
|
|
2009
|
+
let newUserId;
|
|
2010
|
+
try {
|
|
2011
|
+
newUserId = generateUUID();
|
|
2012
|
+
} catch (uuidError) {
|
|
2013
|
+
newUserId = `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
2014
|
+
}
|
|
2015
|
+
fs2.writeFileSync(this._userIdPath, newUserId);
|
|
2016
|
+
return newUserId;
|
|
2017
|
+
}
|
|
2018
|
+
const userId = fs2.readFileSync(this._userIdPath, "utf-8").trim();
|
|
2019
|
+
return userId;
|
|
2020
|
+
} catch (e) {
|
|
2021
|
+
try {
|
|
2022
|
+
return `session-${generateUUID()}`;
|
|
2023
|
+
} catch (uuidError) {
|
|
2024
|
+
return `session-${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
2025
|
+
}
|
|
1993
2026
|
}
|
|
1994
|
-
return fs2.readFileSync(this._userIdPath, "utf-8").trim();
|
|
1995
2027
|
}
|
|
1996
2028
|
/**
|
|
1997
2029
|
* Get or create user ID from localStorage (Browser)
|
|
@@ -2000,14 +2032,22 @@ var Telemetry = class _Telemetry {
|
|
|
2000
2032
|
try {
|
|
2001
2033
|
let userId = localStorage.getItem(USER_ID_STORAGE_KEY);
|
|
2002
2034
|
if (!userId) {
|
|
2003
|
-
|
|
2035
|
+
try {
|
|
2036
|
+
userId = generateUUID();
|
|
2037
|
+
} catch (uuidError) {
|
|
2038
|
+
userId = `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
2039
|
+
}
|
|
2004
2040
|
localStorage.setItem(USER_ID_STORAGE_KEY, userId);
|
|
2005
|
-
logger.debug(`Created new browser user ID`);
|
|
2006
2041
|
}
|
|
2007
2042
|
return userId;
|
|
2008
2043
|
} catch (e) {
|
|
2009
|
-
|
|
2010
|
-
|
|
2044
|
+
let sessionId;
|
|
2045
|
+
try {
|
|
2046
|
+
sessionId = `session-${generateUUID()}`;
|
|
2047
|
+
} catch (uuidError) {
|
|
2048
|
+
sessionId = `session-${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
2049
|
+
}
|
|
2050
|
+
return sessionId;
|
|
2011
2051
|
}
|
|
2012
2052
|
}
|
|
2013
2053
|
_getCacheHome(os, path2) {
|
|
@@ -2036,6 +2076,7 @@ var Telemetry = class _Telemetry {
|
|
|
2036
2076
|
if (!this._posthogNodeClient && !this._posthogBrowserClient && !this._scarfClient) {
|
|
2037
2077
|
return;
|
|
2038
2078
|
}
|
|
2079
|
+
const currentUserId = this.userId;
|
|
2039
2080
|
const properties = { ...event.properties };
|
|
2040
2081
|
properties.mcp_use_version = getPackageVersion();
|
|
2041
2082
|
properties.language = "typescript";
|
|
@@ -2043,9 +2084,8 @@ var Telemetry = class _Telemetry {
|
|
|
2043
2084
|
properties.runtime = this._runtimeEnvironment;
|
|
2044
2085
|
if (this._posthogNodeClient) {
|
|
2045
2086
|
try {
|
|
2046
|
-
logger.debug(`CAPTURE: PostHog Node Event ${event.name}`);
|
|
2047
2087
|
this._posthogNodeClient.capture({
|
|
2048
|
-
distinctId:
|
|
2088
|
+
distinctId: currentUserId,
|
|
2049
2089
|
event: event.name,
|
|
2050
2090
|
properties
|
|
2051
2091
|
});
|
|
@@ -2055,10 +2095,9 @@ var Telemetry = class _Telemetry {
|
|
|
2055
2095
|
}
|
|
2056
2096
|
if (this._posthogBrowserClient) {
|
|
2057
2097
|
try {
|
|
2058
|
-
logger.debug(`CAPTURE: PostHog Browser Event ${event.name}`);
|
|
2059
2098
|
this._posthogBrowserClient.capture(event.name, {
|
|
2060
2099
|
...properties,
|
|
2061
|
-
distinct_id:
|
|
2100
|
+
distinct_id: currentUserId
|
|
2062
2101
|
});
|
|
2063
2102
|
} catch (e) {
|
|
2064
2103
|
logger.debug(
|
|
@@ -2070,7 +2109,7 @@ var Telemetry = class _Telemetry {
|
|
|
2070
2109
|
try {
|
|
2071
2110
|
const scarfProperties = {
|
|
2072
2111
|
...properties,
|
|
2073
|
-
user_id:
|
|
2112
|
+
user_id: currentUserId,
|
|
2074
2113
|
event: event.name
|
|
2075
2114
|
};
|
|
2076
2115
|
await this._scarfClient.logEvent(scarfProperties);
|
package/dist/src/browser.js
CHANGED
|
@@ -12,27 +12,27 @@ import {
|
|
|
12
12
|
getSupportedProviders,
|
|
13
13
|
isValidLLMString,
|
|
14
14
|
parseLLMString
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-6TCXBLDE.js";
|
|
16
16
|
import "../chunk-JRGQRPTN.js";
|
|
17
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-I3NZCYBR.js";
|
|
18
18
|
import {
|
|
19
19
|
BaseAdapter
|
|
20
20
|
} from "../chunk-MFSO5PUW.js";
|
|
21
21
|
import {
|
|
22
22
|
BrowserMCPClient
|
|
23
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-OD724W55.js";
|
|
24
24
|
import {
|
|
25
25
|
BaseConnector,
|
|
26
26
|
HttpConnector,
|
|
27
27
|
MCPSession
|
|
28
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-M6HG2X4Q.js";
|
|
29
29
|
import {
|
|
30
30
|
Tel,
|
|
31
31
|
Telemetry,
|
|
32
32
|
VERSION,
|
|
33
33
|
getPackageVersion,
|
|
34
34
|
setTelemetrySource
|
|
35
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-MIY5EBAT.js";
|
|
36
36
|
import {
|
|
37
37
|
Logger,
|
|
38
38
|
logger
|
package/dist/src/client.cjs
CHANGED
|
@@ -942,7 +942,7 @@ function generateUUID() {
|
|
|
942
942
|
__name(generateUUID, "generateUUID");
|
|
943
943
|
|
|
944
944
|
// src/version.ts
|
|
945
|
-
var VERSION = "1.11.0-canary.
|
|
945
|
+
var VERSION = "1.11.0-canary.18";
|
|
946
946
|
function getPackageVersion() {
|
|
947
947
|
return VERSION;
|
|
948
948
|
}
|
|
@@ -1080,12 +1080,26 @@ var Telemetry = class _Telemetry {
|
|
|
1080
1080
|
"Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false to disable."
|
|
1081
1081
|
);
|
|
1082
1082
|
this._posthogLoading = this._initPostHog();
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1083
|
+
if (this._runtimeEnvironment !== "browser") {
|
|
1084
|
+
try {
|
|
1085
|
+
this._scarfClient = new ScarfEventLogger(
|
|
1086
|
+
this.SCARF_GATEWAY_URL,
|
|
1087
|
+
3e3
|
|
1088
|
+
);
|
|
1089
|
+
} catch (e) {
|
|
1090
|
+
logger.warn(`Failed to initialize Scarf telemetry: ${e}`);
|
|
1091
|
+
this._scarfClient = null;
|
|
1092
|
+
}
|
|
1093
|
+
} else {
|
|
1087
1094
|
this._scarfClient = null;
|
|
1088
1095
|
}
|
|
1096
|
+
if (this._storageCapability === "filesystem" && this._scarfClient) {
|
|
1097
|
+
setTimeout(() => {
|
|
1098
|
+
this.trackPackageDownload({ triggered_by: "initialization" }).catch(
|
|
1099
|
+
(e) => logger.debug(`Failed to track package download: ${e}`)
|
|
1100
|
+
);
|
|
1101
|
+
}, 0);
|
|
1102
|
+
}
|
|
1089
1103
|
}
|
|
1090
1104
|
}
|
|
1091
1105
|
_checkTelemetryDisabled() {
|
|
@@ -1210,47 +1224,65 @@ var Telemetry = class _Telemetry {
|
|
|
1210
1224
|
break;
|
|
1211
1225
|
case "session-only":
|
|
1212
1226
|
default:
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1227
|
+
try {
|
|
1228
|
+
this._currUserId = `session-${generateUUID()}`;
|
|
1229
|
+
} catch (uuidError) {
|
|
1230
|
+
this._currUserId = `session-${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
1231
|
+
}
|
|
1217
1232
|
break;
|
|
1218
1233
|
}
|
|
1219
|
-
if (this._storageCapability === "filesystem" && this._currUserId) {
|
|
1220
|
-
this._trackPackageDownloadInternal(this._currUserId, {
|
|
1221
|
-
triggered_by: "user_id_property"
|
|
1222
|
-
}).catch((e) => logger.debug(`Failed to track package download: ${e}`));
|
|
1223
|
-
}
|
|
1224
1234
|
} catch (e) {
|
|
1225
|
-
logger.debug(`Failed to get/create user ID: ${e}`);
|
|
1226
1235
|
this._currUserId = this.UNKNOWN_USER_ID;
|
|
1227
1236
|
}
|
|
1228
1237
|
return this._currUserId;
|
|
1229
1238
|
}
|
|
1230
1239
|
/**
|
|
1231
1240
|
* Get or create user ID from filesystem (Node.js/Bun)
|
|
1241
|
+
* Falls back to session ID if filesystem operations fail
|
|
1232
1242
|
*/
|
|
1233
1243
|
_getUserIdFromFilesystem() {
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1244
|
+
try {
|
|
1245
|
+
let fs2, os, path2;
|
|
1246
|
+
try {
|
|
1247
|
+
fs2 = require("fs");
|
|
1248
|
+
os = require("os");
|
|
1249
|
+
path2 = require("path");
|
|
1250
|
+
} catch (requireError) {
|
|
1251
|
+
try {
|
|
1252
|
+
const sessionId = `session-${generateUUID()}`;
|
|
1253
|
+
return sessionId;
|
|
1254
|
+
} catch (uuidError) {
|
|
1255
|
+
return `session-${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
if (!this._userIdPath) {
|
|
1259
|
+
this._userIdPath = path2.join(
|
|
1260
|
+
this._getCacheHome(os, path2),
|
|
1261
|
+
"mcp_use_3",
|
|
1262
|
+
"telemetry_user_id"
|
|
1263
|
+
);
|
|
1264
|
+
}
|
|
1265
|
+
const isFirstTime = !fs2.existsSync(this._userIdPath);
|
|
1266
|
+
if (isFirstTime) {
|
|
1267
|
+
fs2.mkdirSync(path2.dirname(this._userIdPath), { recursive: true });
|
|
1268
|
+
let newUserId;
|
|
1269
|
+
try {
|
|
1270
|
+
newUserId = generateUUID();
|
|
1271
|
+
} catch (uuidError) {
|
|
1272
|
+
newUserId = `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
1273
|
+
}
|
|
1274
|
+
fs2.writeFileSync(this._userIdPath, newUserId);
|
|
1275
|
+
return newUserId;
|
|
1276
|
+
}
|
|
1277
|
+
const userId = fs2.readFileSync(this._userIdPath, "utf-8").trim();
|
|
1278
|
+
return userId;
|
|
1279
|
+
} catch (e) {
|
|
1280
|
+
try {
|
|
1281
|
+
return `session-${generateUUID()}`;
|
|
1282
|
+
} catch (uuidError) {
|
|
1283
|
+
return `session-${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
1284
|
+
}
|
|
1252
1285
|
}
|
|
1253
|
-
return fs2.readFileSync(this._userIdPath, "utf-8").trim();
|
|
1254
1286
|
}
|
|
1255
1287
|
/**
|
|
1256
1288
|
* Get or create user ID from localStorage (Browser)
|
|
@@ -1259,14 +1291,22 @@ var Telemetry = class _Telemetry {
|
|
|
1259
1291
|
try {
|
|
1260
1292
|
let userId = localStorage.getItem(USER_ID_STORAGE_KEY);
|
|
1261
1293
|
if (!userId) {
|
|
1262
|
-
|
|
1294
|
+
try {
|
|
1295
|
+
userId = generateUUID();
|
|
1296
|
+
} catch (uuidError) {
|
|
1297
|
+
userId = `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
1298
|
+
}
|
|
1263
1299
|
localStorage.setItem(USER_ID_STORAGE_KEY, userId);
|
|
1264
|
-
logger.debug(`Created new browser user ID`);
|
|
1265
1300
|
}
|
|
1266
1301
|
return userId;
|
|
1267
1302
|
} catch (e) {
|
|
1268
|
-
|
|
1269
|
-
|
|
1303
|
+
let sessionId;
|
|
1304
|
+
try {
|
|
1305
|
+
sessionId = `session-${generateUUID()}`;
|
|
1306
|
+
} catch (uuidError) {
|
|
1307
|
+
sessionId = `session-${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
1308
|
+
}
|
|
1309
|
+
return sessionId;
|
|
1270
1310
|
}
|
|
1271
1311
|
}
|
|
1272
1312
|
_getCacheHome(os, path2) {
|
|
@@ -1295,6 +1335,7 @@ var Telemetry = class _Telemetry {
|
|
|
1295
1335
|
if (!this._posthogNodeClient && !this._posthogBrowserClient && !this._scarfClient) {
|
|
1296
1336
|
return;
|
|
1297
1337
|
}
|
|
1338
|
+
const currentUserId = this.userId;
|
|
1298
1339
|
const properties = { ...event.properties };
|
|
1299
1340
|
properties.mcp_use_version = getPackageVersion();
|
|
1300
1341
|
properties.language = "typescript";
|
|
@@ -1302,9 +1343,8 @@ var Telemetry = class _Telemetry {
|
|
|
1302
1343
|
properties.runtime = this._runtimeEnvironment;
|
|
1303
1344
|
if (this._posthogNodeClient) {
|
|
1304
1345
|
try {
|
|
1305
|
-
logger.debug(`CAPTURE: PostHog Node Event ${event.name}`);
|
|
1306
1346
|
this._posthogNodeClient.capture({
|
|
1307
|
-
distinctId:
|
|
1347
|
+
distinctId: currentUserId,
|
|
1308
1348
|
event: event.name,
|
|
1309
1349
|
properties
|
|
1310
1350
|
});
|
|
@@ -1314,10 +1354,9 @@ var Telemetry = class _Telemetry {
|
|
|
1314
1354
|
}
|
|
1315
1355
|
if (this._posthogBrowserClient) {
|
|
1316
1356
|
try {
|
|
1317
|
-
logger.debug(`CAPTURE: PostHog Browser Event ${event.name}`);
|
|
1318
1357
|
this._posthogBrowserClient.capture(event.name, {
|
|
1319
1358
|
...properties,
|
|
1320
|
-
distinct_id:
|
|
1359
|
+
distinct_id: currentUserId
|
|
1321
1360
|
});
|
|
1322
1361
|
} catch (e) {
|
|
1323
1362
|
logger.debug(
|
|
@@ -1329,7 +1368,7 @@ var Telemetry = class _Telemetry {
|
|
|
1329
1368
|
try {
|
|
1330
1369
|
const scarfProperties = {
|
|
1331
1370
|
...properties,
|
|
1332
|
-
user_id:
|
|
1371
|
+
user_id: currentUserId,
|
|
1333
1372
|
event: event.name
|
|
1334
1373
|
};
|
|
1335
1374
|
await this._scarfClient.logEvent(scarfProperties);
|
package/dist/src/client.js
CHANGED
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
MCPClient,
|
|
5
5
|
VMCodeExecutor,
|
|
6
6
|
isVMAvailable
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-I3NZCYBR.js";
|
|
8
8
|
import {
|
|
9
9
|
MCPSession
|
|
10
|
-
} from "../chunk-
|
|
11
|
-
import "../chunk-
|
|
10
|
+
} from "../chunk-M6HG2X4Q.js";
|
|
11
|
+
import "../chunk-MIY5EBAT.js";
|
|
12
12
|
import "../chunk-FRUZDWXH.js";
|
|
13
13
|
import "../chunk-3GQAWCBQ.js";
|
|
14
14
|
export {
|