@zzz0350/our-workbuddy-standalone 0.0.0-stage → 5.31.3

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/package.json CHANGED
@@ -1,6 +1,49 @@
1
1
  {
2
2
  "name": "@zzz0350/our-workbuddy-standalone",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "5.31.3",
4
+ "description": "Our WorkBuddy standalone gateway (main.js + Windows hidden launcher & watchdog)",
5
+ "license": "UNLICENSED",
6
+ "type": "module",
7
+ "main": "main.js",
8
+ "files": [
9
+ "main.js",
10
+ "start.cmd",
11
+ "start-hidden.vbs",
12
+ "watchdog.cmd",
13
+ "watchdog-hidden.vbs",
14
+ "workbuddy-icon.ico",
15
+ "README.md"
16
+ ],
17
+ "scripts": {
18
+ "release": "node source/release.mjs",
19
+ "release:dry": "node source/release.mjs --dry-run",
20
+ "pack:check": "npm pack --dry-run"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public",
24
+ "registry": "https://registry.npmjs.org/"
25
+ },
26
+ "releaseNotes": [
27
+ {
28
+ "version": "5.31.3",
29
+ "date": "2026-11-24",
30
+ "items": [
31
+ "精简侧栏底部版本展示,并移除能力页中的 DSH 剔除说明卡片",
32
+ "更新页隐藏更新源配置,默认自动检测最新版本并展示版本更新内容",
33
+ "运行日志页与启动日志新增显示守护 CMD 进程 PID 及一键复制停止命令"
34
+ ]
35
+ },
36
+ {
37
+ "version": "5.31.2",
38
+ "date": "2026-11-24",
39
+ "items": [
40
+ "同步上游 v5.31.2,支持无窗口后台守护运行与文件日志",
41
+ "管理面板新增「运行日志」查看页与「系统更新 / 一键回滚」功能"
42
+ ]
43
+ }
44
+ ],
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/z2476720314-sys/our-workbuddy-standalone.git"
48
+ }
49
+ }
@@ -0,0 +1,39 @@
1
+ ' Our WorkBuddy - hidden gateway launcher (port 18911)
2
+ ' Starts watchdog.cmd hidden (logs written to %USERPROFILE%\.our-workbuddy\logs\gateway.log)
3
+ ' and opens the admin panel once /healthz responds.
4
+ Option Explicit
5
+
6
+ Dim sh, fso, dir, i
7
+ Set sh = CreateObject("WScript.Shell")
8
+ Set fso = CreateObject("Scripting.FileSystemObject")
9
+ dir = fso.GetParentFolderName(WScript.ScriptFullName)
10
+
11
+ Function IsGatewayUp()
12
+ Dim http
13
+ IsGatewayUp = False
14
+ On Error Resume Next
15
+ Set http = CreateObject("WinHttp.WinHttpRequest.5.1")
16
+ http.SetTimeouts 500, 500, 500, 1000
17
+ http.Open "GET", "http://127.0.0.1:18911/healthz", False
18
+ http.Send
19
+ If Err.Number = 0 And http.Status = 200 Then
20
+ IsGatewayUp = True
21
+ End If
22
+ Err.Clear
23
+ On Error GoTo 0
24
+ End Function
25
+
26
+ If Not IsGatewayUp() Then
27
+ If Not fso.FileExists(dir & "\main.js") Or Not fso.FileExists(dir & "\watchdog.cmd") Then
28
+ MsgBox "Missing main.js or watchdog.cmd in " & dir, vbCritical, "Our WorkBuddy"
29
+ WScript.Quit 1
30
+ End If
31
+ sh.CurrentDirectory = dir
32
+ sh.Run """" & dir & "\watchdog.cmd""", 0, False
33
+ For i = 1 To 20
34
+ WScript.Sleep 500
35
+ If IsGatewayUp() Then Exit For
36
+ Next
37
+ End If
38
+
39
+ sh.Run "http://127.0.0.1:18911/", 1, False
package/start.cmd ADDED
@@ -0,0 +1,48 @@
1
+ @echo off
2
+ rem ============================================================
3
+ rem Our WorkBuddy - standalone gateway launcher (port 18911)
4
+ rem Starts hidden via start-hidden.vbs / watchdog.cmd so no
5
+ rem console window stays open; logs go to gateway.log.
6
+ rem ============================================================
7
+ chcp 65001 >nul 2>&1
8
+ setlocal
9
+ title Our WorkBuddy (18911)
10
+
11
+ set "ROOT=%~dp0"
12
+ set "ENTRY=%ROOT%main.js"
13
+ set "HIDDEN=%ROOT%start-hidden.vbs"
14
+ set "PORT=18911"
15
+
16
+ where node >nul 2>&1
17
+ if errorlevel 1 (
18
+ echo [x] node not found in PATH. Install Node.js first.
19
+ goto :fail
20
+ )
21
+
22
+ if not exist "%ENTRY%" (
23
+ echo [x] build output missing:
24
+ echo %ENTRY%
25
+ goto :fail
26
+ )
27
+
28
+ if not exist "%HIDDEN%" (
29
+ echo [x] hidden launcher missing:
30
+ echo %HIDDEN%
31
+ goto :fail
32
+ )
33
+
34
+ netstat -ano | findstr ":%PORT%" | findstr "LISTENING" >nul 2>&1
35
+ if not errorlevel 1 (
36
+ echo [i] port %PORT% already serving - opening the panel instead.
37
+ start "" "http://127.0.0.1:%PORT%/"
38
+ exit /b 0
39
+ )
40
+
41
+ wscript.exe //nologo "%HIDDEN%"
42
+ exit /b 0
43
+
44
+ :fail
45
+ echo.
46
+ echo ------------------------------------------------------
47
+ pause
48
+ exit /b 1
@@ -0,0 +1,10 @@
1
+ ' Our WorkBuddy - hidden watchdog launcher
2
+ ' Run(..., 0, False): window hidden, caller returns immediately.
3
+ ' All paths are relative to this script, so the folder can be moved anywhere.
4
+ Option Explicit
5
+ Dim sh, fso, dir
6
+ Set sh = CreateObject("WScript.Shell")
7
+ Set fso = CreateObject("Scripting.FileSystemObject")
8
+ dir = fso.GetParentFolderName(WScript.ScriptFullName)
9
+ sh.CurrentDirectory = dir
10
+ sh.Run """" & dir & "\watchdog.cmd""", 0, False
package/watchdog.cmd ADDED
@@ -0,0 +1,101 @@
1
+ @echo off
2
+ rem ============================================================
3
+ rem Our WorkBuddy - process watchdog (port 18911)
4
+ rem
5
+ rem WHY: the node process gets taken down by things nobody is
6
+ rem watching - parent terminal closing, uncaught failures, upstream
7
+ rem connection resets. Every death used to need a manual restart,
8
+ rem and Hermes' wb provider answers "Provider temporarily
9
+ rem unavailable" until someone does it.
10
+ rem
11
+ rem This loop only starts it again and writes down WHY it stopped.
12
+ rem The exit code and timestamp are the only evidence afterwards.
13
+ rem
14
+ rem ASCII only: cmd decodes this file with the system ANSI code
15
+ rem page before chcp takes effect, so non-ASCII here turns to mush.
16
+ rem ============================================================
17
+ chcp 65001 >nul 2>&1
18
+ setlocal enabledelayedexpansion
19
+ title watchdog - Our WorkBuddy (18911)
20
+
21
+ set "ROOT=%~dp0"
22
+ set "LOGDIR=%USERPROFILE%\.our-workbuddy\logs"
23
+ set "LOG=%LOGDIR%\gateway.log"
24
+ set "ENTRY=%ROOT%main.js"
25
+ set "PORT=18911"
26
+ set "MAXBYTES=5000000"
27
+
28
+ if not exist "%LOGDIR%" mkdir "%LOGDIR%" >nul 2>&1
29
+ cd /d "%ROOT%"
30
+
31
+ if exist "%LOG%" (
32
+ for %%A in ("%LOG%") do set "SIZE=%%~zA"
33
+ if !SIZE! GTR %MAXBYTES% (
34
+ if exist "%LOG%.old" del "%LOG%.old" >nul 2>&1
35
+ move /y "%LOG%" "%LOG%.old" >nul 2>&1
36
+ )
37
+ )
38
+
39
+ rem NOTE: every wait below uses ping, never timeout.
40
+ rem timeout needs a console input handle; under wscript with a
41
+ rem hidden window it returns instantly, which turns a crash loop
42
+ rem into a 0.2s-per-iteration storm.
43
+ set "CRASHES=0"
44
+
45
+ :loop
46
+ if not exist "%ENTRY%" (
47
+ echo [%date% %time%] ABORT: entry missing - %ENTRY% >> "%LOG%"
48
+ goto :giveup
49
+ )
50
+
51
+ rem If something else already serves the port, wait instead of
52
+ rem fighting it - two instances on one port is an EADDRINUSE storm.
53
+ netstat -ano | findstr ":%PORT%" | findstr "LISTENING" >nul 2>&1
54
+ if not errorlevel 1 (
55
+ ping -n 31 127.0.0.1 >nul
56
+ goto loop
57
+ )
58
+
59
+ echo. >> "%LOG%"
60
+ echo ==================== start %date% %time% ==================== >> "%LOG%"
61
+
62
+ set "WB_PORT=%PORT%"
63
+ set "WB_WATCHDOG=1"
64
+ set "WB_APP_DIR=%ROOT%"
65
+ node "%ENTRY%" >> "%LOG%" 2>&1
66
+ set "CODE=!ERRORLEVEL!"
67
+
68
+ echo ==================== exit %date% %time% code=!CODE! ==================== >> "%LOG%"
69
+
70
+ if "!CODE!"=="0" (
71
+ echo [%date% %time%] clean exit - watchdog stops >> "%LOG%"
72
+ goto :giveup
73
+ )
74
+
75
+ if "!CODE!"=="42" (
76
+ echo [%date% %time%] update restart requested - restarting >> "%LOG%"
77
+ set "CRASHES=0"
78
+ if exist "%ROOT%watchdog.cmd.new" (
79
+ move /y "%ROOT%watchdog.cmd.new" "%ROOT%watchdog.cmd" >nul 2>&1
80
+ if exist "%ROOT%watchdog-hidden.vbs" (
81
+ wscript.exe //nologo "%ROOT%watchdog-hidden.vbs"
82
+ exit /b 0
83
+ )
84
+ )
85
+ ping -n 2 127.0.0.1 >nul
86
+ goto loop
87
+ )
88
+
89
+ set /a CRASHES+=1
90
+ if !CRASHES! GEQ 10 (
91
+ echo [%date% %time%] !CRASHES! consecutive crashes - backing off 60s >> "%LOG%"
92
+ ping -n 61 127.0.0.1 >nul
93
+ ) else (
94
+ ping -n 6 127.0.0.1 >nul
95
+ )
96
+ goto loop
97
+
98
+ :giveup
99
+ echo watchdog stopped. log: %LOG%
100
+ ping -n 9 127.0.0.1 >nul
101
+ exit /b 0
Binary file