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,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/components/guardrails.ts", "../src/components/transport/tool-registry.ts", "../src/components/transport/skill-authoring.ts", "../src/components/transport/mcp-tool.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * guardrails.ts \u2014 path + command restrictions for SECURITY_MODE=guardrails.\n * Defense-in-depth: catches accidental/confused model behavior, NOT adversarial bypass.\n */\n\nimport { resolve, sep } from \"node:path\";\nimport { homedir } from \"node:os\";\nimport { getEnv } from \"./env-schema.js\";\nimport { logWarn } from \"./logger.js\";\n\nconst TAG = \"guardrails\";\nconst HOME = homedir();\n\nconst BLOCKED_PATHS = [\n `${HOME}/.ssh${sep}`,\n `${HOME}/.abtars/secret${sep}`,\n `/etc${sep}`,\n `/proc${sep}`,\n `/sys${sep}`,\n `/dev${sep}`,\n `/root${sep}`,\n `/run${sep}`,\n];\n\nconst WRITE_BLOCKED = [\n `${HOME}/.abtars/config/peers.json`,\n `${HOME}/.kiro${sep}`,\n];\n\nconst BLOCKED_COMMAND_PREFIXES = [\n \"sudo \",\n \"npm publish\",\n \"git push \",\n \"chmod 777\",\n \"rm -rf /\",\n];\n\nexport type SecurityMode = \"off\" | \"guardrails\" | \"sandbox\";\n\nexport function getSecurityMode(): SecurityMode {\n const mode = getEnv().securityMode as SecurityMode;\n return mode || \"off\";\n}\n\nexport function isGuardrailsActive(): boolean {\n return getSecurityMode() !== \"off\";\n}\n\n/** Check if a file path is allowed. Returns error message or null if OK. */\nexport function checkPath(path: string, mode: \"read\" | \"write\"): string | null {\n if (!isGuardrailsActive()) return null;\n\n const resolved = resolve(path) + (path.endsWith(\"/\") ? sep : \"\");\n\n for (const blocked of BLOCKED_PATHS) {\n if (resolved.startsWith(blocked) || resolved === blocked.slice(0, -1)) {\n return `Path blocked by guardrails: ${path}`;\n }\n }\n\n if (mode === \"write\") {\n for (const wb of WRITE_BLOCKED) {\n if (resolved.startsWith(wb) || resolved === wb) {\n return `Write blocked by guardrails: ${path}`;\n }\n }\n }\n\n return null;\n}\n\n/** Check if a bash command is allowed. Returns error message or null if OK. */\nexport function checkCommand(cmd: string): string | null {\n if (!isGuardrailsActive()) return null;\n\n const trimmed = cmd.trim().toLowerCase();\n\n for (const prefix of BLOCKED_COMMAND_PREFIXES) {\n if (trimmed.startsWith(prefix.toLowerCase())) {\n logWarn(TAG, `Blocked command: ${cmd.slice(0, 100)}`);\n return `Command blocked by guardrails: matches '${prefix.trim()}'`;\n }\n }\n\n return null;\n}\n", "/**\n * Tool registry for DirectApiTransport.\n * Phase 2: native tool schemas. Phase 3: in-process memory when available.\n */\n\nimport { execFile } from \"node:child_process\";\nimport { appendFileSync, mkdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\nimport type { MemoryBackend } from \"abmind\";\nimport type { InstantStoreParams } from \"../../types/index.js\";\nimport { logWarn, redactSecrets } from \"../logger.js\";\nimport { logAndSwallow } from \"../log-and-swallow.js\";\nimport { checkTool, checkPath, auditDeny, type SandboxPolicy } from \"../tool-sandbox.js\";\n\nconst TAG = \"tool_registry\";\n\n// #449: append-only audit log\nconst AUDIT_DIR = join(process.env[\"ABTARS_HOME\"] ?? join(homedir(), \".abtars\"), \"logs\");\nconst AUDIT_PATH = join(AUDIT_DIR, \"audit.jsonl\");\ntry { mkdirSync(AUDIT_DIR, { recursive: true }); } catch (err) { logAndSwallow(TAG, \"mkdirSync audit dir\", err); }\nfunction audit(entry: Record<string, unknown>): void {\n try { appendFileSync(AUDIT_PATH, JSON.stringify(entry) + \"\\n\"); } catch (err) { logAndSwallow(TAG, \"audit write\", err); }\n}\n\nexport type ToolDefinition = {\n readonly name: string;\n readonly description: string;\n readonly parameters: Record<string, unknown>;\n execute(args: Record<string, string>, context?: { userId: string; signal?: AbortSignal }): Promise<string>;\n};\n\nconst BASH_TIMEOUT_MS = 300_000;\nconst CLI_TIMEOUT_MS = 60_000;\n\n/**\n * Patterns that would spawn or restart a bridge/watchdog process.\n * Blocked to prevent the LLM (especially fallback models) from accidentally\n * starting a second bridge instance, which would cause port conflicts,\n * Telegram 409 errors, and bridge.lock PID confusion.\n *\n * See post-mortem of 2026-04-22 outage: cron agent ran execute_bash that\n * spawned a rogue bridge alongside the watchdog-supervised one.\n */\nconst BLOCKED_PATTERNS: readonly RegExp[] = [\n /\\bmain\\.js\\b/, // node .../current/dist/main.js ...\n /\\babtars\\.sh\\b/, // the launcher\n /\\bwatchdog\\.sh\\b/, // the watchdog\n /\\blaunchctl\\s+(load|bootstrap|kickstart|start)\\b/, // launchd bridge start\n];\n\nexport function isBridgeSpawnCommand(cmd: string): boolean {\n return BLOCKED_PATTERNS.some(p => p.test(cmd));\n}\n\n/** Block kill/pkill/killall targeting the bridge's own PID or process patterns (#414). */\nfunction isBridgeKillCommand(cmd: string): boolean {\n const pid = process.pid;\n const ppid = process.ppid;\n // Direct kill of own PID or parent\n if (new RegExp(`\\\\bkill\\\\s+(-\\\\d+\\\\s+)?${pid}\\\\b`).test(cmd)) return true;\n if (new RegExp(`\\\\bkill\\\\s+(-\\\\d+\\\\s+)?${ppid}\\\\b`).test(cmd)) return true;\n // pkill/killall targeting bridge patterns\n if (/\\b(pkill|killall)\\b.*\\b(abtars|main\\.js|watchdog)\\b/.test(cmd)) return true;\n if (/\\bkill\\b.*\\$\\(.*pgrep.*abtars/.test(cmd)) return true;\n return false;\n}\n\nfunction runBash(cmd: string, timeout = BASH_TIMEOUT_MS, signal?: AbortSignal): Promise<string> {\n // Guardrails: command check\n const { checkCommand } = require(\"../guardrails.js\") as typeof import(\"../guardrails.js\");\n const cmdBlock = checkCommand(cmd);\n if (cmdBlock) {\n logWarn(\"tool-registry\", `Guardrails blocked: ${cmd.slice(0, 200)}`);\n return Promise.resolve(JSON.stringify({ stderr: cmdBlock, exit_code: 126 }));\n }\n\n if (isBridgeSpawnCommand(cmd)) {\n logWarn(\"tool-registry\", `Blocked bridge-spawn command: ${cmd.slice(0, 200)}`);\n return Promise.resolve(JSON.stringify({\n stderr: \"Command blocked: this would spawn/restart a bridge or watchdog process. The bridge is already running under launchd+watchdog supervision; use launchctl inspection commands (launchctl list, launchctl print) or signal the existing process instead.\",\n exit_code: 126,\n }));\n }\n if (isBridgeKillCommand(cmd)) {\n logWarn(\"tool-registry\", `Blocked bridge-kill command: ${cmd.slice(0, 200)}`);\n return Promise.resolve(JSON.stringify({\n stderr: \"Command blocked: this would kill the bridge process (yourself). Ask the user to send /restart for a session reset or restart the bridge manually.\",\n exit_code: 126,\n }));\n }\n return new Promise((resolve) => {\n const child = execFile(\"bash\", [\"-c\", cmd], { timeout, maxBuffer: 1024 * 1024 }, (err, stdout, stderr) => {\n const result: Record<string, unknown> = {};\n if (stdout) result[\"stdout\"] = stdout.slice(0, 50_000);\n if (stderr) result[\"stderr\"] = stderr.slice(0, 10_000);\n if (err) result[\"exit_code\"] = (err as NodeJS.ErrnoException & { code?: number }).code ?? 1;\n else result[\"exit_code\"] = 0;\n resolve(JSON.stringify(result));\n });\n if (signal) {\n if (signal.aborted) { child.kill(\"SIGTERM\"); return; }\n const onAbort = (): void => { child.kill(\"SIGTERM\"); };\n signal.addEventListener(\"abort\", onAbort, { once: true });\n child.on(\"exit\", () => signal.removeEventListener(\"abort\", onAbort));\n }\n });\n}\n\nlet memoryBackend: MemoryBackend | null = null;\n\n/** Wire in-process memory backend. Call once after memory init. */\nexport function setMemoryBackend(backend: MemoryBackend | null): void {\n memoryBackend = backend;\n}\n\nlet _peerActivityCb: ((msg: string) => void) | null = null;\n\n/** Wire peer activity notification callback. */\nexport function setPeerActivityCallback(cb: ((msg: string) => void) | null): void {\n _peerActivityCb = cb;\n}\n\n// --- Tool definitions ---\n\nconst bashTool: ToolDefinition = {\n name: \"execute_bash\",\n description: \"Execute a bash command. Use for file operations, git, running scripts, and any shell command. Commands that would spawn or restart a bridge/watchdog process (node main.js, abtars.sh, watchdog.sh, launchctl load/bootstrap/kickstart/start) are blocked \u2014 the bridge is already supervised.\",\n parameters: {\n type: \"object\",\n properties: { command: { type: \"string\", description: \"The bash command to execute\" } },\n required: [\"command\"],\n },\n execute: (args, context) => runBash(args[\"command\"] ?? \"\", BASH_TIMEOUT_MS, context?.signal),\n};\n\nlet _storeCount = 0;\nconst STORE_CAP = 20;\n\n/** Reset store counter (called on new subagent session). */\nexport function resetStoreCounter(): void { _storeCount = 0; }\n\nconst memoryStoreTool: ToolDefinition = {\n name: \"memory_store\",\n description: \"Store a memory. Use after learning something about the user, their preferences, decisions, or facts worth remembering.\",\n parameters: {\n type: \"object\",\n properties: {\n translated: { type: \"string\", description: \"Memory content in English\" },\n original: { type: \"string\", description: \"Memory content in original language (if not English)\" },\n type: { type: \"string\", enum: [\"fact\", \"preference\", \"decision\", \"experience\", \"skill\", \"relationship\", \"goal\"], description: \"Memory type\" },\n emotion: { type: \"integer\", description: \"Emotion score -5 to +5 (0=neutral)\" },\n confidence: { type: \"integer\", description: \"Confidence 1-5 (3=default)\" },\n classification: { type: \"integer\", description: \"0=public (general knowledge), 1=internal (default), 2=confidential (personal preferences, habits, opinions about specific users), 3=secret (credentials, API keys, tokens, passwords \u2014 store IMMEDIATELY with exact string, never paraphrase, never wait for Dreamy)\" },\n },\n required: [\"translated\", \"type\"],\n },\n async execute(args, context): Promise<string> {\n if (++_storeCount > STORE_CAP) {\n return JSON.stringify({ stored: false, error: \"Store limit reached for this session. Move to next task.\" });\n }\n if (memoryBackend) {\n try {\n const params: InstantStoreParams = {\n userId: context?.userId ?? \"master\",\n contentEn: args[\"translated\"] ?? \"\",\n contentOriginal: args[\"original\"] ?? args[\"translated\"] ?? \"\",\n memoryType: (args[\"type\"] ?? \"fact\") as InstantStoreParams[\"memoryType\"],\n emotionScore: parseInt(args[\"emotion\"] ?? \"0\", 10),\n confidence: parseInt(args[\"confidence\"] ?? \"3\", 10),\n classification: parseInt(args[\"classification\"] ?? \"1\", 10),\n };\n const result = await memoryBackend.instantStore({ ...params, createdBy: \"tool:memory_store\" });\n return JSON.stringify(result);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n // #706: FTS5 corruption self-heal \u2014 rebuild indexes and retry once\n if (msg.includes(\"fts5\") || msg.includes(\"corruption\")) {\n try {\n memoryBackend.rebuildFtsIndexes();\n logWarn(\"tool-registry\", \"FTS corruption detected \u2014 rebuilt indexes, retrying store\");\n const params: InstantStoreParams = {\n userId: context?.userId ?? \"master\",\n contentEn: args[\"translated\"] ?? \"\",\n contentOriginal: args[\"original\"] ?? args[\"translated\"] ?? \"\",\n memoryType: (args[\"type\"] ?? \"fact\") as InstantStoreParams[\"memoryType\"],\n emotionScore: parseInt(args[\"emotion\"] ?? \"0\", 10),\n confidence: parseInt(args[\"confidence\"] ?? \"3\", 10),\n classification: parseInt(args[\"classification\"] ?? \"1\", 10),\n };\n const result = await memoryBackend.instantStore({ ...params, createdBy: \"tool:memory_store\" });\n return JSON.stringify(result);\n } catch (retryErr) { /* fall through */ }\n }\n return JSON.stringify({ error: msg });\n }\n }\n let cmd = `abmind store --translated ${JSON.stringify(args[\"translated\"] ?? \"\")} --type ${args[\"type\"] ?? \"fact\"}`;\n if (args[\"original\"]) cmd += ` --original ${JSON.stringify(args[\"original\"])}`;\n if (args[\"emotion\"]) cmd += ` --emotion-score ${args[\"emotion\"]}`;\n if (args[\"confidence\"]) cmd += ` --confidence ${args[\"confidence\"]}`;\n if (args[\"classification\"]) cmd += ` --classification ${args[\"classification\"]}`;\n return runBash(cmd, CLI_TIMEOUT_MS);\n },\n};\n\nconst memoryRecallTool: ToolDefinition = {\n name: \"memory_recall\",\n description: \"Search memories by keyword or semantic query. Returns relevant stored memories.\",\n parameters: {\n type: \"object\",\n properties: {\n query: { type: \"string\", description: \"Search query\" },\n limit: { type: \"integer\", description: \"Max results (default 10)\" },\n },\n required: [\"query\"],\n },\n async execute(args, context): Promise<string> {\n if (memoryBackend) {\n try {\n const result = await memoryBackend.recall({\n translated: [args[\"query\"] ?? \"\"],\n original: args[\"query\"] ?? \"\",\n userId: context?.userId ?? \"master\",\n limit: parseInt(args[\"limit\"] ?? \"10\", 10),\n });\n return JSON.stringify(result);\n } catch (err) {\n return JSON.stringify({ error: err instanceof Error ? err.message : String(err) });\n }\n }\n let cmd = `abmind recall ${JSON.stringify(args[\"query\"] ?? \"\")}`;\n if (args[\"limit\"]) cmd += ` --limit ${args[\"limit\"]}`;\n return runBash(cmd, CLI_TIMEOUT_MS);\n },\n};\n\nconst memoryEditTool: ToolDefinition = {\n name: \"memory_edit\",\n description: \"Edit an existing memory by ID. Change content, type, emotion, confidence, or classification.\",\n parameters: {\n type: \"object\",\n properties: {\n memory_id: { type: \"integer\", description: \"Memory ID to edit\" },\n translated: { type: \"string\", description: \"New English content\" },\n original: { type: \"string\", description: \"New original language content\" },\n type: { type: \"string\", description: \"New memory type\" },\n emotion: { type: \"integer\", description: \"New emotion score\" },\n confidence: { type: \"integer\", description: \"New confidence\" },\n classification: { type: \"integer\", description: \"New classification\" },\n caller: { type: \"string\", enum: [\"kp\", \"dreamy\"], description: \"Who is making the edit\" },\n },\n required: [\"memory_id\"],\n },\n async execute(args): Promise<string> {\n if (memoryBackend) {\n try {\n const result = await memoryBackend.editMemory({\n memoryId: parseInt(args[\"memory_id\"] ?? \"0\", 10),\n contentEn: args[\"translated\"],\n contentOriginal: args[\"original\"],\n memoryType: args[\"type\"] as \"fact\" | \"decision\" | \"preference\" | \"event\" | undefined,\n emotionScore: args[\"emotion\"] ? parseInt(args[\"emotion\"], 10) : undefined,\n confidence: args[\"confidence\"] ? parseInt(args[\"confidence\"], 10) : undefined,\n classification: args[\"classification\"] ? parseInt(args[\"classification\"], 10) : undefined,\n caller: (args[\"caller\"] ?? \"kp\") as \"kp\" | \"dreamy\",\n });\n return JSON.stringify(result);\n } catch (err) {\n return JSON.stringify({ error: err instanceof Error ? err.message : String(err) });\n }\n }\n let cmd = `abmind edit --memory-id ${args[\"memory_id\"] ?? \"0\"}`;\n if (args[\"translated\"]) cmd += ` --translated ${JSON.stringify(args[\"translated\"])}`;\n if (args[\"original\"]) cmd += ` --original ${JSON.stringify(args[\"original\"])}`;\n if (args[\"type\"]) cmd += ` --type ${args[\"type\"]}`;\n if (args[\"emotion\"]) cmd += ` --emotion-score ${args[\"emotion\"]}`;\n if (args[\"confidence\"]) cmd += ` --confidence ${args[\"confidence\"]}`;\n if (args[\"classification\"]) cmd += ` --classification ${args[\"classification\"]}`;\n if (args[\"caller\"]) cmd += ` --caller ${args[\"caller\"]}`;\n return runBash(cmd, CLI_TIMEOUT_MS);\n },\n};\n\nconst webBrowseTool: ToolDefinition = {\n name: \"web_browse\",\n description: \"Browse a URL or perform a complex multi-step web task. For quick lookups use execute_bash with curl.\",\n parameters: {\n type: \"object\",\n properties: {\n task: { type: \"string\", description: \"What to do on the web\" },\n chat_id: { type: \"string\", description: \"Chat ID for result delivery\" },\n engine: { type: \"string\", enum: [\"patchright\"], description: \"Browser engine (default: patchright)\" },\n },\n required: [\"task\", \"chat_id\"],\n },\n execute: (args) => {\n let cmd = `abtars-browse --task ${JSON.stringify(args[\"task\"] ?? \"\")} --chat-id ${args[\"chat_id\"] ?? \"0\"}`;\n if (args[\"engine\"]) cmd += ` --engine ${args[\"engine\"]}`;\n return runBash(cmd, CLI_TIMEOUT_MS);\n },\n};\n\nconst todoTool: ToolDefinition = {\n name: \"todo_manage\",\n description: \"Manage TODO items. Add, complete, or list tasks.\",\n parameters: {\n type: \"object\",\n properties: {\n action: { type: \"string\", enum: [\"add\", \"done\", \"list\", \"remove\"], description: \"Action to perform\" },\n text: { type: \"string\", description: \"TODO text (for add)\" },\n id: { type: \"string\", description: \"TODO ID (for done/remove)\" },\n },\n required: [\"action\"],\n },\n execute: (args) => {\n const action = args[\"action\"] ?? \"list\";\n if (action === \"add\") return runBash(`abtars-todo add ${JSON.stringify(args[\"text\"] ?? \"\")}`, CLI_TIMEOUT_MS);\n if (action === \"done\") return runBash(`abtars-todo done ${args[\"id\"] ?? \"\"}`, CLI_TIMEOUT_MS);\n if (action === \"remove\") return runBash(`abtars-todo remove ${args[\"id\"] ?? \"\"}`, CLI_TIMEOUT_MS);\n return runBash(\"abtars-todo list\", CLI_TIMEOUT_MS);\n },\n};\n\nlet _enqueueCron: ((id: string, manual?: boolean) => string | null) | null = null;\n\n/** Inject enqueueCron from bridge for task_manage --run. */\nexport function setEnqueueCron(fn: (id: string, manual?: boolean) => string | null): void { _enqueueCron = fn; }\n\nlet _ircSend: ((channel: string, message: string) => void) | null = null;\n\n/** Inject IRC send from bridge for irc_send tool. */\nexport function setIrcSend(fn: (channel: string, message: string) => void): void { _ircSend = fn; }\n\n/** @deprecated \u2014 secret_get now reads from file, not DB. Kept for backward compat (callers may still call this). */\nexport function setSecretGetDb(_db: unknown): void { /* no-op */ }\n\nlet _sendDocument: ((path: string, caption?: string) => Promise<number>) | null = null;\n\n/**\n * Inject sendDocument from bridge for the send_document tool.\n * Caller binds main chat id + telegram adapter; tool is a thin wrapper around that.\n */\nexport function setSendDocument(fn: ((path: string, caption?: string) => Promise<number>) | null): void { _sendDocument = fn; }\n\nconst sendDocumentTool: ToolDefinition = {\n name: \"send_document\",\n description: \"Send a file from disk to the user's Telegram chat. Use for delivering reports, daily summaries, logs, or any .md file the user asks for. Do not summarize \u2014 the raw file is sent as an attachment.\",\n parameters: {\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Absolute path to the file\" },\n caption: { type: \"string\", description: \"Optional short caption (\u22641024 chars)\" },\n },\n required: [\"path\"],\n },\n execute: async (args) => {\n const path = args[\"path\"];\n if (!path) return JSON.stringify({ error: \"path is required\" });\n if (!_sendDocument) return JSON.stringify({ error: \"Telegram not configured (sendDocument unavailable)\" });\n try {\n const messageId = await _sendDocument(path, args[\"caption\"]);\n return JSON.stringify({ ok: true, message_id: messageId });\n } catch (err) {\n return JSON.stringify({ error: err instanceof Error ? err.message : String(err) });\n }\n },\n};\n\nconst taskTool: ToolDefinition = {\n name: \"task_manage\",\n description: \"Manage scheduled/recurring tasks (cron). Add, list, remove, pause, resume, or run tasks. Use action=run to execute a task immediately via the cron queue (isolated subagent).\",\n parameters: {\n type: \"object\",\n properties: {\n action: { type: \"string\", enum: [\"add\", \"list\", \"remove\", \"pause\", \"resume\", \"run\"], description: \"Action\" },\n message: { type: \"string\", description: \"Task message/command (for add)\" },\n schedule: { type: \"string\", description: \"Cron schedule expression (for add)\" },\n type: { type: \"string\", enum: [\"reminder\", \"script\", \"agent\"], description: \"Task type (for add)\" },\n chat_id: { type: \"string\", description: \"Chat ID (for add)\" },\n id: { type: \"string\", description: \"Task ID (for remove/pause/resume/run)\" },\n },\n required: [\"action\"],\n },\n execute: (args) => {\n const action = args[\"action\"] ?? \"list\";\n if (action === \"list\") return runBash(\"abtars-task list\", CLI_TIMEOUT_MS);\n if (action === \"remove\") return runBash(`abtars-task remove ${args[\"id\"] ?? \"\"}`, CLI_TIMEOUT_MS);\n if (action === \"pause\") return runBash(`abtars-task pause ${args[\"id\"] ?? \"\"}`, CLI_TIMEOUT_MS);\n if (action === \"resume\") return runBash(`abtars-task resume ${args[\"id\"] ?? \"\"}`, CLI_TIMEOUT_MS);\n if (action === \"run\") {\n if (!_enqueueCron) return Promise.resolve(JSON.stringify({ error: \"enqueueCron not available\" }));\n const err = _enqueueCron(args[\"id\"] ?? \"\", true);\n return Promise.resolve(JSON.stringify(err ? { error: err } : { ok: true, message: `Task ${args[\"id\"]} enqueued for immediate execution` }));\n }\n let cmd = `abtars-task add --message ${JSON.stringify(args[\"message\"] ?? \"\")}`;\n if (args[\"schedule\"]) cmd += ` --schedule ${JSON.stringify(args[\"schedule\"])}`;\n if (args[\"type\"]) cmd += ` --type ${args[\"type\"]}`;\n if (args[\"chat_id\"]) cmd += ` --chat-id ${args[\"chat_id\"]}`;\n return runBash(cmd, CLI_TIMEOUT_MS);\n },\n};\n\nconst peerSessionTool: ToolDefinition = {\n name: \"peer_session\",\n description: \"Open or continue a peer-to-peer session with another agent. Messages persist across turns. Use only when the user explicitly asks to contact another agent.\",\n parameters: {\n type: \"object\",\n properties: {\n peer_name: { type: \"string\", description: \"Name of the peer (as in peers.json)\" },\n message: { type: \"string\", description: \"Your message to the peer\" },\n session_id: { type: \"string\", description: \"Session ID from previous call (omit for new conversation)\" },\n },\n required: [\"peer_name\", \"message\"],\n },\n async execute(args) {\n const { callPeer } = await import(\"../peer-client.js\");\n const { loadPeerConfig } = await import(\"../peer-config.js\");\n const { getOrCreateSession, addTurn, isEnded, destroySession } = await import(\"../peer-sessions.js\");\n\n const peerName = args.peer_name?.trim();\n const message = args.message?.trim();\n if (!peerName || !message) return JSON.stringify({ error: \"peer_name and message required\" });\n\n const config = loadPeerConfig();\n if (peerName === config.self.name) return JSON.stringify({ error: \"Cannot chat with yourself\" });\n if (!config.peers[peerName]) return JSON.stringify({ error: `Unknown peer: ${peerName}` });\n\n const session = getOrCreateSession(args.session_id?.trim() || undefined, peerName);\n\n // Check turn cap before sending\n if (session.messages.length >= 20) {\n destroySession(session.id);\n return JSON.stringify({ session_id: session.id, response: \"[SESSION_END] Turn limit reached.\", ended: true, reason: \"max-turns\" });\n }\n\n addTurn(session, \"user\", message);\n\n // Build full conversation for peer (OpenAI messages format)\n const prompt = session.messages.map(m => `${m.role === \"user\" ? \"You\" : \"Peer\"}: ${m.content}`).join(\"\\n\") + \"\\n\\nRespond to the latest message.\";\n\n try {\n const response = await callPeer(peerName, prompt, config.maxHops);\n addTurn(session, \"assistant\", response);\n _peerActivityCb?.(`\uD83E\uDD16 Agents: ${config.self.name} \u2194 ${peerName} session. [turn ${session.messages.length}]`);\n\n const { ended, reason } = isEnded(session, response);\n if (ended) destroySession(session.id);\n\n return JSON.stringify({ session_id: session.id, response, ended, reason });\n } catch (err) {\n destroySession(session.id);\n return JSON.stringify({ error: `peer_session failed: ${err instanceof Error ? err.message : String(err)}`, session_id: session.id, ended: true });\n }\n },\n};\n\nconst peerWakeupTool: ToolDefinition = {\n name: \"peer_wakeup\",\n description: \"Send a wake-up signal to a peer that cannot reach us directly (firewall). The peer's bridge will call us back via A2A within seconds.\",\n parameters: {\n type: \"object\",\n properties: {\n peer_name: { type: \"string\", description: \"Name of the peer to wake up (as in peers.json)\" },\n },\n required: [\"peer_name\"],\n },\n async execute(args) {\n const { sendWakeup } = await import(\"../dns-wakeup.js\");\n const { loadPeerConfig } = await import(\"../peer-config.js\");\n const peerName = args.peer_name?.trim();\n if (!peerName) return JSON.stringify({ error: \"peer_name required\" });\n const config = loadPeerConfig();\n const peer = config.peers[peerName];\n if (!peer) return JSON.stringify({ error: `Unknown peer: ${peerName}` });\n const udpPort = peer.udpPort ?? 5353;\n sendWakeup(config.self.name, peer.host, udpPort, peer.token);\n return JSON.stringify({ ok: true, message: `Wake-up sent to ${peerName}. Expect callback within seconds.` });\n },\n};\n\nconst ircSendTool: ToolDefinition = {\n name: \"irc_send\",\n description: \"Send a message to an IRC channel (e.g. #bridges)\",\n parameters: {\n channel: { type: \"string\", description: \"IRC channel (e.g. #bridges)\" },\n message: { type: \"string\", description: \"Message text to send\" },\n },\n execute: async (args) => {\n if (!_ircSend) return JSON.stringify({ error: \"IRC adapter not connected\" });\n const channel = args[\"channel\"] ?? \"\";\n const message = args[\"message\"] ?? \"\";\n if (!channel || !message) return JSON.stringify({ error: \"channel and message are required\" });\n _ircSend(channel, message);\n return JSON.stringify({ ok: true, channel, sent: message.length + \" chars\" });\n },\n};\n\nconst secretGetTool: ToolDefinition = {\n name: \"secret_get\",\n description: \"Retrieve a secret from ~/.abtars/secret/. For env-var secrets (no extension), returns the value. For files (with extension like .json), returns the full decrypted content. NEVER echo the value to the user.\",\n parameters: {\n properties: {\n name: { type: \"string\", description: \"Exact filename in secret/ dir (e.g. 'OPENROUTER_API_KEY', 'x-cookies.json')\" },\n },\n required: [\"name\"],\n },\n execute: async (args) => {\n const name = args.name?.trim();\n if (!name) return JSON.stringify({ error: \"name is required\" });\n try {\n const { join } = await import(\"node:path\");\n const { homedir } = await import(\"node:os\");\n const { readFileSync, existsSync } = await import(\"node:fs\");\n const { createDecipheriv, hkdfSync } = await import(\"node:crypto\");\n const { loadKey } = await import(\"abmind\");\n\n const secretPath = join(homedir(), \".abtars\", \"secret\", name);\n if (!existsSync(secretPath)) return JSON.stringify({ error: `secret '${name}' not found` });\n\n const raw = readFileSync(secretPath, \"utf-8\").trim();\n if (!raw) return JSON.stringify({ error: `secret '${name}' is empty` });\n\n let value: string;\n if (raw.startsWith(\"ENC:\")) {\n const master = loadKey();\n const key = Buffer.from(hkdfSync(\"sha256\", master, \"\", \"abtars-secrets-files-v1\", 32));\n const buf = Buffer.from(raw.slice(4), \"base64\");\n const d = createDecipheriv(\"aes-256-gcm\", key, buf.subarray(1, 13));\n d.setAuthTag(buf.subarray(buf.length - 16));\n value = d.update(buf.subarray(13, buf.length - 16), undefined, \"utf-8\") + d.final(\"utf-8\");\n } else {\n value = raw;\n }\n\n // For env-var type (no extension): also inject into process.env\n if (!name.includes(\".\")) {\n process.env[name] = value;\n return JSON.stringify({ ok: true, env_var: `$${name}`, hint: `Use $${name} in commands. NEVER print or echo the value.` });\n }\n return JSON.stringify({ ok: true, content: value });\n } catch (err) {\n return JSON.stringify({ error: `secret_get failed: ${err instanceof Error ? err.message : String(err)}` });\n }\n },\n};\n\nimport { skillCreateTool, skillUpdateTool, skillPatchTool, skillRemoveTool } from \"./skill-authoring.js\";\nimport { mcpTool } from \"./mcp-tool.js\";\nimport { getDelegationTools } from \"./delegation-tools.js\";\n\nconst ALL_TOOLS: ToolDefinition[] = [bashTool, memoryStoreTool, memoryRecallTool, memoryEditTool, webBrowseTool, todoTool, taskTool, sendDocumentTool, peerSessionTool, peerWakeupTool, ircSendTool, secretGetTool, skillCreateTool, skillUpdateTool, skillPatchTool, skillRemoveTool, mcpTool, ...getDelegationTools()];\n\nexport function getToolDefinitions(): ToolDefinition[] { return ALL_TOOLS; }\n\nexport function getToolSchemas(policy?: SandboxPolicy): Array<{ type: \"function\"; function: { name: string; description: string; parameters: Record<string, unknown> } }> {\n const tools = policy ? ALL_TOOLS.filter(t => checkTool(t.name, policy).allowed) : ALL_TOOLS;\n return tools.map(t => ({\n type: \"function\" as const,\n function: { name: t.name, description: t.description, parameters: t.parameters },\n }));\n}\n\nimport { bumpRead } from \"../skill-stats.js\";\n\n/** Check if a bash command result indicates a skill file was read. */\nfunction checkSkillRead(toolName: string, args: Record<string, string>): void {\n if (toolName !== \"execute_bash\") return;\n const cmd = args[\"command\"] ?? \"\";\n if (cmd.includes(\"/.abtars/skills/\") && cmd.includes(\"/SKILL.md\")) {\n const match = cmd.match(/\\/.abtars\\/skills\\/[^/]+\\/([^/]+)\\/SKILL\\.md/);\n if (match) bumpRead(match[1]!);\n }\n}\n\nexport async function executeToolCall(name: string, args: Record<string, string>, context?: { userId: string; signal?: AbortSignal; sandboxPolicy?: SandboxPolicy }): Promise<string> {\n // Sandbox enforcement\n if (context?.sandboxPolicy) {\n const toolCheck = checkTool(name, context.sandboxPolicy);\n if (!toolCheck.allowed) {\n const available = ALL_TOOLS.filter(t => checkTool(t.name, context.sandboxPolicy!).allowed).map(t => t.name);\n auditDeny(name, undefined, \"session\", toolCheck.reason!);\n return JSON.stringify({ error: `Tool '${name}' not available in this session`, available_tools: available, reason: \"peer_sandbox\" });\n }\n const filePath = args[\"path\"] ?? args[\"file_path\"];\n if (filePath) {\n const mode = name.includes(\"read\") || name === \"memory_recall\" ? \"read\" as const : \"write\" as const;\n const pathCheck = checkPath(filePath, mode, context.sandboxPolicy);\n if (!pathCheck.allowed) {\n auditDeny(name, filePath, \"session\", pathCheck.reason!);\n return JSON.stringify({ error: pathCheck.reason, reason: \"peer_sandbox\" });\n }\n }\n }\n\n const tool = ALL_TOOLS.find(t => t.name === name);\n if (!tool) return JSON.stringify({ error: `Unknown tool: ${name}` });\n const ts = Date.now();\n\n // #621: redact abmind_store args based on classification\n const storeClass = (name === \"abmind_store\" || name === \"memory_store\") ? parseInt(args.classification ?? args.class ?? \"1\", 10) : 0;\n const auditArgs = storeClass >= 2\n ? `{\"class\":${storeClass},\"[REDACTED]\":true}`\n : redactSecrets(JSON.stringify(args));\n audit({ ts, tool: name, args: auditArgs, userId: context?.userId });\n\n try {\n const result = await tool.execute(args, context);\n audit({ ts, tool: name, status: \"ok\", chars: result.length });\n checkSkillRead(name, args);\n return result;\n } catch (err) {\n audit({ ts, tool: name, status: \"error\", error: err instanceof Error ? err.message : String(err) });\n throw err;\n }\n}\n", "/**\n * skill-authoring.ts \u2014 skill lifecycle tools (#381, #613, #614).\n * Agent persists procedural knowledge as skills under ~/.abtars/skills/self/.\n */\n\nimport { existsSync, mkdirSync, writeFileSync, readFileSync, renameSync, appendFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { abmind } from \"../../utils/abmind-lazy.js\";\nimport { abtarsHome } from \"../../paths.js\";\nimport { logInfo } from \"../logger.js\";\nimport { logAndSwallow } from \"../log-and-swallow.js\";\nimport { setProvenance } from \"../skill-stats.js\";\nimport type { ToolDefinition } from \"./tool-registry.js\";\n\nconst TAG = \"skill-authoring\";\nconst NAME_RE = /^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$/;\nconst MIN_BYTES = 100;\nconst MAX_BYTES = 50_000;\nconst MAX_TAGS = 5;\n\nfunction skillsDir(): string { return join(abtarsHome(), \"skills\"); }\nfunction selfDir(): string { return join(skillsDir(), \"self\"); }\nfunction trashDir(): string { return join(skillsDir(), \".trash\"); }\nfunction auditLogPath(): string { return join(abtarsHome(), \"logs\", \"skill-authoring.log\"); }\n\nfunction audit(entry: string): void {\n const line = `[${new Date().toISOString()}] ${entry}\\n`;\n try {\n const dir = join(abtarsHome(), \"logs\");\n if (!existsSync(dir)) mkdirSync(dir, { recursive: true });\n appendFileSync(auditLogPath(), line);\n } catch (err) { logAndSwallow(TAG, \"audit write\", err); }\n}\n\nfunction validate(name: string, description: string, content: string): string | null {\n if (!NAME_RE.test(name)) return `Invalid name \"${name}\". Must be 3-64 chars, lowercase alphanumeric + hyphens, no leading/trailing hyphens.`;\n const desc = description.trim();\n if (desc.length < 1 || desc.length > 120) return `Description must be 1-120 chars (got ${desc.length}).`;\n const bytes = Buffer.byteLength(content, \"utf-8\");\n if (bytes < MIN_BYTES) return `Content too short (${bytes} bytes, minimum ${MIN_BYTES}). Write a useful skill, not a one-liner.`;\n if (bytes > MAX_BYTES) return `Content too large (${bytes} bytes, maximum ${MAX_BYTES}). Split into a skill + references/ files.`;\n const path = join(selfDir(), name, \"SKILL.md\");\n if (existsSync(path)) return `Skill \"${name}\" already exists. Use skill_update to modify it.`;\n const scan = abmind()?.scanForInjection(content);\n if (scan && !scan.safe) return `Content blocked by injection scanner: ${scan.flags[0]?.category ?? \"unknown\"} (score=${scan.score}). Rephrase the content.`;\n return null;\n}\n\n/** Parse YAML-like frontmatter from SKILL.md content. */\nfunction parseFrontmatter(raw: string): { meta: Record<string, unknown>; body: string } {\n const match = raw.match(/^---\\n([\\s\\S]*?)\\n---\\n\\n?([\\s\\S]*)$/);\n if (!match) return { meta: {}, body: raw };\n const meta: Record<string, unknown> = {};\n for (const line of match[1]!.split(\"\\n\")) {\n const idx = line.indexOf(\":\");\n if (idx < 0) continue;\n const key = line.slice(0, idx).trim();\n let val: unknown = line.slice(idx + 1).trim();\n // Parse array: [a, b, c]\n if (typeof val === \"string\" && val.startsWith(\"[\") && val.endsWith(\"]\")) {\n val = val.slice(1, -1).split(\",\").map(s => s.trim()).filter(Boolean);\n }\n meta[key] = val;\n }\n return { meta, body: match[2]! };\n}\n\n/** Serialize frontmatter fields back to YAML-like string. */\nfunction serializeFrontmatter(meta: Record<string, unknown>): string {\n const lines: string[] = [\"---\"];\n for (const [k, v] of Object.entries(meta)) {\n if (v === undefined || v === null) continue;\n if (Array.isArray(v) && v.length > 0) {\n lines.push(`${k}: [${v.join(\", \")}]`);\n } else if (!Array.isArray(v)) {\n lines.push(`${k}: ${v}`);\n }\n }\n lines.push(\"---\\n\\n\");\n return lines.join(\"\\n\");\n}\n\n/** Guard: skill must exist in self/ dir. Returns error string or null. */\nfunction guardSelfSkill(name: string): string | null {\n if (!NAME_RE.test(name)) return `Invalid name \"${name}\".`;\n const path = join(selfDir(), name, \"SKILL.md\");\n if (!existsSync(path)) return `Skill \"${name}\" not found in self/.`;\n return null;\n}\n\nexport const skillCreateTool: ToolDefinition = {\n name: \"skill_create\",\n description: \"Persist a new procedural skill to disk. Use when you've solved a novel task, discovered a workflow, or received a correction worth remembering as a repeatable recipe. Skills become available in future sessions via the skills_catalog.\",\n parameters: {\n type: \"object\",\n properties: {\n name: { type: \"string\", description: \"Skill identifier, kebab-case, e.g. 'fix-pnpm-workspace-drift'. 3-64 chars, [a-z0-9-]+.\" },\n description: { type: \"string\", description: \"One-line description, max 120 chars. Shown in skills_catalog.\" },\n content: { type: \"string\", description: \"Skill body in Markdown. Starts with # <Title>. No frontmatter \u2014 the tool writes it.\" },\n tags: { type: \"array\", items: { type: \"string\" }, description: \"Optional tags for categorization (max 5). E.g. ['tools', 'browser', 'debugging'].\" },\n related: { type: \"array\", items: { type: \"string\" }, description: \"Optional related skill names.\" },\n },\n required: [\"name\", \"description\", \"content\"],\n },\n async execute(args) {\n const { name, description, content, tags, related } = args as unknown as { name: string; description: string; content: string; tags?: string[]; related?: string[] };\n const error = validate(name, description, content);\n if (error) {\n audit(`skill_create name=${name} bytes=${content.length} ok=false error=\"${error}\"`);\n return JSON.stringify({ error });\n }\n\n const tagList = (tags ?? []).slice(0, MAX_TAGS).map(t => t.toLowerCase().trim()).filter(Boolean);\n const relList = (related ?? []).filter(Boolean);\n const tagsLine = tagList.length > 0 ? `tags: [${tagList.join(\", \")}]\\n` : \"\";\n const relatedLine = relList.length > 0 ? `related: [${relList.join(\", \")}]\\n` : \"\";\n const frontmatter = `---\\nname: ${name}\\ndescription: ${description.trim()}\\n${tagsLine}${relatedLine}---\\n\\n`;\n const fullContent = frontmatter + content;\n const dir = join(selfDir(), name);\n const filePath = join(dir, \"SKILL.md\");\n const tmpPath = filePath + \".tmp\";\n\n try {\n mkdirSync(dir, { recursive: true });\n writeFileSync(tmpPath, fullContent, \"utf-8\");\n renameSync(tmpPath, filePath);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n audit(`skill_create name=${name} bytes=${content.length} ok=false error=\"write failed: ${msg}\"`);\n return JSON.stringify({ error: `Write failed: ${msg}` });\n }\n\n setProvenance(name, \"agent\");\n audit(`skill_create name=${name} tags=[${tagList.join(\",\")}] bytes=${content.length} ok=true`);\n logInfo(TAG, `Created skill: self/${name} (${content.length} bytes)`);\n return JSON.stringify({ ok: true, path: filePath, message: `Skill \"${name}\" created in self/. Available in skills_catalog after /skill reload.` });\n },\n};\n\nexport const skillUpdateTool: ToolDefinition = {\n name: \"skill_update\",\n description: \"Full rewrite of an existing skill's SKILL.md in self/. Preserves frontmatter fields (tags, related, description) when omitted by caller.\",\n parameters: {\n type: \"object\",\n properties: {\n name: { type: \"string\", description: \"Skill name (must exist in self/).\" },\n description: { type: \"string\", description: \"New description (optional \u2014 keeps existing if omitted).\" },\n content: { type: \"string\", description: \"New skill body in Markdown (no frontmatter).\" },\n tags: { type: \"array\", items: { type: \"string\" }, description: \"New tags (optional \u2014 keeps existing if omitted).\" },\n related: { type: \"array\", items: { type: \"string\" }, description: \"New related skills (optional \u2014 keeps existing if omitted).\" },\n },\n required: [\"name\", \"content\"],\n },\n async execute(args) {\n const { name, content, description, tags, related } = args as unknown as { name: string; content: string; description?: string; tags?: string[]; related?: string[] };\n const guard = guardSelfSkill(name);\n if (guard) { audit(`skill_update name=${name} ok=false error=\"${guard}\"`); return JSON.stringify({ error: guard }); }\n\n const bytes = Buffer.byteLength(content, \"utf-8\");\n if (bytes < MIN_BYTES) return JSON.stringify({ error: `Content too short (${bytes} bytes, minimum ${MIN_BYTES}).` });\n if (bytes > MAX_BYTES) return JSON.stringify({ error: `Content too large (${bytes} bytes, maximum ${MAX_BYTES}).` });\n\n const scan = abmind()?.scanForInjection(content);\n if (scan && !scan.safe) return JSON.stringify({ error: `Content blocked by injection scanner: ${scan.flags[0]?.category ?? \"unknown\"}.` });\n\n const filePath = join(selfDir(), name, \"SKILL.md\");\n const existing = readFileSync(filePath, \"utf-8\");\n const { meta } = parseFrontmatter(existing);\n\n // Merge: caller fields override, omitted fields preserved\n const merged: Record<string, unknown> = { ...meta, name };\n if (description !== undefined) merged[\"description\"] = description.trim();\n if (tags !== undefined) merged[\"tags\"] = tags.slice(0, MAX_TAGS).map(t => t.toLowerCase().trim()).filter(Boolean);\n if (related !== undefined) merged[\"related\"] = related.filter(Boolean);\n\n const fullContent = serializeFrontmatter(merged) + content;\n const tmpPath = filePath + \".tmp\";\n try {\n writeFileSync(tmpPath, fullContent, \"utf-8\");\n renameSync(tmpPath, filePath);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n audit(`skill_update name=${name} ok=false error=\"write failed: ${msg}\"`);\n return JSON.stringify({ error: `Write failed: ${msg}` });\n }\n\n audit(`skill_update name=${name} bytes=${bytes} ok=true`);\n logInfo(TAG, `Updated skill: self/${name} (${bytes} bytes)`);\n return JSON.stringify({ ok: true, path: filePath, message: `Skill \"${name}\" updated.` });\n },\n};\n\nexport const skillPatchTool: ToolDefinition = {\n name: \"skill_patch\",\n description: \"Targeted find-and-replace within a skill's SKILL.md in self/. old_string must match exactly once.\",\n parameters: {\n type: \"object\",\n properties: {\n name: { type: \"string\", description: \"Skill name (must exist in self/).\" },\n old_string: { type: \"string\", description: \"Exact string to find (must match once).\" },\n new_string: { type: \"string\", description: \"Replacement string.\" },\n },\n required: [\"name\", \"old_string\", \"new_string\"],\n },\n async execute(args) {\n const { name, old_string, new_string } = args as unknown as { name: string; old_string: string; new_string: string };\n const guard = guardSelfSkill(name);\n if (guard) { audit(`skill_patch name=${name} ok=false error=\"${guard}\"`); return JSON.stringify({ error: guard }); }\n\n const filePath = join(selfDir(), name, \"SKILL.md\");\n const existing = readFileSync(filePath, \"utf-8\");\n\n const count = existing.split(old_string).length - 1;\n if (count === 0) return JSON.stringify({ error: `old_string not found in skill \"${name}\".` });\n if (count > 1) return JSON.stringify({ error: `old_string matches ${count} times \u2014 must match exactly once.` });\n\n const patched = existing.replace(old_string, new_string);\n const scan = abmind()?.scanForInjection(patched);\n if (scan && !scan.safe) return JSON.stringify({ error: `Patched content blocked by injection scanner: ${scan.flags[0]?.category ?? \"unknown\"}.` });\n\n const tmpPath = filePath + \".tmp\";\n try {\n writeFileSync(tmpPath, patched, \"utf-8\");\n renameSync(tmpPath, filePath);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n audit(`skill_patch name=${name} ok=false error=\"write failed: ${msg}\"`);\n return JSON.stringify({ error: `Write failed: ${msg}` });\n }\n\n audit(`skill_patch name=${name} ok=true`);\n logInfo(TAG, `Patched skill: self/${name}`);\n return JSON.stringify({ ok: true, path: filePath, message: `Skill \"${name}\" patched.` });\n },\n};\n\nexport const skillRemoveTool: ToolDefinition = {\n name: \"skill_remove\",\n description: \"Soft-delete a skill from self/ by moving it to .trash/ (recoverable for 7 days).\",\n parameters: {\n type: \"object\",\n properties: {\n name: { type: \"string\", description: \"Skill name (must exist in self/).\" },\n },\n required: [\"name\"],\n },\n async execute(args) {\n const { name } = args as unknown as { name: string };\n const guard = guardSelfSkill(name);\n if (guard) { audit(`skill_remove name=${name} ok=false error=\"${guard}\"`); return JSON.stringify({ error: guard }); }\n\n const srcDir = join(selfDir(), name);\n const ts = Date.now();\n const destDir = join(trashDir(), `${name}-${ts}`);\n try {\n mkdirSync(trashDir(), { recursive: true });\n renameSync(srcDir, destDir);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n audit(`skill_remove name=${name} ok=false error=\"move failed: ${msg}\"`);\n return JSON.stringify({ error: `Move failed: ${msg}` });\n }\n\n audit(`skill_remove name=${name} dest=${destDir} ok=true`);\n logInfo(TAG, `Removed skill: self/${name} \u2192 .trash/`);\n return JSON.stringify({ ok: true, message: `Skill \"${name}\" moved to .trash/. Will be pruned after 7 days.` });\n },\n};\n", "/**\n * mcp-tool.ts \u2014 Generic MCP tool (#471 v2).\n * Single tool that routes to any mcporter server/tool. Daemon starts on-demand.\n */\n\nimport { execFile } from \"node:child_process\";\nimport { promisify } from \"node:util\";\nimport { logInfo, logWarn } from \"../logger.js\";\nimport { logAndSwallow } from \"../log-and-swallow.js\";\nimport type { ToolDefinition } from \"./tool-registry.js\";\n\nconst execFileAsync = promisify(execFile);\nconst TAG = \"mcp\";\nlet daemonStarted = false;\n\nasync function ensureDaemon(): Promise<void> {\n if (daemonStarted) return;\n try {\n await execFileAsync(\"mcporter\", [\"daemon\", \"start\"], { timeout: 10_000 });\n daemonStarted = true;\n logInfo(TAG, \"mcporter daemon started (on-demand)\");\n } catch {\n logWarn(TAG, \"mcporter daemon start failed \u2014 calls may still work if already running\");\n daemonStarted = true; // don't retry every call \u2014 assume already running\n }\n}\n\nexport const mcpTool: ToolDefinition = {\n name: \"mcp\",\n description: \"Call an MCP server tool via mcporter. Available servers shown by /mcp command. Use when you need JIRA, presentations, or other MCP-connected services.\",\n parameters: {\n type: \"object\",\n properties: {\n server: { type: \"string\", description: \"Server name (e.g. 'pptx', 'atlassian')\" },\n tool: { type: \"string\", description: \"Tool name (e.g. 'jira_search', 'create_presentation')\" },\n args: { type: \"string\", description: \"Tool arguments as JSON string (e.g. '{\\\"query\\\": \\\"assignee = me\\\"}')\" },\n },\n required: [\"server\", \"tool\"],\n },\n async execute(params) {\n await ensureDaemon();\n const { server, tool, args } = params as { server: string; tool: string; args?: string };\n const cliArgs = [\"call\", `${server}.${tool}`];\n if (args) {\n try {\n const parsed = JSON.parse(args) as Record<string, string>;\n for (const [k, v] of Object.entries(parsed)) cliArgs.push(`${k}=${v}`);\n } catch (err) {\n logAndSwallow(TAG, \"JSON.parse mcp args\", err);\n cliArgs.push(args);\n }\n }\n try {\n const { stdout } = await execFileAsync(\"mcporter\", cliArgs, { timeout: 30_000, encoding: \"utf-8\" });\n return stdout;\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n return JSON.stringify({ error: `mcp call failed: ${msg}` });\n }\n },\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,mBAAAA;AAAA,EAAA;AAAA;AAAA;AAKA,SAAS,SAAS,WAAW;AAC7B,SAAS,eAAe;AAiCjB,SAAS,kBAAgC;AAC9C,QAAM,OAAO,OAAO,EAAE;AACtB,SAAO,QAAQ;AACjB;AAEO,SAAS,qBAA8B;AAC5C,SAAO,gBAAgB,MAAM;AAC/B;AAGO,SAASA,WAAU,MAAc,MAAuC;AAC7E,MAAI,CAAC,mBAAmB,EAAG,QAAO;AAElC,QAAM,WAAW,QAAQ,IAAI,KAAK,KAAK,SAAS,GAAG,IAAI,MAAM;AAE7D,aAAW,WAAW,eAAe;AACnC,QAAI,SAAS,WAAW,OAAO,KAAK,aAAa,QAAQ,MAAM,GAAG,EAAE,GAAG;AACrE,aAAO,+BAA+B,IAAI;AAAA,IAC5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E,IAAI,MAAM,MAAM,MAAM,WAAW,QAAQ,SAAS,OAAO,CAAC;AAElE,MAAI;AACF,UAAM,SAAS,MAAM,KAAK,QAAQ,MAAM,OAAO;AAC/C,IAAAA,OAAM,EAAE,IAAI,MAAM,MAAM,QAAQ,MAAM,OAAO,OAAO,OAAO,CAAC;AAC5D,mBAAe,MAAM,IAAI;AACzB,WAAO;AAAA,EACT,SAAS,KAAK;AACZ,IAAAA,OAAM,EAAE,IAAI,MAAM,MAAM,QAAQ,SAAS,OAAO,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,EAAE,CAAC;AAClG,UAAM;AAAA,EACR;AACF;",
|
|
6
|
+
"names": ["checkPath", "TAG", "execFile", "appendFileSync", "mkdirSync", "join", "homedir", "TAG", "TAG", "join", "homedir", "mkdirSync", "audit", "appendFileSync", "checkCommand", "resolve", "execFile", "readFileSync", "existsSync"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
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
|
+
PEERS_SCHEMA,
|
|
4
|
+
init_config_validator,
|
|
5
|
+
validateShape
|
|
6
|
+
} from "./chunk-2UPU3OW6.js";
|
|
7
|
+
import {
|
|
8
|
+
init_logger,
|
|
9
|
+
logInfo,
|
|
10
|
+
logWarn
|
|
11
|
+
} from "./chunk-BUUVFUPO.js";
|
|
12
|
+
import {
|
|
13
|
+
abtarsHome,
|
|
14
|
+
init_paths
|
|
15
|
+
} from "./chunk-X76UX47U.js";
|
|
16
|
+
import {
|
|
17
|
+
__esm,
|
|
18
|
+
__export
|
|
19
|
+
} from "./chunk-NWDBD4PA.js";
|
|
20
|
+
|
|
21
|
+
// src/components/peer-config.ts
|
|
22
|
+
var peer_config_exports = {};
|
|
23
|
+
__export(peer_config_exports, {
|
|
24
|
+
clearPeerConfigCache: () => clearPeerConfigCache,
|
|
25
|
+
loadPeerConfig: () => loadPeerConfig
|
|
26
|
+
});
|
|
27
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
28
|
+
import { join } from "node:path";
|
|
29
|
+
function loadPeerConfig() {
|
|
30
|
+
if (_config) return _config;
|
|
31
|
+
const p = join(abtarsHome(), "config", "peers.json");
|
|
32
|
+
if (!existsSync(p)) {
|
|
33
|
+
_config = { self: { name: "default" }, peers: {}, ...DEFAULTS };
|
|
34
|
+
return _config;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
const raw = JSON.parse(readFileSync(p, "utf-8"));
|
|
38
|
+
validateShape(raw, PEERS_SCHEMA, "peers.json");
|
|
39
|
+
const peers = {};
|
|
40
|
+
if (raw.peers && typeof raw.peers === "object") {
|
|
41
|
+
for (const [name, entry] of Object.entries(raw.peers)) {
|
|
42
|
+
const e = entry;
|
|
43
|
+
if (typeof e.host === "string" && typeof e.port === "number" && typeof e.token === "string") {
|
|
44
|
+
peers[name] = {
|
|
45
|
+
host: e.host,
|
|
46
|
+
port: e.port,
|
|
47
|
+
token: e.token,
|
|
48
|
+
...e.mode === "signed" ? { mode: "signed" } : {},
|
|
49
|
+
...typeof e.verifyKey === "string" ? { verifyKey: e.verifyKey } : {},
|
|
50
|
+
...typeof e.udpPort === "number" ? { udpPort: e.udpPort } : {},
|
|
51
|
+
...typeof e.certFingerprint === "string" ? { certFingerprint: e.certFingerprint } : {},
|
|
52
|
+
...typeof e.certPem === "string" ? { certPem: e.certPem } : {},
|
|
53
|
+
...Array.isArray(e.allowedTools) ? { allowedTools: e.allowedTools } : {},
|
|
54
|
+
...Array.isArray(e.allowedRead) ? { allowedRead: e.allowedRead } : {},
|
|
55
|
+
...Array.isArray(e.allowedWrite) ? { allowedWrite: e.allowedWrite } : {}
|
|
56
|
+
};
|
|
57
|
+
} else {
|
|
58
|
+
logWarn(TAG, `Skipped peer '${name}' \u2014 missing host/port/token`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
_config = {
|
|
63
|
+
self: {
|
|
64
|
+
name: typeof raw.self?.name === "string" ? raw.self.name : "default",
|
|
65
|
+
...typeof raw.self?.signingKey === "string" ? { signingKey: raw.self.signingKey } : {},
|
|
66
|
+
...typeof raw.self?.udpPort === "number" ? { udpPort: raw.self.udpPort } : {}
|
|
67
|
+
},
|
|
68
|
+
peers,
|
|
69
|
+
maxHops: typeof raw.maxHops === "number" ? raw.maxHops : DEFAULTS.maxHops,
|
|
70
|
+
timeoutMs: typeof raw.timeoutMs === "number" ? raw.timeoutMs : DEFAULTS.timeoutMs
|
|
71
|
+
};
|
|
72
|
+
const names = Object.keys(peers);
|
|
73
|
+
if (names.length > 0) logInfo(TAG, `Loaded ${names.length} peer(s): ${names.join(", ")} (self: ${_config.self.name})`);
|
|
74
|
+
return _config;
|
|
75
|
+
} catch (err) {
|
|
76
|
+
logWarn(TAG, `Failed to parse peers.json: ${err instanceof Error ? err.message : String(err)}`);
|
|
77
|
+
_config = { self: { name: "default" }, peers: {}, ...DEFAULTS };
|
|
78
|
+
return _config;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function clearPeerConfigCache() {
|
|
82
|
+
_config = null;
|
|
83
|
+
}
|
|
84
|
+
var TAG, DEFAULTS, _config;
|
|
85
|
+
var init_peer_config = __esm({
|
|
86
|
+
"src/components/peer-config.ts"() {
|
|
87
|
+
init_paths();
|
|
88
|
+
init_logger();
|
|
89
|
+
init_config_validator();
|
|
90
|
+
TAG = "peer-config";
|
|
91
|
+
DEFAULTS = { maxHops: 12, timeoutMs: 6e4 };
|
|
92
|
+
_config = null;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export {
|
|
97
|
+
loadPeerConfig,
|
|
98
|
+
clearPeerConfigCache,
|
|
99
|
+
peer_config_exports,
|
|
100
|
+
init_peer_config
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=chunk-W6FAL35D.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/components/peer-config.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * peer-config.ts \u2014 load and validate ~/.abtars/config/peers.json (#392).\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { abtarsHome } from \"../paths.js\";\nimport { logInfo, logWarn } from \"./logger.js\";\nimport { validateShape, PEERS_SCHEMA } from \"./config-validator.js\";\n\nconst TAG = \"peer-config\";\n\nexport interface PeerEntry {\n host: string;\n port: number;\n token: string;\n mode?: \"plain\" | \"signed\";\n verifyKey?: string;\n udpPort?: number;\n certFingerprint?: string;\n certPem?: string;\n allowedTools?: string[];\n allowedRead?: string[];\n allowedWrite?: string[];\n}\n\nexport interface PeerConfig {\n self: { name: string; signingKey?: string; udpPort?: number };\n peers: Record<string, PeerEntry>;\n maxHops: number;\n timeoutMs: number;\n}\n\nconst DEFAULTS: Omit<PeerConfig, \"peers\" | \"self\"> = { maxHops: 12, timeoutMs: 60000 };\n\nlet _config: PeerConfig | null = null;\n\nexport function loadPeerConfig(): PeerConfig {\n if (_config) return _config;\n const p = join(abtarsHome(), \"config\", \"peers.json\");\n if (!existsSync(p)) {\n _config = { self: { name: \"default\" }, peers: {}, ...DEFAULTS };\n return _config;\n }\n try {\n const raw = JSON.parse(readFileSync(p, \"utf-8\"));\n validateShape(raw, PEERS_SCHEMA, \"peers.json\");\n const peers: Record<string, PeerEntry> = {};\n if (raw.peers && typeof raw.peers === \"object\") {\n for (const [name, entry] of Object.entries(raw.peers)) {\n const e = entry as Record<string, unknown>;\n if (typeof e.host === \"string\" && typeof e.port === \"number\" && typeof e.token === \"string\") {\n peers[name] = {\n host: e.host, port: e.port, token: e.token,\n ...(e.mode === \"signed\" ? { mode: \"signed\" as const } : {}),\n ...(typeof e.verifyKey === \"string\" ? { verifyKey: e.verifyKey } : {}),\n ...(typeof e.udpPort === \"number\" ? { udpPort: e.udpPort } : {}),\n ...(typeof e.certFingerprint === \"string\" ? { certFingerprint: e.certFingerprint } : {}),\n ...(typeof e.certPem === \"string\" ? { certPem: e.certPem } : {}),\n ...(Array.isArray(e.allowedTools) ? { allowedTools: e.allowedTools as string[] } : {}),\n ...(Array.isArray(e.allowedRead) ? { allowedRead: e.allowedRead as string[] } : {}),\n ...(Array.isArray(e.allowedWrite) ? { allowedWrite: e.allowedWrite as string[] } : {}),\n };\n } else {\n logWarn(TAG, `Skipped peer '${name}' \u2014 missing host/port/token`);\n }\n }\n }\n _config = {\n self: {\n name: typeof raw.self?.name === \"string\" ? raw.self.name : \"default\",\n ...(typeof raw.self?.signingKey === \"string\" ? { signingKey: raw.self.signingKey } : {}),\n ...(typeof raw.self?.udpPort === \"number\" ? { udpPort: raw.self.udpPort } : {}),\n },\n peers,\n maxHops: typeof raw.maxHops === \"number\" ? raw.maxHops : DEFAULTS.maxHops,\n timeoutMs: typeof raw.timeoutMs === \"number\" ? raw.timeoutMs : DEFAULTS.timeoutMs,\n };\n const names = Object.keys(peers);\n if (names.length > 0) logInfo(TAG, `Loaded ${names.length} peer(s): ${names.join(\", \")} (self: ${_config.self.name})`);\n return _config;\n } catch (err) {\n logWarn(TAG, `Failed to parse peers.json: ${err instanceof Error ? err.message : String(err)}`);\n _config = { self: { name: \"default\" }, peers: {}, ...DEFAULTS };\n return _config;\n }\n}\n\nexport function clearPeerConfigCache(): void { _config = null; }\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,SAAS,YAAY,oBAAoB;AACzC,SAAS,YAAY;AAgCd,SAAS,iBAA6B;AAC3C,MAAI,QAAS,QAAO;AACpB,QAAM,IAAI,KAAK,WAAW,GAAG,UAAU,YAAY;AACnD,MAAI,CAAC,WAAW,CAAC,G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