jishushell 0.4.2 → 0.4.17
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/Dockerfile.openclaw-slim +58 -0
- package/INSTALL-NOTICE +45 -0
- package/dist/auth.js +3 -3
- package/dist/auth.js.map +1 -1
- package/dist/cli/app.d.ts +3 -0
- package/dist/cli/app.js +156 -0
- package/dist/cli/app.js.map +1 -0
- package/dist/{doctor.d.ts → cli/doctor.d.ts} +6 -1
- package/dist/{doctor.js → cli/doctor.js} +389 -27
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/helpers.d.ts +4 -0
- package/dist/cli/helpers.js +32 -0
- package/dist/cli/helpers.js.map +1 -0
- package/dist/cli/job.d.ts +3 -0
- package/dist/cli/job.js +260 -0
- package/dist/cli/job.js.map +1 -0
- package/dist/cli/llm.d.ts +24 -0
- package/dist/cli/llm.js +593 -0
- package/dist/cli/llm.js.map +1 -0
- package/dist/cli/openclaw.d.ts +12 -0
- package/dist/cli/openclaw.js +156 -0
- package/dist/cli/openclaw.js.map +1 -0
- package/dist/cli/panel.d.ts +25 -0
- package/dist/cli/panel.js +734 -0
- package/dist/cli/panel.js.map +1 -0
- package/dist/cli.js +476 -219
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +22 -4
- package/dist/config.js +96 -55
- package/dist/config.js.map +1 -1
- package/dist/control.d.ts +13 -41
- package/dist/control.js +12 -1355
- package/dist/control.js.map +1 -1
- package/dist/install.d.ts +1 -1
- package/dist/install.js +15 -29
- package/dist/install.js.map +1 -1
- package/dist/routes/apps.d.ts +3 -0
- package/dist/routes/apps.js +99 -0
- package/dist/routes/apps.js.map +1 -0
- package/dist/routes/backup.d.ts +2 -0
- package/dist/routes/backup.js +370 -0
- package/dist/routes/backup.js.map +1 -0
- package/dist/routes/instances.d.ts +1 -0
- package/dist/routes/instances.js +61 -15
- package/dist/routes/instances.js.map +1 -1
- package/dist/routes/llm.d.ts +15 -0
- package/dist/routes/llm.js +246 -0
- package/dist/routes/llm.js.map +1 -0
- package/dist/routes/setup.js +32 -7
- package/dist/routes/setup.js.map +1 -1
- package/dist/routes/system.js +31 -6
- package/dist/routes/system.js.map +1 -1
- package/dist/server.js +69 -5
- package/dist/server.js.map +1 -1
- package/dist/services/app-compiler.d.ts +15 -0
- package/dist/services/app-compiler.js +169 -0
- package/dist/services/app-compiler.js.map +1 -0
- package/dist/services/app-manager.d.ts +17 -0
- package/dist/services/app-manager.js +168 -0
- package/dist/services/app-manager.js.map +1 -0
- package/dist/services/backup-manager.d.ts +253 -0
- package/dist/services/backup-manager.js +2014 -0
- package/dist/services/backup-manager.js.map +1 -0
- package/dist/services/backup-verify.d.ts +26 -0
- package/dist/services/backup-verify.js +240 -0
- package/dist/services/backup-verify.js.map +1 -0
- package/dist/services/instance-manager.d.ts +73 -5
- package/dist/services/instance-manager.js +446 -74
- package/dist/services/instance-manager.js.map +1 -1
- package/dist/services/job-manager.d.ts +22 -0
- package/dist/services/job-manager.js +102 -0
- package/dist/services/job-manager.js.map +1 -0
- package/dist/services/llm-proxy/adapters.js +5 -1
- package/dist/services/llm-proxy/adapters.js.map +1 -1
- package/dist/services/llm-proxy/index.d.ts +30 -0
- package/dist/services/llm-proxy/index.js +71 -1
- package/dist/services/llm-proxy/index.js.map +1 -1
- package/dist/services/llm-proxy/ssrf.js +1 -1
- package/dist/services/llm-proxy/ssrf.js.map +1 -1
- package/dist/services/nomad-manager.js +263 -159
- package/dist/services/nomad-manager.js.map +1 -1
- package/dist/services/panel-manager.d.ts +40 -0
- package/dist/services/panel-manager.js +346 -0
- package/dist/services/panel-manager.js.map +1 -0
- package/dist/services/process-manager.js +24 -10
- package/dist/services/process-manager.js.map +1 -1
- package/dist/services/setup-manager.d.ts +4 -2
- package/dist/services/setup-manager.js +578 -154
- package/dist/services/setup-manager.js.map +1 -1
- package/dist/services/telemetry/activation.js +10 -7
- package/dist/services/telemetry/activation.js.map +1 -1
- package/dist/services/telemetry/client.js +7 -18
- package/dist/services/telemetry/client.js.map +1 -1
- package/dist/services/telemetry/heartbeat.js +12 -6
- package/dist/services/telemetry/heartbeat.js.map +1 -1
- package/dist/services/update-manager.d.ts +47 -0
- package/dist/services/update-manager.js +305 -0
- package/dist/services/update-manager.js.map +1 -0
- package/dist/types.d.ts +62 -0
- package/dist/utils/fs.d.ts +85 -0
- package/dist/utils/fs.js +111 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/safe-json.d.ts +2 -0
- package/dist/utils/safe-json.js +22 -16
- package/dist/utils/safe-json.js.map +1 -1
- package/install/jishu-install.sh +582 -138
- package/install/jishu-uninstall.sh +276 -391
- package/install/post-install.sh +85 -3
- package/openclaw-entry.sh +15 -0
- package/package.json +12 -5
- package/public/assets/Dashboard-CQsp1Mr9.js +1 -0
- package/public/assets/InitPassword-BEC8SE4A.js +1 -0
- package/public/assets/InstanceDetail-B5wTgNEg.js +17 -0
- package/public/assets/{Login-RkjzTNWg.js → Login-D1Bt-Lyk.js} +1 -1
- package/public/assets/NewInstance-GQzm3K9D.js +1 -0
- package/public/assets/Settings-ByjGlqhP.js +1 -0
- package/public/assets/Setup-cMF21Y-8.js +1 -0
- package/public/assets/index-B6qQP4mH.css +1 -0
- package/public/assets/index-BuTQtuNy.js +16 -0
- package/public/assets/logo-black-theme-DywLAtFy.png +0 -0
- package/public/assets/logo-white-theme-DXffFAWw.png +0 -0
- package/public/assets/{providers-lBSOjUWy.js → providers-V-vwrExZ.js} +1 -1
- package/public/assets/{usePolling-CqQ8hrNc.js → usePolling-CK0DfI4h.js} +1 -1
- package/public/assets/{vendor-i18n-Bvxxh8Di.js → vendor-i18n-CfW0RvgE.js} +1 -1
- package/public/assets/vendor-react-B1-3Yrt-.js +59 -0
- package/public/index.html +4 -4
- package/dist/doctor.js.map +0 -1
- package/public/assets/Dashboard-CAOQDYDR.js +0 -1
- package/public/assets/InitPassword-CkehIkJG.js +0 -1
- package/public/assets/InstanceDetail-CzW2S95J.js +0 -14
- package/public/assets/NewInstance-DdbErdjA.js +0 -1
- package/public/assets/Settings-BUD7zwv9.js +0 -1
- package/public/assets/Setup-RRTIERGG.js +0 -1
- package/public/assets/index-77Ug7feY.css +0 -1
- package/public/assets/index-DfRnVUQR.js +0 -16
- package/public/assets/vendor-react-DONn7uBV.js +0 -59
package/install/post-install.sh
CHANGED
|
@@ -6,6 +6,26 @@ if [[ "${CI:-}" == "true" || -n "${CI_PIPELINE_ID:-}" ]]; then
|
|
|
6
6
|
exit 0
|
|
7
7
|
fi
|
|
8
8
|
|
|
9
|
+
_post_install_has_tty() {
|
|
10
|
+
( : > /dev/tty ) 2>/dev/null
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
# Only run when installed globally via `npm install -g jishushell`.
|
|
14
|
+
# Local installs (npm install, npm run build) skip post-install entirely.
|
|
15
|
+
if [[ -n "${npm_lifecycle_event:-}" && "${npm_config_global:-false}" != "true" ]]; then
|
|
16
|
+
_tty=/dev/stderr
|
|
17
|
+
if _post_install_has_tty; then
|
|
18
|
+
_tty=/dev/tty
|
|
19
|
+
fi
|
|
20
|
+
{
|
|
21
|
+
echo ""
|
|
22
|
+
echo " JishuShell requires global installation."
|
|
23
|
+
echo " Please use: npm install -g jishushell"
|
|
24
|
+
echo ""
|
|
25
|
+
} > "$_tty"
|
|
26
|
+
exit 0
|
|
27
|
+
fi
|
|
28
|
+
|
|
9
29
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
10
30
|
# JishuShell Post-Install Script
|
|
11
31
|
#
|
|
@@ -20,6 +40,15 @@ fi
|
|
|
20
40
|
# Sources jishu-install.sh for all shared functions.
|
|
21
41
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
22
42
|
|
|
43
|
+
# ── Skip when running inside a local dev checkout ─────────────────────────────
|
|
44
|
+
# During development, `npm install` (or `npm run build`) runs in the repo root.
|
|
45
|
+
# The postinstall hook is meant for end-user `npm install -g jishushell` only.
|
|
46
|
+
# Detect the dev checkout by looking for a .git directory next to package.json.
|
|
47
|
+
_post_install_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
48
|
+
if [[ -d "${_post_install_dir}/../.git" ]]; then
|
|
49
|
+
exit 0
|
|
50
|
+
fi
|
|
51
|
+
|
|
23
52
|
# When post-install.sh is triggered by npm's postinstall hook that was itself
|
|
24
53
|
# launched from inside jishu-install.sh (i.e. jishu-install.sh called
|
|
25
54
|
# `npm install -g jishushell`), all installation steps have already been run
|
|
@@ -67,13 +96,60 @@ export JISHUSHELL_SKIP_NPM_INSTALL=1
|
|
|
67
96
|
# Parse any extra args forwarded via npm (e.g. --dry-run, --yes, --skip-docker)
|
|
68
97
|
parse_args "$@"
|
|
69
98
|
|
|
99
|
+
# ── Non-interactive upgrade mode ──────────────────────────────────────────────
|
|
100
|
+
# Web-triggered `npm install -g jishushell` runs without a controlling TTY, so
|
|
101
|
+
# postinstall must not block on sudo prompts or fail the package upgrade solely
|
|
102
|
+
# because privileged refresh steps cannot be confirmed interactively.
|
|
103
|
+
POST_INSTALL_BEST_EFFORT=0
|
|
104
|
+
configure_postinstall_mode() {
|
|
105
|
+
# Web-triggered upgrade: npm was spawned by the panel backend without a
|
|
106
|
+
# controlling TTY. Skip all privileged steps so npm can exit cleanly.
|
|
107
|
+
if [[ "${JISHUSHELL_WEB_UPDATE:-0}" == "1" ]]; then
|
|
108
|
+
POST_INSTALL_BEST_EFFORT=1
|
|
109
|
+
NO_PROMPT=1
|
|
110
|
+
SUDO=""
|
|
111
|
+
SKIP_DOCKER=1
|
|
112
|
+
SKIP_NOMAD=1
|
|
113
|
+
SKIP_OPENCLAW=1
|
|
114
|
+
SKIP_JISHUSHELL_SERVICE=1
|
|
115
|
+
return 0
|
|
116
|
+
fi
|
|
117
|
+
|
|
118
|
+
if [[ $EUID -eq 0 ]]; then
|
|
119
|
+
SUDO=""
|
|
120
|
+
return 0
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
if ! command -v sudo &>/dev/null; then
|
|
124
|
+
return 0
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
if sudo -n true 2>/dev/null; then
|
|
128
|
+
SUDO="sudo"
|
|
129
|
+
NO_PROMPT=1
|
|
130
|
+
return 0
|
|
131
|
+
fi
|
|
132
|
+
|
|
133
|
+
if _post_install_has_tty; then
|
|
134
|
+
return 0
|
|
135
|
+
fi
|
|
136
|
+
|
|
137
|
+
POST_INSTALL_BEST_EFFORT=1
|
|
138
|
+
NO_PROMPT=1
|
|
139
|
+
SUDO=""
|
|
140
|
+
SKIP_DOCKER=1
|
|
141
|
+
SKIP_NOMAD=1
|
|
142
|
+
SKIP_OPENCLAW=1
|
|
143
|
+
SKIP_JISHUSHELL_SERVICE=1
|
|
144
|
+
}
|
|
145
|
+
|
|
70
146
|
# ── Log setup ─────────────────────────────────────────────────────────────────
|
|
71
147
|
# npm captures lifecycle script stdout/stderr and only shows it on error.
|
|
72
148
|
# Writing to /dev/tty bypasses that capture so progress is visible in real time.
|
|
73
149
|
# The log file is always written regardless of tty availability.
|
|
74
150
|
mkdir -p "${REAL_HOME}/.jishushell"
|
|
75
151
|
LOG_FILE="${REAL_HOME}/.jishushell/post-install-$(date +%Y-%m-%d-%H-%M-%S)-$$.log"
|
|
76
|
-
if
|
|
152
|
+
if _post_install_has_tty; then
|
|
77
153
|
# tee writes to $LOG_FILE; its stdout (>/dev/tty) goes straight to the terminal,
|
|
78
154
|
# bypassing npm's stdout capture entirely.
|
|
79
155
|
exec > >(tee -a "$LOG_FILE" >/dev/tty) 2>&1
|
|
@@ -89,8 +165,14 @@ echo ""
|
|
|
89
165
|
# ── Run install steps ─────────────────────────────────────────────────────────
|
|
90
166
|
detect_os
|
|
91
167
|
detect_arch
|
|
92
|
-
|
|
93
|
-
|
|
168
|
+
configure_postinstall_mode
|
|
169
|
+
if [[ "$POST_INSTALL_BEST_EFFORT" == "1" ]]; then
|
|
170
|
+
ui_warn "No interactive sudo is available during npm post-install — skipping privileged runtime checks and service refresh."
|
|
171
|
+
ui_info "The JishuShell package files were updated. If you need to reconcile system components later, run: jishushell install --yes"
|
|
172
|
+
else
|
|
173
|
+
check_sudo
|
|
174
|
+
ensure_prerequisites
|
|
175
|
+
fi
|
|
94
176
|
run_install_components --with-jishushell || true
|
|
95
177
|
_rc=$?
|
|
96
178
|
show_summary --with-jishushell
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# openclaw-entry.sh — OpenClaw version-switch entrypoint
|
|
3
|
+
# Prefer the upgraded version under HOME (npm_config_prefix),
|
|
4
|
+
# fall back to the image-bundled version.
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
HOME_PKG="$HOME/.npm-global/lib/node_modules/openclaw/openclaw.mjs"
|
|
9
|
+
IMAGE_PKG="/app/openclaw.mjs"
|
|
10
|
+
|
|
11
|
+
if [ -f "$HOME_PKG" ]; then
|
|
12
|
+
exec node "$HOME_PKG" "$@"
|
|
13
|
+
else
|
|
14
|
+
exec node "$IMAGE_PKG" "$@"
|
|
15
|
+
fi
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jishushell",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "JishuShell -
|
|
3
|
+
"version": "0.4.17",
|
|
4
|
+
"description": "JishuShell - Multi-Agent Framework Management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"jishushell": "./dist/cli.js"
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
"public/",
|
|
12
12
|
"scripts/",
|
|
13
13
|
"install/",
|
|
14
|
-
"
|
|
14
|
+
"Dockerfile.openclaw-slim",
|
|
15
|
+
"openclaw-entry.sh",
|
|
16
|
+
"INSTALL-NOTICE",
|
|
15
17
|
"THIRD-PARTY-NOTICES"
|
|
16
18
|
],
|
|
17
19
|
"scripts": {
|
|
@@ -23,15 +25,18 @@
|
|
|
23
25
|
"test": "vitest run",
|
|
24
26
|
"test:unit:backend": "vitest run tests/unit",
|
|
25
27
|
"test:integration": "vitest run tests/integration",
|
|
28
|
+
"test:e2e:real": "npm run build:backend && vitest run --config vitest.e2e-real.config.ts",
|
|
29
|
+
"test:e2e:real:verbose": "npm run build:backend && vitest run --config vitest.e2e-real.config.ts --reporter=verbose",
|
|
26
30
|
"test:watch": "vitest",
|
|
27
31
|
"test:coverage": "vitest run --coverage",
|
|
28
32
|
"test:ci": "npm run build:backend && vitest run --coverage && cd frontend && npm install && npm run test",
|
|
33
|
+
"test:ci:full": "npm run test:ci && vitest run --config vitest.e2e-real.config.ts",
|
|
29
34
|
"prepublishOnly": "npm run build && chmod +x dist/cli.js",
|
|
30
35
|
"postinstall": "bash install/post-install.sh",
|
|
31
36
|
"preuninstall": "bash install/post-uninstall.sh",
|
|
32
37
|
"prepare": "git config core.hooksPath .githooks 2>/dev/null || true",
|
|
33
38
|
"build:pack": "npm run build && npm pack",
|
|
34
|
-
"version": "node -e \"const fs=require('fs'),
|
|
39
|
+
"version": "node -e \"const fs=require('fs'),v=JSON.parse(fs.readFileSync('./package.json','utf8')).version,fp='./frontend/package.json',p=JSON.parse(fs.readFileSync(fp,'utf8'));p.version=v;fs.writeFileSync(fp,JSON.stringify(p,null,2)+'\\n')\" && git add frontend/package.json"
|
|
35
40
|
},
|
|
36
41
|
"engines": {
|
|
37
42
|
"node": ">=22"
|
|
@@ -43,12 +48,14 @@
|
|
|
43
48
|
],
|
|
44
49
|
"license": "Apache-2.0",
|
|
45
50
|
"dependencies": {
|
|
51
|
+
"@fastify/multipart": "^10.0.0",
|
|
46
52
|
"@fastify/static": "^8.1.0",
|
|
47
53
|
"@noble/hashes": "^2.0.1",
|
|
48
54
|
"bcryptjs": "^2.4.3",
|
|
49
55
|
"fastify": "^5.2.0",
|
|
50
56
|
"jsonwebtoken": "^9.0.2",
|
|
51
|
-
"systeminformation": "^5.23.0"
|
|
57
|
+
"systeminformation": "^5.23.0",
|
|
58
|
+
"yaml": "^2.8.3"
|
|
52
59
|
},
|
|
53
60
|
"devDependencies": {
|
|
54
61
|
"@types/bcryptjs": "^2.4.6",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as B,j as e,L as E,k,l as M,m as R,n as K,o as L,q as A,t as I,v as T,w as W}from"./index-BuTQtuNy.js";import{r as m,u as D}from"./vendor-react-B1-3Yrt-.js";import{u as P}from"./usePolling-CK0DfI4h.js";import{u as C}from"./vendor-i18n-CfW0RvgE.js";function q(t){if(!t)return"-";const l=Math.floor(t/86400),d=Math.floor(t%86400/3600),r=Math.floor(t%3600/60);return l>0?`${l}d ${d}h`:d>0?`${d}h ${r}m`:`${r}m`}function G({status:t}){const{t:l}=C(),r={running:{cls:"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",labelKey:"status.running"},pending:{cls:"bg-amber-500/10 text-amber-400 border border-amber-500/20",labelKey:"status.starting"},failed:{cls:"bg-red-500/10 text-red-400 border border-red-500/20",labelKey:"status.failed"},dead:{cls:"bg-red-500/10 text-red-400 border border-red-500/20",labelKey:"status.crashed"}}[t]||{cls:"bg-[var(--card)] text-muted border border-[var(--border)]",labelKey:"status.stopped"};return e.jsx("span",{className:`inline-flex items-center text-xs px-2 py-0.5 rounded-full font-medium ${r.cls}`,children:l(r.labelKey)})}function z(){const{t}=C(["dashboard","common"]),[l,d]=m.useState([]),[r,$]=m.useState(null),[h,v]=m.useState(""),[y,j]=m.useState(""),[p,N]=m.useState(!1),g=D(),{showToast:c}=B(),u=()=>{K().then(s=>{d(s),j("")}).catch(s=>j(s.message||t("common:error.loadFailed"))),L().then($).catch(()=>{})};P(u,1e4);const _=async()=>{if(window.confirm(t("engine.restartConfirm"))){N(!0);try{await A(),c(t("engine.restarted"),"success"),setTimeout(u,2e3)}catch(s){c(s.message||t("engine.restartFailed"),"error")}finally{N(!1)}}},f=async(s,a,i)=>{s.stopPropagation(),v(`${i}-${a}`);try{let n=null;a==="start"&&(n=await I(i)),a==="stop"&&(n=await T(i)),a==="restart"&&(n=await W(i)),c(t(`common:action.${a}Done`),"success");const o=n==null?void 0:n.port_allocation;o&&typeof o.from=="number"&&typeof o.to=="number"&&o.from!==o.to&&c(t("common:toast.portReallocated",{defaultValue:"端口 {{from}} 被占用,已自动切换到 {{to}}",from:o.from,to:o.to}),"info"),setTimeout(u,1e3)}catch(n){c(n.message||t("common:error.operationFailed"),"error")}finally{v("")}},F=l.filter(s=>{var a;return((a=s.service)==null?void 0:a.status)==="running"}).length,b=!!r&&r.disk.percent>90,S=r?[{label:t("stats.runningInstances"),value:`${F} / ${l.length}`,sub:r.nomad_running?t("stats.engineRunning"):t("stats.engineStopped"),subColor:r.nomad_running?"text-emerald-400":"text-red-400",icon:e.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),e.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),iconColor:"text-[#0066FF]",glowColor:"rgba(0,102,255,0.12)",accent:"border-l-2 border-l-[#0066FF]"},{label:t("stats.cpu"),value:`${r.cpu_percent}%`,sub:r.temperature?`${r.temperature}°C`:null,icon:e.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:[e.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),e.jsx("rect",{x:"9",y:"9",width:"6",height:"6"}),e.jsx("line",{x1:"9",y1:"2",x2:"9",y2:"4"}),e.jsx("line",{x1:"15",y1:"2",x2:"15",y2:"4"}),e.jsx("line",{x1:"9",y1:"20",x2:"9",y2:"22"}),e.jsx("line",{x1:"15",y1:"20",x2:"15",y2:"22"}),e.jsx("line",{x1:"20",y1:"9",x2:"22",y2:"9"}),e.jsx("line",{x1:"20",y1:"15",x2:"22",y2:"15"}),e.jsx("line",{x1:"2",y1:"9",x2:"4",y2:"9"}),e.jsx("line",{x1:"2",y1:"15",x2:"4",y2:"15"})]}),iconColor:"text-[#0066FF]",glowColor:"rgba(0,102,255,0.12)",accent:"border-l-2 border-l-[#0066FF]",warn:r.cpu_percent>90},{label:t("stats.memory"),value:`${r.memory.percent}%`,sub:`${r.memory.used_mb}MB / ${r.memory.total_mb}MB`,icon:e.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{d:"M6 19v-8m4 8v-4m4 4v-6m4 6v-2"})}),iconColor:"text-[#00D4AA]",glowColor:"rgba(0,212,170,0.12)",accent:"border-l-2 border-l-[#00D4AA]"},{label:t("stats.disk"),value:`${r.disk.percent}%`,sub:`${r.disk.used_gb}GB / ${r.disk.total_gb}GB`,icon:e.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:[e.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),e.jsx("path",{d:"M3 5v14a9 3 0 0018 0V5"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"22"})]}),iconColor:b?"text-red-400":"text-[#0066FF]",glowColor:b?"rgba(239,68,68,0.12)":"rgba(0,102,255,0.12)",accent:b?"border-l-2 border-l-red-400":"border-l-2 border-l-[#0066FF]",warn:b}]:[];return e.jsxs("div",{className:"p-4 max-w-5xl mx-auto",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-base font-semibold text-foreground",children:t("title")}),e.jsx("p",{className:"text-xs text-muted mt-0.5",children:t("subtitle")})]}),e.jsx(E,{})]}),r&&e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-4",children:S.map(s=>e.jsxs("div",{className:`bg-[var(--card)] border border-[var(--border)] rounded-lg p-3 relative overflow-hidden hover:border-[var(--border-hover)] hover:bg-[var(--card-hover)] transition-all duration-200 ${s.accent}`,children:[e.jsx("div",{className:"absolute top-0 right-0 w-16 h-16 rounded-full opacity-60 pointer-events-none",style:{background:`radial-gradient(circle, ${s.glowColor} 0%, transparent 70%)`}}),e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-[11px] text-muted",children:s.label}),e.jsx("span",{className:`${s.iconColor} opacity-80`,children:s.icon})]}),e.jsx("div",{className:`text-lg font-semibold ${s.warn?"text-red-400":"text-foreground"}`,children:s.value}),s.sub&&e.jsx("div",{className:`text-[11px] mt-0.5 truncate ${s.subColor??"text-muted"}`,children:s.sub})]},s.label))}),e.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-2.5 border-b border-[var(--border)] flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-medium text-foreground",children:t("instances.title")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>g("/instances/new"),className:"bg-[#0066FF] text-white px-3 py-1.5 rounded-md text-xs font-medium hover:bg-[#0066FF]/90 transition-all duration-200 shadow-[0_0_12px_rgba(0,102,255,0.3)]",children:t("instances.new")}),e.jsx("button",{onClick:()=>g("/instances/new?import=true"),className:"px-3 py-1.5 rounded-md text-xs font-medium text-muted border border-[var(--border)] bg-[var(--card)] hover:bg-[var(--card-hover)] hover:text-foreground transition-all duration-200",children:t("instances.import")}),e.jsxs("button",{onClick:_,disabled:p,title:t("instances.restartEngineTitle"),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs font-medium text-red-400 border border-red-500/20 bg-red-500/5 hover:bg-red-500/15 disabled:opacity-40 disabled:cursor-not-allowed transition-all duration-200",children:[e.jsx(k,{className:`w-3 h-3 ${p?"animate-spin":""}`}),t(p?"instances.restarting":"instances.restartEngine")]})]})]}),y?e.jsxs("div",{className:"text-center py-12 px-4",children:[e.jsx("p",{className:"text-sm text-red-400 mb-2",children:t("instances.loadError",{error:y})}),e.jsx("button",{onClick:u,className:"text-xs text-muted hover:text-foreground underline",children:t("common:action.retry")})]}):l.length===0?e.jsxs("div",{className:"text-center py-12 px-4",children:[e.jsx("div",{className:"text-muted opacity-40 mb-3",children:e.jsxs("svg",{className:"w-8 h-8 mx-auto",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),e.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}),e.jsx("p",{className:"text-sm text-muted mb-1",children:t("instances.empty")}),e.jsx("p",{className:"text-xs text-muted opacity-60",children:t("instances.emptyHint")})]}):e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-xs text-muted border-b border-[var(--border)]",children:[e.jsx("th",{className:"text-left font-medium px-4 py-2",children:t("table.name")}),e.jsx("th",{className:"text-left font-medium px-4 py-2",children:t("table.status")}),e.jsx("th",{className:"text-left font-medium px-4 py-2 hidden sm:table-cell",children:t("table.uptime")}),e.jsx("th",{className:"text-left font-medium px-4 py-2 hidden md:table-cell",children:t("table.memory")}),e.jsx("th",{className:"text-right font-medium px-4 py-2",children:t("table.actions")})]})}),e.jsx("tbody",{className:"divide-y divide-[var(--border)]",children:l.map(s=>{var n,o,w;const a=((n=s.service)==null?void 0:n.status)||"stopped",i=a==="running";return e.jsxs("tr",{className:"hover:bg-[var(--card-hover)] cursor-pointer transition-colors duration-150",onClick:()=>g(`/instances/${s.id}`),children:[e.jsxs("td",{className:"px-4 py-2.5",children:[e.jsx("div",{className:"font-medium text-foreground",children:s.name}),e.jsx("div",{className:"text-xs text-muted font-mono",children:s.id})]}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(G,{status:a}),((o=s.auto_backup)==null?void 0:o.enabled)&&e.jsx("span",{className:`text-xs leading-none ${s.auto_backup.last_backup_ok===!1?"text-red-400":"text-green-400"}`,title:s.auto_backup.last_backup_ok===!1?"Backup failed":"Backup OK",children:s.auto_backup.last_backup_ok===!1?"⚠":"●"})]})}),e.jsx("td",{className:"px-4 py-2.5 text-muted hidden sm:table-cell font-mono text-xs",children:i?q(s.service.uptime):"-"}),e.jsx("td",{className:"px-4 py-2.5 text-muted hidden md:table-cell font-mono text-xs",children:(w=s.service)!=null&&w.memory_mb?`${s.service.memory_mb} MB`:"-"}),e.jsx("td",{className:"px-4 py-2.5 text-right",children:e.jsx("div",{className:"inline-flex items-center gap-1",children:i||a==="pending"?e.jsxs(e.Fragment,{children:[e.jsx("button",{title:t("common:action.restart"),onClick:x=>f(x,"restart",s.id),disabled:!!h,className:"p-1.5 rounded-md text-muted hover:text-foreground hover:bg-[var(--card-hover)] disabled:opacity-30 transition-colors duration-150",children:e.jsx(k,{className:"w-3.5 h-3.5"})}),e.jsx("button",{title:t("common:action.stop"),onClick:x=>f(x,"stop",s.id),disabled:!!h,className:"p-1.5 rounded-md text-muted hover:text-red-400 hover:bg-red-500/10 disabled:opacity-30 transition-colors duration-150",children:e.jsx(M,{className:"w-3.5 h-3.5"})})]}):e.jsx("button",{title:t("common:action.start"),onClick:x=>f(x,"start",s.id),disabled:!!h,className:"p-1.5 rounded-md text-muted hover:text-emerald-400 hover:bg-emerald-500/10 disabled:opacity-30 transition-colors duration-150",children:e.jsx(R,{className:"w-3.5 h-3.5"})})})})]},s.id)})})]})]})]})}export{z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,L as j,T as v,I as w,a as N,c as y,s as F}from"./index-BuTQtuNy.js";import{r}from"./vendor-react-B1-3Yrt-.js";import{u as S}from"./vendor-i18n-CfW0RvgE.js";const x="w-full bg-[var(--input-bg)] border border-[var(--border)] rounded-md px-3 py-2.5 text-sm text-foreground placeholder-[var(--muted)] focus:outline-none focus:ring-1 focus:ring-[#0066FF]/60 focus:border-[#0066FF]/60 transition-colors duration-200";function C({onDone:h}){const{t}=S("auth"),[s,p]=r.useState(""),[n,b]=r.useState(""),[o,f]=r.useState(!1),[l,d]=r.useState(""),[c,m]=r.useState(!1),u=s.length>=8&&s===n,g=async a=>{if(a.preventDefault(),!!u){d(""),m(!0);try{const i=await y(s);F(i.token),h()}catch(i){d(i.message||t("init.failed"))}finally{m(!1)}}};return e.jsxs("div",{className:"min-h-screen flex items-center justify-center p-4 bg-background relative overflow-hidden",children:[e.jsx("div",{className:"grid-bg absolute inset-0 pointer-events-none"}),e.jsx("div",{className:"absolute top-1/3 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[500px] h-[300px] rounded-full bg-[#0066FF]/[0.07] blur-[90px] pointer-events-none"}),e.jsx("div",{className:"absolute top-4 right-4 z-20",children:e.jsx(j,{})}),e.jsxs("div",{className:"w-full max-w-sm relative z-10",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx(v,{className:"w-40 h-40 mx-auto mb-4 object-contain"}),e.jsx("p",{className:"text-sm text-muted mt-1",children:t("init.title")})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[l&&e.jsx("div",{className:"bg-red-500/10 border border-red-500/20 text-red-400 text-sm rounded-lg px-3 py-2.5",children:l}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:t("init.password")}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:o?"text":"password",value:s,onChange:a=>p(a.target.value),placeholder:t("init.passwordPlaceholder"),className:`${x} pr-10`,autoFocus:!0}),e.jsx("button",{type:"button",onClick:()=>f(!o),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted hover:text-foreground transition-colors duration-200",children:o?e.jsx(w,{}):e.jsx(N,{})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:t("init.confirm")}),e.jsx("input",{type:o?"text":"password",value:n,onChange:a=>b(a.target.value),placeholder:t("init.confirmPlaceholder"),className:x}),s&&n&&s!==n&&e.jsx("p",{className:"text-red-400 text-xs mt-1.5",children:t("init.mismatch")})]}),e.jsx("button",{type:"submit",disabled:c||!u,className:"w-full bg-[#0066FF] text-white rounded-md py-2.5 text-sm font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 disabled:cursor-not-allowed transition-all duration-200 shadow-[0_0_20px_rgba(0,102,255,0.3)] hover:shadow-[0_0_28px_rgba(0,102,255,0.45)]",children:c?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx("span",{className:"w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin"}),t("init.loading")]}):t("init.submit")})]})]})]})}export{C as default};
|