@cc-monitoring/proxy-core 0.4.3 → 0.4.4
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/cli/__tests__/commands.test.js +4 -1
- package/dist/cli/index.js +5 -0
- package/dist/docs/404.html +1 -1
- package/dist/docs/assets/{app.D3ZWFMdh.js → app.CjQvyEo5.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.DdOdtTxI.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.D7u_reyg.js → VPLocalSearchBox.M4dBuYqX.js} +1 -1
- package/dist/docs/assets/chunks/{theme.DjTLYPOt.js → theme.5bK01na6.js} +2 -2
- package/dist/docs/index.html +2 -2
- package/dist/docs/overview.html +2 -2
- package/dist/docs/packages-utils.html +2 -2
- package/dist/docs/proxy-admin/env-and-build.html +2 -2
- package/dist/docs/proxy-admin/index.html +2 -2
- package/dist/docs/proxy-admin/layout-and-menu.html +2 -2
- package/dist/docs/proxy-admin/pages.html +2 -2
- package/dist/docs/proxy-admin/routing-and-auth.html +2 -2
- package/dist/docs/proxy-admin/services-and-mock.html +2 -2
- package/dist/docs/proxy-cli/api-layer.html +2 -2
- package/dist/docs/proxy-cli/app-shell.html +2 -2
- package/dist/docs/proxy-cli/components-common.html +2 -2
- package/dist/docs/proxy-cli/components-config.html +2 -2
- package/dist/docs/proxy-cli/components-requests.html +2 -2
- package/dist/docs/proxy-cli/components-stats.html +2 -2
- package/dist/docs/proxy-cli/components-status.html +2 -2
- package/dist/docs/proxy-cli/data-hooks.html +2 -2
- package/dist/docs/proxy-cli/index.html +2 -2
- package/dist/docs/proxy-cli/utils-and-i18n.html +2 -2
- package/dist/docs/proxy-core/chat-api.html +2 -2
- package/dist/docs/proxy-core/cli.html +2 -2
- package/dist/docs/proxy-core/config.html +2 -2
- package/dist/docs/proxy-core/data-layer.html +2 -2
- package/dist/docs/proxy-core/entry.html +2 -2
- package/dist/docs/proxy-core/index.html +2 -2
- package/dist/docs/proxy-core/pm2.html +2 -2
- package/dist/docs/proxy-core/providers.html +2 -2
- package/dist/docs/proxy-core/proxy.html +2 -2
- package/dist/docs/proxy-core/stats.html +2 -2
- package/dist/docs/proxy-core/tool.html +2 -2
- package/dist/docs/proxy-core/ui-routes.html +2 -2
- package/dist/docs/proxy-core/utilities.html +2 -2
- package/dist/docs/quickstart.html +2 -2
- package/dist/docs/request-flow.html +2 -2
- package/dist/logger/__tests__/logger.test.js +13 -0
- package/dist/logger/index.js +3 -1
- package/dist/server/proxy.js +2 -0
- package/dist/utils/__tests__/pm2.test.js +33 -2
- package/dist/utils/pm2.d.ts +1 -0
- package/dist/utils/pm2.js +34 -23
- package/package.json +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.BOtEa2K_.js +0 -1
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/docs/assets/chunks/theme.
|
|
14
|
+
<link rel="modulepreload" href="/docs/assets/chunks/theme.5bK01na6.js">
|
|
15
15
|
<link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
|
|
16
16
|
<link rel="modulepreload" href="/docs/assets/proxy-cli_data-hooks.md.Bz8CVbxO.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/docs/assets/chunks/theme.
|
|
14
|
+
<link rel="modulepreload" href="/docs/assets/chunks/theme.5bK01na6.js">
|
|
15
15
|
<link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
|
|
16
16
|
<link rel="modulepreload" href="/docs/assets/proxy-cli_index.md.BA6g8QD-.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/docs/assets/chunks/theme.
|
|
14
|
+
<link rel="modulepreload" href="/docs/assets/chunks/theme.5bK01na6.js">
|
|
15
15
|
<link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
|
|
16
16
|
<link rel="modulepreload" href="/docs/assets/proxy-cli_utils-and-i18n.md.Ch_e-g_o.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/docs/assets/chunks/theme.
|
|
14
|
+
<link rel="modulepreload" href="/docs/assets/chunks/theme.5bK01na6.js">
|
|
15
15
|
<link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
|
|
16
16
|
<link rel="modulepreload" href="/docs/assets/proxy-core_chat-api.md.DHihiBxR.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/docs/assets/chunks/theme.
|
|
14
|
+
<link rel="modulepreload" href="/docs/assets/chunks/theme.5bK01na6.js">
|
|
15
15
|
<link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
|
|
16
16
|
<link rel="modulepreload" href="/docs/assets/proxy-core_cli.md.DCFYX4Bd.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/docs/assets/chunks/theme.
|
|
14
|
+
<link rel="modulepreload" href="/docs/assets/chunks/theme.5bK01na6.js">
|
|
15
15
|
<link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
|
|
16
16
|
<link rel="modulepreload" href="/docs/assets/proxy-core_config.md.BXSOyxYE.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/docs/assets/chunks/theme.
|
|
14
|
+
<link rel="modulepreload" href="/docs/assets/chunks/theme.5bK01na6.js">
|
|
15
15
|
<link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
|
|
16
16
|
<link rel="modulepreload" href="/docs/assets/proxy-core_data-layer.md.Cdomb3Gz.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/docs/assets/chunks/theme.
|
|
14
|
+
<link rel="modulepreload" href="/docs/assets/chunks/theme.5bK01na6.js">
|
|
15
15
|
<link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
|
|
16
16
|
<link rel="modulepreload" href="/docs/assets/proxy-core_entry.md.BZmIcCUM.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/docs/assets/chunks/theme.
|
|
14
|
+
<link rel="modulepreload" href="/docs/assets/chunks/theme.5bK01na6.js">
|
|
15
15
|
<link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
|
|
16
16
|
<link rel="modulepreload" href="/docs/assets/proxy-core_index.md.BM6VV5Qe.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/docs/assets/chunks/theme.
|
|
14
|
+
<link rel="modulepreload" href="/docs/assets/chunks/theme.5bK01na6.js">
|
|
15
15
|
<link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
|
|
16
16
|
<link rel="modulepreload" href="/docs/assets/proxy-core_pm2.md.DUhWEtgn.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/docs/assets/chunks/theme.
|
|
14
|
+
<link rel="modulepreload" href="/docs/assets/chunks/theme.5bK01na6.js">
|
|
15
15
|
<link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
|
|
16
16
|
<link rel="modulepreload" href="/docs/assets/proxy-core_providers.md.CbDZ6b_7.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/docs/assets/chunks/theme.
|
|
14
|
+
<link rel="modulepreload" href="/docs/assets/chunks/theme.5bK01na6.js">
|
|
15
15
|
<link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
|
|
16
16
|
<link rel="modulepreload" href="/docs/assets/proxy-core_proxy.md.CzQYmX6X.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/docs/assets/chunks/theme.
|
|
14
|
+
<link rel="modulepreload" href="/docs/assets/chunks/theme.5bK01na6.js">
|
|
15
15
|
<link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
|
|
16
16
|
<link rel="modulepreload" href="/docs/assets/proxy-core_stats.md.BsM6wuK_.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/docs/assets/chunks/theme.
|
|
14
|
+
<link rel="modulepreload" href="/docs/assets/chunks/theme.5bK01na6.js">
|
|
15
15
|
<link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
|
|
16
16
|
<link rel="modulepreload" href="/docs/assets/proxy-core_tool.md.B6Le1nQr.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/docs/assets/chunks/theme.
|
|
14
|
+
<link rel="modulepreload" href="/docs/assets/chunks/theme.5bK01na6.js">
|
|
15
15
|
<link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
|
|
16
16
|
<link rel="modulepreload" href="/docs/assets/proxy-core_ui-routes.md.B21t1p7R.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/docs/assets/chunks/theme.
|
|
14
|
+
<link rel="modulepreload" href="/docs/assets/chunks/theme.5bK01na6.js">
|
|
15
15
|
<link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
|
|
16
16
|
<link rel="modulepreload" href="/docs/assets/proxy-core_utilities.md.C18pjnkz.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/docs/assets/chunks/theme.
|
|
14
|
+
<link rel="modulepreload" href="/docs/assets/chunks/theme.5bK01na6.js">
|
|
15
15
|
<link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
|
|
16
16
|
<link rel="modulepreload" href="/docs/assets/quickstart.md.Cy_FmXIY.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/docs/assets/chunks/theme.
|
|
14
|
+
<link rel="modulepreload" href="/docs/assets/chunks/theme.5bK01na6.js">
|
|
15
15
|
<link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
|
|
16
16
|
<link rel="modulepreload" href="/docs/assets/request-flow.md.C1fyxdPE.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import fs from 'fs/promises';
|
|
2
|
+
import os from 'os';
|
|
2
3
|
import path from 'path';
|
|
4
|
+
jest.mock('file-stream-rotator', () => ({
|
|
5
|
+
getStream: jest.fn(() => ({ write: jest.fn() }))
|
|
6
|
+
}));
|
|
7
|
+
import * as rotator from 'file-stream-rotator';
|
|
3
8
|
import { createLogger, readLogs } from '../index';
|
|
4
9
|
const LOG_CONFIG = { level: 'info', file: 'logs/test-proxy.log' };
|
|
5
10
|
describe('createLogger', () => {
|
|
@@ -23,6 +28,14 @@ describe('createLogger', () => {
|
|
|
23
28
|
const logger = createLogger(errorConfig);
|
|
24
29
|
expect(logger.level).toBe('error');
|
|
25
30
|
});
|
|
31
|
+
it('轮转时以 end_stream: true 优雅关闭旧流,避免 ERR_STREAM_DESTROYED', () => {
|
|
32
|
+
const config = {
|
|
33
|
+
level: 'info',
|
|
34
|
+
file: path.join(os.tmpdir(), 'ccm-logger-test', 'test-rotator.log')
|
|
35
|
+
};
|
|
36
|
+
createLogger(config);
|
|
37
|
+
expect(rotator.getStream).toHaveBeenCalledWith(expect.objectContaining({ end_stream: true }));
|
|
38
|
+
});
|
|
26
39
|
});
|
|
27
40
|
describe('readLogs', () => {
|
|
28
41
|
const tmpDir = path.join(process.cwd(), '__test_logs_tmp__');
|
package/dist/logger/index.js
CHANGED
|
@@ -35,7 +35,9 @@ export function createLogger(config) {
|
|
|
35
35
|
frequency: 'daily',
|
|
36
36
|
date_format: 'YYYY-MM-DD',
|
|
37
37
|
size: config.maxSize || '10m',
|
|
38
|
-
verbose: false
|
|
38
|
+
verbose: false,
|
|
39
|
+
// 轮转时优雅 end 旧流而非 destroy,避免进行中的写入回调触发 ERR_STREAM_DESTROYED
|
|
40
|
+
end_stream: true
|
|
39
41
|
});
|
|
40
42
|
// Dual-output: file (rotating) + console (pretty)
|
|
41
43
|
const dualStream = {
|
package/dist/server/proxy.js
CHANGED
|
@@ -7,6 +7,7 @@ import { pushNewRequest, broadcastToDataClients, clearStatsNotify, scheduleStats
|
|
|
7
7
|
import { initDatabase, closeDatabase, getDatabase } from '../utils/db.js';
|
|
8
8
|
import { recoverCrashedTasks } from '../utils/learn-tasks-db.js';
|
|
9
9
|
import { getActiveProvider } from '../utils/providers-db.js';
|
|
10
|
+
import { disconnectPm2 } from '../utils/pm2.js';
|
|
10
11
|
import { aggregateStats } from '../utils/stats-aggregator.js';
|
|
11
12
|
import { mcpManager } from '../utils/mcp-manager.js';
|
|
12
13
|
import { getMachineIdSync, preloadMachineId } from '../utils/machine-id.js';
|
|
@@ -285,6 +286,7 @@ export async function setupProxy(fastify, proxyConfig) {
|
|
|
285
286
|
clearStatsNotify();
|
|
286
287
|
await mcpManager.close();
|
|
287
288
|
closeDatabase();
|
|
289
|
+
await disconnectPm2();
|
|
288
290
|
});
|
|
289
291
|
// Application-layer forwarding (Controller + Fetch + SSE Pipe)
|
|
290
292
|
// Fastify parses body automatically -> we get full JSON payload
|
|
@@ -3,9 +3,12 @@ jest.mock('pm2', () => {
|
|
|
3
3
|
const { createPm2Mock } = jest.requireActual('../__mocks__/pm2-helpers');
|
|
4
4
|
return createPm2Mock();
|
|
5
5
|
});
|
|
6
|
-
import { startProcess, stopProcess, reloadProcess, getProcessStatus } from '../pm2';
|
|
7
|
-
beforeEach(() => {
|
|
6
|
+
import { startProcess, stopProcess, reloadProcess, getProcessStatus, disconnectPm2 } from '../pm2';
|
|
7
|
+
beforeEach(async () => {
|
|
8
|
+
// 重置模块级连接单例,保证每个测试都重新 connect
|
|
9
|
+
await disconnectPm2();
|
|
8
10
|
resetMockState();
|
|
11
|
+
jest.restoreAllMocks();
|
|
9
12
|
});
|
|
10
13
|
describe('startProcess', () => {
|
|
11
14
|
it('connects, starts a process from ecosystem path, and disconnects', async () => {
|
|
@@ -111,3 +114,31 @@ describe('getProcessStatus', () => {
|
|
|
111
114
|
expect(result.restarts).toBe(5);
|
|
112
115
|
});
|
|
113
116
|
});
|
|
117
|
+
describe('shared pm2 connection', () => {
|
|
118
|
+
it('calls pm2.connect only once across consecutive exported calls', async () => {
|
|
119
|
+
const connectSpy = jest.spyOn(jest.requireMock('pm2'), 'connect');
|
|
120
|
+
await getProcessStatus('non-existent');
|
|
121
|
+
await getProcessStatus('non-existent');
|
|
122
|
+
expect(connectSpy).toHaveBeenCalledTimes(1);
|
|
123
|
+
});
|
|
124
|
+
it('retries connect on the next call after a connect rejection', async () => {
|
|
125
|
+
const pm2Mock = jest.requireMock('pm2');
|
|
126
|
+
const connectSpy = jest.spyOn(pm2Mock, 'connect');
|
|
127
|
+
connectSpy.mockImplementationOnce((...args) => {
|
|
128
|
+
const cb = args[0];
|
|
129
|
+
cb?.(new Error('connect failed'));
|
|
130
|
+
});
|
|
131
|
+
await expect(getProcessStatus('non-existent')).rejects.toThrow('connect failed');
|
|
132
|
+
expect(connectSpy).toHaveBeenCalledTimes(1);
|
|
133
|
+
await getProcessStatus('non-existent');
|
|
134
|
+
expect(connectSpy).toHaveBeenCalledTimes(2);
|
|
135
|
+
});
|
|
136
|
+
it('disconnectPm2 closes the shared connection so the next call reconnects', async () => {
|
|
137
|
+
const connectSpy = jest.spyOn(jest.requireMock('pm2'), 'connect');
|
|
138
|
+
await getProcessStatus('non-existent');
|
|
139
|
+
expect(connectSpy).toHaveBeenCalledTimes(1);
|
|
140
|
+
await disconnectPm2();
|
|
141
|
+
await getProcessStatus('non-existent');
|
|
142
|
+
expect(connectSpy).toHaveBeenCalledTimes(2);
|
|
143
|
+
});
|
|
144
|
+
});
|
package/dist/utils/pm2.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ export declare function startProcess(ecosystemPath: string): Promise<void>;
|
|
|
3
3
|
export declare function stopProcess(name: string): Promise<void>;
|
|
4
4
|
export declare function killProcess(name: string): Promise<void>;
|
|
5
5
|
export declare function reloadProcess(name: string): Promise<void>;
|
|
6
|
+
export declare function disconnectPm2(): Promise<void>;
|
|
6
7
|
export declare function waitForOnline(name: string, timeoutMs?: number, intervalMs?: number): Promise<boolean>;
|
|
7
8
|
export declare function getProcessStatus(name: string): Promise<Pm2ProcessStatus | null>;
|
package/dist/utils/pm2.js
CHANGED
|
@@ -22,6 +22,20 @@ async function pm2Connect() {
|
|
|
22
22
|
});
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
+
// 模块级懒加载单例:复用同一条 pm2 RPC 连接,避免每个操作都
|
|
26
|
+
// connect/disconnect 触发 pm2 竞态(disconnect 后 axon connect 事件
|
|
27
|
+
// 才到达时 self.client 已为 null)。
|
|
28
|
+
let connectPromise = null;
|
|
29
|
+
function getConnection() {
|
|
30
|
+
if (!connectPromise) {
|
|
31
|
+
connectPromise = pm2Connect().catch((err) => {
|
|
32
|
+
// 连接失败时允许下次调用重新尝试,同时不吞掉 reject
|
|
33
|
+
connectPromise = null;
|
|
34
|
+
throw err;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return connectPromise;
|
|
38
|
+
}
|
|
25
39
|
async function pm2Disconnect() {
|
|
26
40
|
return new Promise((resolve) => {
|
|
27
41
|
pm2.disconnect();
|
|
@@ -84,47 +98,44 @@ async function pm2List() {
|
|
|
84
98
|
});
|
|
85
99
|
}
|
|
86
100
|
export async function startProcess(ecosystemPath) {
|
|
87
|
-
await
|
|
101
|
+
await getConnection();
|
|
88
102
|
await pm2Start(ecosystemPath);
|
|
89
|
-
await pm2Disconnect();
|
|
90
103
|
}
|
|
91
104
|
export async function stopProcess(name) {
|
|
92
|
-
await
|
|
105
|
+
await getConnection();
|
|
93
106
|
await pm2Stop(name);
|
|
94
|
-
await pm2Disconnect();
|
|
95
107
|
}
|
|
96
108
|
export async function killProcess(name) {
|
|
97
|
-
await
|
|
109
|
+
await getConnection();
|
|
98
110
|
await pm2Delete(name);
|
|
99
|
-
await pm2Disconnect();
|
|
100
111
|
}
|
|
101
112
|
export async function reloadProcess(name) {
|
|
102
|
-
await
|
|
113
|
+
await getConnection();
|
|
103
114
|
await pm2Reload(name);
|
|
115
|
+
}
|
|
116
|
+
// 服务器关闭时断开共享的 pm2 连接
|
|
117
|
+
export async function disconnectPm2() {
|
|
118
|
+
if (!connectPromise)
|
|
119
|
+
return;
|
|
104
120
|
await pm2Disconnect();
|
|
121
|
+
connectPromise = null;
|
|
105
122
|
}
|
|
106
123
|
// 轮询 pm2 list,直到目标进程状态为 online 或超时
|
|
107
124
|
export async function waitForOnline(name, timeoutMs = 8000, intervalMs = 300) {
|
|
108
|
-
await
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
117
|
-
}
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
finally {
|
|
121
|
-
await pm2Disconnect();
|
|
125
|
+
await getConnection();
|
|
126
|
+
const deadline = Date.now() + timeoutMs;
|
|
127
|
+
while (Date.now() < deadline) {
|
|
128
|
+
const list = await pm2List();
|
|
129
|
+
const proc = list.find(p => p.name === name);
|
|
130
|
+
if (proc?.pm2_env?.status === 'online')
|
|
131
|
+
return true;
|
|
132
|
+
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
122
133
|
}
|
|
134
|
+
return false;
|
|
123
135
|
}
|
|
124
136
|
export async function getProcessStatus(name) {
|
|
125
|
-
await
|
|
137
|
+
await getConnection();
|
|
126
138
|
const list = await pm2List();
|
|
127
|
-
await pm2Disconnect();
|
|
128
139
|
const proc = list.find(p => p.name === name);
|
|
129
140
|
if (!proc)
|
|
130
141
|
return null;
|