From e54626faedca471cc67acd2d1fdf0be27e273fdf Mon Sep 17 00:00:00 2001 From: liuxunxun7-max Date: Sat, 7 Mar 2026 19:52:24 +0800 Subject: [PATCH 01/20] =?UTF-8?q?=3F=3FDEV-003=20=E7=87=95=E6=A8=8AM18?= =?UTF-8?q?=E7=8E=AF=E8=8A=822server.js=E4=BB=A3=E7=A0=81=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- m18-health-check/package-lock.json | 827 +++++++++++++++++++++++++++++ m18-health-check/package.json | 16 + m18-health-check/server.js | 240 +++++++++ m18-health-check/server.txt | 247 +++++++++ 4 files changed, 1330 insertions(+) create mode 100644 m18-health-check/package-lock.json create mode 100644 m18-health-check/package.json create mode 100644 m18-health-check/server.js create mode 100644 m18-health-check/server.txt diff --git a/m18-health-check/package-lock.json b/m18-health-check/package-lock.json new file mode 100644 index 00000000..b79d36ea --- /dev/null +++ b/m18-health-check/package-lock.json @@ -0,0 +1,827 @@ +{ + "name": "hololake-health", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "hololake-health", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "express": "^5.2.1" + } + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/body-parser": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz", + "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.3", + "http-errors": "^2.0.0", + "iconv-lite": "^0.7.0", + "on-finished": "^2.4.1", + "qs": "^6.14.1", + "raw-body": "^3.0.1", + "type-is": "^2.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz", + "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", + "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.1", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", + "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.0.tgz", + "integrity": "sha512-mAZTtNCeetKMH+pSjrb76NAM8V9a05I9aBZOHztWy/UqcJdQYNsf59vrRKWnojAT9Y+GbIvoTBC++CPHqpDBhQ==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + } + } +} diff --git a/m18-health-check/package.json b/m18-health-check/package.json new file mode 100644 index 00000000..1887483c --- /dev/null +++ b/m18-health-check/package.json @@ -0,0 +1,16 @@ +{ + "name": "hololake-health", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "type": "commonjs", + "dependencies": { + "express": "^5.2.1" + } +} diff --git a/m18-health-check/server.js b/m18-health-check/server.js new file mode 100644 index 00000000..40ed6a97 --- /dev/null +++ b/m18-health-check/server.js @@ -0,0 +1,240 @@ +const express = require('express'); +const os = require('os'); + +const app = express(); +const PORT = 3000; + +// 记录服务器启动时间 +const SERVER_START_TIME = new Date(); + +// 解析JSON请求体 +app.use(express.json()); + +// ========== 数据存储 ========== +let heartbeats = []; +const patrolHistory = []; +const alerts = []; +const HEARTBEAT_TIMEOUT = 5 * 60 * 1000; // 5分钟 + +// ========== 告警检查函数 ========== +function checkAlerts(memPercent) { + let level = null; + let message = ''; + + if (memPercent > 90) { + level = 'critical'; + message = `内存使用率过高: ${memPercent}%`; + } else if (memPercent > 80) { + level = 'warning'; + message = `内存使用率警告: ${memPercent}%`; + } + + if (level) { + const alert = { + timestamp: new Date().toISOString(), + level: level, + message: message, + memoryPercent: memPercent + }; + alerts.push(alert); + + if (alerts.length > 20) { + alerts.shift(); + } + + console.log(`[ALERT] ${level.toUpperCase()}: ${message}`); + } +} + +// ========== 在线状态检查函数 ========== +function checkOnlineStatus() { + const now = Date.now(); + const onlineServices = []; + const offlineServices = []; + + const latestHeartbeats = {}; + heartbeats.forEach(hb => { + const source = hb.service || 'unknown'; + if (!latestHeartbeats[source] || new Date(hb.timestamp) > new Date(latestHeartbeats[source].timestamp)) { + latestHeartbeats[source] = hb; + } + }); + + for (const [source, hb] of Object.entries(latestHeartbeats)) { + const hbTime = new Date(hb.timestamp).getTime(); + const isOnline = (now - hbTime) < HEARTBEAT_TIMEOUT; + + const serviceInfo = { + source: source, + lastHeartbeat: hb.timestamp, + secondsAgo: Math.floor((now - hbTime) / 1000), + status: isOnline ? 'online' : 'offline' + }; + + if (isOnline) { + onlineServices.push(serviceInfo); + } else { + offlineServices.push(serviceInfo); + } + } + + return { online: onlineServices, offline: offlineServices }; +} + +// ========== API路由 ========== + +// GET /api/health - 快速健康检查 +app.get('/api/health', (req, res) => { + res.json({ + status: 'healthy', + timestamp: new Date().toISOString() + }); +}); + +// GET /api/status - 详细系统状态 +app.get('/api/status', (req, res) => { + const totalMem = os.totalmem(); + const freeMem = os.freemem(); + const usedMem = totalMem - freeMem; + const memPercent = Math.round((usedMem / totalMem) * 100); + + checkAlerts(memPercent); + + res.json({ + service: 'HoloLake Health Monitor', + version: '1.0.0', + status: 'running', + timestamp: new Date().toISOString(), + uptime: { + seconds: Math.floor((Date.now() - SERVER_START_TIME.getTime()) / 1000), + startedAt: SERVER_START_TIME.toISOString() + }, + system: { + platform: os.platform(), + arch: os.arch(), + hostname: os.hostname(), + nodeVersion: process.version + }, + memory: { + totalMB: Math.round(totalMem / 1024 / 1024), + usedMB: Math.round(usedMem / 1024 / 1024), + freeMB: Math.round(freeMem / 1024 / 1024), + usagePercent: memPercent + '%' + }, + services: checkOnlineStatus() + }); +}); + +// POST /api/heartbeat - 心跳上报 +app.post('/api/heartbeat', (req, res) => { + const heartbeat = { + timestamp: new Date().toISOString(), + service: req.body.service || 'unknown', + status: req.body.status || 'ok' + }; + heartbeats.push(heartbeat); + + res.json({ + received: true, + heartbeat: heartbeat + }); +}); + +// GET /api/heartbeat/history - 查看心跳历史 +app.get('/api/heartbeat/history', (req, res) => { + res.json({ + total: heartbeats.length, + heartbeats: heartbeats.slice(-20) + }); +}); + +// GET /api/heartbeat/online - 查看在线服务 +app.get('/api/heartbeat/online', (req, res) => { + const status = checkOnlineStatus(); + res.json({ + timestamp: new Date().toISOString(), + onlineCount: status.online.length, + offlineCount: status.offline.length, + online: status.online, + offline: status.offline + }); +}); + +// GET /api/patrol/history - 查看巡检历史 +app.get('/api/patrol/history', (req, res) => { + res.json({ + total: patrolHistory.length, + patrols: patrolHistory + }); +}); + +// GET /api/alerts - 查看告警历史 +app.get('/api/alerts', (req, res) => { + res.json({ + total: alerts.length, + critical: alerts.filter(a => a.level === 'critical').length, + warning: alerts.filter(a => a.level === 'warning').length, + alerts: alerts + }); +}); + +// GET / - 根路径欢迎页 +app.get('/', (req, res) => { + res.json({ + service: 'HoloLake Health Check & Status Report', + version: '2.0.0', + endpoints: [ + 'GET /api/health - 快速健康检查', + 'GET /api/status - 详细系统状态', + 'POST /api/heartbeat - 心跳上报', + 'GET /api/heartbeat/history - 心跳历史', + 'GET /api/heartbeat/online - 在线服务', + 'GET /api/patrol/history - 巡检历史', + 'GET /api/alerts - 告警历史' + ] + }); +}); + +// ========== 定时自动巡检 ========== +setInterval(() => { + console.log('[PATROL] 开始定时巡检...'); + + const totalMem = os.totalmem(); + const freeMem = os.freemem(); + const usedMem = totalMem - freeMem; + const memPercent = Math.round((usedMem / totalMem) * 100); + + const patrolRecord = { + timestamp: new Date().toISOString(), + memory: { + totalMB: Math.round(totalMem / 1024 / 1024), + usedMB: Math.round(usedMem / 1024 / 1024), + usagePercent: memPercent + }, + uptime: Math.floor((Date.now() - SERVER_START_TIME.getTime()) / 1000), + heartbeatCount: heartbeats.length + }; + + patrolHistory.push(patrolRecord); + if (patrolHistory.length > 50) { + patrolHistory.shift(); + } + + checkAlerts(memPercent); + + console.log(`[PATROL] 巡检完成 - 内存使用: ${memPercent}%`); +}, 60000); + +// 启动服务器 +app.listen(PORT, () => { + console.log('='.repeat(50)); + console.log('🌊 HoloLake Health Check & Status Report'); + console.log('📡 服务运行在: http://localhost:' + PORT); + console.log('💚 GET /api/health - 健康检查'); + console.log('📊 GET /api/status - 系统状态'); + console.log('💓 POST /api/heartbeat - 心跳上报'); + console.log('🔄 定时巡检 - 每60秒'); + console.log('🚨 异常告警 - 内存>80%'); + console.log('⏰ 心跳超时 - 5分钟'); + console.log('='.repeat(50)); +}); \ No newline at end of file diff --git a/m18-health-check/server.txt b/m18-health-check/server.txt new file mode 100644 index 00000000..49907eef --- /dev/null +++ b/m18-health-check/server.txt @@ -0,0 +1,247 @@ +const express = require('express'); +const os = require('os'); + +const app = express(); +const PORT = 3000; + +// 记录服务器启动时间 +const SERVER_START_TIME = new Date(); + +// 解析JSON请求体 +app.use(express.json()); + +// GET /api/health - 快速健康检查 +app.get('/api/health', (req, res) => { + res.json({ + status: 'healthy', + timestamp: new Date().toISOString() + }); +}); + +// GET /api/status - 详细系统状态 +app.get('/api/status', (req, res) => { + const totalMem = os.totalmem(); + const freeMem = os.freemem(); + const usedMem = totalMem - freeMem; + + res.json({ + service: 'HoloLake Health Monitor', + version: '1.0.0', + status: 'running', + timestamp: new Date().toISOString(), + uptime: { + seconds: Math.floor((Date.now() - SERVER_START_TIME.getTime()) / 1000), + startedAt: SERVER_START_TIME.toISOString() + }, + system: { + platform: os.platform(), + arch: os.arch(), + hostname: os.hostname(), + nodeVersion: process.version + }, + memory: { + totalMB: Math.round(totalMem / 1024 / 1024), + usedMB: Math.round(usedMem / 1024 / 1024), + freeMB: Math.round(freeMem / 1024 / 1024), + usagePercent: Math.round((usedMem / totalMem) * 100) + '%' + } + }); +}); + +// POST /api/heartbeat - 心跳上报 +let heartbeats = []; +app.post('/api/heartbeat', (req, res) => { + const heartbeat = { + timestamp: new Date().toISOString(), + service: req.body.service || 'unknown', + status: req.body.status || 'ok' + }; + heartbeats.push(heartbeat); + + res.json({ + received: true, + heartbeat: heartbeat + }); +}); + +// GET /api/heartbeat/history - 查看心跳历史 +app.get('/api/heartbeat/history', (req, res) => { + res.json({ + total: heartbeats.length, + heartbeats: heartbeats.slice(-20) + }); +}); + +// GET / - 根路径欢迎页 +app.get('/', (req, res) => { + res.json({ + service: 'HoloLake Health Check & Status Report', + version: '1.0.0', + endpoints: [ + 'GET /api/health - 快速健康检查', + 'GET /api/status - 详细系统状态', + 'POST /api/heartbeat - 心跳上报', + 'GET /api/heartbeat/history - 心跳历史' + ] + }); +}); + +// 启动服务器 +app.listen(PORT, () => { + console.log('='.repeat(50)); + console.log('🌊 HoloLake Health Check & Status Report'); + console.log('📡 服务运行在: http://localhost:' + PORT); + console.log('💚 GET /api/health - 健康检查'); + console.log('📊 GET /api/status - 系统状态'); + console.log('💓 POST /api/heartbeat - 心跳上报'); + console.log('='.repeat(50)); +}); +// ========== 定时自动巡检系统 ========== +const patrolHistory = []; + +// 每60秒执行一次巡检 +setInterval(() => { + console.log('[PATROL] 开始定时巡检...'); + + const totalMem = os.totalmem(); + const freeMem = os.freemem(); + const usedMem = totalMem - freeMem; + const memPercent = Math.round((usedMem / totalMem) * 100); + + const patrolRecord = { + timestamp: new Date().toISOString(), + memory: { + totalMB: Math.round(totalMem / 1024 / 1024), + usedMB: Math.round(usedMem / 1024 / 1024), + usagePercent: memPercent + }, + uptime: Math.floor((Date.now() - SERVER_START_TIME.getTime()) / 1000), + heartbeatCount: heartbeats.length + }; + + patrolHistory.push(patrolRecord); + + // 只保留最近50条记录 + if (patrolHistory.length > 50) { + patrolHistory.shift(); + } + + console.log(`[PATROL] 巡检完成 - 内存使用: ${memPercent}%`); +}, 60000); // 60000毫秒 = 60秒 + +// GET /api/patrol/history - 查看巡检历史 +app.get('/api/patrol/history', (req, res) => { + res.json({ + total: patrolHistory.length, + patrols: patrolHistory + }); +}); + +console.log('🔄 定时巡检系统已启动(每60秒)'); + +// ========== 异常状态告警系统 ========== +const alerts = []; + +// 告警检查函数 +function checkAlerts(memPercent) { + let level = null; + let message = ''; + + if (memPercent > 90) { + level = 'critical'; + message = `内存使用率过高: ${memPercent}%`; + } else if (memPercent > 80) { + level = 'warning'; + message = `内存使用率警告: ${memPercent}%`; + } + + if (level) { + const alert = { + timestamp: new Date().toISOString(), + level: level, + message: message, + memoryPercent: memPercent + }; + alerts.push(alert); + + // 只保留最近20条告警 + if (alerts.length > 20) { + alerts.shift(); + } + + console.log(`[ALERT] ${level.toUpperCase()}: ${message}`); + } +} + +// 修改巡检代码,加入告警检查(找到之前的setInterval,在console.log后面添加) +// 在 patrolHistory.push(patrolRecord); 之后添加: +// checkAlerts(memPercent); + +// GET /api/alerts - 查看告警历史 +app.get('/api/alerts', (req, res) => { + res.json({ + total: alerts.length, + critical: alerts.filter(a => a.level === 'critical').length, + warning: alerts.filter(a => a.level === 'warning').length, + alerts: alerts + }); +}); + +console.log('🚨 异常告警系统已启动(阈值: 80%警告, 90%严重)'); +// ========== 心跳超时检测系统 ========== +const HEARTBEAT_TIMEOUT = 5 * 60 * 1000; // 5分钟 = 300000毫秒 + +// 检查服务在线状态 +function checkOnlineStatus() { + const now = Date.now(); + const onlineServices = []; + const offlineServices = []; + + // 按source分组,找出每个source的最新心跳 + const latestHeartbeats = {}; + heartbeats.forEach(hb => { + const source = hb.service || 'unknown'; + if (!latestHeartbeats[source] || new Date(hb.timestamp) > new Date(latestHeartbeats[source].timestamp)) { + latestHeartbeats[source] = hb; + } + }); + + // 检查每个source是否超时 + for (const [source, hb] of Object.entries(latestHeartbeats)) { + const hbTime = new Date(hb.timestamp).getTime(); + const isOnline = (now - hbTime) < HEARTBEAT_TIMEOUT; + + const serviceInfo = { + source: source, + lastHeartbeat: hb.timestamp, + secondsAgo: Math.floor((now - hbTime) / 1000), + status: isOnline ? 'online' : 'offline' + }; + + if (isOnline) { + onlineServices.push(serviceInfo); + } else { + offlineServices.push(serviceInfo); + } + } + + return { online: onlineServices, offline: offlineServices }; +} + +// 修改GET /api/status,添加在线服务列表 +// 找到原来的 app.get('/api/status', ...),在res.json里添加: +// services: checkOnlineStatus() + +// GET /api/heartbeat/online - 查看在线服务 +app.get('/api/heartbeat/online', (req, res) => { + const status = checkOnlineStatus(); + res.json({ + timestamp: new Date().toISOString(), + onlineCount: status.online.length, + offlineCount: status.offline.length, + online: status.online, + offline: status.offline + }); +}); + +console.log('⏰ 心跳超时检测已启动(超时: 5分钟)'); From 0ee82347d17e49f99408ed9860d7172987ff6e12 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Mar 2026 12:08:46 +0000 Subject: [PATCH 02/20] Initial plan From 8743cde59a7b0ab9090dcd12e047051be10e7c13 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Mar 2026 12:12:30 +0000 Subject: [PATCH 03/20] =?UTF-8?q?YM-COLLAB-20260307-001:=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=20guanghulab-main=20=E5=88=B0=20rsync=20=E6=8E=92?= =?UTF-8?q?=E9=99=A4=20+=20CD=20=E9=AA=8C=E8=AF=81=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> --- .github/workflows/deploy-to-server.yml | 1 + status-board/index.html | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/deploy-to-server.yml b/.github/workflows/deploy-to-server.yml index 1208d6e6..dd8ef35f 100644 --- a/.github/workflows/deploy-to-server.yml +++ b/.github/workflows/deploy-to-server.yml @@ -160,6 +160,7 @@ jobs: --exclude 'tests' \ --exclude 'reports' \ --exclude 'scripts' \ + --exclude 'guanghulab-main' \ --exclude '*.bak' \ --exclude '*.bak2' \ --exclude '*_副本' \ diff --git a/status-board/index.html b/status-board/index.html index 34f2201b..1a22ee3b 100644 --- a/status-board/index.html +++ b/status-board/index.html @@ -1,3 +1,4 @@ + From 87a569bdae0e331c179d5a5c86a664052d0d2f75 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Mar 2026 13:00:49 +0000 Subject: [PATCH 04/20] Initial plan From e3475f64e79c396e54fc7d5287b840853620eb02 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Mar 2026 13:04:48 +0000 Subject: [PATCH 05/20] =?UTF-8?q?=F0=9F=A7=AA=20feat:=20add=20Notion=20con?= =?UTF-8?q?nectivity=20test=20script=20and=20workflow=20(YM-TEST-20260307-?= =?UTF-8?q?001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> --- .../workflows/notion-connectivity-test.yml | 53 +++ scripts/notion-connectivity-test.js | 326 ++++++++++++++++++ 2 files changed, 379 insertions(+) create mode 100644 .github/workflows/notion-connectivity-test.yml create mode 100644 scripts/notion-connectivity-test.js diff --git a/.github/workflows/notion-connectivity-test.yml b/.github/workflows/notion-connectivity-test.yml new file mode 100644 index 00000000..c8d25bd3 --- /dev/null +++ b/.github/workflows/notion-connectivity-test.yml @@ -0,0 +1,53 @@ +name: 铸渊 · Notion 连通性测试 + +# YM-TEST-20260307-001 · 铸渊→Notion 数据桥连通性测试 +# +# 三项测试: +# 1. 写入「📡 跨平台信号日志」(SIGNAL_LOG_DB_ID) +# 2. 写入「📋 GitHub 变更日志」(CHANGES_DB_ID,有默认值) +# 3. 写入「📥 GitHub SYSLOG 收件箱」(SYSLOG_DB_ID,有默认值) +# +# 依赖 Secrets: +# NOTION_TOKEN Notion Integration Token +# +# 可选 Secrets / Variables: +# SIGNAL_LOG_DB_ID 信号日志 database_id(Secrets 或 Variables) +# CHANGES_DB_ID 变更日志 database_id(有默认值,可覆盖) +# SYSLOG_DB_ID SYSLOG 收件箱 database_id(有默认值,可覆盖) + +on: + workflow_dispatch: + +jobs: + connectivity-test: + name: 🧪 Notion 连通性测试 + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: 🧪 执行连通性测试 + id: test + env: + NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} + SIGNAL_LOG_DB_ID: ${{ vars.SIGNAL_LOG_DB_ID }} + CHANGES_DB_ID: ${{ secrets.CHANGES_DB_ID }} + SYSLOG_DB_ID: ${{ secrets.SYSLOG_DB_ID }} + run: node scripts/notion-connectivity-test.js + + - name: 提交信号日志 + if: always() + run: | + git config user.name "铸渊 (ZhùYuān)" + git config user.email "zhuyuan@guanghulab.com" + git add signal-log/ + git diff --cached --quiet || git commit -m "🧪 连通性测试信号日志 · YM-TEST-20260307-001" + git push || true diff --git a/scripts/notion-connectivity-test.js b/scripts/notion-connectivity-test.js new file mode 100644 index 00000000..4b009c4a --- /dev/null +++ b/scripts/notion-connectivity-test.js @@ -0,0 +1,326 @@ +// scripts/notion-connectivity-test.js +// 铸渊 → Notion 连通性测试(YM-TEST-20260307-001) +// +// 用法: +// node scripts/notion-connectivity-test.js +// +// 必需环境变量: +// NOTION_TOKEN Notion Integration Token(GitHub Secret) +// +// 可选环境变量(有内置默认值): +// SIGNAL_LOG_DB_ID 「📡 跨平台信号日志」database_id +// CHANGES_DB_ID 「📋 GitHub 变更日志」database_id(默认已内置) +// SYSLOG_DB_ID 「📥 GitHub SYSLOG 收件箱」database_id(默认已内置) + +'use strict'; + +const https = require('https'); +const fs = require('fs'); +const path = require('path'); + +// ══════════════════════════════════════════════════════════ +// 常量 +// ══════════════════════════════════════════════════════════ + +const NOTION_VERSION = '2022-06-28'; +const NOTION_API_HOSTNAME = 'api.notion.com'; + +// Notion 数据库 ID(默认值与 notion-bridge.js / notion-signal-bridge.js 一致) +const DEFAULT_SYSLOG_DB_ID = '330ab17507d542c9bbb96d0749b41197'; +const DEFAULT_CHANGES_DB_ID = 'e740b77aa6bd4ac0a2e8a75f678fba98'; + +const SIGNAL_LOG_DIR = path.join(__dirname, '../signal-log'); +const SIGNAL_INDEX_PATH = path.join(SIGNAL_LOG_DIR, 'index.json'); + +// ══════════════════════════════════════════════════════════ +// Notion API 基础调用(复用 notion-bridge.js 模式) +// ══════════════════════════════════════════════════════════ + +function notionPost(endpoint, body, token) { + return new Promise((resolve, reject) => { + const payload = JSON.stringify(body); + const opts = { + hostname: NOTION_API_HOSTNAME, + port: 443, + path: endpoint, + method: 'POST', + headers: { + 'Authorization': 'Bearer ' + token, + 'Content-Type': 'application/json', + 'Notion-Version': NOTION_VERSION, + 'Content-Length': Buffer.byteLength(payload), + }, + }; + + const req = https.request(opts, res => { + let data = ''; + res.on('data', chunk => data += chunk); + res.on('end', () => { + try { + const parsed = JSON.parse(data); + resolve({ statusCode: res.statusCode, body: parsed }); + } catch (e) { + resolve({ statusCode: res.statusCode, body: null, raw: data }); + } + }); + }); + + req.on('error', reject); + req.setTimeout(30000, () => { req.destroy(new Error('Notion API 请求超时')); }); + req.write(payload); + req.end(); + }); +} + +// ══════════════════════════════════════════════════════════ +// 本地信号日志(复用 notion-signal-bridge.js 模式) +// ══════════════════════════════════════════════════════════ + +function loadSignalIndex() { + if (!fs.existsSync(SIGNAL_INDEX_PATH)) { + return { + description: '铸渊信号日志目录索引 · AGE OS 信号协议(Notion API 直连)', + last_updated: new Date().toISOString(), + total_count: 0, + signals: [] + }; + } + return JSON.parse(fs.readFileSync(SIGNAL_INDEX_PATH, 'utf8')); +} + +function writeLocalSignalLog(signal) { + const dateStr = signal.timestamp.slice(0, 7); + const monthDir = path.join(SIGNAL_LOG_DIR, dateStr); + fs.mkdirSync(monthDir, { recursive: true }); + + const filePath = path.join(monthDir, `${signal.signal_id}.json`); + fs.writeFileSync(filePath, JSON.stringify(signal, null, 2)); + + const index = loadSignalIndex(); + index.total_count += 1; + index.signals.unshift({ + signal_id: signal.signal_id, + trace_id: signal.trace_id, + type: signal.signal_type, + timestamp: signal.timestamp, + summary: signal.summary, + related_dev: null, + file: `${dateStr}/${signal.signal_id}.json` + }); + index.last_updated = new Date().toISOString(); + fs.writeFileSync(SIGNAL_INDEX_PATH, JSON.stringify(index, null, 2)); +} + +// ══════════════════════════════════════════════════════════ +// 三项连通性测试 +// ══════════════════════════════════════════════════════════ + +async function testSignalLog(token, dbId) { + return notionPost('/v1/pages', { + parent: { database_id: dbId }, + properties: { + '信号编号': { title: [{ text: { content: 'SIG-TEST-20260307-001' } }] }, + '信号类型': { select: { name: 'GL-ACK' } }, + '发送方': { select: { name: '铸渊' } }, + '接收方': { select: { name: '霜砚' } }, + '方向': { select: { name: 'GitHub→Notion' } }, + '关联DEV': { select: { name: '系统' } }, + '关联模块': { select: { name: '全局' } }, + '执行结果': { status: { name: '成功' } }, + '摘要': { rich_text: [{ text: { content: '🧪 铸渊→Notion API 连通性测试 · NOTION_TOKEN 验证 · 数据桥首次握手' } }] }, + '备注': { rich_text: [{ text: { content: '这是一条自动化测试信号。如果你在 Notion 信号日志里看到这条记录,说明 GitHub→Notion 数据桥已打通。' } }] } + } + }, token); +} + +async function testChangeLog(token, dbId) { + return notionPost('/v1/pages', { + parent: { database_id: dbId }, + properties: { + '标题': { title: [{ text: { content: '🧪 连通性测试 · 铸渊首次握手 · 2026-03-07' } }] }, + '变更类型': { select: { name: 'Commit' } }, + '提交者': { select: { name: '铸渊' } }, + '分支': { rich_text: [{ text: { content: 'main' } }] }, + 'commit_sha': { rich_text: [{ text: { content: 'test-00000000' } }] }, + '变更文件': { rich_text: [{ text: { content: '.github/test/bridge-connectivity-test.md' } }] }, + '霜砚已读': { checkbox: false } + } + }, token); +} + +async function testSyslogInbox(token, dbId) { + return notionPost('/v1/pages', { + parent: { database_id: dbId }, + properties: { + '标题': { title: [{ text: { content: '🧪 SYSLOG连通性测试 · 2026-03-07' } }] }, + 'DEV编号': { select: { name: 'DEV-001' } }, + '处理状态': { status: { name: '待处理' } }, + '推送方': { rich_text: [{ text: { content: '铸渊' } }] }, + '来源路径': { rich_text: [{ text: { content: 'syslog-inbox/test/bridge-test-20260307.md' } }] }, + '文件内容': { rich_text: [{ text: { content: '这是一条连通性测试SYSLOG。如果霜砚能在收件箱看到这条,说明铸渊→Notion SYSLOG推送管线已打通。' } }] }, + 'commit_sha': { rich_text: [{ text: { content: 'test-00000000' } }] } + } + }, token); +} + +// ══════════════════════════════════════════════════════════ +// 主执行 +// ══════════════════════════════════════════════════════════ + +async function main() { + console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'); + console.log('🧪 YM-TEST-20260307-001 · 铸渊→Notion 连通性测试'); + console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'); + + const token = process.env.NOTION_TOKEN; + if (!token) { + console.error('❌ NOTION_TOKEN 未设置,无法执行连通性测试'); + console.error(' 请在 GitHub Secrets 中配置 NOTION_TOKEN'); + process.exit(1); + } + console.log('✅ NOTION_TOKEN 已检测到'); + + const signalLogDbId = process.env.SIGNAL_LOG_DB_ID || ''; + const changesDbId = process.env.CHANGES_DB_ID || DEFAULT_CHANGES_DB_ID; + const syslogDbId = process.env.SYSLOG_DB_ID || DEFAULT_SYSLOG_DB_ID; + + const results = { + signalLog: { ok: false, pageId: null, error: null }, + changeLog: { ok: false, pageId: null, error: null }, + syslogInbox: { ok: false, pageId: null, error: null }, + }; + + // ── 测试一:信号日志 ────────────────────────────────── + console.log('\n── 测试一:写入「📡 跨平台信号日志」──'); + if (!signalLogDbId) { + console.log('⚠️ SIGNAL_LOG_DB_ID 未配置,跳过此测试'); + results.signalLog.error = 'SIGNAL_LOG_DB_ID 未配置'; + } else { + console.log(` Database ID: ${signalLogDbId}`); + try { + const res = await testSignalLog(token, signalLogDbId); + if (res.statusCode >= 200 && res.statusCode < 300) { + results.signalLog.ok = true; + results.signalLog.pageId = res.body.id; + console.log(` ✅ 写入成功 · page_id: ${res.body.id}`); + } else { + results.signalLog.error = `HTTP ${res.statusCode}: ${res.body?.message || JSON.stringify(res.body)}`; + console.log(` ❌ 写入失败 · ${results.signalLog.error}`); + } + } catch (err) { + results.signalLog.error = err.message; + console.log(` ❌ 请求异常 · ${err.message}`); + } + } + + // ── 测试二:变更日志 ────────────────────────────────── + console.log('\n── 测试二:写入「📋 GitHub 变更日志」──'); + console.log(` Database ID: ${changesDbId}`); + try { + const res = await testChangeLog(token, changesDbId); + if (res.statusCode >= 200 && res.statusCode < 300) { + results.changeLog.ok = true; + results.changeLog.pageId = res.body.id; + console.log(` ✅ 写入成功 · page_id: ${res.body.id}`); + } else { + results.changeLog.error = `HTTP ${res.statusCode}: ${res.body?.message || JSON.stringify(res.body)}`; + console.log(` ❌ 写入失败 · ${results.changeLog.error}`); + } + } catch (err) { + results.changeLog.error = err.message; + console.log(` ❌ 请求异常 · ${err.message}`); + } + + // ── 测试三:SYSLOG 收件箱 ───────────────────────────── + console.log('\n── 测试三:写入「📥 GitHub SYSLOG 收件箱」──'); + console.log(` Database ID: ${syslogDbId}`); + try { + const res = await testSyslogInbox(token, syslogDbId); + if (res.statusCode >= 200 && res.statusCode < 300) { + results.syslogInbox.ok = true; + results.syslogInbox.pageId = res.body.id; + console.log(` ✅ 写入成功 · page_id: ${res.body.id}`); + } else { + results.syslogInbox.error = `HTTP ${res.statusCode}: ${res.body?.message || JSON.stringify(res.body)}`; + console.log(` ❌ 写入失败 · ${results.syslogInbox.error}`); + } + } catch (err) { + results.syslogInbox.error = err.message; + console.log(` ❌ 请求异常 · ${err.message}`); + } + + // ── 写入本地信号日志 ────────────────────────────────── + const now = new Date(); + const allPassed = results.signalLog.ok && results.changeLog.ok && results.syslogInbox.ok; + const signalLogSkipped = !signalLogDbId; + const partialPassed = results.changeLog.ok || results.syslogInbox.ok || results.signalLog.ok; + + let bridgeStatus; + if (allPassed) { + bridgeStatus = '全通'; + } else if (signalLogSkipped && results.changeLog.ok && results.syslogInbox.ok) { + bridgeStatus = '全通(信号日志DB未配置,其余全通)'; + } else if (partialPassed) { + bridgeStatus = '部分通'; + } else { + bridgeStatus = '不通'; + } + + const signal = { + signal_id: 'SIG-TEST-20260307-001', + trace_id: 'TRC-TEST-20260307-YM001', + timestamp: now.toISOString(), + signal_type: 'GL-ACK', + direction: 'GitHub→Notion', + sender: '铸渊', + receiver: '霜砚', + summary: `🧪 连通性测试完成 · 数据桥状态 = ${bridgeStatus}`, + result: allPassed || (signalLogSkipped && results.changeLog.ok && results.syslogInbox.ok) ? '成功' : '失败', + payload: { + test_id: 'YM-TEST-20260307-001', + signal_log: results.signalLog, + change_log: results.changeLog, + syslog_inbox: results.syslogInbox, + bridge_status: bridgeStatus + } + }; + + try { + writeLocalSignalLog(signal); + console.log(`\n📝 本地信号日志已写入: ${signal.signal_id}`); + } catch (err) { + console.error(`\n⚠️ 本地信号日志写入失败: ${err.message}`); + } + + // ── 输出汇总 ────────────────────────────────────────── + const fmt = (r) => r.ok ? `✅(page_id: ${r.pageId})` : `❌(${r.error})`; + + console.log('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'); + console.log('✅ YM-TEST-20260307-001 连通性测试完成'); + console.log(`· 信号日志写入:${signalLogSkipped ? '⚠️ 跳过(SIGNAL_LOG_DB_ID 未配置)' : fmt(results.signalLog)}`); + console.log(`· 变更日志写入:${fmt(results.changeLog)}`); + console.log(`· SYSLOG收件箱写入:${fmt(results.syslogInbox)}`); + console.log(`· 总结:数据桥状态 = ${bridgeStatus}`); + console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'); + + // GitHub Actions: 输出到 GITHUB_OUTPUT(如有) + if (process.env.GITHUB_OUTPUT) { + const outputLines = [ + `signal_log_ok=${results.signalLog.ok}`, + `change_log_ok=${results.changeLog.ok}`, + `syslog_inbox_ok=${results.syslogInbox.ok}`, + `bridge_status=${bridgeStatus}`, + ]; + fs.appendFileSync(process.env.GITHUB_OUTPUT, outputLines.join('\n') + '\n'); + } + + // 如果没有全通(且不是因为跳过信号日志),以非零退出码结束 + if (!allPassed && !(signalLogSkipped && results.changeLog.ok && results.syslogInbox.ok)) { + process.exit(1); + } +} + +main().catch(err => { + console.error('❌ 连通性测试异常退出:', err.message); + process.exit(1); +}); From bcecea391209d325b0628bfa27e22a1aaab7b704 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Mar 2026 13:05:50 +0000 Subject: [PATCH 06/20] =?UTF-8?q?=F0=9F=A7=AA=20refactor:=20address=20code?= =?UTF-8?q?=20review=20feedback=20(rename=20fmt,=20improve=20push=20error?= =?UTF-8?q?=20logging)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> --- .github/workflows/notion-connectivity-test.yml | 3 ++- scripts/notion-connectivity-test.js | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/notion-connectivity-test.yml b/.github/workflows/notion-connectivity-test.yml index c8d25bd3..03190d1e 100644 --- a/.github/workflows/notion-connectivity-test.yml +++ b/.github/workflows/notion-connectivity-test.yml @@ -50,4 +50,5 @@ jobs: git config user.email "zhuyuan@guanghulab.com" git add signal-log/ git diff --cached --quiet || git commit -m "🧪 连通性测试信号日志 · YM-TEST-20260307-001" - git push || true + # push 可能因分支保护或无变更而失败,不影响测试结果 + git push || echo "⚠️ 信号日志推送失败(可能无变更或分支受保护)" diff --git a/scripts/notion-connectivity-test.js b/scripts/notion-connectivity-test.js index 4b009c4a..1851af7f 100644 --- a/scripts/notion-connectivity-test.js +++ b/scripts/notion-connectivity-test.js @@ -293,13 +293,13 @@ async function main() { } // ── 输出汇总 ────────────────────────────────────────── - const fmt = (r) => r.ok ? `✅(page_id: ${r.pageId})` : `❌(${r.error})`; + const formatResult = (r) => r.ok ? `✅(page_id: ${r.pageId})` : `❌(${r.error})`; console.log('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'); console.log('✅ YM-TEST-20260307-001 连通性测试完成'); - console.log(`· 信号日志写入:${signalLogSkipped ? '⚠️ 跳过(SIGNAL_LOG_DB_ID 未配置)' : fmt(results.signalLog)}`); - console.log(`· 变更日志写入:${fmt(results.changeLog)}`); - console.log(`· SYSLOG收件箱写入:${fmt(results.syslogInbox)}`); + console.log(`· 信号日志写入:${signalLogSkipped ? '⚠️ 跳过(SIGNAL_LOG_DB_ID 未配置)' : formatResult(results.signalLog)}`); + console.log(`· 变更日志写入:${formatResult(results.changeLog)}`); + console.log(`· SYSLOG收件箱写入:${formatResult(results.syslogInbox)}`); console.log(`· 总结:数据桥状态 = ${bridgeStatus}`); console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'); From 1b26b6897f697937e87e395c902df5029cd29f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=B8=E6=B8=8A=20=28Zh=C3=B9Yu=C4=81n=29?= Date: Sun, 8 Mar 2026 06:14:08 +0000 Subject: [PATCH 07/20] =?UTF-8?q?=F0=9F=93=9A=20=E9=93=B8=E6=B8=8A?= =?UTF-8?q?=E5=9B=BE=E4=B9=A6=E9=A6=86=E7=9B=AE=E5=BD=95=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20=C2=B7=202026-03-08T06:14?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/brain/repo-map.json | 2 +- .github/brain/repo-snapshot.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/brain/repo-map.json b/.github/brain/repo-map.json index 36806263..646e4dba 100644 --- a/.github/brain/repo-map.json +++ b/.github/brain/repo-map.json @@ -1,7 +1,7 @@ { "description": "铸渊图书馆目录 · Library Catalog for 铸渊 (Zhùyuān)", "version": "2.0", - "generated_at": "2026-03-08T05:19:52.088Z", + "generated_at": "2026-03-08T06:14:08.816Z", "generated_by": "scripts/generate-repo-map.js", "repo": "qinfendebingshuo/guanghulab", "stats": { diff --git a/.github/brain/repo-snapshot.md b/.github/brain/repo-snapshot.md index a4f037aa..443f195b 100644 --- a/.github/brain/repo-snapshot.md +++ b/.github/brain/repo-snapshot.md @@ -1,5 +1,5 @@ # 铸渊图书馆快照 · Repo Snapshot -> 生成于 2026-03-08 13:19 CST · 每次 push 自动更新 · 铸渊唤醒时优先读取此文件 +> 生成于 2026-03-08 14:14 CST · 每次 push 自动更新 · 铸渊唤醒时优先读取此文件 --- @@ -13,7 +13,7 @@ | 脚本 | 18 个执行脚本 | | 开发者节点 | 8 人 | | HLI 接口覆盖率 | 3/17 (18%) | -| 快照生成时间 | 2026-03-08 13:19 CST | +| 快照生成时间 | 2026-03-08 14:14 CST | --- From ea342fa0e0caaca20adb635b230883ab7490b59a Mon Sep 17 00:00:00 2001 From: zhizhi200271 Date: Sun, 8 Mar 2026 14:18:50 +0800 Subject: [PATCH 08/20] =?UTF-8?q?DEV-004:M17=E7=8E=AF=E8=8A=825-=E5=8A=A8?= =?UTF-8?q?=E7=94=BB=E6=97=B6=E9=97=B4=E8=BD=B4=C2=B7=E5=B8=A7=E5=BA=8F?= =?UTF-8?q?=E5=88=97+=E6=92=AD=E6=94=BE=E6=8E=A7=E5=88=B6+=E5=B8=A7?= =?UTF-8?q?=E7=8E=87=E8=B0=83=E8=8A=82+=E6=95=B0=E6=8D=AE=E6=8C=81?= =?UTF-8?q?=E4=B9=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dynamic-comic-studio/css/style.css | 348 +++++++++++++++++ dynamic-comic-studio/index.html | 88 +++++ dynamic-comic-studio/js/app.js | 581 +++++++++++++++++++++++++++++ 3 files changed, 1017 insertions(+) create mode 100644 dynamic-comic-studio/css/style.css create mode 100644 dynamic-comic-studio/index.html create mode 100644 dynamic-comic-studio/js/app.js diff --git a/dynamic-comic-studio/css/style.css b/dynamic-comic-studio/css/style.css new file mode 100644 index 00000000..3243d659 --- /dev/null +++ b/dynamic-comic-studio/css/style.css @@ -0,0 +1,348 @@ +/* ==================== 基础重置 ==================== */ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif; + background: #1a1a2e; + color: #eee; + overflow: hidden; +} + +/* ==================== 布局框架 ==================== */ +#app { + display: flex; + flex-direction: column; + height: 100vh; +} + +/* ==================== 顶部工具栏 ==================== */ +#toolbar { + display: flex; + justify-content: space-between; + align-items: center; + padding: 10px 20px; + background: #16213e; + border-bottom: 2px solid #0f3460; +} + +#toolbar h1 { + font-size: 18px; + color: #e94560; +} + +.toolbar-actions button { + margin-left: 10px; + padding: 6px 12px; + background: #0f3460; + color: #fff; + border: none; + border-radius: 4px; + cursor: pointer; + transition: background 0.3s; +} + +.toolbar-actions button:hover { + background: #e94560; +} + +/* ==================== 主工作区 ==================== */ +#workspace { + display: flex; + flex: 1; + overflow: hidden; +} + +/* ==================== 左侧素材面板 ==================== */ +#assets-panel { + width: 200px; + background: #16213e; + border-right: 2px solid #0f3460; + padding: 15px; + overflow-y: auto; +} + +#assets-panel h3 { + color: #e94560; + margin-bottom: 15px; + font-size: 16px; +} + +.asset-category { + margin-bottom: 20px; +} + +.asset-category h4 { + color: #533483; + font-size: 14px; + margin-bottom: 10px; + padding-left: 5px; + border-left: 3px solid #e94560; +} + +.asset-items { + display: flex; + flex-wrap: wrap; + gap: 8px; +} + +.asset-item { + padding: 8px 12px; + background: #0f3460; + border-radius: 6px; + cursor: move; + font-size: 13px; + transition: all 0.3s; + user-select: none; +} + +.asset-item:hover { + background: #e94560; + transform: translateY(-2px); +} + +/* ==================== 画布区域 ==================== */ +#canvas-container { + flex: 1; + display: flex; + flex-direction: column; + background: #0f0f1a; +} + +#scene-tabs { + display: flex; + align-items: center; + padding: 10px; + background: #16213e; + border-bottom: 2px solid #0f3460; +} + +#tabs-list { + display: flex; + gap: 8px; + flex: 1; +} + +.scene-tab { + padding: 8px 16px; + background: #0f3460; + border-radius: 4px 4px 0 0; + cursor: pointer; + font-size: 14px; + position: relative; +} + +.scene-tab.active { + background: #e94560; +} + +.scene-tab .close-btn { + margin-left: 8px; + opacity: 0.6; +} + +.scene-tab .close-btn:hover { + opacity: 1; +} + +#add-scene-btn { + padding: 8px 16px; + background: #533483; + color: #fff; + border: none; + border-radius: 4px; + cursor: pointer; + margin-left: 10px; +} + +#canvas-wrapper { + flex: 1; + display: flex; + justify-content: center; + align-items: center; + padding: 20px; + overflow: auto; +} + +#main-canvas { + background: #fff; + border-radius: 8px; + box-shadow: 0 4px 20px rgba(0,0,0,0.5); + cursor: crosshair; +} + +/* ==================== 底部时间轴面板 ==================== */ +#timeline-panel { + background: #16213e; + border-top: 2px solid #0f3460; + padding: 15px 20px; + display: flex; + flex-direction: column; + gap: 12px; +} + +/* 播放控制栏 */ +#playback-controls { + display: flex; + align-items: center; + gap: 15px; +} + +#playback-controls button { + width: 40px; + height: 40px; + border-radius: 50%; + border: none; + background: #0f3460; + color: #fff; + font-size: 18px; + cursor: pointer; + transition: all 0.3s; + display: flex; + align-items: center; + justify-content: center; +} + +#playback-controls button:hover { + background: #e94560; + transform: scale(1.1); +} + +#frame-counter { + font-size: 14px; + color: #aaa; + min-width: 80px; +} + +#playback-controls label { + display: flex; + align-items: center; + gap: 10px; + font-size: 14px; + color: #aaa; +} + +#fps-slider { + width: 120px; + cursor: pointer; +} + +#fps-display { + color: #e94560; + font-weight: bold; + min-width: 50px; +} + +/* 帧缩略图时间轴 */ +#timeline-frames { + display: flex; + gap: 8px; + padding: 10px; + background: #0f0f1a; + border-radius: 6px; + overflow-x: auto; + min-height: 70px; + align-items: center; +} + +.frame-thumb { + width: 80px; + height: 60px; + background: #0f3460; + border: 2px solid #533483; + border-radius: 4px; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + font-size: 12px; + color: #aaa; + position: relative; + transition: all 0.3s; + flex-shrink: 0; +} + +.frame-thumb:hover { + border-color: #e94560; + transform: translateY(-2px); +} + +.frame-thumb.active { + border-color: #e94560; + background: #533483; + box-shadow: 0 0 10px rgba(233, 69, 96, 0.5); +} + +.frame-thumb::before { + content: attr(data-frame); + position: absolute; + top: 2px; + left: 4px; + font-size: 10px; + color: #fff; + background: rgba(0,0,0,0.5); + padding: 1px 4px; + border-radius: 2px; +} + +/* 时间轴操作按钮 */ +#timeline-actions { + display: flex; + gap: 10px; +} + +#timeline-actions button { + padding: 8px 16px; + background: #0f3460; + color: #fff; + border: none; + border-radius: 4px; + cursor: pointer; + font-size: 14px; + transition: all 0.3s; +} + +#timeline-actions button:hover { + background: #e94560; +} + +/* ==================== 画布上的素材样式 ==================== */ +.canvas-asset { + position: absolute; + cursor: move; + user-select: none; + font-size: 48px; + filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3)); + transition: transform 0.1s; +} + +.canvas-asset:hover { + transform: scale(1.1); +} + +.canvas-asset.selected { + outline: 2px dashed #e94560; + outline-offset: 4px; +} + +/* ==================== 滚动条样式 ==================== */ +::-webkit-scrollbar { + width: 8px; + height: 8px; +} + +::-webkit-scrollbar-track { + background: #0f0f1a; +} + +::-webkit-scrollbar-thumb { + background: #533483; + border-radius: 4px; +} + +::-webkit-scrollbar-thumb:hover { + background: #e94560; +} diff --git a/dynamic-comic-studio/index.html b/dynamic-comic-studio/index.html new file mode 100644 index 00000000..b5be2dcb --- /dev/null +++ b/dynamic-comic-studio/index.html @@ -0,0 +1,88 @@ + + + + + + HoloLake 动态漫制作系统 - 环节5 + + + +
+ +
+

🎬 HoloLake 动态漫制作系统

+
+ + + + +
+
+ + +
+ + + + +
+
+
+ +
+
+ +
+
+
+ + +
+
+ + + 帧 1/1 + +
+
+
+ + +
+
+
+ + + + diff --git a/dynamic-comic-studio/js/app.js b/dynamic-comic-studio/js/app.js new file mode 100644 index 00000000..184d1b06 --- /dev/null +++ b/dynamic-comic-studio/js/app.js @@ -0,0 +1,581 @@ +// ==================== HoloLake 动态漫制作系统 v5.0 ==================== +// 环节5:动画时间轴(帧序列 + 播放控制 + 帧率调节) + +const STORAGE_KEY = 'hololake-comic-studio-data'; +const canvas = document.getElementById('main-canvas'); +const ctx = canvas.getContext('2d'); + +// ==================== 全局状态 ==================== +let appState = { + currentSceneId: 1, + nextSceneId: 2, + nextAssetId: 1, + nextFrameId: 1, + scenes: [], + playback: { + isPlaying: false, + fps: 4, + intervalId: null, + currentFrameIndex: 0 + } +}; + +// ==================== 初始化 ==================== +function init() { + loadFromStorage(); + if (appState.scenes.length === 0) { + createDefaultScene(); + } + setupEventListeners(); + renderSceneTabs(); + renderCanvas(); + renderTimeline(); + updatePlaybackControls(); +} + +// 创建默认场景 +function createDefaultScene() { + const defaultScene = { + id: 1, + name: '场景 1', + currentFrameIndex: 0, + frames: [{ + id: 1, + assets: [] + }], + nextFrameId: 2 + }; + appState.scenes.push(defaultScene); + appState.currentSceneId = 1; + saveToStorage(); +} + +// ==================== 存储管理 ==================== +function saveToStorage() { + localStorage.setItem(STORAGE_KEY, JSON.stringify(appState)); +} + +function loadFromStorage() { + const data = localStorage.getItem(STORAGE_KEY); + if (data) { + const parsed = JSON.parse(data); + // 向后兼容:旧数据没有 frames 字段 + if (parsed.scenes && parsed.scenes.length > 0 && !parsed.scenes[0].frames) { + parsed.scenes = parsed.scenes.map(scene => ({ + ...scene, + currentFrameIndex: 0, + frames: [{ + id: 1, + assets: scene.assets || [] + }], + nextFrameId: 2 + })); + delete parsed.scenes[0].assets; // 删除旧的 assets 字段 + } + // 确保 playback 对象存在 + if (!parsed.playback) { + parsed.playback = { isPlaying: false, fps: 4, intervalId: null, currentFrameIndex: 0 }; + } + appState = parsed; + } +} + +// ==================== 场景管理 ==================== +function addScene() { + const newScene = { + id: appState.nextSceneId++, + name: `场景 ${appState.scenes.length + 1}`, + currentFrameIndex: 0, + frames: [{ + id: 1, + assets: [] + }], + nextFrameId: 2 + }; + appState.scenes.push(newScene); + appState.currentSceneId = newScene.id; + saveToStorage(); + renderSceneTabs(); + renderCanvas(); + renderTimeline(); +} + +function switchScene(sceneId) { + if (appState.playback.isPlaying) { + stopAnimation(); + } + appState.currentSceneId = sceneId; + saveToStorage(); + renderSceneTabs(); + renderCanvas(); + renderTimeline(); + updateFrameCounter(); +} + +function deleteScene(sceneId) { + if (appState.scenes.length <= 1) { + alert('至少保留一个场景!'); + return; + } + appState.scenes = appState.scenes.filter(s => s.id !== sceneId); + if (appState.currentSceneId === sceneId) { + appState.currentSceneId = appState.scenes[0].id; + } + saveToStorage(); + renderSceneTabs(); + renderCanvas(); + renderTimeline(); +} + +function getCurrentScene() { + return appState.scenes.find(s => s.id === appState.currentSceneId); +} + +function getCurrentFrame() { + const scene = getCurrentScene(); + if (!scene) return null; + return scene.frames[scene.currentFrameIndex]; +}// ==================== 帧管理 ==================== +function addFrame() { + const scene = getCurrentScene(); + if (!scene) return; + + // 深拷贝当前帧的素材状态 + const currentFrame = scene.frames[scene.currentFrameIndex]; + const newFrame = { + id: scene.nextFrameId++, + assets: JSON.parse(JSON.stringify(currentFrame.assets)) + }; + + // 在当前帧后插入新帧 + scene.frames.splice(scene.currentFrameIndex + 1, 0, newFrame); + scene.currentFrameIndex++; + + saveToStorage(); + renderTimeline(); + renderCanvas(); + updateFrameCounter(); +} + +function deleteFrame() { + const scene = getCurrentScene(); + if (!scene) return; + + if (scene.frames.length <= 1) { + alert('至少保留一帧!'); + return; + } + + scene.frames.splice(scene.currentFrameIndex, 1); + if (scene.currentFrameIndex >= scene.frames.length) { + scene.currentFrameIndex = scene.frames.length - 1; + } + + saveToStorage(); + renderTimeline(); + renderCanvas(); + updateFrameCounter(); +} + +function switchFrame(frameIndex) { + const scene = getCurrentScene(); + if (!scene || frameIndex < 0 || frameIndex >= scene.frames.length) return; + + // 保存当前画布状态到当前帧 + captureFrame(); + + scene.currentFrameIndex = frameIndex; + saveToStorage(); + renderTimeline(); + renderCanvas(); + updateFrameCounter(); +} + +function captureFrame() { + // 画布状态实时保存在 assets 中,无需额外操作 + saveToStorage(); +} + +// ==================== 播放引擎 ==================== +function playAnimation() { + const scene = getCurrentScene(); + if (!scene || scene.frames.length <= 1) return; + + appState.playback.isPlaying = true; + updatePlaybackControls(); + + const intervalMs = 1000 / appState.playback.fps; + + appState.playback.intervalId = setInterval(() => { + const scene = getCurrentScene(); + if (!scene) return; + + scene.currentFrameIndex++; + if (scene.currentFrameIndex >= scene.frames.length) { + scene.currentFrameIndex = 0; // 循环播放 + } + + renderCanvas(); + renderTimeline(); + updateFrameCounter(); + saveToStorage(); + }, intervalMs); +} + +function pauseAnimation() { + appState.playback.isPlaying = false; + if (appState.playback.intervalId) { + clearInterval(appState.playback.intervalId); + appState.playback.intervalId = null; + } + updatePlaybackControls(); +} + +function stopAnimation() { + pauseAnimation(); + const scene = getCurrentScene(); + if (scene) { + scene.currentFrameIndex = 0; + renderCanvas(); + renderTimeline(); + updateFrameCounter(); + saveToStorage(); + } +} + +function togglePlayback() { + if (appState.playback.isPlaying) { + pauseAnimation(); + } else { + playAnimation(); + } +} + +function setFPS(fps) { + appState.playback.fps = parseInt(fps); + document.getElementById('fps-display').textContent = fps + ' FPS'; + saveToStorage(); + + // 如果正在播放,重启定时器以应用新帧率 + if (appState.playback.isPlaying) { + pauseAnimation(); + playAnimation(); + } +} + +function updatePlaybackControls() { + const btnPlay = document.getElementById('btn-play'); + if (appState.playback.isPlaying) { + btnPlay.textContent = '⏸️'; + btnPlay.title = '暂停'; + } else { + btnPlay.textContent = '▶️'; + btnPlay.title = '播放'; + } +} + +function updateFrameCounter() { + const scene = getCurrentScene(); + if (!scene) return; + const counter = document.getElementById('frame-counter'); + counter.textContent = `帧 ${scene.currentFrameIndex + 1}/${scene.frames.length}`; +}// ==================== 渲染函数 ==================== +function renderSceneTabs() { + const tabsList = document.getElementById('tabs-list'); + tabsList.innerHTML = ''; + + appState.scenes.forEach(scene => { + const tab = document.createElement('div'); + tab.className = 'scene-tab' + (scene.id === appState.currentSceneId ? ' active' : ''); + tab.innerHTML = ` + ${scene.name} + × + `; + tab.onclick = () => switchScene(scene.id); + tabsList.appendChild(tab); + }); +} + +function renderTimeline() { + const timelineFrames = document.getElementById('timeline-frames'); + timelineFrames.innerHTML = ''; + + const scene = getCurrentScene(); + if (!scene) return; + + scene.frames.forEach((frame, index) => { + const thumb = document.createElement('div'); + thumb.className = 'frame-thumb' + (index === scene.currentFrameIndex ? ' active' : ''); + thumb.setAttribute('data-frame', index + 1); + thumb.textContent = `帧 ${index + 1}`; + thumb.onclick = () => switchFrame(index); + timelineFrames.appendChild(thumb); + }); +} + +function renderCanvas() { + // 清空画布 + ctx.fillStyle = '#ffffff'; + ctx.fillRect(0, 0, canvas.width, canvas.height); + + const frame = getCurrentFrame(); + if (!frame) return; + + // 绘制所有素材 + frame.assets.forEach(asset => { + ctx.font = '48px Arial'; + ctx.textAlign = 'center'; + ctx.textBaseline = 'middle'; + + // 绘制阴影 + ctx.shadowColor = 'rgba(0,0,0,0.3)'; + ctx.shadowBlur = 4; + ctx.shadowOffsetX = 2; + ctx.shadowOffsetY = 2; + + ctx.fillText(asset.emoji, asset.x, asset.y); + + // 重置阴影 + ctx.shadowColor = 'transparent'; + ctx.shadowBlur = 0; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 0; + + // 如果是选中状态,绘制边框 + if (asset.selected) { + ctx.strokeStyle = '#e94560'; + ctx.lineWidth = 2; + ctx.setLineDash([5, 5]); + ctx.strokeRect(asset.x - 30, asset.y - 30, 60, 60); + ctx.setLineDash([]); + } + }); +} + +// ==================== 素材拖放 ==================== +function setupEventListeners() { + // 素材库拖放 + const assetItems = document.querySelectorAll('.asset-item'); + assetItems.forEach(item => { + item.addEventListener('dragstart', (e) => { + e.dataTransfer.setData('type', item.dataset.type); + e.dataTransfer.setData('emoji', item.dataset.emoji); + }); + }); + + // 画布接收拖放 + canvas.addEventListener('dragover', (e) => { + e.preventDefault(); + }); + + canvas.addEventListener('drop', (e) => { + e.preventDefault(); + const type = e.dataTransfer.getData('type'); + const emoji = e.dataTransfer.getData('emoji'); + + if (emoji) { + const rect = canvas.getBoundingClientRect(); + const x = e.clientX - rect.left; + const y = e.clientY - rect.top; + + addAssetToCanvas(emoji, x, y); + } + }); + + // 画布点击选择/移动 + let isDragging = false; + let dragStartX, dragStartY; + let selectedAsset = null; + + canvas.addEventListener('mousedown', (e) => { + const rect = canvas.getBoundingClientRect(); + const x = e.clientX - rect.left; + const y = e.clientY - rect.top; + + const frame = getCurrentFrame(); + if (!frame) return; + + // 查找点击的素材(从后往前,优先选上层的) + selectedAsset = null; + for (let i = frame.assets.length - 1; i >= 0; i--) { + const asset = frame.assets[i]; + const dist = Math.sqrt((x - asset.x) ** 2 + (y - asset.y) ** 2); + if (dist < 30) { + selectedAsset = asset; + // 更新选中状态 + frame.assets.forEach(a => a.selected = false); + asset.selected = true; + isDragging = true; + dragStartX = x - asset.x; + dragStartY = y - asset.y; + renderCanvas(); + break; + } + } + + // 如果没点到素材,取消所有选中 + if (!selectedAsset) { + frame.assets.forEach(a => a.selected = false); + renderCanvas(); + } + }); + + canvas.addEventListener('mousemove', (e) => { + if (!isDragging || !selectedAsset) return; + + const rect = canvas.getBoundingClientRect(); + const x = e.clientX - rect.left; + const y = e.clientY - rect.top; + + selectedAsset.x = x - dragStartX; + selectedAsset.y = y - dragStartY; + + // 边界限制 + selectedAsset.x = Math.max(30, Math.min(canvas.width - 30, selectedAsset.x)); + selectedAsset.y = Math.max(30, Math.min(canvas.height - 30, selectedAsset.y)); + + renderCanvas(); + }); + + canvas.addEventListener('mouseup', () => { + if (isDragging) { + isDragging = false; + saveToStorage(); + } + }); + + // 键盘删除 + document.addEventListener('keydown', (e) => { + if (e.key === 'Delete' || e.key === 'Backspace') { + const frame = getCurrentFrame(); + if (!frame) return; + + const selectedIndex = frame.assets.findIndex(a => a.selected); + if (selectedIndex !== -1) { + frame.assets.splice(selectedIndex, 1); + renderCanvas(); + saveToStorage(); + } + } + }); + + // 导入文件监听 + document.getElementById('import-file').addEventListener('change', handleImport); +} + +function addAssetToCanvas(emoji, x, y) { + const frame = getCurrentFrame(); + if (!frame) return; + + // 取消其他选中 + frame.assets.forEach(a => a.selected = false); + + const newAsset = { + id: appState.nextAssetId++, + type: 'emoji', + emoji: emoji, + x: x, + y: y, + selected: true + }; + + frame.assets.push(newAsset); + renderCanvas(); + saveToStorage(); +}// ==================== 导出导入 ==================== +function exportScene() { + const dataStr = JSON.stringify(appState, null, 2); + const blob = new Blob([dataStr], { type: 'application/json' }); + const url = URL.createObjectURL(blob); + + const a = document.createElement('a'); + a.href = url; + a.download = `hololake-scene-${Date.now()}.json`; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + URL.revokeObjectURL(url); +} + +function importScene() { + document.getElementById('import-file').click(); +} + +function handleImport(e) { + const file = e.target.files[0]; + if (!file) return; + + const reader = new FileReader(); + reader.onload = (event) => { + try { + const imported = JSON.parse(event.target.result); + + // 验证数据结构 + if (!imported.scenes || !Array.isArray(imported.scenes)) { + throw new Error('无效的数据格式'); + } + + // 向后兼容处理 + imported.scenes = imported.scenes.map(scene => { + if (!scene.frames) { + return { + ...scene, + currentFrameIndex: 0, + frames: [{ + id: 1, + assets: scene.assets || [] + }], + nextFrameId: 2 + }; + } + return scene; + }); + + if (!imported.playback) { + imported.playback = { isPlaying: false, fps: 4, intervalId: null, currentFrameIndex: 0 }; + } + + appState = imported; + saveToStorage(); + renderSceneTabs(); + renderCanvas(); + renderTimeline(); + updatePlaybackControls(); + updateFrameCounter(); + + alert('导入成功!'); + } catch (err) { + alert('导入失败:' + err.message); + } + }; + reader.readAsText(file); + + // 清空 input,允许重复导入同一文件 + e.target.value = ''; +} + +// ==================== 截图导出 ==================== +function exportScreenshot() { + // 临时取消选中状态 + const frame = getCurrentFrame(); + if (!frame) return; + + const originalSelected = frame.assets.map(a => a.selected); + frame.assets.forEach(a => a.selected = false); + renderCanvas(); + + // 导出 PNG + const link = document.createElement('a'); + link.download = `hololake-frame-${Date.now()}.png`; + link.href = canvas.toDataURL(); + link.click(); + + // 恢复选中状态 + frame.assets.forEach((a, i) => { + a.selected = originalSelected[i]; + }); + renderCanvas(); +} + +// ==================== 启动应用 ==================== +document.addEventListener('DOMContentLoaded', init); From bb574bd9e64640007f181cb3b127f52d792180f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=B8=E6=B8=8A=20=28Zh=C3=B9Yu=C4=81n=29?= Date: Sun, 8 Mar 2026 06:28:27 +0000 Subject: [PATCH 09/20] =?UTF-8?q?=F0=9F=93=9A=20=E9=93=B8=E6=B8=8A?= =?UTF-8?q?=E5=9B=BE=E4=B9=A6=E9=A6=86=E7=9B=AE=E5=BD=95=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20=C2=B7=202026-03-08T06:28?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/brain/repo-map.json | 2 +- .github/brain/repo-snapshot.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/brain/repo-map.json b/.github/brain/repo-map.json index 646e4dba..9cf4291e 100644 --- a/.github/brain/repo-map.json +++ b/.github/brain/repo-map.json @@ -1,7 +1,7 @@ { "description": "铸渊图书馆目录 · Library Catalog for 铸渊 (Zhùyuān)", "version": "2.0", - "generated_at": "2026-03-08T06:14:08.816Z", + "generated_at": "2026-03-08T06:28:27.088Z", "generated_by": "scripts/generate-repo-map.js", "repo": "qinfendebingshuo/guanghulab", "stats": { diff --git a/.github/brain/repo-snapshot.md b/.github/brain/repo-snapshot.md index 443f195b..246ae21c 100644 --- a/.github/brain/repo-snapshot.md +++ b/.github/brain/repo-snapshot.md @@ -1,5 +1,5 @@ # 铸渊图书馆快照 · Repo Snapshot -> 生成于 2026-03-08 14:14 CST · 每次 push 自动更新 · 铸渊唤醒时优先读取此文件 +> 生成于 2026-03-08 14:28 CST · 每次 push 自动更新 · 铸渊唤醒时优先读取此文件 --- @@ -13,7 +13,7 @@ | 脚本 | 18 个执行脚本 | | 开发者节点 | 8 人 | | HLI 接口覆盖率 | 3/17 (18%) | -| 快照生成时间 | 2026-03-08 14:14 CST | +| 快照生成时间 | 2026-03-08 14:28 CST | --- From 99a992f6138e8f8fc8e10ba512baa0d3257097da Mon Sep 17 00:00:00 2001 From: liuxunxun7-max Date: Sun, 8 Mar 2026 16:08:26 +0800 Subject: [PATCH 10/20] =?UTF-8?q?M18-=E7=8E=AF=E8=8A=823:=E5=B7=A1?= =?UTF-8?q?=E6=A3=80=E6=95=B0=E6=8D=AE=E6=8C=81=E4=B9=85=E5=8C=96+?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E6=9F=A5=E8=AF=A2API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/health/health-log.json | 170 +++++++ backend/health/package-lock.json | 849 +++++++++++++++++++++++++++++++ backend/health/package.json | 17 + backend/health/server.js | 333 ++++++++++++ 4 files changed, 1369 insertions(+) create mode 100644 backend/health/health-log.json create mode 100644 backend/health/package-lock.json create mode 100644 backend/health/package.json create mode 100644 backend/health/server.js diff --git a/backend/health/health-log.json b/backend/health/health-log.json new file mode 100644 index 00000000..e7ec8190 --- /dev/null +++ b/backend/health/health-log.json @@ -0,0 +1,170 @@ +[ + { + "timestamp": "2026-03-08T07:55:39.101Z", + "memory": { + "totalMB": 16319, + "usedMB": 13240, + "usagePercent": 81 + }, + "uptime": 60, + "heartbeatCount": 0, + "services": { + "online": [], + "offline": [] + } + }, + { + "timestamp": "2026-03-08T07:56:39.101Z", + "memory": { + "totalMB": 16319, + "usedMB": 13157, + "usagePercent": 81 + }, + "uptime": 120, + "heartbeatCount": 0, + "services": { + "online": [], + "offline": [] + } + }, + { + "timestamp": "2026-03-08T07:57:39.111Z", + "memory": { + "totalMB": 16319, + "usedMB": 13187, + "usagePercent": 81 + }, + "uptime": 180, + "heartbeatCount": 0, + "services": { + "online": [], + "offline": [] + } + }, + { + "timestamp": "2026-03-08T07:58:39.104Z", + "memory": { + "totalMB": 16319, + "usedMB": 13565, + "usagePercent": 83 + }, + "uptime": 240, + "heartbeatCount": 0, + "services": { + "online": [], + "offline": [] + } + }, + { + "timestamp": "2026-03-08T07:59:39.105Z", + "memory": { + "totalMB": 16319, + "usedMB": 13602, + "usagePercent": 83 + }, + "uptime": 300, + "heartbeatCount": 0, + "services": { + "online": [], + "offline": [] + } + }, + { + "timestamp": "2026-03-08T08:00:39.103Z", + "memory": { + "totalMB": 16319, + "usedMB": 12951, + "usagePercent": 79 + }, + "uptime": 360, + "heartbeatCount": 0, + "services": { + "online": [], + "offline": [] + } + }, + { + "timestamp": "2026-03-08T08:01:39.104Z", + "memory": { + "totalMB": 16319, + "usedMB": 12972, + "usagePercent": 79 + }, + "uptime": 420, + "heartbeatCount": 0, + "services": { + "online": [], + "offline": [] + } + }, + { + "timestamp": "2026-03-08T08:02:39.107Z", + "memory": { + "totalMB": 16319, + "usedMB": 12993, + "usagePercent": 80 + }, + "uptime": 480, + "heartbeatCount": 0, + "services": { + "online": [], + "offline": [] + } + }, + { + "timestamp": "2026-03-08T08:03:39.105Z", + "memory": { + "totalMB": 16319, + "usedMB": 13034, + "usagePercent": 80 + }, + "uptime": 540, + "heartbeatCount": 0, + "services": { + "online": [], + "offline": [] + } + }, + { + "timestamp": "2026-03-08T08:04:39.106Z", + "memory": { + "totalMB": 16319, + "usedMB": 13205, + "usagePercent": 81 + }, + "uptime": 600, + "heartbeatCount": 0, + "services": { + "online": [], + "offline": [] + } + }, + { + "timestamp": "2026-03-08T08:05:39.106Z", + "memory": { + "totalMB": 16319, + "usedMB": 13238, + "usagePercent": 81 + }, + "uptime": 660, + "heartbeatCount": 0, + "services": { + "online": [], + "offline": [] + } + }, + { + "timestamp": "2026-03-08T08:06:39.108Z", + "memory": { + "totalMB": 16319, + "usedMB": 13264, + "usagePercent": 81 + }, + "uptime": 720, + "heartbeatCount": 0, + "services": { + "online": [], + "offline": [] + } + } +] \ No newline at end of file diff --git a/backend/health/package-lock.json b/backend/health/package-lock.json new file mode 100644 index 00000000..dc4bdcb8 --- /dev/null +++ b/backend/health/package-lock.json @@ -0,0 +1,849 @@ +{ + "name": "hololake-health", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "hololake-health", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "express": "^5.2.1", + "ws": "^8.19.0" + } + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/body-parser": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz", + "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.3", + "http-errors": "^2.0.0", + "iconv-lite": "^0.7.0", + "on-finished": "^2.4.1", + "qs": "^6.14.1", + "raw-body": "^3.0.1", + "type-is": "^2.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz", + "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", + "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.1", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", + "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.0.tgz", + "integrity": "sha512-mAZTtNCeetKMH+pSjrb76NAM8V9a05I9aBZOHztWy/UqcJdQYNsf59vrRKWnojAT9Y+GbIvoTBC++CPHqpDBhQ==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/ws": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz", + "integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/backend/health/package.json b/backend/health/package.json new file mode 100644 index 00000000..8c71ed31 --- /dev/null +++ b/backend/health/package.json @@ -0,0 +1,17 @@ +{ + "name": "hololake-health", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "type": "commonjs", + "dependencies": { + "express": "^5.2.1", + "ws": "^8.19.0" + } +} diff --git a/backend/health/server.js b/backend/health/server.js new file mode 100644 index 00000000..6ef3a642 --- /dev/null +++ b/backend/health/server.js @@ -0,0 +1,333 @@ +const express = require('express'); +const os = require('os'); + +const app = express(); +const PORT = 3000; + +// 记录服务器启动时间 +const SERVER_START_TIME = new Date(); + +// 解析JSON请求体 +app.use(express.json()); + +// ========== 数据存储 ========== +let heartbeats = []; +const patrolHistory = []; +const alerts = []; +const HEARTBEAT_TIMEOUT = 5 * 60 * 1000; // 5分钟 + +// ========== 告警检查函数 ========== +function checkAlerts(memPercent) { + let level = null; + let message = ''; + + if (memPercent > 90) { + level = 'critical'; + message = `内存使用率过高: ${memPercent}%`; + } else if (memPercent > 80) { + level = 'warning'; + message = `内存使用率警告: ${memPercent}%`; + } + + if (level) { + const alert = { + timestamp: new Date().toISOString(), + level: level, + message: message, + memoryPercent: memPercent + }; + alerts.push(alert); + + if (alerts.length > 20) { + alerts.shift(); + } + + console.log(`[ALERT] ${level.toUpperCase()}: ${message}`); + } +} + +// ========== 在线状态检查函数 ========== +function checkOnlineStatus() { + const now = Date.now(); + const onlineServices = []; + const offlineServices = []; + + const latestHeartbeats = {}; + heartbeats.forEach(hb => { + const source = hb.service || 'unknown'; + if (!latestHeartbeats[source] || new Date(hb.timestamp) > new Date(latestHeartbeats[source].timestamp)) { + latestHeartbeats[source] = hb; + } + }); + + for (const [source, hb] of Object.entries(latestHeartbeats)) { + const hbTime = new Date(hb.timestamp).getTime(); + const isOnline = (now - hbTime) < HEARTBEAT_TIMEOUT; + + const serviceInfo = { + source: source, + lastHeartbeat: hb.timestamp, + secondsAgo: Math.floor((now - hbTime) / 1000), + status: isOnline ? 'online' : 'offline' + }; + + if (isOnline) { + onlineServices.push(serviceInfo); + } else { + offlineServices.push(serviceInfo); + } + } + + return { online: onlineServices, offline: offlineServices }; +} + +// ========== API路由 ========== + +// GET /api/health - 快速健康检查 +app.get('/api/health', (req, res) => { + res.json({ + status: 'healthy', + timestamp: new Date().toISOString() + }); +}); + +// GET /api/status - 详细系统状态 +app.get('/api/status', (req, res) => { + const totalMem = os.totalmem(); + const freeMem = os.freemem(); + const usedMem = totalMem - freeMem; + const memPercent = Math.round((usedMem / totalMem) * 100); + + checkAlerts(memPercent); + + res.json({ + service: 'HoloLake Health Monitor', + version: '1.0.0', + status: 'running', + timestamp: new Date().toISOString(), + uptime: { + seconds: Math.floor((Date.now() - SERVER_START_TIME.getTime()) / 1000), + startedAt: SERVER_START_TIME.toISOString() + }, + system: { + platform: os.platform(), + arch: os.arch(), + hostname: os.hostname(), + nodeVersion: process.version + }, + memory: { + totalMB: Math.round(totalMem / 1024 / 1024), + usedMB: Math.round(usedMem / 1024 / 1024), + freeMB: Math.round(freeMem / 1024 / 1024), + usagePercent: memPercent + '%' + }, + services: checkOnlineStatus() + }); +}); + +// POST /api/heartbeat - 心跳上报 +app.post('/api/heartbeat', (req, res) => { + const heartbeat = { + timestamp: new Date().toISOString(), + service: req.body.service || 'unknown', + status: req.body.status || 'ok' + }; + heartbeats.push(heartbeat); + + res.json({ + received: true, + heartbeat: heartbeat + }); +}); + +// GET /api/heartbeat/history - 查看心跳历史 +app.get('/api/heartbeat/history', (req, res) => { + res.json({ + total: heartbeats.length, + heartbeats: heartbeats.slice(-20) + }); +}); + +// GET /api/heartbeat/online - 查看在线服务 +app.get('/api/heartbeat/online', (req, res) => { + const status = checkOnlineStatus(); + res.json({ + timestamp: new Date().toISOString(), + onlineCount: status.online.length, + offlineCount: status.offline.length, + online: status.online, + offline: status.offline + }); +}); + +// GET /api/patrol/history - 查看巡检历史 +app.get('/api/patrol/history', (req, res) => { + res.json({ + total: patrolHistory.length, + patrols: patrolHistory + }); +}); + +// GET /api/alerts - 查看告警历史 +app.get('/api/alerts', (req, res) => { + res.json({ + total: alerts.length, + critical: alerts.filter(a => a.level === 'critical').length, + warning: alerts.filter(a => a.level === 'warning').length, + alerts: alerts + }); +}); + +// GET / - 根路径欢迎页 +app.get('/', (req, res) => { + res.json({ + service: 'HoloLake Health Check & Status Report', + version: '2.0.0', + endpoints: [ + 'GET /api/health - 快速健康检查', + 'GET /api/status - 详细系统状态', + 'POST /api/heartbeat - 心跳上报', + 'GET /api/heartbeat/history - 心跳历史', + 'GET /api/heartbeat/online - 在线服务', + 'GET /api/patrol/history - 巡检历史', + 'GET /api/alerts - 告警历史' + ] + }); +}); + +// ========== 定时自动巡检 ========== +setInterval(() => { + console.log('[PATROL] 开始定时巡检...'); + + const totalMem = os.totalmem(); + const freeMem = os.freemem(); + const usedMem = totalMem - freeMem; + const memPercent = Math.round((usedMem / totalMem) * 100); + + const patrolRecord = { + timestamp: new Date().toISOString(), + memory: { + totalMB: Math.round(totalMem / 1024 / 1024), + usedMB: Math.round(usedMem / 1024 / 1024), + usagePercent: memPercent + }, + uptime: Math.floor((Date.now() - SERVER_START_TIME.getTime()) / 1000), + heartbeatCount: heartbeats.length + }; + + patrolHistory.push(patrolRecord); + if (patrolHistory.length > 50) { + patrolHistory.shift(); + } + + checkAlerts(memPercent); + + console.log(`[PATROL] 巡检完成 - 内存使用: ${memPercent}%`); +}, 60000); + +// 启动服务器 +app.listen(PORT, () => { + console.log('='.repeat(50)); + console.log('🌊 HoloLake Health Check & Status Report'); + console.log('📡 服务运行在: http://localhost:' + PORT); + console.log('💚 GET /api/health - 健康检查'); + console.log('📊 GET /api/status - 系统状态'); + console.log('💓 POST /api/heartbeat - 心跳上报'); + console.log('🔄 定时巡检 - 每60秒'); + console.log('🚨 异常告警 - 内存>80%'); + console.log('⏰ 心跳超时 - 5分钟'); + console.log('='.repeat(50)); +}); +// ========== 环节3:巡检数据持久化 ========== +const fs = require('fs'); +const path = require('path'); + +const LOG_FILE = path.join(__dirname, 'health-log.json'); +const MAX_LOG_DAYS = 7; // 保留7天记录 + +// 读取历史记录 +function loadLogs() { + try { + if (fs.existsSync(LOG_FILE)) { + const data = fs.readFileSync(LOG_FILE, 'utf8'); + return JSON.parse(data); + } + } catch (err) { + console.error('[LOG] 读取日志文件失败:', err.message); + } + return []; +} + +// 保存记录到文件 +function saveLogs(logs) { + try { + fs.writeFileSync(LOG_FILE, JSON.stringify(logs, null, 2)); + } catch (err) { + console.error('[LOG] 保存日志文件失败:', err.message); + } +} + +// 清理旧记录 +function cleanOldLogs(logs) { + const cutoff = new Date(); + cutoff.setDate(cutoff.getDate() - MAX_LOG_DAYS); + + return logs.filter(log => new Date(log.timestamp) > cutoff); +} + +// 修改定时巡检,加入持久化(找到setInterval,替换为以下) +setInterval(() => { + console.log('[PATROL] 开始定时巡检...'); + + const totalMem = os.totalmem(); + const freeMem = os.freemem(); + const usedMem = totalMem - freeMem; + const memPercent = Math.round((usedMem / totalMem) * 100); + + // 检查告警 + checkAlerts(memPercent); + + const patrolRecord = { + timestamp: new Date().toISOString(), + memory: { + totalMB: Math.round(totalMem / 1024 / 1024), + usedMB: Math.round(usedMem / 1024 / 1024), + usagePercent: memPercent + }, + uptime: Math.floor((Date.now() - SERVER_START_TIME.getTime()) / 1000), + heartbeatCount: heartbeats.length, + services: checkOnlineStatus() + }; + + // 添加到内存数组 + patrolHistory.push(patrolRecord); + if (patrolHistory.length > 50) { + patrolHistory.shift(); + } + + // 持久化到文件 + let logs = loadLogs(); + logs.push(patrolRecord); + logs = cleanOldLogs(logs); // 清理旧记录 + saveLogs(logs); + + console.log(`[PATROL] 巡检完成 - 内存使用: ${memPercent}% - 已保存到health-log.json`); +}, 60000); + +// GET /health/history - 查询巡检历史(支持?days=N) +app.get('/health/history', (req, res) => { + const days = parseInt(req.query.days) || 7; + const cutoff = new Date(); + cutoff.setDate(cutoff.getDate() - days); + + let logs = loadLogs(); + const filteredLogs = logs.filter(log => new Date(log.timestamp) > cutoff); + + res.json({ + total: filteredLogs.length, + days: days, + logs: filteredLogs + }); +}); + +console.log('💾 巡检数据持久化已启动(保留7天)'); \ No newline at end of file From e20e2cca9d4cb154a5ab506962212df0e6b45cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=B8=E6=B8=8A=20=28Zh=C3=B9Yu=C4=81n=29?= Date: Sun, 8 Mar 2026 08:08:55 +0000 Subject: [PATCH 11/20] =?UTF-8?q?=F0=9F=93=9A=20=E9=93=B8=E6=B8=8A?= =?UTF-8?q?=E5=9B=BE=E4=B9=A6=E9=A6=86=E7=9B=AE=E5=BD=95=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20=C2=B7=202026-03-08T08:08?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/brain/repo-map.json | 4 ++-- .github/brain/repo-snapshot.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/brain/repo-map.json b/.github/brain/repo-map.json index 9cf4291e..76786bed 100644 --- a/.github/brain/repo-map.json +++ b/.github/brain/repo-map.json @@ -1,7 +1,7 @@ { "description": "铸渊图书馆目录 · Library Catalog for 铸渊 (Zhùyuān)", "version": "2.0", - "generated_at": "2026-03-08T06:28:27.088Z", + "generated_at": "2026-03-08T08:08:55.408Z", "generated_by": "scripts/generate-repo-map.js", "repo": "qinfendebingshuo/guanghulab", "stats": { @@ -431,7 +431,7 @@ { "module_id": "M18", "dir": "m18-health-check", - "files": 3, + "files": 5, "has_readme": true } ], diff --git a/.github/brain/repo-snapshot.md b/.github/brain/repo-snapshot.md index 246ae21c..f4544bc8 100644 --- a/.github/brain/repo-snapshot.md +++ b/.github/brain/repo-snapshot.md @@ -1,5 +1,5 @@ # 铸渊图书馆快照 · Repo Snapshot -> 生成于 2026-03-08 14:28 CST · 每次 push 自动更新 · 铸渊唤醒时优先读取此文件 +> 生成于 2026-03-08 16:08 CST · 每次 push 自动更新 · 铸渊唤醒时优先读取此文件 --- @@ -13,7 +13,7 @@ | 脚本 | 18 个执行脚本 | | 开发者节点 | 8 人 | | HLI 接口覆盖率 | 3/17 (18%) | -| 快照生成时间 | 2026-03-08 14:28 CST | +| 快照生成时间 | 2026-03-08 16:08 CST | --- @@ -189,7 +189,7 @@ - `m11-module/` — 4 个文件 (有README) - `m12-kanban/` — 1 个文件 (有README) - `m15-cloud-drive/` — 3 个文件 -- `m18-health-check/` — 3 个文件 (有README) +- `m18-health-check/` — 5 个文件 (有README) --- From 32cb7342ed7b70a6fe2cecc7c7398fc2a8d8e17e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=B8=E6=B8=8A=5Bbot=5D?= Date: Sun, 8 Mar 2026 08:41:27 +0000 Subject: [PATCH 12/20] =?UTF-8?q?=F0=9F=A7=A0=20memory:=20=E6=AF=8F?= =?UTF-8?q?=E6=97=A5=E8=87=AA=E6=A3=80=E8=AE=B0=E5=BD=95=20[skip=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/brain/memory.json | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/brain/memory.json b/.github/brain/memory.json index 401f5831..928e7fb3 100644 --- a/.github/brain/memory.json +++ b/.github/brain/memory.json @@ -1,7 +1,7 @@ { "identity": "铸渊(Zhùyuān)· GitHub 代码守护人格体", "rules_version": "v1.0", - "last_updated": "2026-03-08T03:32:30.449Z", + "last_updated": "2026-03-08T08:41:27.504Z", "wake_protocol_version": "v1.0", "wake_triggers": [ "我是冰朔", @@ -88,6 +88,14 @@ "actor": "qinfendebingshuo", "ref": "refs/heads/main", "run_id": "22795791187" + }, + { + "timestamp": "2026-03-08T08:41:27.504Z", + "type": "daily_check", + "result": "passed", + "actor": "qinfendebingshuo", + "ref": "refs/heads/main", + "run_id": "22817574664" } ] -} \ No newline at end of file +} From e63fd67bcae94cfe346b15d95afb7fc5c7992e5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=9E=E6=AF=9B=E5=98=B4=E5=B8=85=E6=B0=94=E7=88=B1?= Date: Sun, 8 Mar 2026 17:47:12 +0800 Subject: [PATCH 13/20] =?UTF-8?q?M14-=E7=8E=AF=E8=8A=823:=20=E9=A3=9E?= =?UTF-8?q?=E4=B9=A6Webhook=E9=80=9A=E7=9F=A5=E6=8E=A5=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/coldstart/config.json | 8 + backend/coldstart/package-lock.json | 929 ++++++++++++++++++++++++++++ backend/coldstart/package.json | 19 + backend/coldstart/server.js | 140 +++++ 4 files changed, 1096 insertions(+) create mode 100644 backend/coldstart/config.json create mode 100644 backend/coldstart/package-lock.json create mode 100644 backend/coldstart/package.json create mode 100644 backend/coldstart/server.js diff --git a/backend/coldstart/config.json b/backend/coldstart/config.json new file mode 100644 index 00000000..3ab9d7d5 --- /dev/null +++ b/backend/coldstart/config.json @@ -0,0 +1,8 @@ +{ + "serverPort": 3014, + "webhookUrl": "", + "logPath": "./logs", + "historyPath": "./warmup-history.json", + "autoCleanDays": 7, + "retryCount": 3 +} diff --git a/backend/coldstart/package-lock.json b/backend/coldstart/package-lock.json new file mode 100644 index 00000000..d8095250 --- /dev/null +++ b/backend/coldstart/package-lock.json @@ -0,0 +1,929 @@ +{ + "name": "coldstart", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "coldstart", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "axios": "^1.13.6", + "express": "^5.2.1", + "fs": "^0.0.1-security", + "moment": "^2.30.1", + "path": "^0.12.7" + } + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "1.13.6", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.6.tgz", + "integrity": "sha512-ChTCHMouEe2kn713WHbQGcuYrr6fXTBiu460OTwWrWob16g1bXn4vtz07Ope7ewMozJAnEquLk5lWQWtBig9DQ==", + "dependencies": { + "follow-redirects": "^1.15.11", + "form-data": "^4.0.5", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/body-parser": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz", + "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.3", + "http-errors": "^2.0.0", + "iconv-lite": "^0.7.0", + "on-finished": "^2.4.1", + "qs": "^6.14.1", + "raw-body": "^3.0.1", + "type-is": "^2.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/content-disposition": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz", + "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", + "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.1", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", + "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz", + "integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/form-data/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/form-data/node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/fs": { + "version": "0.0.1-security", + "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", + "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==" + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", + "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/moment": { + "version": "2.30.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", + "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", + "engines": { + "node": "*" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path": { + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", + "integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==", + "dependencies": { + "process": "^0.11.1", + "util": "^0.10.3" + } + }, + "node_modules/path-to-regexp": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "node_modules/qs": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.0.tgz", + "integrity": "sha512-mAZTtNCeetKMH+pSjrb76NAM8V9a05I9aBZOHztWy/UqcJdQYNsf59vrRKWnojAT9Y+GbIvoTBC++CPHqpDBhQ==", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dependencies": { + "inherits": "2.0.3" + } + }, + "node_modules/util/node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==" + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + } + } +} diff --git a/backend/coldstart/package.json b/backend/coldstart/package.json new file mode 100644 index 00000000..8359f565 --- /dev/null +++ b/backend/coldstart/package.json @@ -0,0 +1,19 @@ +{ + "name": "coldstart", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "axios": "^1.13.6", + "express": "^5.2.1", + "fs": "^0.0.1-security", + "moment": "^2.30.1", + "path": "^0.12.7" + } +} diff --git a/backend/coldstart/server.js b/backend/coldstart/server.js new file mode 100644 index 00000000..19862c14 --- /dev/null +++ b/backend/coldstart/server.js @@ -0,0 +1,140 @@ +const express = require("express"); +const fs = require("fs"); +const path = require("path"); +const axios = require("axios"); +const moment = require("moment"); +const app = express(); +app.use(express.json()); +// 读取配置文件 +const config = require("./config.json"); +const PORT = config.serverPort || 3014; +const WEBHOOK_URL = config.webhookUrl; +const LOG_PATH = path.join(__dirname, config.logPath); +const RETRY_COUNT = config.retryCount || 3; +// 确保日志目录存在 +if (!fs.existsSync(LOG_PATH)) { + fs.mkdirSync(LOG_PATH, { recursive: true }); +} +// 日志写入函数 +const writeLog = (content) => { + const logFile = path.join(LOG_PATH, `warmup-${moment().format("YYYY-MM-DD")}.log`); + const logContent = `[${moment().toISOString()}] ${content}\\n`; + fs.appendFileSync(logFile, logContent, "utf8"); +}; +// 飞书Webhook通知函数 +const sendFeishuWebhook = async (warmupData) => { + if (!WEBHOOK_URL) { + writeLog("Webhook通知失败:未配置webhookUrl"); + return { success: false, reason: "未配置webhookUrl" }; + } + try { + const notifyData = { + msg_type: "text", + content: { + text: `冷启动热身通知:\n状态:${warmupData.status}\n耗时:${warmupData.elapsed}ms\n时间:${moment(warmupData.timestamp).toISOString()}` + } + }; + await axios.post(WEBHOOK_URL, notifyData, { timeout: 5000 }); + writeLog(`Webhook通知成功:${JSON.stringify(warmupData)}`); + return { success: true }; + } catch (error) { + const errMsg = `Webhook通知失败:${error.message}`; + writeLog(errMsg); + return { success: false, reason: errMsg }; + } +}; +// 热身核心函数 +const warmup = async () => { + const startTime = Date.now(); + let status = "success"; + let details = "热身执行成功"; + try { + // 模拟热身业务逻辑 + await new Promise(resolve => setTimeout(resolve, 10)); + } catch (error) { + status = "fail"; + details = `热身执行失败:${error.message}`; + writeLog(details); + } + const elapsed = Date.now() - startTime; + const warmupData = { + timestamp: new Date().toISOString(), + status, + elapsed, + details + }; + // 发送Webhook通知(不阻塞热身流程) + sendFeishuWebhook(warmupData); + writeLog(`热身完成:${JSON.stringify(warmupData)}`); + return warmupData; +}; +// 自动热身(带失败重试) +const autoWarmup = async (retry = 0) => { + writeLog(`开始自动热身(第${retry + 1}次)`); + const result = await warmup(); + if (result.status === "fail" && retry < RETRY_COUNT - 1) { + writeLog(`自动热身失败,将进行第${retry + 2}次重试`); + setTimeout(() => autoWarmup(retry + 1), 1000); + } else if (result.status === "fail") { + writeLog("自动热身重试次数用尽,执行失败"); + } +}; +// 接口:手动触发热身 +app.get("/warmup", async (req, res) => { + try { + const result = await warmup(); + res.json({ code: 200, msg: "success", data: result }); + } catch (error) { + res.json({ code: 500, msg: "fail", error: error.message }); + } +}); +// 接口:自动热身状态 +app.get("/warmup/auto", (req, res) => { + res.json({ + code: 200, + msg: "success", + data: { + autoWarmupEnabled: true, + retryCount: RETRY_COUNT, + lastRun: moment().subtract(5, "minutes").toISOString() + } + }); +}); +// 接口:查询日志 +app.get("/warmup/logs", (req, res) => { + try { + const logFile = path.join(LOG_PATH, `warmup-${moment().format("YYYY-MM-DD")}.log`); + if (fs.existsSync(logFile)) { + const logs = fs.readFileSync(logFile, "utf8").split("\\n").filter(line => line); + res.json({ code: 200, msg: "success", data: logs }); + } else { + res.json({ code: 200, msg: "success", data: ["暂无日志"] }); + } + } catch (error) { + res.json({ code: 500, msg: "fail", error: error.message }); + } +}); +// 环节3新增:触发Webhook通知接口 +app.post("/warmup/notify", async (req, res) => { + try { + const warmupData = req.body; + if (!warmupData.status || !warmupData.elapsed) { + return res.json({ code: 400, msg: "fail", error: "缺少必传参数:status/elapsed" }); + } + const notifyResult = await sendFeishuWebhook(warmupData); + if (notifyResult.success) { + res.json({ code: 200, msg: "Webhook通知发送成功" }); + } else { + res.json({ code: 500, msg: "Webhook通知发送失败", reason: notifyResult.reason }); + } + } catch (error) { + res.json({ code: 500, msg: "fail", error: error.message }); + } +}); +// 启动服务+自动热身 +app.listen(PORT, () => { + console.log(`冷启动热身服务启动成功,端口:${PORT}`); + writeLog(`服务启动成功,端口:${PORT}`); + autoWarmup(); // 启动时执行自动热身 +}); +module.exports = app; From b9abf0b600d4520fb061584a38edf1c4261562fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=B8=E6=B8=8A=20=28Zh=C3=B9Yu=C4=81n=29?= Date: Sun, 8 Mar 2026 09:47:42 +0000 Subject: [PATCH 14/20] =?UTF-8?q?=F0=9F=93=9A=20=E9=93=B8=E6=B8=8A?= =?UTF-8?q?=E5=9B=BE=E4=B9=A6=E9=A6=86=E7=9B=AE=E5=BD=95=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20=C2=B7=202026-03-08T09:47?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/brain/repo-map.json | 4 ++-- .github/brain/repo-snapshot.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/brain/repo-map.json b/.github/brain/repo-map.json index 76786bed..48b5578f 100644 --- a/.github/brain/repo-map.json +++ b/.github/brain/repo-map.json @@ -1,7 +1,7 @@ { "description": "铸渊图书馆目录 · Library Catalog for 铸渊 (Zhùyuān)", "version": "2.0", - "generated_at": "2026-03-08T08:08:55.408Z", + "generated_at": "2026-03-08T09:47:42.834Z", "generated_by": "scripts/generate-repo-map.js", "repo": "qinfendebingshuo/guanghulab", "stats": { @@ -14,7 +14,7 @@ "hli_implemented": 3, "hli_coverage_pct": "18%", "last_ci_run": "2026-03-05T10:30:46.894Z", - "memory_last_updated": "2026-03-08T03:32:30.449Z" + "memory_last_updated": "2026-03-08T08:41:27.504Z" }, "zones": [ { diff --git a/.github/brain/repo-snapshot.md b/.github/brain/repo-snapshot.md index f4544bc8..77e5e8f0 100644 --- a/.github/brain/repo-snapshot.md +++ b/.github/brain/repo-snapshot.md @@ -1,5 +1,5 @@ # 铸渊图书馆快照 · Repo Snapshot -> 生成于 2026-03-08 16:08 CST · 每次 push 自动更新 · 铸渊唤醒时优先读取此文件 +> 生成于 2026-03-08 17:47 CST · 每次 push 自动更新 · 铸渊唤醒时优先读取此文件 --- @@ -13,7 +13,7 @@ | 脚本 | 18 个执行脚本 | | 开发者节点 | 8 人 | | HLI 接口覆盖率 | 3/17 (18%) | -| 快照生成时间 | 2026-03-08 16:08 CST | +| 快照生成时间 | 2026-03-08 17:47 CST | --- @@ -208,9 +208,9 @@ ## 🕐 最近动态(memory.json 最新3条) +- `2026-03-08T08:41:27.504Z` · daily_check — passed - `2026-03-07T08:41:28.888Z` · daily_check — passed - `2026-03-06T08:51:24.830Z` · daily_check — passed -- `2026-03-05T16:07:24.070Z` · ci_run — passed --- From e7050eaf35d6cd2c61cfd30ab8be8cbd8fe373b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=9E=E6=AF=9B=E5=98=B4=E5=B8=85=E6=B0=94=E7=88=B1?= Date: Sun, 8 Mar 2026 17:49:26 +0800 Subject: [PATCH 15/20] =?UTF-8?q?M14-=E7=8E=AF=E8=8A=824:=20=E7=83=AD?= =?UTF-8?q?=E8=BA=AB=E5=8E=86=E5=8F=B2=E6=8C=81=E4=B9=85=E5=8C=96+?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/coldstart/server.js | 74 ++++++++++++++++++++++++++++++++++--- 1 file changed, 69 insertions(+), 5 deletions(-) diff --git a/backend/coldstart/server.js b/backend/coldstart/server.js index 19862c14..f3b30b71 100644 --- a/backend/coldstart/server.js +++ b/backend/coldstart/server.js @@ -10,17 +10,47 @@ const config = require("./config.json"); const PORT = config.serverPort || 3014; const WEBHOOK_URL = config.webhookUrl; const LOG_PATH = path.join(__dirname, config.logPath); +const HISTORY_PATH = path.join(__dirname, config.historyPath); const RETRY_COUNT = config.retryCount || 3; +const AUTO_CLEAN_DAYS = config.autoCleanDays || 7; // 确保日志目录存在 if (!fs.existsSync(LOG_PATH)) { fs.mkdirSync(LOG_PATH, { recursive: true }); } +// 初始化历史记录文件 +const initHistoryFile = () => { + if (!fs.existsSync(HISTORY_PATH)) { + fs.writeFileSync(HISTORY_PATH, JSON.stringify([], null, 2), "utf8"); + } +}; +initHistoryFile(); // 日志写入函数 const writeLog = (content) => { const logFile = path.join(LOG_PATH, `warmup-${moment().format("YYYY-MM-DD")}.log`); - const logContent = `[${moment().toISOString()}] ${content}\\n`; + const logContent = `[${moment().toISOString()}] ${content}\n`; fs.appendFileSync(logFile, logContent, "utf8"); }; +// 读取历史记录 +const readHistory = () => { + const rawData = fs.readFileSync(HISTORY_PATH, "utf8"); + return JSON.parse(rawData) || []; +}; +// 写入历史记录 +const writeHistory = (data) => { + fs.writeFileSync(HISTORY_PATH, JSON.stringify(data, null, 2), "utf8"); +}; +// 自动清理旧记录 +const cleanOldHistory = () => { + const history = readHistory(); + const now = moment(); + const filteredHistory = history.filter(item => { + return now.diff(moment(item.timestamp), "days") < AUTO_CLEAN_DAYS; + }); + if (filteredHistory.length !== history.length) { + writeHistory(filteredHistory); + writeLog(`自动清理历史记录:移除${history.length - filteredHistory.length}条超过${AUTO_CLEAN_DAYS}天的记录`); + } +}; // 飞书Webhook通知函数 const sendFeishuWebhook = async (warmupData) => { if (!WEBHOOK_URL) { @@ -63,9 +93,14 @@ const warmup = async () => { elapsed, details }; + // 写入历史记录+自动清理 + const history = readHistory(); + history.push(warmupData); + cleanOldHistory(); + writeHistory(history); + writeLog(`热身完成:${JSON.stringify(warmupData)},已写入历史记录`); // 发送Webhook通知(不阻塞热身流程) sendFeishuWebhook(warmupData); - writeLog(`热身完成:${JSON.stringify(warmupData)}`); return warmupData; }; // 自动热身(带失败重试) @@ -96,7 +131,8 @@ app.get("/warmup/auto", (req, res) => { data: { autoWarmupEnabled: true, retryCount: RETRY_COUNT, - lastRun: moment().subtract(5, "minutes").toISOString() + lastRun: moment().subtract(5, "minutes").toISOString(), + autoCleanDays: AUTO_CLEAN_DAYS } }); }); @@ -105,7 +141,7 @@ app.get("/warmup/logs", (req, res) => { try { const logFile = path.join(LOG_PATH, `warmup-${moment().format("YYYY-MM-DD")}.log`); if (fs.existsSync(logFile)) { - const logs = fs.readFileSync(logFile, "utf8").split("\\n").filter(line => line); + const logs = fs.readFileSync(logFile, "utf8").split("\n").filter(line => line); res.json({ code: 200, msg: "success", data: logs }); } else { res.json({ code: 200, msg: "success", data: ["暂无日志"] }); @@ -131,10 +167,38 @@ app.post("/warmup/notify", async (req, res) => { res.json({ code: 500, msg: "fail", error: error.message }); } }); +// 环节4新增:查询热身历史记录API(支持?days=N筛选) +app.get("/warmup/history", (req, res) => { + try { + const { days } = req.query; + const filterDays = days ? parseInt(days) : AUTO_CLEAN_DAYS; + let history = readHistory(); + const now = moment(); + // 按天数筛选 + if (!isNaN(filterDays)) { + history = history.filter(item => { + return now.diff(moment(item.timestamp), "days") < filterDays; + }); + } + // 按时间倒序排列 + history = history.sort((a, b) => moment(b.timestamp) - moment(a.timestamp)); + res.json({ + code: 200, + msg: "success", + data: { + count: history.length, + filterDays, + records: history + } + }); + } catch (error) { + res.json({ code: 500, msg: "fail", error: error.message }); + } +}); // 启动服务+自动热身 app.listen(PORT, () => { console.log(`冷启动热身服务启动成功,端口:${PORT}`); - writeLog(`服务启动成功,端口:${PORT}`); + writeLog(`服务启动成功,端口:${PORT},自动清理天数:${AUTO_CLEAN_DAYS}天`); autoWarmup(); // 启动时执行自动热身 }); module.exports = app; From 7cc564f3cce4a13ef30c37146a9ff4bdffa69698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=B8=E6=B8=8A=20=28Zh=C3=B9Yu=C4=81n=29?= Date: Sun, 8 Mar 2026 09:57:09 +0000 Subject: [PATCH 16/20] =?UTF-8?q?=F0=9F=93=9A=20=E9=93=B8=E6=B8=8A?= =?UTF-8?q?=E5=9B=BE=E4=B9=A6=E9=A6=86=E7=9B=AE=E5=BD=95=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20=C2=B7=202026-03-08T09:57?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/brain/repo-map.json | 2 +- .github/brain/repo-snapshot.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/brain/repo-map.json b/.github/brain/repo-map.json index 48b5578f..7f49d96a 100644 --- a/.github/brain/repo-map.json +++ b/.github/brain/repo-map.json @@ -1,7 +1,7 @@ { "description": "铸渊图书馆目录 · Library Catalog for 铸渊 (Zhùyuān)", "version": "2.0", - "generated_at": "2026-03-08T09:47:42.834Z", + "generated_at": "2026-03-08T09:57:09.323Z", "generated_by": "scripts/generate-repo-map.js", "repo": "qinfendebingshuo/guanghulab", "stats": { diff --git a/.github/brain/repo-snapshot.md b/.github/brain/repo-snapshot.md index 77e5e8f0..7c31b1dc 100644 --- a/.github/brain/repo-snapshot.md +++ b/.github/brain/repo-snapshot.md @@ -1,5 +1,5 @@ # 铸渊图书馆快照 · Repo Snapshot -> 生成于 2026-03-08 17:47 CST · 每次 push 自动更新 · 铸渊唤醒时优先读取此文件 +> 生成于 2026-03-08 17:57 CST · 每次 push 自动更新 · 铸渊唤醒时优先读取此文件 --- @@ -13,7 +13,7 @@ | 脚本 | 18 个执行脚本 | | 开发者节点 | 8 人 | | HLI 接口覆盖率 | 3/17 (18%) | -| 快照生成时间 | 2026-03-08 17:47 CST | +| 快照生成时间 | 2026-03-08 17:57 CST | --- From 04020060c89cc5cbef1522f7d01b33b6d7c3da0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=9E=E6=AF=9B=E5=98=B4=E5=B8=85=E6=B0=94=E7=88=B1?= Date: Sun, 8 Mar 2026 18:07:43 +0800 Subject: [PATCH 17/20] =?UTF-8?q?M14-=E7=8E=AF=E8=8A=825:=20config?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E9=85=8D=E7=BD=AE+README+=E5=9B=9E=E5=BD=92?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/coldstart/server.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/backend/coldstart/server.js b/backend/coldstart/server.js index f3b30b71..2782d85b 100644 --- a/backend/coldstart/server.js +++ b/backend/coldstart/server.js @@ -195,6 +195,31 @@ app.get("/warmup/history", (req, res) => { res.json({ code: 500, msg: "fail", error: error.message }); } }); +// 环节5新增:读取当前运行配置API +app.get("/warmup/config", (req, res) => { + try { + // 返回当前生效的所有配置,屏蔽敏感信息(仅返回配置项,不返回原始文件) + const runtimeConfig = { + serverPort: PORT, + webhookUrl: WEBHOOK_URL ? "已配置" : "未配置", + logPath: LOG_PATH, + historyPath: HISTORY_PATH, + autoCleanDays: AUTO_CLEAN_DAYS, + retryCount: RETRY_COUNT, + apiVersion: "HLI v1.0", + serverDomain: "guanghulab.com" + }; + res.json({ + code: 200, + msg: "success", + data: runtimeConfig + }); + writeLog("查询当前运行配置成功"); + } catch (error) { + res.json({ code: 500, msg: "fail", error: error.message }); + writeLog(`查询配置失败:${error.message}`); + } +}); // 启动服务+自动热身 app.listen(PORT, () => { console.log(`冷启动热身服务启动成功,端口:${PORT}`); From 3dd295a8b81f3c6e92fd5b466aa847b337037124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=B8=E6=B8=8A=20=28Zh=C3=B9Yu=C4=81n=29?= Date: Sun, 8 Mar 2026 10:11:29 +0000 Subject: [PATCH 18/20] =?UTF-8?q?=F0=9F=93=9A=20=E9=93=B8=E6=B8=8A?= =?UTF-8?q?=E5=9B=BE=E4=B9=A6=E9=A6=86=E7=9B=AE=E5=BD=95=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20=C2=B7=202026-03-08T10:11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/brain/repo-map.json | 2 +- .github/brain/repo-snapshot.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/brain/repo-map.json b/.github/brain/repo-map.json index 7f49d96a..28c60d44 100644 --- a/.github/brain/repo-map.json +++ b/.github/brain/repo-map.json @@ -1,7 +1,7 @@ { "description": "铸渊图书馆目录 · Library Catalog for 铸渊 (Zhùyuān)", "version": "2.0", - "generated_at": "2026-03-08T09:57:09.323Z", + "generated_at": "2026-03-08T10:11:29.644Z", "generated_by": "scripts/generate-repo-map.js", "repo": "qinfendebingshuo/guanghulab", "stats": { diff --git a/.github/brain/repo-snapshot.md b/.github/brain/repo-snapshot.md index 7c31b1dc..8cf0bbf5 100644 --- a/.github/brain/repo-snapshot.md +++ b/.github/brain/repo-snapshot.md @@ -1,5 +1,5 @@ # 铸渊图书馆快照 · Repo Snapshot -> 生成于 2026-03-08 17:57 CST · 每次 push 自动更新 · 铸渊唤醒时优先读取此文件 +> 生成于 2026-03-08 18:11 CST · 每次 push 自动更新 · 铸渊唤醒时优先读取此文件 --- @@ -13,7 +13,7 @@ | 脚本 | 18 个执行脚本 | | 开发者节点 | 8 人 | | HLI 接口覆盖率 | 3/17 (18%) | -| 快照生成时间 | 2026-03-08 17:57 CST | +| 快照生成时间 | 2026-03-08 18:11 CST | --- From 3c6c927791a2ca943ab0f170b06dbc9b83322ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=B8=E6=B8=8A=20=28Zh=C3=B9Yu=C4=81n=29?= Date: Sun, 8 Mar 2026 13:07:42 +0000 Subject: [PATCH 19/20] =?UTF-8?q?=F0=9F=93=8B=20=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=20HoloLake=20Era=20=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=96=87=E6=A1=A3=20=C2=B7=202026-03-08=2013:07=20UTC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/HoloLake-Era-OS-Modules.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/HoloLake-Era-OS-Modules.md b/docs/HoloLake-Era-OS-Modules.md index 0947e799..d18fae55 100644 --- a/docs/HoloLake-Era-OS-Modules.md +++ b/docs/HoloLake-Era-OS-Modules.md @@ -1,6 +1,6 @@ # HoloLake Era 操作系统部署模块 -> 📋 **自动生成文档** · 铸渊(ZhùYuān)维护 · 最后更新:2026-03-07 11:38 UTC +> 📋 **自动生成文档** · 铸渊(ZhùYuān)维护 · 最后更新:2026-03-08 13:07 UTC > > 本文档由 GitHub Actions 自动触发生成,每当合作者上传/更新模块时自动刷新。 > 按合作者编号(DEV-XXX)整理所有已上传模块。 @@ -332,7 +332,7 @@ m11-module/ | 已上传模块数 | 12 | | 待上传模块数 | 0 | | 上传完成率 | 100% | -| 文档更新时间 | 2026-03-07 11:38 UTC | +| 文档更新时间 | 2026-03-08 13:07 UTC | --- From 54d1d7512462ee0a40499159a0b1fe70a57008ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=B8=E6=B8=8A=20=28Zh=C3=B9Yu=C4=81n=29?= Date: Sun, 8 Mar 2026 13:07:56 +0000 Subject: [PATCH 20/20] =?UTF-8?q?=F0=9F=93=9A=20=E9=93=B8=E6=B8=8A?= =?UTF-8?q?=E5=9B=BE=E4=B9=A6=E9=A6=86=E7=9B=AE=E5=BD=95=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20=C2=B7=202026-03-08T13:07?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/brain/repo-map.json | 2 +- .github/brain/repo-snapshot.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/brain/repo-map.json b/.github/brain/repo-map.json index 28c60d44..838132de 100644 --- a/.github/brain/repo-map.json +++ b/.github/brain/repo-map.json @@ -1,7 +1,7 @@ { "description": "铸渊图书馆目录 · Library Catalog for 铸渊 (Zhùyuān)", "version": "2.0", - "generated_at": "2026-03-08T10:11:29.644Z", + "generated_at": "2026-03-08T13:07:56.041Z", "generated_by": "scripts/generate-repo-map.js", "repo": "qinfendebingshuo/guanghulab", "stats": { diff --git a/.github/brain/repo-snapshot.md b/.github/brain/repo-snapshot.md index 8cf0bbf5..82d566f2 100644 --- a/.github/brain/repo-snapshot.md +++ b/.github/brain/repo-snapshot.md @@ -1,5 +1,5 @@ # 铸渊图书馆快照 · Repo Snapshot -> 生成于 2026-03-08 18:11 CST · 每次 push 自动更新 · 铸渊唤醒时优先读取此文件 +> 生成于 2026-03-08 21:07 CST · 每次 push 自动更新 · 铸渊唤醒时优先读取此文件 --- @@ -13,7 +13,7 @@ | 脚本 | 18 个执行脚本 | | 开发者节点 | 8 人 | | HLI 接口覆盖率 | 3/17 (18%) | -| 快照生成时间 | 2026-03-08 18:11 CST | +| 快照生成时间 | 2026-03-08 21:07 CST | ---