abtars 0.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/README.md +84 -0
- package/bundle/_registry.generated-M4WY2MMI.js +35 -0
- package/bundle/_registry.generated-M4WY2MMI.js.map +7 -0
- package/bundle/abtars-browser.js +162 -0
- package/bundle/abtars-browser.js.map +7 -0
- package/bundle/abtars-cli.js +1438 -0
- package/bundle/abtars-cli.js.map +7 -0
- package/bundle/abtars-restart.js +12 -0
- package/bundle/abtars-restart.js.map +7 -0
- package/bundle/abtars-rss.js +165 -0
- package/bundle/abtars-rss.js.map +7 -0
- package/bundle/abtars-task.js +258 -0
- package/bundle/abtars-task.js.map +7 -0
- package/bundle/abtars.js +4072 -0
- package/bundle/abtars.js.map +7 -0
- package/bundle/agent-api-rate-limit-OQNFMXTZ.js +38 -0
- package/bundle/agent-api-rate-limit-OQNFMXTZ.js.map +7 -0
- package/bundle/agent-registry-LT4JNQH6.js +18 -0
- package/bundle/agent-registry-LT4JNQH6.js.map +7 -0
- package/bundle/agents/default.md +29 -0
- package/bundle/anthropic-adapter-2APTH3LA.js +40 -0
- package/bundle/anthropic-adapter-2APTH3LA.js.map +7 -0
- package/bundle/bridge-lock-transport-4AC2G5G6.js +39 -0
- package/bundle/bridge-lock-transport-4AC2G5G6.js.map +7 -0
- package/bundle/browse-delivery-JXBY36GK.js +17 -0
- package/bundle/browse-delivery-JXBY36GK.js.map +7 -0
- package/bundle/browser-ELNDVPLC.js +18 -0
- package/bundle/browser-ELNDVPLC.js.map +7 -0
- package/bundle/capability-CIL3G4FI.js +17 -0
- package/bundle/capability-CIL3G4FI.js.map +7 -0
- package/bundle/chunk-265TPOPC.js +289 -0
- package/bundle/chunk-265TPOPC.js.map +7 -0
- package/bundle/chunk-2UENBO6M.js +223 -0
- package/bundle/chunk-2UENBO6M.js.map +7 -0
- package/bundle/chunk-2UPU3OW6.js +67 -0
- package/bundle/chunk-2UPU3OW6.js.map +7 -0
- package/bundle/chunk-2XU2X4OI.js +125 -0
- package/bundle/chunk-2XU2X4OI.js.map +7 -0
- package/bundle/chunk-3B7BBE4F.js +758 -0
- package/bundle/chunk-3B7BBE4F.js.map +7 -0
- package/bundle/chunk-3E545J66.js +69 -0
- package/bundle/chunk-3E545J66.js.map +7 -0
- package/bundle/chunk-5R2ANXQ7.js +510 -0
- package/bundle/chunk-5R2ANXQ7.js.map +7 -0
- package/bundle/chunk-6CPN4IGS.js +507 -0
- package/bundle/chunk-6CPN4IGS.js.map +7 -0
- package/bundle/chunk-6NR3OHEW.js +88 -0
- package/bundle/chunk-6NR3OHEW.js.map +7 -0
- package/bundle/chunk-6SETMHNN.js +206 -0
- package/bundle/chunk-6SETMHNN.js.map +7 -0
- package/bundle/chunk-6UCRKRWR.js +644 -0
- package/bundle/chunk-6UCRKRWR.js.map +7 -0
- package/bundle/chunk-AR6GO6YC.js +83 -0
- package/bundle/chunk-AR6GO6YC.js.map +7 -0
- package/bundle/chunk-AZJIODTQ.js +54 -0
- package/bundle/chunk-AZJIODTQ.js.map +7 -0
- package/bundle/chunk-BHMZ4RCC.js +3706 -0
- package/bundle/chunk-BHMZ4RCC.js.map +7 -0
- package/bundle/chunk-BQ2L4GMG.js +9175 -0
- package/bundle/chunk-BQ2L4GMG.js.map +7 -0
- package/bundle/chunk-BSSBCSCL.js +159 -0
- package/bundle/chunk-BSSBCSCL.js.map +7 -0
- package/bundle/chunk-BUUVFUPO.js +157 -0
- package/bundle/chunk-BUUVFUPO.js.map +7 -0
- package/bundle/chunk-CEVRHKJY.js +131 -0
- package/bundle/chunk-CEVRHKJY.js.map +7 -0
- package/bundle/chunk-CWOHNFUV.js +39 -0
- package/bundle/chunk-CWOHNFUV.js.map +7 -0
- package/bundle/chunk-D2DCBO6M.js +228 -0
- package/bundle/chunk-D2DCBO6M.js.map +7 -0
- package/bundle/chunk-FMWKEPM7.js +31 -0
- package/bundle/chunk-FMWKEPM7.js.map +7 -0
- package/bundle/chunk-GRNENTPA.js +145 -0
- package/bundle/chunk-GRNENTPA.js.map +7 -0
- package/bundle/chunk-GST5T3WZ.js +93 -0
- package/bundle/chunk-GST5T3WZ.js.map +7 -0
- package/bundle/chunk-GUQVJC3U.js +299 -0
- package/bundle/chunk-GUQVJC3U.js.map +7 -0
- package/bundle/chunk-HX7Y7EYP.js +3659 -0
- package/bundle/chunk-HX7Y7EYP.js.map +7 -0
- package/bundle/chunk-JCJS4ZIB.js +296 -0
- package/bundle/chunk-JCJS4ZIB.js.map +7 -0
- package/bundle/chunk-JW6RU47G.js +184 -0
- package/bundle/chunk-JW6RU47G.js.map +7 -0
- package/bundle/chunk-LSPKJQCI.js +24 -0
- package/bundle/chunk-LSPKJQCI.js.map +7 -0
- package/bundle/chunk-M6VBAPNT.js +16 -0
- package/bundle/chunk-M6VBAPNT.js.map +7 -0
- package/bundle/chunk-MPX525QO.js +129 -0
- package/bundle/chunk-MPX525QO.js.map +7 -0
- package/bundle/chunk-MW6WDLU7.js +130 -0
- package/bundle/chunk-MW6WDLU7.js.map +7 -0
- package/bundle/chunk-NT3OBORC.js +215 -0
- package/bundle/chunk-NT3OBORC.js.map +7 -0
- package/bundle/chunk-NWDBD4PA.js +50 -0
- package/bundle/chunk-NWDBD4PA.js.map +7 -0
- package/bundle/chunk-OP7BTAWY.js +29 -0
- package/bundle/chunk-OP7BTAWY.js.map +7 -0
- package/bundle/chunk-PLCY3GFH.js +77 -0
- package/bundle/chunk-PLCY3GFH.js.map +7 -0
- package/bundle/chunk-PNEDC45Y.js +97 -0
- package/bundle/chunk-PNEDC45Y.js.map +7 -0
- package/bundle/chunk-QBGBT5QS.js +81 -0
- package/bundle/chunk-QBGBT5QS.js.map +7 -0
- package/bundle/chunk-RVE2N7FA.js +70 -0
- package/bundle/chunk-RVE2N7FA.js.map +7 -0
- package/bundle/chunk-TZHIDLDS.js +71910 -0
- package/bundle/chunk-TZHIDLDS.js.map +7 -0
- package/bundle/chunk-UCQ2WC3B.js +126 -0
- package/bundle/chunk-UCQ2WC3B.js.map +7 -0
- package/bundle/chunk-UHRP745J.js +214 -0
- package/bundle/chunk-UHRP745J.js.map +7 -0
- package/bundle/chunk-V76TVMCM.js +58 -0
- package/bundle/chunk-V76TVMCM.js.map +7 -0
- package/bundle/chunk-VVEDVGCR.js +981 -0
- package/bundle/chunk-VVEDVGCR.js.map +7 -0
- package/bundle/chunk-W6FAL35D.js +102 -0
- package/bundle/chunk-W6FAL35D.js.map +7 -0
- package/bundle/chunk-X6TERNVJ.js +15902 -0
- package/bundle/chunk-X6TERNVJ.js.map +7 -0
- package/bundle/chunk-X76UX47U.js +47 -0
- package/bundle/chunk-X76UX47U.js.map +7 -0
- package/bundle/chunk-XREWVCUO.js +518 -0
- package/bundle/chunk-XREWVCUO.js.map +7 -0
- package/bundle/chunk-Y6XAEX2Q.js +408 -0
- package/bundle/chunk-Y6XAEX2Q.js.map +7 -0
- package/bundle/chunk-YOCTDKKL.js +28 -0
- package/bundle/chunk-YOCTDKKL.js.map +7 -0
- package/bundle/chunk-ZXPXCDA6.js +160 -0
- package/bundle/chunk-ZXPXCDA6.js.map +7 -0
- package/bundle/commands-BHVUOU3V.js +31 -0
- package/bundle/commands-BHVUOU3V.js.map +7 -0
- package/bundle/completion-buffer-P253ONKF.js +13 -0
- package/bundle/completion-buffer-P253ONKF.js.map +7 -0
- package/bundle/config-RGSDAPZN.js +19 -0
- package/bundle/config-RGSDAPZN.js.map +7 -0
- package/bundle/config-show-ERTATR6E.js +40 -0
- package/bundle/config-show-ERTATR6E.js.map +7 -0
- package/bundle/context-HCEGZNDC.js +72 -0
- package/bundle/context-HCEGZNDC.js.map +7 -0
- package/bundle/delegation-tools-GYTS2D6A.js +27 -0
- package/bundle/delegation-tools-GYTS2D6A.js.map +7 -0
- package/bundle/deploy-lib-import-32ZFKHWP.js +49 -0
- package/bundle/deploy-lib-import-32ZFKHWP.js.map +7 -0
- package/bundle/digital-signature-OFCGSHWO.js +13 -0
- package/bundle/digital-signature-OFCGSHWO.js.map +7 -0
- package/bundle/direct-api-transport-YR7SXXNN.js +860 -0
- package/bundle/direct-api-transport-YR7SXXNN.js.map +7 -0
- package/bundle/discord-adapter-YYWVMPPU.js +584 -0
- package/bundle/discord-adapter-YYWVMPPU.js.map +7 -0
- package/bundle/dist-MTMKARCP.js +1969 -0
- package/bundle/dist-MTMKARCP.js.map +7 -0
- package/bundle/dns-wakeup-27M7D2MR.js +107 -0
- package/bundle/dns-wakeup-27M7D2MR.js.map +7 -0
- package/bundle/doctor-QNUSDY73.js +248 -0
- package/bundle/doctor-QNUSDY73.js.map +7 -0
- package/bundle/ensure-invariants-NMXNS476.js +49 -0
- package/bundle/ensure-invariants-NMXNS476.js.map +7 -0
- package/bundle/env-schema-2KBHBDGN.js +19 -0
- package/bundle/env-schema-2KBHBDGN.js.map +7 -0
- package/bundle/esm-DDP6NCZG.js +100663 -0
- package/bundle/esm-DDP6NCZG.js.map +7 -0
- package/bundle/fallback-policy-L4QV2PEJ.js +46 -0
- package/bundle/fallback-policy-L4QV2PEJ.js.map +7 -0
- package/bundle/health-check-SPA7NT6N.js +56 -0
- package/bundle/health-check-SPA7NT6N.js.map +7 -0
- package/bundle/hook-system-6Q5YTR53.js +17 -0
- package/bundle/hook-system-6Q5YTR53.js.map +7 -0
- package/bundle/hotskills-K7BM4YLB.js +12 -0
- package/bundle/hotskills-K7BM4YLB.js.map +7 -0
- package/bundle/install-6HRZVKUM.js +15 -0
- package/bundle/install-6HRZVKUM.js.map +7 -0
- package/bundle/install-log-IAPHYKD4.js +28 -0
- package/bundle/install-log-IAPHYKD4.js.map +7 -0
- package/bundle/install-manifest-SPQRUNXL.js +102 -0
- package/bundle/install-manifest-SPQRUNXL.js.map +7 -0
- package/bundle/install-validate-PVLZXYLQ.js +53 -0
- package/bundle/install-validate-PVLZXYLQ.js.map +7 -0
- package/bundle/irc-adapter-OI5UZSQF.js +293 -0
- package/bundle/irc-adapter-OI5UZSQF.js.map +7 -0
- package/bundle/irc-config-55YO6EGB.js +88 -0
- package/bundle/irc-config-55YO6EGB.js.map +7 -0
- package/bundle/logs-ZNYXX5PA.js +19 -0
- package/bundle/logs-ZNYXX5PA.js.map +7 -0
- package/bundle/media-utils-XNNDTYFI.js +4662 -0
- package/bundle/media-utils-XNNDTYFI.js.map +7 -0
- package/bundle/message-pipeline-LLH5SYMO.js +33 -0
- package/bundle/message-pipeline-LLH5SYMO.js.map +7 -0
- package/bundle/meta.json +41304 -0
- package/bundle/model-health-registry-35LQNVQR.js +11 -0
- package/bundle/model-health-registry-35LQNVQR.js.map +7 -0
- package/bundle/notification-Y5S5MMLV.js +13 -0
- package/bundle/notification-Y5S5MMLV.js.map +7 -0
- package/bundle/openrouter-credits-EDY7ETAU.js +32 -0
- package/bundle/openrouter-credits-EDY7ETAU.js.map +7 -0
- package/bundle/passwd-RRFV4CC5.js +133 -0
- package/bundle/passwd-RRFV4CC5.js.map +7 -0
- package/bundle/paths-G33RZWZ7.js +17 -0
- package/bundle/paths-G33RZWZ7.js.map +7 -0
- package/bundle/peer-client-52XYMNI7.js +156 -0
- package/bundle/peer-client-52XYMNI7.js.map +7 -0
- package/bundle/peer-config-VK6EDLN5.js +16 -0
- package/bundle/peer-config-VK6EDLN5.js.map +7 -0
- package/bundle/peer-sessions-EAXTNQ36.js +49 -0
- package/bundle/peer-sessions-EAXTNQ36.js.map +7 -0
- package/bundle/pending-callback-RIMQZ7FJ.js +40 -0
- package/bundle/pending-callback-RIMQZ7FJ.js.map +7 -0
- package/bundle/phase-transport-KYERDL2O.js +22 -0
- package/bundle/phase-transport-KYERDL2O.js.map +7 -0
- package/bundle/public/css/dashboard.css +542 -0
- package/bundle/public/index.html +180 -0
- package/bundle/public/js/app.js +437 -0
- package/bundle/public/memory-universe.js +384 -0
- package/bundle/responses-adapter-AAQTY3K4.js +30 -0
- package/bundle/responses-adapter-AAQTY3K4.js.map +7 -0
- package/bundle/restore-ZE3SEPSS.js +46 -0
- package/bundle/restore-ZE3SEPSS.js.map +7 -0
- package/bundle/self-healer-utils-DMUUXC47.js +43 -0
- package/bundle/self-healer-utils-DMUUXC47.js.map +7 -0
- package/bundle/skill-stats-LLEXEXLR.js +22 -0
- package/bundle/skill-stats-LLEXEXLR.js.map +7 -0
- package/bundle/sleep-OYIUOVQD.js +19 -0
- package/bundle/sleep-OYIUOVQD.js.map +7 -0
- package/bundle/soul-loader-54WCVNLJ.js +16 -0
- package/bundle/soul-loader-54WCVNLJ.js.map +7 -0
- package/bundle/src-JL4PVO23.js +8 -0
- package/bundle/src-JL4PVO23.js.map +7 -0
- package/bundle/sse-parser-anthropic-P7CE2MH2.js +72 -0
- package/bundle/sse-parser-anthropic-P7CE2MH2.js.map +7 -0
- package/bundle/sse-parser-responses-EQQA5FWN.js +63 -0
- package/bundle/sse-parser-responses-EQQA5FWN.js.map +7 -0
- package/bundle/ssrf-guard-FZCBYIVW.js +64 -0
- package/bundle/ssrf-guard-FZCBYIVW.js.map +7 -0
- package/bundle/start-FH3GRMJ4.js +35 -0
- package/bundle/start-FH3GRMJ4.js.map +7 -0
- package/bundle/stream-single-WSG4D53C.js +33 -0
- package/bundle/stream-single-WSG4D53C.js.map +7 -0
- package/bundle/stt-2UH3RITX.js +14 -0
- package/bundle/stt-2UH3RITX.js.map +7 -0
- package/bundle/subagent-runtime-LE2ZXH3G.js +12 -0
- package/bundle/subagent-runtime-LE2ZXH3G.js.map +7 -0
- package/bundle/system-message-T5R3EYYN.js +30 -0
- package/bundle/system-message-T5R3EYYN.js.map +7 -0
- package/bundle/system-status-KQ6KHFJ6.js +189 -0
- package/bundle/system-status-KQ6KHFJ6.js.map +7 -0
- package/bundle/task-store-K7CQDEPI.js +22 -0
- package/bundle/task-store-K7CQDEPI.js.map +7 -0
- package/bundle/telegram-adapter-2V3XUMT5.js +1060 -0
- package/bundle/telegram-adapter-2V3XUMT5.js.map +7 -0
- package/bundle/tool-registry-MU3OX4UI.js +38 -0
- package/bundle/tool-registry-MU3OX4UI.js.map +7 -0
- package/bundle/tool-sandbox-VYOK4ZOA.js +20 -0
- package/bundle/tool-sandbox-VYOK4ZOA.js.map +7 -0
- package/bundle/transport-config-YLXU33RO.js +57 -0
- package/bundle/transport-config-YLXU33RO.js.map +7 -0
- package/bundle/update-QCW5LXRN.js +13 -0
- package/bundle/update-QCW5LXRN.js.map +7 -0
- package/bundle/update-check-27KZSAP6.js +12 -0
- package/bundle/update-check-27KZSAP6.js.map +7 -0
- package/bundle/usage-tracker-OVVEVMOY.js +17 -0
- package/bundle/usage-tracker-OVVEVMOY.js.map +7 -0
- package/bundle/user-registry-D4SD73UV.js +16 -0
- package/bundle/user-registry-D4SD73UV.js.map +7 -0
- package/core/professor.json +14 -0
- package/core/prompts/browsing_prompt.md +39 -0
- package/core/prompts/compaction.md +32 -0
- package/core/skills/memory/classification/SKILL.md +37 -0
- package/core/skills/memory/memory-anomalies/SKILL.md +39 -0
- package/core/skills/memory/memory-search/SKILL.md +48 -0
- package/core/skills/memory/topic-save/SKILL.md +44 -0
- package/core/skills/ops/cron/SKILL.md +51 -0
- package/core/skills/ops/gdrive-backup/SKILL.md +15 -0
- package/core/skills/ops/session-start/SKILL.md +11 -0
- package/core/skills/ops/skill-authoring/SKILL.md +54 -0
- package/core/skills/ops/system-health/SKILL.md +104 -0
- package/core/skills/ops/troubleshooting/SKILL.md +48 -0
- package/core/skills/ops/trust-gating/SKILL.md +30 -0
- package/core/skills/tools/a2a-communication/SKILL.md +68 -0
- package/core/skills/tools/browse-delegate/SKILL.md +27 -0
- package/core/skills/tools/browser/SKILL.md +36 -0
- package/core/skills/tools/clawhub/SKILL.md +44 -0
- package/core/skills/tools/delegation/SKILL.md +48 -0
- package/core/skills/tools/fxtwitter/SKILL.md +52 -0
- package/core/skills/tools/gmail/SKILL.md +44 -0
- package/core/skills/tools/irc-chat/SKILL.md +84 -0
- package/core/skills/tools/linear/SKILL.md +90 -0
- package/core/skills/tools/mcporter/SKILL.md +46 -0
- package/core/skills/tools/model-scout/SKILL.md +132 -0
- package/core/skills/tools/model-scout/scout-add-model.py +67 -0
- package/core/skills/tools/model-scout/scout-ollama.py +116 -0
- package/core/skills/tools/model-scout/scout-openrouter.py +85 -0
- package/core/skills/tools/nlm/SKILL.md +40 -0
- package/core/skills/tools/todo/SKILL.md +30 -0
- package/core/skills/tools/twitterX/SKILL.md +52 -0
- package/core/skills/tools/twitterX/scripts/abtars-tweet.js +532 -0
- package/core/skills/tools/twitterX/scripts/package.json +1 -0
- package/core/skills/tools/web-fetch/SKILL.md +29 -0
- package/package.json +59 -0
- package/scripts/abtars-daemon.service +23 -0
- package/scripts/abtars-fetch.sh +42 -0
- package/scripts/abtars-watchdog.service +13 -0
- package/scripts/abtars.sh +14 -0
- package/scripts/abtars@.service +21 -0
- package/scripts/browser-patchright.sh +79 -0
- package/scripts/com.abtars.daemon.plist +24 -0
- package/scripts/com.abtars.watchdog.plist +27 -0
- package/scripts/daily-backup.sh +62 -0
- package/scripts/doctor.sh +553 -0
- package/scripts/hooks/audit-logger.sh +22 -0
- package/scripts/upgrade-deps.sh +64 -0
- package/scripts/watchdog.sh +309 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { createRequire as __bundleCreateRequire } from 'node:module'; import { fileURLToPath as __bundleFileURLToPath } from 'node:url'; import { dirname as __bundleDirname } from 'node:path'; const require = __bundleCreateRequire(import.meta.url); const __chunk_filename = __bundleFileURLToPath(import.meta.url); const __chunk_dirname = __bundleDirname(__chunk_filename);
|
|
2
|
+
import {
|
|
3
|
+
init_logger,
|
|
4
|
+
logDebug,
|
|
5
|
+
logInfo,
|
|
6
|
+
logWarn
|
|
7
|
+
} from "./chunk-BUUVFUPO.js";
|
|
8
|
+
import "./chunk-X76UX47U.js";
|
|
9
|
+
import "./chunk-NWDBD4PA.js";
|
|
10
|
+
|
|
11
|
+
// src/components/dns-wakeup.ts
|
|
12
|
+
init_logger();
|
|
13
|
+
import { createSocket } from "node:dgram";
|
|
14
|
+
import { createHmac, randomBytes } from "node:crypto";
|
|
15
|
+
var TAG = "dns-wakeup";
|
|
16
|
+
var PREFIX = "ab-";
|
|
17
|
+
var SUFFIX = "._workstation._tcp.local";
|
|
18
|
+
var PATTERN = /^ab-([a-f0-9]{10})\._workstation\._tcp\.local$/;
|
|
19
|
+
var MAX_AGE_S = 60;
|
|
20
|
+
var RATE_LIMIT_MS = 5e3;
|
|
21
|
+
var lastWakeup = /* @__PURE__ */ new Map();
|
|
22
|
+
function parseMdnsQueryName(buf) {
|
|
23
|
+
if (buf.length < 12) return null;
|
|
24
|
+
let offset = 12;
|
|
25
|
+
const labels = [];
|
|
26
|
+
while (offset < buf.length) {
|
|
27
|
+
const len = buf[offset];
|
|
28
|
+
if (len === 0) break;
|
|
29
|
+
if (len > 63) return null;
|
|
30
|
+
offset++;
|
|
31
|
+
if (offset + len > buf.length) return null;
|
|
32
|
+
labels.push(buf.subarray(offset, offset + len).toString("ascii"));
|
|
33
|
+
offset += len;
|
|
34
|
+
}
|
|
35
|
+
return labels.join(".").toLowerCase();
|
|
36
|
+
}
|
|
37
|
+
function buildMdnsQuery(name) {
|
|
38
|
+
const labels = name.split(".");
|
|
39
|
+
const header = Buffer.from([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]);
|
|
40
|
+
const parts = [header];
|
|
41
|
+
for (const label of labels) {
|
|
42
|
+
parts.push(Buffer.from([label.length]));
|
|
43
|
+
parts.push(Buffer.from(label, "ascii"));
|
|
44
|
+
}
|
|
45
|
+
parts.push(Buffer.from([0]));
|
|
46
|
+
parts.push(Buffer.from([0, 12, 0, 1]));
|
|
47
|
+
return Buffer.concat(parts);
|
|
48
|
+
}
|
|
49
|
+
function buildEmptyResponse(queryBuf) {
|
|
50
|
+
const resp = Buffer.from(queryBuf);
|
|
51
|
+
if (resp.length >= 4) {
|
|
52
|
+
resp[2] = 132;
|
|
53
|
+
resp[3] = 0;
|
|
54
|
+
}
|
|
55
|
+
return resp;
|
|
56
|
+
}
|
|
57
|
+
function startDnsWakeup(port, config, onWakeup) {
|
|
58
|
+
const sock = createSocket("udp4");
|
|
59
|
+
sock.on("message", (msg, rinfo) => {
|
|
60
|
+
const name = parseMdnsQueryName(msg);
|
|
61
|
+
if (!name || !PATTERN.test(name)) return;
|
|
62
|
+
const token10 = name.match(PATTERN)[1];
|
|
63
|
+
const tokenBuf = Buffer.from(token10, "hex");
|
|
64
|
+
for (const [peerName, peer] of Object.entries(config.peers)) {
|
|
65
|
+
const hmac = createHmac("sha256", peer.token).update(peerName).digest();
|
|
66
|
+
const decoded = Buffer.alloc(5);
|
|
67
|
+
for (let i = 0; i < 5; i++) decoded[i] = tokenBuf[i] ^ hmac[i];
|
|
68
|
+
const ts = decoded.readUInt32BE(0);
|
|
69
|
+
if (Math.abs(Date.now() / 1e3 - ts) <= MAX_AGE_S) {
|
|
70
|
+
const now = Date.now();
|
|
71
|
+
const last = lastWakeup.get(peerName) ?? 0;
|
|
72
|
+
if (now - last < RATE_LIMIT_MS) {
|
|
73
|
+
logDebug(TAG, `Rate-limited wake-up from ${peerName}`);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
lastWakeup.set(peerName, now);
|
|
77
|
+
sock.send(buildEmptyResponse(msg), rinfo.port, rinfo.address);
|
|
78
|
+
logInfo(TAG, `Valid wake-up from ${peerName} \u2014 initiating callback`);
|
|
79
|
+
onWakeup(peerName);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
sock.on("error", (err) => logWarn(TAG, `Socket error: ${err.message}`));
|
|
85
|
+
sock.bind(port, () => logInfo(TAG, `Listening on UDP port ${port}`));
|
|
86
|
+
return sock;
|
|
87
|
+
}
|
|
88
|
+
function sendWakeup(peerName, peerHost, udpPort, token) {
|
|
89
|
+
const ts = Math.floor(Date.now() / 1e3);
|
|
90
|
+
const nonce = randomBytes(1);
|
|
91
|
+
const hmac = createHmac("sha256", token).update(peerName).digest();
|
|
92
|
+
const plain = Buffer.alloc(5);
|
|
93
|
+
plain.writeUInt32BE(ts, 0);
|
|
94
|
+
plain[4] = nonce[0];
|
|
95
|
+
const xored = Buffer.alloc(5);
|
|
96
|
+
for (let i = 0; i < 5; i++) xored[i] = plain[i] ^ hmac[i];
|
|
97
|
+
const queryName = `${PREFIX}${xored.toString("hex")}${SUFFIX}`;
|
|
98
|
+
const query = buildMdnsQuery(queryName);
|
|
99
|
+
const sock = createSocket("udp4");
|
|
100
|
+
sock.send(query, udpPort, peerHost, () => sock.close());
|
|
101
|
+
logDebug(TAG, `Sent wake-up to ${peerName} at ${peerHost}:${udpPort}`);
|
|
102
|
+
}
|
|
103
|
+
export {
|
|
104
|
+
sendWakeup,
|
|
105
|
+
startDnsWakeup
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=dns-wakeup-27M7D2MR.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/components/dns-wakeup.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * dns-wakeup.ts \u2014 mDNS-disguised UDP wake-up for A2A callback (#425).\n *\n * Sender crafts a valid mDNS PTR query: AB-<token>._workstation._tcp.local\n * Token = (ts(4) + nonce(1)) XOR HMAC-SHA256(peer.token, peername)[:5]\n *\n * Receiver tries each known peer, XORs to recover ts, validates within 60s.\n * On valid wake-up \u2192 triggers A2A callback (outbound TCP).\n *\n * Looks like normal mDNS service discovery to endpoint protection.\n */\n\nimport { createSocket, type Socket } from \"node:dgram\";\nimport { createHmac, randomBytes } from \"node:crypto\";\nimport { logInfo, logWarn, logDebug } from \"./logger.js\";\nimport type { PeerConfig } from \"./peer-config.js\";\n\nconst TAG = \"dns-wakeup\";\nconst PREFIX = \"ab-\";\nconst SUFFIX = \"._workstation._tcp.local\";\nconst PATTERN = /^ab-([a-f0-9]{10})\\._workstation\\._tcp\\.local$/;\nconst MAX_AGE_S = 60;\nconst RATE_LIMIT_MS = 5000;\n\nconst lastWakeup = new Map<string, number>();\n\n/** Parse the query name from a raw DNS/mDNS packet (minimal parser). */\nfunction parseMdnsQueryName(buf: Buffer): string | null {\n if (buf.length < 12) return null;\n let offset = 12; // skip DNS header\n const labels: string[] = [];\n while (offset < buf.length) {\n const len = buf[offset]!;\n if (len === 0) break;\n if (len > 63) return null; // compressed \u2014 not expected in queries\n offset++;\n if (offset + len > buf.length) return null;\n labels.push(buf.subarray(offset, offset + len).toString(\"ascii\"));\n offset += len;\n }\n return labels.join(\".\").toLowerCase();\n}\n\n/** Build a minimal mDNS query packet for a PTR record. */\nfunction buildMdnsQuery(name: string): Buffer {\n const labels = name.split(\".\");\n // Header: ID=0, flags=0 (standard query), QDCOUNT=1\n const header = Buffer.from([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]);\n // Question section: labels + null + type PTR (12) + class IN (1)\n const parts: Buffer[] = [header];\n for (const label of labels) {\n parts.push(Buffer.from([label.length]));\n parts.push(Buffer.from(label, \"ascii\"));\n }\n parts.push(Buffer.from([0])); // root label\n parts.push(Buffer.from([0, 12, 0, 1])); // type PTR, class IN\n return Buffer.concat(parts);\n}\n\n/** Build an empty mDNS response (no answers \u2014 looks like \"not found\"). */\nfunction buildEmptyResponse(queryBuf: Buffer): Buffer {\n const resp = Buffer.from(queryBuf);\n // Set QR=1 (response), RCODE=0 in flags\n if (resp.length >= 4) {\n resp[2] = 0x84; // QR=1, AA=1\n resp[3] = 0x00; // RCODE=0\n }\n return resp;\n}\n\nexport function startDnsWakeup(\n port: number,\n config: PeerConfig,\n onWakeup: (peerName: string) => void,\n): Socket {\n const sock = createSocket(\"udp4\");\n\n sock.on(\"message\", (msg, rinfo) => {\n const name = parseMdnsQueryName(msg);\n if (!name || !PATTERN.test(name)) return; // early bail \u2014 not ours\n\n const token10 = name.match(PATTERN)![1]!;\n const tokenBuf = Buffer.from(token10, \"hex\"); // 5 bytes\n\n for (const [peerName, peer] of Object.entries(config.peers)) {\n const hmac = createHmac(\"sha256\", peer.token).update(peerName).digest();\n const decoded = Buffer.alloc(5);\n for (let i = 0; i < 5; i++) decoded[i] = tokenBuf[i]! ^ hmac[i]!;\n const ts = decoded.readUInt32BE(0);\n // decoded[4] = nonce \u2014 discarded\n\n if (Math.abs(Date.now() / 1000 - ts) <= MAX_AGE_S) {\n // Rate limit\n const now = Date.now();\n const last = lastWakeup.get(peerName) ?? 0;\n if (now - last < RATE_LIMIT_MS) {\n logDebug(TAG, `Rate-limited wake-up from ${peerName}`);\n return;\n }\n lastWakeup.set(peerName, now);\n\n // Send empty mDNS response\n sock.send(buildEmptyResponse(msg), rinfo.port, rinfo.address);\n\n logInfo(TAG, `Valid wake-up from ${peerName} \u2014 initiating callback`);\n onWakeup(peerName);\n return;\n }\n }\n });\n\n sock.on(\"error\", (err) => logWarn(TAG, `Socket error: ${err.message}`));\n sock.bind(port, () => logInfo(TAG, `Listening on UDP port ${port}`));\n return sock;\n}\n\n/** Send a wake-up signal to a peer (mDNS-disguised). */\nexport function sendWakeup(peerName: string, peerHost: string, udpPort: number, token: string): void {\n const ts = Math.floor(Date.now() / 1000);\n const nonce = randomBytes(1);\n const hmac = createHmac(\"sha256\", token).update(peerName).digest();\n\n const plain = Buffer.alloc(5);\n plain.writeUInt32BE(ts, 0);\n plain[4] = nonce[0]!;\n\n const xored = Buffer.alloc(5);\n for (let i = 0; i < 5; i++) xored[i] = plain[i]! ^ hmac[i]!;\n\n const queryName = `${PREFIX}${xored.toString(\"hex\")}${SUFFIX}`;\n const query = buildMdnsQuery(queryName);\n\n const sock = createSocket(\"udp4\");\n sock.send(query, udpPort, peerHost, () => sock.close());\n logDebug(TAG, `Sent wake-up to ${peerName} at ${peerHost}:${udpPort}`);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAcA;AAFA,SAAS,oBAAiC;AAC1C,SAAS,YAAY,mBAAmB;AAIxC,IAAM,MAAM;AACZ,IAAM,SAAS;AACf,IAAM,SAAS;AACf,IAAM,UAAU;AAChB,IAAM,YAAY;AAClB,IAAM,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,QAAQ,YAAY,CAAC;AAC3B,QAAM,OAAO,WAAW,UAAU,KAAK,EAAE,OAAO,QAAQ,EAAE,OAAO;AAEjE,QAAM,QAAQ,OAAO,MAAM,CAAC;AAC5B,QAAM,cAAc,IAAI,CAAC;AACzB,QAAM,CAAC,IAAI,MAAM,CAAC;AAElB,QAAM,QAAQ,OAAO,MAAM,CAAC;AAC5B,WAAS,IAAI,GAAG,IAAI,GAAG,IAAK,OAAM,CAAC,IAAI,MAAM,CAAC,IAAK,KAAK,CAAC;AAEzD,QAAM,YAAY,GAAG,MAAM,GAAG,MAAM,SAAS,KAAK,CAAC,GAAG,MAAM;AAC5D,QAAM,QAAQ,eAAe,SAAS;AAEtC,QAAM,OAAO,aAAa,MAAM;AAChC,OAAK,KAAK,OAAO,SAAS,UAAU,MAAM,KAAK,MAAM,CAAC;AACtD,WAAS,KAAK,mBAAmB,QAAQ,OAAO,QAAQ,IAAI,OAAO,EAAE;AACvE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { createRequire as __bundleCreateRequire } from 'node:module'; import { fileURLToPath as __bundleFileURLToPath } from 'node:url'; import { dirname as __bundleDirname } from 'node:path'; const require = __bundleCreateRequire(import.meta.url); const __chunk_filename = __bundleFileURLToPath(import.meta.url); const __chunk_dirname = __bundleDirname(__chunk_filename);
|
|
2
|
+
import {
|
|
3
|
+
init_log_and_swallow,
|
|
4
|
+
logAndSwallow
|
|
5
|
+
} from "./chunk-FMWKEPM7.js";
|
|
6
|
+
import {
|
|
7
|
+
init_logger,
|
|
8
|
+
logInfo
|
|
9
|
+
} from "./chunk-BUUVFUPO.js";
|
|
10
|
+
import "./chunk-X76UX47U.js";
|
|
11
|
+
import "./chunk-NWDBD4PA.js";
|
|
12
|
+
|
|
13
|
+
// src/components/doctor/index.ts
|
|
14
|
+
init_logger();
|
|
15
|
+
init_log_and_swallow();
|
|
16
|
+
var TAG = "doctor";
|
|
17
|
+
function withTimeout(probe, timeoutMs) {
|
|
18
|
+
return async (ctx) => {
|
|
19
|
+
const start = Date.now();
|
|
20
|
+
try {
|
|
21
|
+
const result = await Promise.race([
|
|
22
|
+
probe(ctx),
|
|
23
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error("timeout")), timeoutMs))
|
|
24
|
+
]);
|
|
25
|
+
return result;
|
|
26
|
+
} catch (err) {
|
|
27
|
+
return { name: "unknown", status: "failed", latencyMs: Date.now() - start, detail: `timeout after ${timeoutMs}ms` };
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
var probeMemory = async (ctx) => {
|
|
32
|
+
const start = Date.now();
|
|
33
|
+
if (!ctx.memory) return { name: "memory", status: "skipped", latencyMs: 0, detail: "not configured" };
|
|
34
|
+
try {
|
|
35
|
+
ctx.memory.getStats();
|
|
36
|
+
return { name: "memory", status: "ok", latencyMs: Date.now() - start };
|
|
37
|
+
} catch (err) {
|
|
38
|
+
return { name: "memory", status: "failed", latencyMs: Date.now() - start, detail: String(err) };
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var probeTelegram = async (ctx) => {
|
|
42
|
+
const start = Date.now();
|
|
43
|
+
if (!ctx.telegramRunning) return { name: "telegram", status: "skipped", latencyMs: 0, detail: "not configured" };
|
|
44
|
+
return { name: "telegram", status: "ok", latencyMs: Date.now() - start, detail: "running" };
|
|
45
|
+
};
|
|
46
|
+
var probeDiscord = async (ctx) => {
|
|
47
|
+
const start = Date.now();
|
|
48
|
+
if (!ctx.discordRunning) return { name: "discord", status: "skipped", latencyMs: 0, detail: "not configured" };
|
|
49
|
+
return { name: "discord", status: "ok", latencyMs: Date.now() - start, detail: "running" };
|
|
50
|
+
};
|
|
51
|
+
var probeHeartbeat = async (ctx) => {
|
|
52
|
+
const start = Date.now();
|
|
53
|
+
if (!ctx.memory || typeof ctx.memory.getCronInfo !== "function") return { name: "heartbeat", status: "skipped", latencyMs: 0 };
|
|
54
|
+
try {
|
|
55
|
+
const info = ctx.memory.getCronInfo();
|
|
56
|
+
const running = info.heartbeatRunning;
|
|
57
|
+
return { name: "heartbeat", status: running ? "ok" : "failed", latencyMs: Date.now() - start, detail: running ? `interval ${info.intervalMs}ms` : "not running" };
|
|
58
|
+
} catch (err) {
|
|
59
|
+
logAndSwallow(TAG, "probe heartbeat", err);
|
|
60
|
+
return { name: "heartbeat", status: "failed", latencyMs: Date.now() - start };
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var probeTransport = async (ctx) => {
|
|
64
|
+
const start = Date.now();
|
|
65
|
+
if (!ctx.transport) return { name: "transport", status: "skipped", latencyMs: 0, detail: "not configured" };
|
|
66
|
+
try {
|
|
67
|
+
await ctx.transport.sendPrompt("__doctor_probe__", "hi");
|
|
68
|
+
return { name: "transport", status: "ok", latencyMs: Date.now() - start };
|
|
69
|
+
} catch (err) {
|
|
70
|
+
return { name: "transport", status: "failed", latencyMs: Date.now() - start, detail: err.message?.slice(0, 80) };
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var probeDashboard = async (ctx) => {
|
|
74
|
+
const start = Date.now();
|
|
75
|
+
const port = ctx.config?.webPort ?? 3e3;
|
|
76
|
+
try {
|
|
77
|
+
const res = await fetch(`http://localhost:${port}/`, { signal: AbortSignal.timeout(5e3) });
|
|
78
|
+
return { name: "dashboard", status: res.ok ? "ok" : "failed", latencyMs: Date.now() - start };
|
|
79
|
+
} catch (err) {
|
|
80
|
+
logAndSwallow(TAG, "probe dashboard", err);
|
|
81
|
+
return { name: "dashboard", status: "skipped", latencyMs: Date.now() - start, detail: "not running" };
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
var probeOllama = async (_ctx) => {
|
|
85
|
+
const start = Date.now();
|
|
86
|
+
try {
|
|
87
|
+
const res = await fetch("http://localhost:11434/api/tags", { signal: AbortSignal.timeout(5e3) });
|
|
88
|
+
return { name: "ollama", status: res.ok ? "ok" : "failed", latencyMs: Date.now() - start };
|
|
89
|
+
} catch (err) {
|
|
90
|
+
logAndSwallow(TAG, "probe ollama", err);
|
|
91
|
+
return { name: "ollama", status: "skipped", latencyMs: Date.now() - start, detail: "not reachable" };
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
var probeCoreFiles = async (_ctx) => {
|
|
95
|
+
const { existsSync } = await import("node:fs");
|
|
96
|
+
const { join } = await import("node:path");
|
|
97
|
+
const { homedir } = await import("node:os");
|
|
98
|
+
const start = Date.now();
|
|
99
|
+
const memDir = process.env["ABMIND_MEMORY_DIR"] || join(homedir(), ".abmind", "memory");
|
|
100
|
+
const abmindCore = join(memDir, "core");
|
|
101
|
+
const required = ["SOUL.md", "user_profile.md", "agent_notes.md", "memory-tools.md", "core_facts.md"];
|
|
102
|
+
const missing = required.filter((f) => !existsSync(join(abmindCore, f)));
|
|
103
|
+
if (missing.length === 0) return { name: "core-files", status: "ok", latencyMs: Date.now() - start };
|
|
104
|
+
return { name: "core-files", status: "failed", latencyMs: Date.now() - start, detail: `missing: ${missing.join(", ")}` };
|
|
105
|
+
};
|
|
106
|
+
var probeTlsIdentity = async (_ctx) => {
|
|
107
|
+
const { existsSync } = await import("node:fs");
|
|
108
|
+
const { execSync } = await import("node:child_process");
|
|
109
|
+
const { join } = await import("node:path");
|
|
110
|
+
const { abtarsHome } = await import("./paths-G33RZWZ7.js");
|
|
111
|
+
const start = Date.now();
|
|
112
|
+
const issues = [];
|
|
113
|
+
try {
|
|
114
|
+
execSync("which openssl", { stdio: "ignore" });
|
|
115
|
+
} catch {
|
|
116
|
+
issues.push("openssl not found");
|
|
117
|
+
}
|
|
118
|
+
const configDir = join(abtarsHome(), "config");
|
|
119
|
+
if (!existsSync(join(configDir, "identity.crt"))) issues.push("identity.crt missing");
|
|
120
|
+
if (!existsSync(join(configDir, "identity.tls.key"))) issues.push("identity.tls.key missing");
|
|
121
|
+
if (issues.length === 0) return { name: "tls-identity", status: "ok", latencyMs: Date.now() - start };
|
|
122
|
+
return { name: "tls-identity", status: "failed", latencyMs: Date.now() - start, detail: issues.join(", ") };
|
|
123
|
+
};
|
|
124
|
+
var probeSecretPerms = async (_ctx) => {
|
|
125
|
+
const { readdirSync, statSync } = await import("node:fs");
|
|
126
|
+
const { join } = await import("node:path");
|
|
127
|
+
const { abtarsHome } = await import("./paths-G33RZWZ7.js");
|
|
128
|
+
const start = Date.now();
|
|
129
|
+
const secretDir = join(abtarsHome(), "secret");
|
|
130
|
+
let files;
|
|
131
|
+
try {
|
|
132
|
+
files = readdirSync(secretDir);
|
|
133
|
+
} catch (err) {
|
|
134
|
+
logAndSwallow(TAG, "readdirSync secret dir", err);
|
|
135
|
+
return { name: "secret-perms", status: "skipped", latencyMs: 0, detail: "no secret/ dir" };
|
|
136
|
+
}
|
|
137
|
+
const bad = [];
|
|
138
|
+
for (const f of files) {
|
|
139
|
+
const st = statSync(join(secretDir, f));
|
|
140
|
+
if (!st.isFile()) continue;
|
|
141
|
+
const mode = st.mode & 511;
|
|
142
|
+
if (mode !== 384) bad.push(`${f} (${mode.toString(8)})`);
|
|
143
|
+
}
|
|
144
|
+
if (bad.length === 0) return { name: "secret-perms", status: "ok", latencyMs: Date.now() - start, detail: `${files.filter((f) => statSync(join(secretDir, f)).isFile()).length} files, all 600` };
|
|
145
|
+
return { name: "secret-perms", status: "failed", latencyMs: Date.now() - start, detail: `not 600: ${bad.join(", ")}` };
|
|
146
|
+
};
|
|
147
|
+
var probeFtsIntegrity = async (_ctx) => {
|
|
148
|
+
const { join } = await import("node:path");
|
|
149
|
+
const { homedir } = await import("node:os");
|
|
150
|
+
const { execSync } = await import("node:child_process");
|
|
151
|
+
const start = Date.now();
|
|
152
|
+
try {
|
|
153
|
+
const dbPath = join(process.env["ABMIND_MEMORY_DIR"] || join(homedir(), ".abmind", "memory"), "memory.db");
|
|
154
|
+
const tables = ["extracted_memories_fts", "content_en_trigram", "content_original_trigram"];
|
|
155
|
+
const rebuilt = [];
|
|
156
|
+
for (const t of tables) {
|
|
157
|
+
try {
|
|
158
|
+
execSync(`sqlite3 "${dbPath}" "INSERT INTO ${t}(${t}) VALUES('integrity-check')"`, { stdio: "pipe", timeout: 2e3 });
|
|
159
|
+
} catch {
|
|
160
|
+
try {
|
|
161
|
+
execSync(`sqlite3 "${dbPath}" "INSERT INTO ${t}(${t}) VALUES('rebuild')"`, { stdio: "pipe", timeout: 5e3 });
|
|
162
|
+
rebuilt.push(t);
|
|
163
|
+
} catch {
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (rebuilt.length > 0) return { name: "fts-integrity", status: "ok", latencyMs: Date.now() - start, detail: `rebuilt: ${rebuilt.join(", ")}` };
|
|
168
|
+
return { name: "fts-integrity", status: "ok", latencyMs: Date.now() - start };
|
|
169
|
+
} catch (err) {
|
|
170
|
+
return { name: "fts-integrity", status: "failed", latencyMs: Date.now() - start, detail: err instanceof Error ? err.message : String(err) };
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
var PROBES = [
|
|
174
|
+
{ fn: probeCoreFiles, timeout: 1e3 },
|
|
175
|
+
{ fn: probeFtsIntegrity, timeout: 3e3 },
|
|
176
|
+
{ fn: probeSecretPerms, timeout: 1e3 },
|
|
177
|
+
{ fn: probeTlsIdentity, timeout: 2e3 },
|
|
178
|
+
{ fn: probeMemory, timeout: 5e3 },
|
|
179
|
+
{ fn: probeTelegram, timeout: 5e3 },
|
|
180
|
+
{ fn: probeDiscord, timeout: 5e3 },
|
|
181
|
+
{ fn: probeHeartbeat, timeout: 2e3 },
|
|
182
|
+
{ fn: probeDashboard, timeout: 5e3 },
|
|
183
|
+
{ fn: probeOllama, timeout: 5e3 },
|
|
184
|
+
{ fn: probeTransport, timeout: 1e4 }
|
|
185
|
+
// last — most expensive
|
|
186
|
+
];
|
|
187
|
+
var lastReport = null;
|
|
188
|
+
var CACHE_TTL_MS = 6e4;
|
|
189
|
+
async function getDoctorReport(ctx, opts) {
|
|
190
|
+
const now = Date.now();
|
|
191
|
+
if (!opts?.force && lastReport && now - lastReport.generatedAt < CACHE_TTL_MS) {
|
|
192
|
+
return { ...lastReport.report, cached: true, cacheAgeMs: now - lastReport.generatedAt };
|
|
193
|
+
}
|
|
194
|
+
const start = Date.now();
|
|
195
|
+
const results = await Promise.all(
|
|
196
|
+
PROBES.map((p) => withTimeout(p.fn, p.timeout)(ctx).then((r) => {
|
|
197
|
+
if (r.name === "unknown") r.name = "probe";
|
|
198
|
+
return r;
|
|
199
|
+
}))
|
|
200
|
+
);
|
|
201
|
+
const probedNames = new Set(results.map((r) => r.name));
|
|
202
|
+
if (ctx.phaseHealth) {
|
|
203
|
+
for (const [name, h] of ctx.phaseHealth) {
|
|
204
|
+
const short = name.replace("phase", "").replace(/([A-Z])/g, " $1").trim().toLowerCase();
|
|
205
|
+
if (!probedNames.has(short) && !probedNames.has(short.replace(" ", ""))) {
|
|
206
|
+
results.push({ name: short, status: h.status === "ok" ? "ok" : h.status === "skipped" ? "skipped" : "failed", latencyMs: 0, detail: h.error ?? (h.status === "ok" ? "boot ok" : void 0) });
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const totalMs = Date.now() - start;
|
|
211
|
+
try {
|
|
212
|
+
const { checkForUpdate } = await import("./update-check-27KZSAP6.js");
|
|
213
|
+
const { readlinkSync } = await import("node:fs");
|
|
214
|
+
const { join } = await import("node:path");
|
|
215
|
+
const { homedir } = await import("node:os");
|
|
216
|
+
const target = readlinkSync(join(homedir(), ".abtars", "current")).split("/").pop() ?? "";
|
|
217
|
+
const dash = target.lastIndexOf("-");
|
|
218
|
+
const version = dash > 0 ? target.slice(0, dash) : "unknown";
|
|
219
|
+
const result = checkForUpdate("abtars", version);
|
|
220
|
+
if (result?.updateAvailable) {
|
|
221
|
+
results.push({ name: "update-available", status: "failed", latencyMs: 0, detail: `update: ${result.current} \u2192 ${result.latest} available` });
|
|
222
|
+
} else if (result) {
|
|
223
|
+
results.push({ name: "version", status: "ok", latencyMs: 0, detail: `${result.current} (latest)` });
|
|
224
|
+
}
|
|
225
|
+
} catch (err) {
|
|
226
|
+
logAndSwallow(TAG, "version check", err);
|
|
227
|
+
}
|
|
228
|
+
const report = { results, totalMs, cached: false };
|
|
229
|
+
lastReport = { report, generatedAt: now };
|
|
230
|
+
logInfo("doctor", `Probes complete: ${results.filter((r) => r.status === "ok").length}/${results.length} ok (${totalMs}ms)`);
|
|
231
|
+
return report;
|
|
232
|
+
}
|
|
233
|
+
function renderDoctorText(report) {
|
|
234
|
+
const icon = (s) => s === "ok" ? "\u2713" : s === "failed" ? "\u2717" : "\u23ED";
|
|
235
|
+
const lines = report.results.map((r) => {
|
|
236
|
+
const detail = r.detail ? ` \u2014 ${r.detail}` : "";
|
|
237
|
+
const ms = r.latencyMs > 0 ? ` (${r.latencyMs}ms)` : "";
|
|
238
|
+
return ` ${icon(r.status)} ${r.name}${ms}${detail}`;
|
|
239
|
+
});
|
|
240
|
+
const tag = report.cached ? `[cached ${Math.round((report.cacheAgeMs ?? 0) / 1e3)}s ago]` : "[fresh]";
|
|
241
|
+
return `\u{1FA7A} Doctor Report (${(report.totalMs / 1e3).toFixed(1)}s) ${tag}
|
|
242
|
+
${lines.join("\n")}`;
|
|
243
|
+
}
|
|
244
|
+
export {
|
|
245
|
+
getDoctorReport,
|
|
246
|
+
renderDoctorText
|
|
247
|
+
};
|
|
248
|
+
//# sourceMappingURL=doctor-QNUSDY73.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/components/doctor/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * doctor \u2014 deep runtime healthcheck. Probes every subsystem in parallel.\n * Shared cache (60s) prevents token-burning spam.\n */\n\nimport { logInfo } from \"../logger.js\";\nimport { logAndSwallow } from \"../log-and-swallow.js\";\n\nconst TAG = \"doctor\";\n\nexport interface ProbeResult {\n name: string;\n status: \"ok\" | \"failed\" | \"skipped\";\n latencyMs: number;\n detail?: string;\n}\n\nexport interface DoctorReport {\n results: ProbeResult[];\n totalMs: number;\n cached: boolean;\n cacheAgeMs?: number;\n}\n\nexport interface DoctorCtx {\n memory?: { getStats: () => any; getCronInfo: () => any } | null;\n transport?: { sendPrompt: (key: string, msg: string) => Promise<string> } | null;\n telegramRunning?: boolean;\n discordRunning?: boolean;\n config?: { webPort?: number } | null;\n phaseHealth?: Map<string, { status: \"ok\" | \"failed\" | \"skipped\"; error?: string }>;\n}\n\ntype ProbeFn = (ctx: DoctorCtx) => Promise<ProbeResult>;\n\nfunction withTimeout(probe: ProbeFn, timeoutMs: number): ProbeFn {\n return async (ctx) => {\n const start = Date.now();\n try {\n const result = await Promise.race([\n probe(ctx),\n new Promise<ProbeResult>((_, reject) => setTimeout(() => reject(new Error(\"timeout\")), timeoutMs)),\n ]);\n return result;\n } catch (err) {\n return { name: \"unknown\", status: \"failed\", latencyMs: Date.now() - start, detail: `timeout after ${timeoutMs}ms` };\n }\n };\n}\n\n// \u2500\u2500 Probes \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst probeMemory: ProbeFn = async (ctx) => {\n const start = Date.now();\n if (!ctx.memory) return { name: \"memory\", status: \"skipped\", latencyMs: 0, detail: \"not configured\" };\n try {\n ctx.memory.getStats();\n return { name: \"memory\", status: \"ok\", latencyMs: Date.now() - start };\n } catch (err) {\n return { name: \"memory\", status: \"failed\", latencyMs: Date.now() - start, detail: String(err) };\n }\n};\n\nconst probeTelegram: ProbeFn = async (ctx) => {\n const start = Date.now();\n if (!ctx.telegramRunning) return { name: \"telegram\", status: \"skipped\", latencyMs: 0, detail: \"not configured\" };\n return { name: \"telegram\", status: \"ok\", latencyMs: Date.now() - start, detail: \"running\" };\n};\n\nconst probeDiscord: ProbeFn = async (ctx) => {\n const start = Date.now();\n if (!ctx.discordRunning) return { name: \"discord\", status: \"skipped\", latencyMs: 0, detail: \"not configured\" };\n return { name: \"discord\", status: \"ok\", latencyMs: Date.now() - start, detail: \"running\" };\n};\n\nconst probeHeartbeat: ProbeFn = async (ctx) => {\n const start = Date.now();\n if (!ctx.memory || typeof ctx.memory.getCronInfo !== \"function\") return { name: \"heartbeat\", status: \"skipped\", latencyMs: 0 };\n try {\n const info = ctx.memory.getCronInfo();\n const running = info.heartbeatRunning;\n return { name: \"heartbeat\", status: running ? \"ok\" : \"failed\", latencyMs: Date.now() - start, detail: running ? `interval ${info.intervalMs}ms` : \"not running\" };\n } catch (err) {\n logAndSwallow(TAG, \"probe heartbeat\", err);\n return { name: \"heartbeat\", status: \"failed\", latencyMs: Date.now() - start };\n }\n};\n\nconst probeTransport: ProbeFn = async (ctx) => {\n const start = Date.now();\n if (!ctx.transport) return { name: \"transport\", status: \"skipped\", latencyMs: 0, detail: \"not configured\" };\n try {\n await ctx.transport.sendPrompt(\"__doctor_probe__\", \"hi\");\n return { name: \"transport\", status: \"ok\", latencyMs: Date.now() - start };\n } catch (err) {\n return { name: \"transport\", status: \"failed\", latencyMs: Date.now() - start, detail: (err as Error).message?.slice(0, 80) };\n }\n};\n\nconst probeDashboard: ProbeFn = async (ctx) => {\n const start = Date.now();\n const port = (ctx as any).config?.webPort ?? 3000;\n try {\n const res = await fetch(`http://localhost:${port}/`, { signal: AbortSignal.timeout(5000) });\n return { name: \"dashboard\", status: res.ok ? \"ok\" : \"failed\", latencyMs: Date.now() - start };\n } catch (err) {\n logAndSwallow(TAG, \"probe dashboard\", err);\n return { name: \"dashboard\", status: \"skipped\", latencyMs: Date.now() - start, detail: \"not running\" };\n }\n};\n\nconst probeOllama: ProbeFn = async (_ctx) => {\n const start = Date.now();\n try {\n const res = await fetch(\"http://localhost:11434/api/tags\", { signal: AbortSignal.timeout(5000) });\n return { name: \"ollama\", status: res.ok ? \"ok\" : \"failed\", latencyMs: Date.now() - start };\n } catch (err) {\n logAndSwallow(TAG, \"probe ollama\", err);\n return { name: \"ollama\", status: \"skipped\", latencyMs: Date.now() - start, detail: \"not reachable\" };\n }\n};\n\nconst probeCoreFiles: ProbeFn = async (_ctx) => {\n const { existsSync } = await import(\"node:fs\");\n const { join } = await import(\"node:path\");\n const { homedir } = await import(\"node:os\");\n const start = Date.now();\n const memDir = process.env[\"ABMIND_MEMORY_DIR\"] || join(homedir(), \".abmind\", \"memory\");\n const abmindCore = join(memDir, \"core\");\n const required = [\"SOUL.md\", \"user_profile.md\", \"agent_notes.md\", \"memory-tools.md\", \"core_facts.md\"];\n const missing = required.filter(f => !existsSync(join(abmindCore, f)));\n if (missing.length === 0) return { name: \"core-files\", status: \"ok\", latencyMs: Date.now() - start };\n return { name: \"core-files\", status: \"failed\", latencyMs: Date.now() - start, detail: `missing: ${missing.join(\", \")}` };\n};\n\nconst probeTlsIdentity: ProbeFn = async (_ctx) => {\n const { existsSync } = await import(\"node:fs\");\n const { execSync } = await import(\"node:child_process\");\n const { join } = await import(\"node:path\");\n const { abtarsHome } = await import(\"../../paths.js\");\n const start = Date.now();\n const issues: string[] = [];\n try { execSync(\"which openssl\", { stdio: \"ignore\" }); } catch { issues.push(\"openssl not found\"); }\n const configDir = join(abtarsHome(), \"config\");\n if (!existsSync(join(configDir, \"identity.crt\"))) issues.push(\"identity.crt missing\");\n if (!existsSync(join(configDir, \"identity.tls.key\"))) issues.push(\"identity.tls.key missing\");\n if (issues.length === 0) return { name: \"tls-identity\", status: \"ok\", latencyMs: Date.now() - start };\n return { name: \"tls-identity\", status: \"failed\", latencyMs: Date.now() - start, detail: issues.join(\", \") };\n};\n\nconst probeSecretPerms: ProbeFn = async (_ctx) => {\n const { readdirSync, statSync } = await import(\"node:fs\");\n const { join } = await import(\"node:path\");\n const { abtarsHome } = await import(\"../../paths.js\");\n const start = Date.now();\n const secretDir = join(abtarsHome(), \"secret\");\n let files: string[];\n try { files = readdirSync(secretDir); } catch (err) { logAndSwallow(TAG, \"readdirSync secret dir\", err); return { name: \"secret-perms\", status: \"skipped\", latencyMs: 0, detail: \"no secret/ dir\" }; }\n const bad: string[] = [];\n for (const f of files) {\n const st = statSync(join(secretDir, f));\n if (!st.isFile()) continue;\n const mode = st.mode & 0o777;\n if (mode !== 0o600) bad.push(`${f} (${mode.toString(8)})`);\n }\n if (bad.length === 0) return { name: \"secret-perms\", status: \"ok\", latencyMs: Date.now() - start, detail: `${files.filter(f => statSync(join(secretDir, f)).isFile()).length} files, all 600` };\n return { name: \"secret-perms\", status: \"failed\", latencyMs: Date.now() - start, detail: `not 600: ${bad.join(\", \")}` };\n};\n\n// \u2500\u2500 Collector \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst probeFtsIntegrity: ProbeFn = async (_ctx) => {\n const { join } = await import(\"node:path\");\n const { homedir } = await import(\"node:os\");\n const { execSync } = await import(\"node:child_process\");\n const start = Date.now();\n try {\n const dbPath = join(process.env[\"ABMIND_MEMORY_DIR\"] || join(homedir(), \".abmind\", \"memory\"), \"memory.db\");\n const tables = [\"extracted_memories_fts\", \"content_en_trigram\", \"content_original_trigram\"];\n const rebuilt: string[] = [];\n for (const t of tables) {\n try {\n execSync(`sqlite3 \"${dbPath}\" \"INSERT INTO ${t}(${t}) VALUES('integrity-check')\"`, { stdio: \"pipe\", timeout: 2000 });\n } catch {\n try {\n execSync(`sqlite3 \"${dbPath}\" \"INSERT INTO ${t}(${t}) VALUES('rebuild')\"`, { stdio: \"pipe\", timeout: 5000 });\n rebuilt.push(t);\n } catch { /* table may not exist */ }\n }\n }\n if (rebuilt.length > 0) return { name: \"fts-integrity\", status: \"ok\", latencyMs: Date.now() - start, detail: `rebuilt: ${rebuilt.join(\", \")}` };\n return { name: \"fts-integrity\", status: \"ok\", latencyMs: Date.now() - start };\n } catch (err) {\n return { name: \"fts-integrity\", status: \"failed\", latencyMs: Date.now() - start, detail: err instanceof Error ? err.message : String(err) };\n }\n};\n\nconst PROBES: Array<{ fn: ProbeFn; timeout: number }> = [\n { fn: probeCoreFiles, timeout: 1000 },\n { fn: probeFtsIntegrity, timeout: 3000 },\n { fn: probeSecretPerms, timeout: 1000 },\n { fn: probeTlsIdentity, timeout: 2000 },\n { fn: probeMemory, timeout: 5000 },\n { fn: probeTelegram, timeout: 5000 },\n { fn: probeDiscord, timeout: 5000 },\n { fn: probeHeartbeat, timeout: 2000 },\n { fn: probeDashboard, timeout: 5000 },\n { fn: probeOllama, timeout: 5000 },\n { fn: probeTransport, timeout: 10000 }, // last \u2014 most expensive\n];\n\nlet lastReport: { report: DoctorReport; generatedAt: number } | null = null;\nconst CACHE_TTL_MS = 60_000;\n\nexport async function getDoctorReport(ctx: DoctorCtx, opts?: { force?: boolean }): Promise<DoctorReport> {\n const now = Date.now();\n if (!opts?.force && lastReport && now - lastReport.generatedAt < CACHE_TTL_MS) {\n return { ...lastReport.report, cached: true, cacheAgeMs: now - lastReport.generatedAt };\n }\n\n const start = Date.now();\n const results = await Promise.all(\n PROBES.map(p => withTimeout(p.fn, p.timeout)(ctx).then(r => {\n // withTimeout may return name=\"unknown\" \u2014 fix it\n if (r.name === \"unknown\") r.name = \"probe\";\n return r;\n }))\n );\n\n // Add boot phases not covered by active probes\n const probedNames = new Set(results.map(r => r.name));\n if (ctx.phaseHealth) {\n for (const [name, h] of ctx.phaseHealth) {\n const short = name.replace(\"phase\", \"\").replace(/([A-Z])/g, \" $1\").trim().toLowerCase();\n if (!probedNames.has(short) && !probedNames.has(short.replace(\" \", \"\"))) {\n results.push({ name: short, status: h.status === \"ok\" ? \"ok\" : h.status === \"skipped\" ? \"skipped\" : \"failed\", latencyMs: 0, detail: h.error ?? (h.status === \"ok\" ? \"boot ok\" : undefined) });\n }\n }\n }\n\n const totalMs = Date.now() - start;\n\n // #440 \u2014 version staleness check\n try {\n const { checkForUpdate } = await import(\"../update-check.js\");\n const { readlinkSync } = await import(\"node:fs\");\n const { join } = await import(\"node:path\");\n const { homedir } = await import(\"node:os\");\n const target = readlinkSync(join(homedir(), \".abtars\", \"current\")).split(\"/\").pop() ?? \"\";\n const dash = target.lastIndexOf(\"-\");\n const version = dash > 0 ? target.slice(0, dash) : \"unknown\";\n const result = checkForUpdate(\"abtars\", version);\n if (result?.updateAvailable) {\n results.push({ name: \"update-available\", status: \"failed\", latencyMs: 0, detail: `update: ${result.current} \u2192 ${result.latest} available` });\n } else if (result) {\n results.push({ name: \"version\", status: \"ok\", latencyMs: 0, detail: `${result.current} (latest)` });\n }\n } catch (err) { logAndSwallow(TAG, \"version check\", err); }\n\n const report: DoctorReport = { results, totalMs, cached: false };\n lastReport = { report, generatedAt: now };\n logInfo(\"doctor\", `Probes complete: ${results.filter(r => r.status === \"ok\").length}/${results.length} ok (${totalMs}ms)`);\n return report;\n}\n\nexport function renderDoctorText(report: DoctorReport): string {\n const icon = (s: ProbeResult[\"status\"]): string => s === \"ok\" ? \"\u2713\" : s === \"failed\" ? \"\u2717\" : \"\u23ED\";\n const lines = report.results.map(r => {\n const detail = r.detail ? ` \u2014 ${r.detail}` : \"\";\n const ms = r.latencyMs > 0 ? ` (${r.latencyMs}ms)` : \"\";\n return ` ${icon(r.status)} ${r.name}${ms}${detail}`;\n });\n const tag = report.cached ? `[cached ${Math.round((report.cacheAgeMs ?? 0) / 1000)}s ago]` : \"[fresh]\";\n return `\uD83E\uDE7A Do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AAE,YAAY,IAAI,KAAK,EAAE,SAAS,QAAQ;AACrD,WAAO,KAAK,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,EAAE,GAAG,MAAM;AAAA,EACpD,CAAC;AACD,QAAM,MAAM,OAAO,SAAS,WAAW,KAAK,OAAO,OAAO,cAAc,KAAK,GAAI,CAAC,WAAW;AAC7F,SAAO,6BAAsB,OAAO,UAAU,KAAM,QAAQ,CAAC,CAAC,OAAO,GAAG;AAAA,EAAK,MAAM,KAAK,IAAI,CAAC;AAC/F;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createRequire as __bundleCreateRequire } from 'node:module'; import { fileURLToPath as __bundleFileURLToPath } from 'node:url'; import { dirname as __bundleDirname } from 'node:path'; const require = __bundleCreateRequire(import.meta.url); const __chunk_filename = __bundleFileURLToPath(import.meta.url); const __chunk_dirname = __bundleDirname(__chunk_filename);
|
|
2
|
+
import {
|
|
3
|
+
init_logger,
|
|
4
|
+
logInfo
|
|
5
|
+
} from "./chunk-BUUVFUPO.js";
|
|
6
|
+
import "./chunk-X76UX47U.js";
|
|
7
|
+
import "./chunk-NWDBD4PA.js";
|
|
8
|
+
|
|
9
|
+
// src/cli/ensure-invariants.ts
|
|
10
|
+
init_logger();
|
|
11
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
12
|
+
import { join, dirname } from "node:path";
|
|
13
|
+
var TAG = "ensure-invariants";
|
|
14
|
+
var MIGRATIONS = [
|
|
15
|
+
{
|
|
16
|
+
id: "irc-secure-to-signed",
|
|
17
|
+
file: "config/irc.json",
|
|
18
|
+
applies: (c) => c.includes('"secure"'),
|
|
19
|
+
apply: (c) => c.replace(/"secure"/g, '"signed"')
|
|
20
|
+
}
|
|
21
|
+
];
|
|
22
|
+
async function ensureInstallInvariants(repoRoot, home) {
|
|
23
|
+
const { loadManifest } = await import("./install-manifest-SPQRUNXL.js");
|
|
24
|
+
const manifest = loadManifest(repoRoot);
|
|
25
|
+
const created = [];
|
|
26
|
+
for (const seed of manifest.configSeeds) {
|
|
27
|
+
const src = join(repoRoot, seed.source);
|
|
28
|
+
const dst = join(home, seed.dest);
|
|
29
|
+
if (!existsSync(src) || existsSync(dst)) continue;
|
|
30
|
+
mkdirSync(dirname(dst), { recursive: true });
|
|
31
|
+
writeFileSync(dst, readFileSync(src, "utf-8"), { mode: seed.mode ? parseInt(seed.mode, 8) : 420 });
|
|
32
|
+
created.push(seed.dest);
|
|
33
|
+
logInfo(TAG, `Seeded missing: ${seed.dest}`);
|
|
34
|
+
}
|
|
35
|
+
for (const m of MIGRATIONS) {
|
|
36
|
+
const path = join(home, m.file);
|
|
37
|
+
if (!existsSync(path)) continue;
|
|
38
|
+
const content = readFileSync(path, "utf-8");
|
|
39
|
+
if (!m.applies(content)) continue;
|
|
40
|
+
writeFileSync(path, m.apply(content));
|
|
41
|
+
logInfo(TAG, `Migrated: ${m.id} (${m.file})`);
|
|
42
|
+
created.push(`[migrated] ${m.file}`);
|
|
43
|
+
}
|
|
44
|
+
return created;
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
ensureInstallInvariants
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=ensure-invariants-NMXNS476.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/cli/ensure-invariants.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * ensure-invariants.ts \u2014 seed missing config files + run config migrations on update.\n * Called from both `abtars install` and `abtars update`. Idempotent.\n */\n\nimport { existsSync, readFileSync, writeFileSync, mkdirSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\nimport { logInfo } from \"../components/logger.js\";\n\nconst TAG = \"ensure-invariants\";\n\ninterface ConfigMigration {\n id: string;\n file: string; // relative to home (e.g. \"config/irc.json\")\n applies: (content: string) => boolean;\n apply: (content: string) => string;\n}\n\nconst MIGRATIONS: ConfigMigration[] = [\n {\n id: \"irc-secure-to-signed\",\n file: \"config/irc.json\",\n applies: (c) => c.includes('\"secure\"'),\n apply: (c) => c.replace(/\"secure\"/g, '\"signed\"'),\n },\n];\n\n/** Seed missing config files from install-manifest. Returns list of created files. */\nexport async function ensureInstallInvariants(repoRoot: string, home: string): Promise<string[]> {\n const { loadManifest } = await import(\"./install-manifest.js\");\n const manifest = loadManifest(repoRoot);\n const created: string[] = [];\n\n for (const seed of manifest.configSeeds) {\n const src = join(repoRoot, seed.source);\n const dst = join(home, seed.dest);\n if (!existsSync(src) || existsSync(dst)) continue;\n mkdirSync(dirname(dst), { recursive: true });\n writeFileSync(dst, readFileSync(src, \"utf-8\"), { mode: seed.mode ? parseInt(seed.mode, 8) : 0o644 });\n created.push(seed.dest);\n logInfo(TAG, `Seeded missing: ${seed.dest}`);\n }\n\n // Run config migrations\n for (const m of MIGRATIONS) {\n const path = join(home, m.file);\n if (!existsSync(path)) continue;\n const content = readFileSync(path, \"utf-8\");\n if (!m.applies(content)) continue;\n writeFileSync(path, m.apply(content));\n logInfo(TAG, `Migrated: ${m.id} (${m.file})`);\n created.push(`[migrated] ${m.file}`);\n }\n\n return created;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAOA;AAFA,SAAS,YAAY,cAAc,eAAe,iBAAiB;AACnE,SAAS,MAAM,eAAe;AAG9B,IAAM,MAAM;AASZ,IAAM,aAAgC;AAAA,EACpC;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,SAAS,CAAC,MAAM,EAAE,SAAS,UAAU;AAAA,IACrC,OAAO,CAAC,MAAM,EAAE,QAAQ,aAAa,UAAU;AAAA,EACjD;AACF;AAGA,eAAsB,wBAAwB,UAAkB,MAAiC;AAC/F,QAAM,EAAE,aAAa,IAAI,MAAM,OAAO,gCAAuB;AAC7D,QAAM,WAAW,aAAa,QAAQ;AACtC,QAAM,UAAoB,CAAC;AAE3B,aAAW,QAAQ,SAAS,aAAa;AACvC,UAAM,MAAM,KAAK,UAAU,KAAK,MAAM;AACtC,UAAM,MAAM,KAAK,MAAM,KAAK,IAAI;AAChC,QAAI,CAAC,WAAW,GAAG,KAAK,WAAW,GAAG,EAAG;AACzC,cAAU,QAAQ,GAAG,GAAG,EAAE,WAAW,KAAK,CAAC;AAC3C,kBAAc,KAAK,aAAa,KAAK,OAAO,GAAG,EAAE,MAAM,KAAK,OAAO,SAAS,KAAK,MAAM,CAAC,IAAI,IAAM,CAAC;AACnG,YAAQ,KAAK,KAAK,IAAI;AACtB,YAAQ,KAAK,mBAAmB,KAAK,IAAI,EAAE;AAAA,EAC7C;AAGA,aAAW,KAAK,YAAY;AAC1B,UAAM,OAAO,KAAK,MAAM,EAAE,IAAI;AAC9B,QAAI,CAAC,WAAW,IAAI,EAAG;AACvB,UAAM,UAAU,aAAa,MAAM,OAAO;AAC1C,QAAI,CAAC,EAAE,QAAQ,OAAO,EAAG;AACzB,kBAAc,MAAM,EAAE,MAAM,OAAO,CAAC;AACpC,YAAQ,KAAK,aAAa,EAAE,EAAE,KAAK,EAAE,IAAI,GAAG;AAC5C,YAAQ,KAAK,cAAc,EAAE,IAAI,EAAE;AAAA,EACrC;AAEA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createRequire as __bundleCreateRequire } from 'node:module'; import { fileURLToPath as __bundleFileURLToPath } from 'node:url'; import { dirname as __bundleDirname } from 'node:path'; const require = __bundleCreateRequire(import.meta.url); const __chunk_filename = __bundleFileURLToPath(import.meta.url); const __chunk_dirname = __bundleDirname(__chunk_filename);
|
|
2
|
+
import {
|
|
3
|
+
_resetEnv,
|
|
4
|
+
envDump,
|
|
5
|
+
getEnv,
|
|
6
|
+
initEnv,
|
|
7
|
+
init_env_schema
|
|
8
|
+
} from "./chunk-JCJS4ZIB.js";
|
|
9
|
+
import "./chunk-BUUVFUPO.js";
|
|
10
|
+
import "./chunk-X76UX47U.js";
|
|
11
|
+
import "./chunk-NWDBD4PA.js";
|
|
12
|
+
init_env_schema();
|
|
13
|
+
export {
|
|
14
|
+
_resetEnv,
|
|
15
|
+
envDump,
|
|
16
|
+
getEnv,
|
|
17
|
+
initEnv
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=env-schema-2KBHBDGN.js.map
|