Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI, Telegram or More.
feat: add file sending capability, markdown formatting utilities, and a comprehensive CLI manual
Salman Qureshibf0411c0457f
diff --git a/package-lock.json b/package-lock.jsonindex 200b8731..0b659445 100644--- a/package-lock.json+++ b/package-lock.json@@ -20,6 +20,8 @@"grammy": "^1.42.0","ink": "^5.2.0","js-tiktoken": "^1.0.19",+ "marked": "^15.0.12",+ "marked-terminal": "^7.3.0","node-cron": "^3.0.3","pino": "^9.6.0","react": "^18.3.1",@@ -30,6 +32,7 @@"mercury": "dist/index.js"},"devDependencies": {+ "@types/marked-terminal": "^6.1.1","@types/node": "^22.13.0","@types/node-cron": "^3.0.11","@types/react": "^18.3.0",@@ -149,6 +152,15 @@"node": ">=14.13.1"}},+ "node_modules/@colors/colors": {+ "version": "1.5.0",+ "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz",+ "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==",+ "optional": true,+ "engines": {+ "node": ">=0.1.90"+ }+ },"node_modules/@esbuild/aix-ppc64": {"version": "0.27.7","resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz",@@ -971,6 +983,23 @@"win32"]},+ "node_modules/@sindresorhus/is": {+ "version": "4.6.0",+ "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",+ "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sindresorhus/is?sponsor=1"+ }+ },+ "node_modules/@types/cardinal": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/@types/cardinal/-/cardinal-2.1.1.tgz",+ "integrity": "sha512-/xCVwg8lWvahHsV2wXZt4i64H1sdL+sN1Uoq7fAc8/FA6uYHjuIveDwPwvGUYp4VZiv85dVl6J/Bum3NDAOm8g==",+ "dev": true+ },"node_modules/@types/chai": {"version": "5.2.3","resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz",@@ -998,6 +1027,30 @@"integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==","dev": true},+ "node_modules/@types/marked-terminal": {+ "version": "6.1.1",+ "resolved": "https://registry.npmjs.org/@types/marked-terminal/-/marked-terminal-6.1.1.tgz",+ "integrity": "sha512-DfoUqkmFDCED7eBY9vFUhJ9fW8oZcMAK5EwRDQ9drjTbpQa+DnBTQQCwWhTFVf4WsZ6yYcJTI8D91wxTWXRZZQ==",+ "dev": true,+ "dependencies": {+ "@types/cardinal": "^2.1",+ "@types/node": "*",+ "chalk": "^5.3.0",+ "marked": ">=6.0.0 <12"+ }+ },+ "node_modules/@types/marked-terminal/node_modules/marked": {+ "version": "11.2.0",+ "resolved": "https://registry.npmjs.org/marked/-/marked-11.2.0.tgz",+ "integrity": "sha512-HR0m3bvu0jAPYiIvLUUQtdg1g6D247//lvcekpHO1WMvbwDlwSkZAX9Lw4F4YHE1T0HaaNve0tuAWuV1UJ6vtw==",+ "dev": true,+ "bin": {+ "marked": "bin/marked.js"+ },+ "engines": {+ "node": ">= 18"+ }+ },"node_modules/@types/node": {"version": "22.19.17","resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.17.tgz",@@ -1224,8 +1277,7 @@"node_modules/any-promise": {"version": "1.3.0","resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",- "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==",- "dev": true+ "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A=="},"node_modules/assertion-error": {"version": "2.0.1",@@ -1325,6 +1377,14 @@"url": "https://github.com/chalk/chalk?sponsor=1"}},+ "node_modules/char-regex": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz",+ "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==",+ "engines": {+ "node": ">=10"+ }+ },"node_modules/check-error": {"version": "2.1.3","resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.3.tgz",@@ -1374,6 +1434,114 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/cli-highlight": {+ "version": "2.1.11",+ "resolved": "https://registry.npmjs.org/cli-highlight/-/cli-highlight-2.1.11.tgz",+ "integrity": "sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg==",+ "dependencies": {+ "chalk": "^4.0.0",+ "highlight.js": "^10.7.1",+ "mz": "^2.4.0",+ "parse5": "^5.1.1",+ "parse5-htmlparser2-tree-adapter": "^6.0.0",+ "yargs": "^16.0.0"+ },+ "bin": {+ "highlight": "bin/highlight"+ },+ "engines": {+ "node": ">=8.0.0",+ "npm": ">=5.0.0"+ }+ },+ "node_modules/cli-highlight/node_modules/ansi-styles": {+ "version": "4.3.0",+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",+ "dependencies": {+ "color-convert": "^2.0.1"+ },+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"+ }+ },+ "node_modules/cli-highlight/node_modules/chalk": {+ "version": "4.1.2",+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",+ "dependencies": {+ "ansi-styles": "^4.1.0",+ "supports-color": "^7.1.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/chalk/chalk?sponsor=1"+ }+ },+ "node_modules/cli-table3": {+ "version": "0.6.5",+ "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.5.tgz",+ "integrity": "sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==",+ "dependencies": {+ "string-width": "^4.2.0"+ },+ "engines": {+ "node": "10.* || >= 12.*"+ },+ "optionalDependencies": {+ "@colors/colors": "1.5.0"+ }+ },+ "node_modules/cli-table3/node_modules/ansi-regex": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/cli-table3/node_modules/emoji-regex": {+ "version": "8.0.0",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="+ },+ "node_modules/cli-table3/node_modules/is-fullwidth-code-point": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/cli-table3/node_modules/string-width": {+ "version": "4.2.3",+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",+ "dependencies": {+ "emoji-regex": "^8.0.0",+ "is-fullwidth-code-point": "^3.0.0",+ "strip-ansi": "^6.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/cli-table3/node_modules/strip-ansi": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",+ "dependencies": {+ "ansi-regex": "^5.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },"node_modules/cli-truncate": {"version": "4.0.0","resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-4.0.0.tgz",@@ -1404,6 +1572,91 @@"url": "https://github.com/chalk/slice-ansi?sponsor=1"}},+ "node_modules/cliui": {+ "version": "7.0.4",+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",+ "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",+ "dependencies": {+ "string-width": "^4.2.0",+ "strip-ansi": "^6.0.0",+ "wrap-ansi": "^7.0.0"+ }+ },+ "node_modules/cliui/node_modules/ansi-regex": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/cliui/node_modules/ansi-styles": {+ "version": "4.3.0",+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",+ "dependencies": {+ "color-convert": "^2.0.1"+ },+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"+ }+ },+ "node_modules/cliui/node_modules/emoji-regex": {+ "version": "8.0.0",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="+ },+ "node_modules/cliui/node_modules/is-fullwidth-code-point": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/cliui/node_modules/string-width": {+ "version": "4.2.3",+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",+ "dependencies": {+ "emoji-regex": "^8.0.0",+ "is-fullwidth-code-point": "^3.0.0",+ "strip-ansi": "^6.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/cliui/node_modules/strip-ansi": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",+ "dependencies": {+ "ansi-regex": "^5.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/cliui/node_modules/wrap-ansi": {+ "version": "7.0.0",+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",+ "dependencies": {+ "ansi-styles": "^4.0.0",+ "string-width": "^4.1.0",+ "strip-ansi": "^6.0.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"+ }+ },"node_modules/code-excerpt": {"version": "4.0.0","resolved": "https://registry.npmjs.org/code-excerpt/-/code-excerpt-4.0.0.tgz",@@ -1415,6 +1668,22 @@"node": "^12.20.0 || ^14.13.1 || >=16.0.0"}},+ "node_modules/color-convert": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",+ "dependencies": {+ "color-name": "~1.1.4"+ },+ "engines": {+ "node": ">=7.0.0"+ }+ },+ "node_modules/color-name": {+ "version": "1.1.4",+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="+ },"node_modules/commander": {"version": "13.1.0","resolved": "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz",@@ -1506,6 +1775,11 @@"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz","integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A=="},+ "node_modules/emojilib": {+ "version": "2.4.0",+ "resolved": "https://registry.npmjs.org/emojilib/-/emojilib-2.4.0.tgz",+ "integrity": "sha512-5U0rVMU5Y2n2+ykNLQqMoqklN9ICBT/KsvC1Gz6vqHbz2AXXGkG+Pm5rMWk/8Vjrr/mY9985Hi8DYzn1F09Nyw=="+ },"node_modules/environment": {"version": "1.1.0","resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz",@@ -1569,6 +1843,14 @@"@esbuild/win32-x64": "0.27.7"}},+ "node_modules/escalade": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",+ "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",+ "engines": {+ "node": ">=6"+ }+ },"node_modules/escape-string-regexp": {"version": "2.0.0","resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz",@@ -1645,6 +1927,14 @@"node": "^8.16.0 || ^10.6.0 || >=11.0.0"}},+ "node_modules/get-caller-file": {+ "version": "2.0.5",+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",+ "engines": {+ "node": "6.* || 8.* || >= 10.*"+ }+ },"node_modules/get-east-asian-width": {"version": "1.5.0","resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.5.0.tgz",@@ -1670,6 +1960,22 @@"node": "^12.20.0 || >=14.13.1"}},+ "node_modules/has-flag": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/highlight.js": {+ "version": "10.7.3",+ "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz",+ "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==",+ "engines": {+ "node": "*"+ }+ },"node_modules/indent-string": {"version": "5.0.0","resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz",@@ -1849,6 +2155,37 @@"@jridgewell/sourcemap-codec": "^1.5.5"}},+ "node_modules/marked": {+ "version": "15.0.12",+ "resolved": "https://registry.npmjs.org/marked/-/marked-15.0.12.tgz",+ "integrity": "sha512-8dD6FusOQSrpv9Z1rdNMdlSgQOIP880DHqnohobOmYLElGEqAL/JvxvuxZO16r4HtjTlfPRDC1hbvxC9dPN2nA==",+ "bin": {+ "marked": "bin/marked.js"+ },+ "engines": {+ "node": ">= 18"+ }+ },+ "node_modules/marked-terminal": {+ "version": "7.3.0",+ "resolved": "https://registry.npmjs.org/marked-terminal/-/marked-terminal-7.3.0.tgz",+ "integrity": "sha512-t4rBvPsHc57uE/2nJOLmMbZCQ4tgAccAED3ngXQqW6g+TxA488JzJ+FK3lQkzBQOI1mRV/r/Kq+1ZlJ4D0owQw==",+ "dependencies": {+ "ansi-escapes": "^7.0.0",+ "ansi-regex": "^6.1.0",+ "chalk": "^5.4.1",+ "cli-highlight": "^2.1.11",+ "cli-table3": "^0.6.5",+ "node-emoji": "^2.2.0",+ "supports-hyperlinks": "^3.1.0"+ },+ "engines": {+ "node": ">=16.0.0"+ },+ "peerDependencies": {+ "marked": ">=1 <16"+ }+ },"node_modules/mimic-fn": {"version": "2.1.0","resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",@@ -1878,7 +2215,6 @@"version": "2.7.0","resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz","integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==",- "dev": true,"dependencies": {"any-promise": "^1.0.0","object-assign": "^4.0.1",@@ -1913,6 +2249,20 @@"node": ">=6.0.0"}},+ "node_modules/node-emoji": {+ "version": "2.2.0",+ "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-2.2.0.tgz",+ "integrity": "sha512-Z3lTE9pLaJF47NyMhd4ww1yFTAP8YhYI8SleJiHzM46Fgpm5cnNzSl9XfzFNqbaz+VlJrIj3fXQ4DeN1Rjm6cw==",+ "dependencies": {+ "@sindresorhus/is": "^4.6.0",+ "char-regex": "^1.0.2",+ "emojilib": "^2.4.0",+ "skin-tone": "^2.0.0"+ },+ "engines": {+ "node": ">=18"+ }+ },"node_modules/node-fetch": {"version": "2.7.0","resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",@@ -1936,7 +2286,6 @@"version": "4.1.1","resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz","integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",- "dev": true,"engines": {"node": ">=0.10.0"}@@ -1963,6 +2312,24 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/parse5": {+ "version": "5.1.1",+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz",+ "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug=="+ },+ "node_modules/parse5-htmlparser2-tree-adapter": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz",+ "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==",+ "dependencies": {+ "parse5": "^6.0.1"+ }+ },+ "node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",+ "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw=="+ },"node_modules/patch-console": {"version": "2.0.0","resolved": "https://registry.npmjs.org/patch-console/-/patch-console-2.0.0.tgz",@@ -2195,6 +2562,14 @@"node": ">= 12.13.0"}},+ "node_modules/require-directory": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",+ "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",+ "engines": {+ "node": ">=0.10.0"+ }+ },"node_modules/resolve-from": {"version": "5.0.0","resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz",@@ -2295,6 +2670,17 @@"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz","integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="},+ "node_modules/skin-tone": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/skin-tone/-/skin-tone-2.0.0.tgz",+ "integrity": "sha512-kUMbT1oBJCpgrnKoSr0o6wPtvRWT9W9UKvGLwfJYO2WuahZRHOpEyL1ckyMGgMWh0UdpmaoFqKKD29WTomNEGA==",+ "dependencies": {+ "unicode-emoji-modifier-base": "^1.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },"node_modules/slice-ansi": {"version": "7.1.2","resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.2.tgz",@@ -2460,6 +2846,32 @@"node": ">= 6"}},+ "node_modules/supports-color": {+ "version": "7.2.0",+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",+ "dependencies": {+ "has-flag": "^4.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/supports-hyperlinks": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-3.2.0.tgz",+ "integrity": "sha512-zFObLMyZeEwzAoKCyu1B91U79K2t7ApXuQfo8OuxwXLDgcKxuwM+YvcbIhm6QWqz7mHUH1TVytR1PwVVjEuMig==",+ "dependencies": {+ "has-flag": "^4.0.0",+ "supports-color": "^7.0.0"+ },+ "engines": {+ "node": ">=14.18"+ },+ "funding": {+ "url": "https://github.com/chalk/supports-hyperlinks?sponsor=1"+ }+ },"node_modules/swr": {"version": "2.4.1","resolved": "https://registry.npmjs.org/swr/-/swr-2.4.1.tgz",@@ -2476,7 +2888,6 @@"version": "3.3.1","resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz","integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==",- "dev": true,"dependencies": {"any-promise": "^1.0.0"}@@ -2485,7 +2896,6 @@"version": "1.6.0","resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz","integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==",- "dev": true,"dependencies": {"thenify": ">= 3.1.0 < 4"},@@ -2675,6 +3085,14 @@"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==","dev": true},+ "node_modules/unicode-emoji-modifier-base": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/unicode-emoji-modifier-base/-/unicode-emoji-modifier-base-1.0.0.tgz",+ "integrity": "sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g==",+ "engines": {+ "node": ">=4"+ }+ },"node_modules/use-sync-external-store": {"version": "1.6.0","resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz",@@ -3396,6 +3814,14 @@}}},+ "node_modules/y18n": {+ "version": "5.0.8",+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",+ "engines": {+ "node": ">=10"+ }+ },"node_modules/yaml": {"version": "2.8.3","resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.3.tgz",@@ -3410,6 +3836,76 @@"url": "https://github.com/sponsors/eemeli"}},+ "node_modules/yargs": {+ "version": "16.2.0",+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",+ "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",+ "dependencies": {+ "cliui": "^7.0.2",+ "escalade": "^3.1.1",+ "get-caller-file": "^2.0.5",+ "require-directory": "^2.1.1",+ "string-width": "^4.2.0",+ "y18n": "^5.0.5",+ "yargs-parser": "^20.2.2"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/yargs-parser": {+ "version": "20.2.9",+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",+ "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==",+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/yargs/node_modules/ansi-regex": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/yargs/node_modules/emoji-regex": {+ "version": "8.0.0",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="+ },+ "node_modules/yargs/node_modules/is-fullwidth-code-point": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/yargs/node_modules/string-width": {+ "version": "4.2.3",+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",+ "dependencies": {+ "emoji-regex": "^8.0.0",+ "is-fullwidth-code-point": "^3.0.0",+ "strip-ansi": "^6.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/yargs/node_modules/strip-ansi": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",+ "dependencies": {+ "ansi-regex": "^5.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },"node_modules/yoga-layout": {"version": "3.2.1","resolved": "https://registry.npmjs.org/yoga-layout/-/yoga-layout-3.2.1.tgz",@@ -3499,6 +3995,12 @@"is-fullwidth-code-point": "^4.0.0"}},+ "@colors/colors": {+ "version": "1.5.0",+ "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz",+ "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==",+ "optional": true+ },"@esbuild/aix-ppc64": {"version": "0.27.7","resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz",@@ -3919,6 +4421,17 @@"dev": true,"optional": true},+ "@sindresorhus/is": {+ "version": "4.6.0",+ "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",+ "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw=="+ },+ "@types/cardinal": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/@types/cardinal/-/cardinal-2.1.1.tgz",+ "integrity": "sha512-/xCVwg8lWvahHsV2wXZt4i64H1sdL+sN1Uoq7fAc8/FA6uYHjuIveDwPwvGUYp4VZiv85dVl6J/Bum3NDAOm8g==",+ "dev": true+ },"@types/chai": {"version": "5.2.3","resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz",@@ -3946,6 +4459,26 @@"integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==","dev": true},+ "@types/marked-terminal": {+ "version": "6.1.1",+ "resolved": "https://registry.npmjs.org/@types/marked-terminal/-/marked-terminal-6.1.1.tgz",+ "integrity": "sha512-DfoUqkmFDCED7eBY9vFUhJ9fW8oZcMAK5EwRDQ9drjTbpQa+DnBTQQCwWhTFVf4WsZ6yYcJTI8D91wxTWXRZZQ==",+ "dev": true,+ "requires": {+ "@types/cardinal": "^2.1",+ "@types/node": "*",+ "chalk": "^5.3.0",+ "marked": ">=6.0.0 <12"+ },+ "dependencies": {+ "marked": {+ "version": "11.2.0",+ "resolved": "https://registry.npmjs.org/marked/-/marked-11.2.0.tgz",+ "integrity": "sha512-HR0m3bvu0jAPYiIvLUUQtdg1g6D247//lvcekpHO1WMvbwDlwSkZAX9Lw4F4YHE1T0HaaNve0tuAWuV1UJ6vtw==",+ "dev": true+ }+ }+ },"@types/node": {"version": "22.19.17","resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.17.tgz",@@ -4100,8 +4633,7 @@"any-promise": {"version": "1.3.0","resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",- "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==",- "dev": true+ "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A=="},"assertion-error": {"version": "2.0.1",@@ -4157,6 +4689,11 @@"resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz","integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="},+ "char-regex": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz",+ "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw=="+ },"check-error": {"version": "2.1.3","resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.3.tgz",@@ -4185,6 +4722,82 @@"restore-cursor": "^4.0.0"}},+ "cli-highlight": {+ "version": "2.1.11",+ "resolved": "https://registry.npmjs.org/cli-highlight/-/cli-highlight-2.1.11.tgz",+ "integrity": "sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg==",+ "requires": {+ "chalk": "^4.0.0",+ "highlight.js": "^10.7.1",+ "mz": "^2.4.0",+ "parse5": "^5.1.1",+ "parse5-htmlparser2-tree-adapter": "^6.0.0",+ "yargs": "^16.0.0"+ },+ "dependencies": {+ "ansi-styles": {+ "version": "4.3.0",+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",+ "requires": {+ "color-convert": "^2.0.1"+ }+ },+ "chalk": {+ "version": "4.1.2",+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",+ "requires": {+ "ansi-styles": "^4.1.0",+ "supports-color": "^7.1.0"+ }+ }+ }+ },+ "cli-table3": {+ "version": "0.6.5",+ "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.5.tgz",+ "integrity": "sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==",+ "requires": {+ "@colors/colors": "1.5.0",+ "string-width": "^4.2.0"+ },+ "dependencies": {+ "ansi-regex": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="+ },+ "emoji-regex": {+ "version": "8.0.0",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="+ },+ "is-fullwidth-code-point": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="+ },+ "string-width": {+ "version": "4.2.3",+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",+ "requires": {+ "emoji-regex": "^8.0.0",+ "is-fullwidth-code-point": "^3.0.0",+ "strip-ansi": "^6.0.1"+ }+ },+ "strip-ansi": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",+ "requires": {+ "ansi-regex": "^5.0.1"+ }+ }+ }+ },"cli-truncate": {"version": "4.0.0","resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-4.0.0.tgz",@@ -4205,6 +4818,69 @@}}},+ "cliui": {+ "version": "7.0.4",+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",+ "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",+ "requires": {+ "string-width": "^4.2.0",+ "strip-ansi": "^6.0.0",+ "wrap-ansi": "^7.0.0"+ },+ "dependencies": {+ "ansi-regex": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="+ },+ "ansi-styles": {+ "version": "4.3.0",+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",+ "requires": {+ "color-convert": "^2.0.1"+ }+ },+ "emoji-regex": {+ "version": "8.0.0",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="+ },+ "is-fullwidth-code-point": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="+ },+ "string-width": {+ "version": "4.2.3",+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",+ "requires": {+ "emoji-regex": "^8.0.0",+ "is-fullwidth-code-point": "^3.0.0",+ "strip-ansi": "^6.0.1"+ }+ },+ "strip-ansi": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",+ "requires": {+ "ansi-regex": "^5.0.1"+ }+ },+ "wrap-ansi": {+ "version": "7.0.0",+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",+ "requires": {+ "ansi-styles": "^4.0.0",+ "string-width": "^4.1.0",+ "strip-ansi": "^6.0.0"+ }+ }+ }+ },"code-excerpt": {"version": "4.0.0","resolved": "https://registry.npmjs.org/code-excerpt/-/code-excerpt-4.0.0.tgz",@@ -4213,6 +4889,19 @@"convert-to-spaces": "^2.0.1"}},+ "color-convert": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",+ "requires": {+ "color-name": "~1.1.4"+ }+ },+ "color-name": {+ "version": "1.1.4",+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="+ },"commander": {"version": "13.1.0","resolved": "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz",@@ -4275,6 +4964,11 @@"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz","integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A=="},+ "emojilib": {+ "version": "2.4.0",+ "resolved": "https://registry.npmjs.org/emojilib/-/emojilib-2.4.0.tgz",+ "integrity": "sha512-5U0rVMU5Y2n2+ykNLQqMoqklN9ICBT/KsvC1Gz6vqHbz2AXXGkG+Pm5rMWk/8Vjrr/mY9985Hi8DYzn1F09Nyw=="+ },"environment": {"version": "1.1.0","resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz",@@ -4325,6 +5019,11 @@"@esbuild/win32-x64": "0.27.7"}},+ "escalade": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",+ "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="+ },"escape-string-regexp": {"version": "2.0.0","resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz",@@ -4375,6 +5074,11 @@"dev": true,"optional": true},+ "get-caller-file": {+ "version": "2.0.5",+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="+ },"get-east-asian-width": {"version": "1.5.0","resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.5.0.tgz",@@ -4391,6 +5095,16 @@"node-fetch": "^2.7.0"}},+ "has-flag": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="+ },+ "highlight.js": {+ "version": "10.7.3",+ "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz",+ "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A=="+ },"indent-string": {"version": "5.0.0","resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz",@@ -4512,6 +5226,25 @@"@jridgewell/sourcemap-codec": "^1.5.5"}},+ "marked": {+ "version": "15.0.12",+ "resolved": "https://registry.npmjs.org/marked/-/marked-15.0.12.tgz",+ "integrity": "sha512-8dD6FusOQSrpv9Z1rdNMdlSgQOIP880DHqnohobOmYLElGEqAL/JvxvuxZO16r4HtjTlfPRDC1hbvxC9dPN2nA=="+ },+ "marked-terminal": {+ "version": "7.3.0",+ "resolved": "https://registry.npmjs.org/marked-terminal/-/marked-terminal-7.3.0.tgz",+ "integrity": "sha512-t4rBvPsHc57uE/2nJOLmMbZCQ4tgAccAED3ngXQqW6g+TxA488JzJ+FK3lQkzBQOI1mRV/r/Kq+1ZlJ4D0owQw==",+ "requires": {+ "ansi-escapes": "^7.0.0",+ "ansi-regex": "^6.1.0",+ "chalk": "^5.4.1",+ "cli-highlight": "^2.1.11",+ "cli-table3": "^0.6.5",+ "node-emoji": "^2.2.0",+ "supports-hyperlinks": "^3.1.0"+ }+ },"mimic-fn": {"version": "2.1.0","resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",@@ -4538,7 +5271,6 @@"version": "2.7.0","resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz","integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==",- "dev": true,"requires": {"any-promise": "^1.0.0","object-assign": "^4.0.1",@@ -4558,6 +5290,17 @@"uuid": "8.3.2"}},+ "node-emoji": {+ "version": "2.2.0",+ "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-2.2.0.tgz",+ "integrity": "sha512-Z3lTE9pLaJF47NyMhd4ww1yFTAP8YhYI8SleJiHzM46Fgpm5cnNzSl9XfzFNqbaz+VlJrIj3fXQ4DeN1Rjm6cw==",+ "requires": {+ "@sindresorhus/is": "^4.6.0",+ "char-regex": "^1.0.2",+ "emojilib": "^2.4.0",+ "skin-tone": "^2.0.0"+ }+ },"node-fetch": {"version": "2.7.0","resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",@@ -4569,8 +5312,7 @@"object-assign": {"version": "4.1.1","resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",- "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",- "dev": true+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="},"on-exit-leak-free": {"version": "2.1.2",@@ -4585,6 +5327,26 @@"mimic-fn": "^2.1.0"}},+ "parse5": {+ "version": "5.1.1",+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz",+ "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug=="+ },+ "parse5-htmlparser2-tree-adapter": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz",+ "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==",+ "requires": {+ "parse5": "^6.0.1"+ },+ "dependencies": {+ "parse5": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",+ "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw=="+ }+ }+ },"patch-console": {"version": "2.0.0","resolved": "https://registry.npmjs.org/patch-console/-/patch-console-2.0.0.tgz",@@ -4720,6 +5482,11 @@"resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz","integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg=="},+ "require-directory": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",+ "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q=="+ },"resolve-from": {"version": "5.0.0","resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz",@@ -4799,6 +5566,14 @@"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz","integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="},+ "skin-tone": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/skin-tone/-/skin-tone-2.0.0.tgz",+ "integrity": "sha512-kUMbT1oBJCpgrnKoSr0o6wPtvRWT9W9UKvGLwfJYO2WuahZRHOpEyL1ckyMGgMWh0UdpmaoFqKKD29WTomNEGA==",+ "requires": {+ "unicode-emoji-modifier-base": "^1.0.0"+ }+ },"slice-ansi": {"version": "7.1.2","resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.2.tgz",@@ -4921,6 +5696,23 @@}}},+ "supports-color": {+ "version": "7.2.0",+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",+ "requires": {+ "has-flag": "^4.0.0"+ }+ },+ "supports-hyperlinks": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-3.2.0.tgz",+ "integrity": "sha512-zFObLMyZeEwzAoKCyu1B91U79K2t7ApXuQfo8OuxwXLDgcKxuwM+YvcbIhm6QWqz7mHUH1TVytR1PwVVjEuMig==",+ "requires": {+ "has-flag": "^4.0.0",+ "supports-color": "^7.0.0"+ }+ },"swr": {"version": "2.4.1","resolved": "https://registry.npmjs.org/swr/-/swr-2.4.1.tgz",@@ -4934,7 +5726,6 @@"version": "3.3.1","resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz","integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==",- "dev": true,"requires": {"any-promise": "^1.0.0"}@@ -4943,7 +5734,6 @@"version": "1.6.0","resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz","integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==",- "dev": true,"requires": {"thenify": ">= 3.1.0 < 4"}@@ -5066,6 +5856,11 @@"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==","dev": true},+ "unicode-emoji-modifier-base": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/unicode-emoji-modifier-base/-/unicode-emoji-modifier-base-1.0.0.tgz",+ "integrity": "sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g=="+ },"use-sync-external-store": {"version": "1.6.0","resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz",@@ -5402,11 +6197,70 @@"integrity": "sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA==","requires": {}},+ "y18n": {+ "version": "5.0.8",+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="+ },"yaml": {"version": "2.8.3","resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.3.tgz","integrity": "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg=="},+ "yargs": {+ "version": "16.2.0",+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",+ "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",+ "requires": {+ "cliui": "^7.0.2",+ "escalade": "^3.1.1",+ "get-caller-file": "^2.0.5",+ "require-directory": "^2.1.1",+ "string-width": "^4.2.0",+ "y18n": "^5.0.5",+ "yargs-parser": "^20.2.2"+ },+ "dependencies": {+ "ansi-regex": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="+ },+ "emoji-regex": {+ "version": "8.0.0",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="+ },+ "is-fullwidth-code-point": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="+ },+ "string-width": {+ "version": "4.2.3",+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",+ "requires": {+ "emoji-regex": "^8.0.0",+ "is-fullwidth-code-point": "^3.0.0",+ "strip-ansi": "^6.0.1"+ }+ },+ "strip-ansi": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",+ "requires": {+ "ansi-regex": "^5.0.1"+ }+ }+ }+ },+ "yargs-parser": {+ "version": "20.2.9",+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",+ "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w=="+ },"yoga-layout": {"version": "3.2.1","resolved": "https://registry.npmjs.org/yoga-layout/-/yoga-layout-3.2.1.tgz",diff --git a/package.json b/package.jsonindex 26b1adfe..fac610a4 100644--- a/package.json+++ b/package.json@@ -36,6 +36,8 @@"grammy": "^1.42.0","ink": "^5.2.0","js-tiktoken": "^1.0.19",+ "marked": "^15.0.12",+ "marked-terminal": "^7.3.0","node-cron": "^3.0.3","pino": "^9.6.0","react": "^18.3.1",@@ -43,6 +45,7 @@"zod": "^3.25.76"},"devDependencies": {+ "@types/marked-terminal": "^6.1.1","@types/node": "^22.13.0","@types/node-cron": "^3.0.11","@types/react": "^18.3.0",diff --git a/src/capabilities/filesystem/send-file.ts b/src/capabilities/filesystem/send-file.tsnew file mode 100644index 00000000..e62f306d--- /dev/null+++ b/src/capabilities/filesystem/send-file.ts@@ -0,0 +1,50 @@+import { tool } from 'ai';+import { z } from 'zod';+import { existsSync, statSync } from 'node:fs';+import { resolve, basename } from 'node:path';+import type { PermissionManager } from '../permissions.js';++export function createSendFileTool(+ permissions: PermissionManager,+ sendFile: (filePath: string) => Promise<void>,+) {+ return tool({+ description:+ 'Send a file to the user. On Telegram the file is uploaded as an attachment. On CLI the file path and size are displayed. The path must be within an allowed read scope.',+ parameters: z.object({+ path: z.string().describe('Absolute or relative path to the file to send'),+ }),+ execute: async ({ path }) => {+ const resolved = resolve(path);+ const check = await permissions.checkFsAccess(resolved, 'read');+ if (!check.allowed) {+ return `Error: ${check.reason}`;+ }++ if (!existsSync(resolved)) {+ return `Error: File not found: ${resolved}`;+ }++ const stat = statSync(resolved);+ if (stat.isDirectory()) {+ return `Error: ${resolved} is a directory, not a file. Use list_dir to show its contents.`;+ }++ if (stat.size > 50 * 1024 * 1024) {+ return `Error: File too large (${Math.round(stat.size / (1024 * 1024))}MB). Maximum is 50MB.`;+ }++ try {+ await sendFile(resolved);+ const filename = basename(resolved);+ const sizeStr =+ stat.size > 1024 * 1024+ ? `${(stat.size / (1024 * 1024)).toFixed(1)}MB`+ : `${Math.round(stat.size / 1024)}KB`;+ return `File sent: ${filename} (${sizeStr})`;+ } catch (err: any) {+ return `Error sending file: ${err.message}`;+ }+ },+ });+}\ No newline at end of filediff --git a/src/capabilities/registry.ts b/src/capabilities/registry.tsindex 90e7a7e8..cd55d355 100644--- a/src/capabilities/registry.ts+++ b/src/capabilities/registry.ts@@ -6,6 +6,7 @@ import { createCreateFileTool } from './filesystem/create-file.js';import { createListDirTool } from './filesystem/list-dir.js';import { createDeleteFileTool } from './filesystem/delete-file.js';import { createEditFileTool } from './filesystem/edit-file.js';+import { createSendFileTool } from './filesystem/send-file.js';import { createRunCommandTool } from './shell/run-command.js';import { createApproveCommandTool } from './shell/approve-command.js';import { createInstallSkillTool } from './skills/install-skill.js';@@ -33,16 +34,20 @@ export class CapabilityRegistry {private skillLoader?: SkillLoader;private scheduler?: Scheduler;private tokenBudget?: TokenBudget;+ private sendFileHandler?: (filePath: string) => Promise<void>;constructor(skillLoader?: SkillLoader, scheduler?: Scheduler, tokenBudget?: TokenBudget) {this.permissions = new PermissionManager();this.skillLoader = skillLoader;this.scheduler = scheduler;this.tokenBudget = tokenBudget;- this.registerAll();}- private registerAll(): void {+ setSendFileHandler(handler: (filePath: string) => Promise<void>): void {+ this.sendFileHandler = handler;+ }++ registerAll(): void {const manifest = this.permissions.getManifest();if (manifest.capabilities.filesystem.enabled) {@@ -52,6 +57,11 @@ export class CapabilityRegistry {this.tools.list_dir = createListDirTool(this.permissions);this.tools.delete_file = createDeleteFileTool(this.permissions);this.tools.edit_file = createEditFileTool(this.permissions);++ if (this.sendFileHandler) {+ this.tools.send_file = createSendFileTool(this.permissions, this.sendFileHandler);+ }+logger.info('Filesystem tools registered');}diff --git a/src/channels/base.ts b/src/channels/base.tsindex 26cd3fbf..c0c0989a 100644--- a/src/channels/base.ts+++ b/src/channels/base.ts@@ -5,6 +5,7 @@ export interface Channel {start(): Promise<void>;stop(): Promise<void>;send(content: string, targetId?: string, elapsedMs?: number): Promise<void>;+ sendFile(filePath: string, targetId?: string): Promise<void>;stream(content: AsyncIterable<string>, targetId?: string): Promise<void>;typing(targetId?: string): Promise<void>;isReady(): boolean;@@ -19,6 +20,7 @@ export abstract class BaseChannel implements Channel {abstract start(): Promise<void>;abstract stop(): Promise<void>;abstract send(content: string, targetId?: string, elapsedMs?: number): Promise<void>;+ abstract sendFile(filePath: string, targetId?: string): Promise<void>;abstract stream(content: AsyncIterable<string>, targetId?: string): Promise<void>;abstract typing(targetId?: string): Promise<void>;diff --git a/src/channels/cli.ts b/src/channels/cli.tsindex ad58e4e9..a09ac631 100644--- a/src/channels/cli.ts+++ b/src/channels/cli.ts@@ -1,8 +1,11 @@import readline from 'node:readline';+import fs from 'node:fs';+import path from 'node:path';import chalk from 'chalk';import type { ChannelMessage } from '../types/channel.js';import { BaseChannel } from './base.js';import { logger } from '../utils/logger.js';+import { renderMarkdown } from '../utils/markdown.js';export class CLIChannel extends BaseChannel {readonly type = 'cli' as const;@@ -55,17 +58,44 @@ export class CLIChannel extends BaseChannel {async send(content: string, _targetId?: string, elapsedMs?: number): Promise<void> {const timeStr = elapsedMs != null ? chalk.dim(` (${(elapsedMs / 1000).toFixed(1)}s)`) : '';+ const rendered = renderMarkdown(content);console.log('');console.log(chalk.cyan(` ${this.agentName}:`) + timeStr);- console.log(` ${content}`);+ const indented = rendered+ .split('\n')+ .map((line: string) => ` ${line}`)+ .join('\n');+ console.log(indented);+ console.log('');+ this.showPrompt();+ }++ async sendFile(filePath: string, _targetId?: string): Promise<void> {+ const resolved = path.resolve(filePath);+ if (!fs.existsSync(resolved)) {+ console.log(chalk.red(` File not found: ${filePath}`));+ return;+ }+ const stat = fs.statSync(resolved);+ const sizeStr = stat.size > 1024 * 1024+ ? `${(stat.size / (1024 * 1024)).toFixed(1)}MB`+ : stat.size > 1024+ ? `${(stat.size / 1024).toFixed(1)}KB`+ : `${stat.size}B`;+ console.log('');+ console.log(chalk.cyan(` ${this.agentName}:`) + chalk.dim(' (file)'));+ console.log(chalk.dim(` path: ${resolved}`));+ console.log(chalk.dim(` size: ${sizeStr}`));console.log('');this.showPrompt();}async stream(content: AsyncIterable<string>, _targetId?: string): Promise<void> {process.stdout.write(chalk.cyan(` ${this.agentName}: `));+ let full = '';for await (const chunk of content) {process.stdout.write(chunk);+ full += chunk;}process.stdout.write('\n\n');this.showPrompt();diff --git a/src/channels/telegram.ts b/src/channels/telegram.tsindex 92fab5ad..df478554 100644--- a/src/channels/telegram.ts+++ b/src/channels/telegram.ts@@ -1,9 +1,14 @@-import { Bot } from 'grammy';+import fs from 'node:fs';+import path from 'node:path';+import { Bot, InputFile } from 'grammy';import { autoRetry } from '@grammyjs/auto-retry';import type { ChannelMessage } from '../types/channel.js';import { BaseChannel } from './base.js';import type { MercuryConfig } from '../utils/config.js';import { logger } from '../utils/logger.js';+import { mdToTelegram } from '../utils/markdown.js';++const MAX_MESSAGE_LENGTH = 4096;export class TelegramChannel extends BaseChannel {readonly type = 'telegram' as const;@@ -72,8 +77,55 @@ export class TelegramChannel extends BaseChannel {return;}const timeSuffix = elapsedMs != null ? `\n⏱ ${(elapsedMs / 1000).toFixed(1)}s` : '';- logger.debug({ chatId, textLen: content.length }, 'Telegram sending message');- await this.bot.api.sendMessage(chatId, content + timeSuffix);+ const fullContent = content + timeSuffix;+ const html = mdToTelegram(fullContent);+ const chunks = this.splitMessage(html, MAX_MESSAGE_LENGTH);++ for (const chunk of chunks) {+ try {+ await this.bot.api.sendMessage(chatId, chunk, { parse_mode: 'HTML' });+ } catch (err: any) {+ logger.warn({ err: err.message }, 'HTML parse failed, sending as plain text');+ try {+ await this.bot.api.sendMessage(chatId, this.stripHtml(chunk));+ } catch (err2: any) {+ logger.error({ err: err2.message }, 'Telegram send failed');+ }+ }+ }+ }++ async sendFile(filePath: string, targetId?: string): Promise<void> {+ const chatId = this.parseChatId(targetId);+ if (!chatId || !this.bot) {+ logger.warn({ targetId, chatId }, 'Telegram sendFile: no valid chat ID');+ return;+ }+ const resolved = path.resolve(filePath);+ if (!fs.existsSync(resolved)) {+ await this.bot.api.sendMessage(chatId, `File not found: ${filePath}`);+ return;+ }++ const inputFile = new InputFile(resolved);+ const filename = path.basename(resolved);+ const ext = path.extname(resolved).toLowerCase();++ try {+ if (this.isImageFile(ext)) {+ await this.bot.api.sendPhoto(chatId, inputFile, { caption: filename });+ } else if (this.isAudioFile(ext)) {+ await this.bot.api.sendAudio(chatId, inputFile, { title: filename });+ } else if (this.isVideoFile(ext)) {+ await this.bot.api.sendVideo(chatId, inputFile, { caption: filename });+ } else {+ await this.bot.api.sendDocument(chatId, inputFile, { caption: filename });+ }+ logger.info({ file: resolved, chatId }, 'File sent via Telegram');+ } catch (err: any) {+ logger.error({ err: err.message, file: resolved }, 'Telegram sendFile failed');+ await this.bot.api.sendMessage(chatId, `Failed to send file: ${err.message}`).catch(() => {});+ }}async stream(content: AsyncIterable<string>, targetId?: string): Promise<void> {@@ -84,7 +136,12 @@ export class TelegramChannel extends BaseChannel {for await (const chunk of content) {full += chunk;}- await this.bot.api.sendMessage(chatId, full);+ const html = mdToTelegram(full);+ try {+ await this.bot.api.sendMessage(chatId, html, { parse_mode: 'HTML' });+ } catch (err: any) {+ await this.bot.api.sendMessage(chatId, this.stripHtml(html));+ }}async typing(targetId?: string): Promise<void> {@@ -116,18 +173,65 @@ export class TelegramChannel extends BaseChannel {for await (const chunk of textStream) {full += chunk;}- await this.bot.api.sendMessage(chatId, full);+ const html = mdToTelegram(full);+ try {+ await this.bot.api.sendMessage(chatId, html, { parse_mode: 'HTML' });+ } catch {+ await this.bot.api.sendMessage(chatId, this.stripHtml(html));+ }} finally {this.stopTypingLoop();}}+ private splitMessage(text: string, maxLen: number): string[] {+ if (text.length <= maxLen) return [text];+ const chunks: string[] = [];+ let remaining = text;+ while (remaining.length > 0) {+ let splitAt = maxLen;+ if (remaining.length > maxLen) {+ const lastNewline = remaining.lastIndexOf('\n', maxLen);+ if (lastNewline > maxLen * 0.5) {+ splitAt = lastNewline + 1;+ }+ }+ chunks.push(remaining.slice(0, splitAt));+ remaining = remaining.slice(splitAt);+ }+ return chunks;+ }++ private stripHtml(html: string): string {+ return html+ .replace(/<\/?(b|i|s|u|code|pre|a|blockquote|strong|em)[^>]*>/gi, '')+ .replace(/<pre><code[^>]*>/gi, '')+ .replace(/<\/code><\/pre>/gi, '')+ .replace(/<[^>]+>/g, '')+ .replace(/</g, '<')+ .replace(/>/g, '>')+ .replace(/&/g, '&');+ }++ private isImageFile(ext: string): boolean {+ return ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.bmp', '.svg'].includes(ext);+ }++ private isAudioFile(ext: string): boolean {+ return ['.mp3', '.ogg', '.wav', '.flac', '.m4a'].includes(ext);+ }++ private isVideoFile(ext: string): boolean {+ return ['.mp4', '.mov', '.avi', '.mkv', '.webm'].includes(ext);+ }+private parseChatId(targetId?: string): number | null {if (!targetId) return this.ownerChatId;if (targetId.startsWith('telegram:')) {const raw = Number(targetId.split(':')[1]);return isNaN(raw) ? this.ownerChatId : raw;}+ if (targetId === 'notification') return this.ownerChatId;const num = Number(targetId);return isNaN(num) ? this.ownerChatId : num;}diff --git a/src/index.ts b/src/index.tsindex 7e71a98f..e27dbdeb 100644--- a/src/index.ts+++ b/src/index.ts@@ -155,6 +155,17 @@ async function runAgent(): Promise<void> {const channels = new ChannelRegistry(config);const capabilities = new CapabilityRegistry(skillLoader, scheduler, tokenBudget);+ capabilities.setSendFileHandler(async (filePath: string) => {+ const msg = channels.getActiveChannels().includes('telegram')+ ? channels.get('telegram')+ : channels.get('cli');+ if (msg) {+ await msg.sendFile(filePath);+ }+ });++ capabilities.registerAll();+const agent = new Agent(config, providers, identity, shortTerm, longTerm, episodic, channels, tokenBudget, capabilities, scheduler,);diff --git a/src/utils/manual.ts b/src/utils/manual.tsnew file mode 100644index 00000000..eb048d01--- /dev/null+++ b/src/utils/manual.ts@@ -0,0 +1,146 @@+import chalk from 'chalk';++export function getManual(): string {+ const sections: string[] = [];++ sections.push('');+ sections.push(chalk.bold.cyan(' MERCURY — Capabilities & Commands'));+ sections.push(chalk.dim(' ─────────────────────────────────────────'));+ sections.push('');++ sections.push(chalk.bold.white(' Built-in Tools'));+ sections.push(chalk.dim(' Tools Mercury can use during conversations.'));+ sections.push('');++ const tools = [+ ['read_file', 'Read file contents', 'path (required)'],+ ['write_file', 'Write to an existing file', 'path, content'],+ ['create_file', 'Create a new file (+ dirs)', 'path, content'],+ ['edit_file', 'Replace specific text in a file', 'path, old_string, new_string'],+ ['list_dir', 'List directory contents', 'path'],+ ['delete_file', 'Delete a file', 'path'],+ ['run_command', 'Execute a shell command', 'command'],+ ['approve_command', 'Permanently approve a command type', 'command (e.g. "curl")'],+ ['fetch_url', 'Fetch a URL and return content', 'url, format? (text/markdown)'],+ ['git_status', 'Show working tree status', 'path?'],+ ['git_diff', 'Show file changes', 'path?, staged?'],+ ['git_log', 'Show commit history', 'count?, path?'],+ ['git_add', 'Stage files for commit', 'paths (array)'],+ ['git_commit', 'Create a commit', 'message'],+ ['git_push', 'Push to remote (needs approval)', 'remote?, branch?'],+ ['install_skill', 'Install a skill from content or URL', 'content? or url?'],+ ['list_skills', 'List installed skills', '—'],+ ['use_skill', 'Invoke a skill by name', 'name'],+ ['schedule_task', 'Schedule a recurring or delayed task', 'cron? or delay_seconds, description, prompt? or skill_name?'],+ ['list_scheduled_tasks', 'List all scheduled tasks', '—'],+ ['cancel_scheduled_task', 'Cancel a scheduled task', 'id'],+ ['budget_status', 'Check token budget', '—'],+ ];++ for (const [name, desc, params] of tools) {+ sections.push(` ${chalk.cyan(name.padEnd(24))} ${desc}`);+ sections.push(` ${' '.repeat(24)} ${chalk.dim(params)}`);+ }++ sections.push('');+ sections.push(chalk.bold.white(' CLI Commands'));+ sections.push(chalk.dim(' Run these from your terminal (no API calls consumed).'));+ sections.push('');++ const commands = [+ ['mercury', 'Start the agent (same as mercury start)'],+ ['mercury start', 'Start the agent'],+ ['mercury setup', 'Re-run the setup wizard'],+ ['mercury status', 'Show current configuration'],+ ['mercury help', 'Show this manual'],+ ['mercury --verbose', 'Start with debug logging on stderr'],+ ];++ for (const [cmd, desc] of commands) {+ sections.push(` ${chalk.white(cmd.padEnd(26))} ${desc}`);+ }++ sections.push('');+ sections.push(chalk.bold.white(' In-Chat Commands'));+ sections.push(chalk.dim(' Type these during a conversation (no API calls).'));+ sections.push('');++ const chat = [+ ['/help', 'Show this manual'],+ ['/status', 'Show config and budget info'],+ ['/tools', 'List currently loaded tools'],+ ['/skills', 'List installed skills'],+ ];++ for (const [cmd, desc] of chat) {+ sections.push(` ${chalk.white(cmd.padEnd(16))} ${desc}`);+ }++ sections.push('');+ sections.push(chalk.bold.white(' Permissions'));+ sections.push('');++ const perms = [+ 'Commands are blocked (never run), auto-approved, or need approval.',+ 'Say "always" when prompted to permanently approve a command type.',+ 'Edit ~/.mercury/permissions.yaml to customize manually.',+ 'File access is scoped — new paths need approval (y/n/always).',+ ];++ for (const p of perms) {+ sections.push(` ${chalk.dim('•')} ${p}`);+ }++ sections.push('');+ sections.push(chalk.bold.white(' Skills'));+ sections.push('');++ const skillInfo = [+ 'Skills live in ~/.mercury/skills/<name>/SKILL.md',+ 'Install: ask Mercury to "install skill from <url>" or paste content',+ 'Invoke: ask Mercury to "use skill <name>"',+ 'Schedule: "remind me daily at 9am to run daily-digest skill"',+ ];++ for (const s of skillInfo) {+ sections.push(` ${chalk.dim('•')} ${s}`);+ }++ sections.push('');+ sections.push(chalk.bold.white(' Scheduling'));+ sections.push('');++ const schedInfo = [+ 'Recurring: "every day at 9am remind me to…"',+ 'One-shot: "remind me in 15 seconds to…"',+ 'Tasks persist to ~/.mercury/schedules.yaml',+ ];++ for (const s of schedInfo) {+ sections.push(` ${chalk.dim('•')} ${s}`);+ }++ sections.push('');+ sections.push(chalk.bold.white(' Configuration'));+ sections.push('');++ const configInfo = [+ ['~/.mercury/mercury.yaml', 'Main config (providers, channels, budget)'],+ ['~/.mercury/permissions.yaml', 'Capabilities and approval rules'],+ ['~/.mercury/soul/*.md', 'Agent personality (soul, persona, taste, heartbeat)'],+ ['~/.mercury/skills/', 'Installed skills'],+ ['~/.mercury/schedules.yaml', 'Scheduled tasks'],+ ['~/.mercury/token-usage.json', 'Daily token usage tracking'],+ ['~/.mercury/memory/', 'Short-term, long-term, episodic memory'],+ ];++ for (const [path, desc] of configInfo) {+ sections.push(` ${chalk.dim(path.padEnd(36))} ${desc}`);+ }++ sections.push('');+ sections.push(chalk.dim(' mercury.cosmicstack.org'));+ sections.push('');++ return sections.join('\n');+}\ No newline at end of filediff --git a/src/utils/markdown.ts b/src/utils/markdown.tsnew file mode 100644index 00000000..a2574fd4--- /dev/null+++ b/src/utils/markdown.ts@@ -0,0 +1,72 @@+import { Marked } from 'marked';+import { markedTerminal } from 'marked-terminal';+import type { MarkedExtension } from 'marked';++// eslint-disable-next-line @typescript-eslint/no-explicit-any+const terminalRenderer = markedTerminal({ width: 80, text: ' ' } as any) as unknown as MarkedExtension;++const marked = new Marked(terminalRenderer);++export function renderMarkdown(text: string): string {+ try {+ const result = marked.parse(text);+ if (typeof result === 'string') return result;+ return text;+ } catch {+ return text;+ }+}++function escapeHtml(text: string): string {+ return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');+}++export function mdToTelegram(text: string): string {+ let out = text;++ const codeBlocks: string[] = [];+ out = out.replace(/```(\w*)\n([\s\S]*?)```/g, (_match, lang, code) => {+ const placeholder = `__CODEBLOCK_${codeBlocks.length}__`;+ codeBlocks.push(`<pre><code class="${lang}">${escapeHtml(code)}</code></pre>`);+ return placeholder;+ });++ const inlineCodes: string[] = [];+ out = out.replace(/`([^`]+)`/g, (_match, code) => {+ const placeholder = `__INLINECODE_${inlineCodes.length}__`;+ inlineCodes.push(`<code>${escapeHtml(code)}</code>`);+ return placeholder;+ });++ const links: string[] = [];+ out = out.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_match, label, href) => {+ const placeholder = `__LINK_${links.length}__`;+ links.push(`<a href="${escapeHtml(href)}">${escapeHtml(label)}</a>`);+ return placeholder;+ });++ out = escapeHtml(out);++ out = out.replace(/^### (.+)$/gm, '<b><i>$1</i></b>');+ out = out.replace(/^## (.+)$/gm, '<b>$1</b>');+ out = out.replace(/^# (.+)$/gm, '<b>$1</b>');+ out = out.replace(/\*\*([^*]+)\*\*/g, '<b>$1</b>');+ out = out.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g, '<i>$1</i>');+ out = out.replace(/~~([^~]+)~~/g, '<s>$1</s>');++ for (let i = 0; i < inlineCodes.length; i++) {+ out = out.replace(`__INLINECODE_${i}__`, inlineCodes[i]);+ }+ for (let i = 0; i < codeBlocks.length; i++) {+ out = out.replace(`__CODEBLOCK_${i}__`, codeBlocks[i]);+ }+ for (let i = 0; i < links.length; i++) {+ out = out.replace(`__LINK_${i}__`, links[i]);+ }++ if (out.length > 4096) {+ out = out.slice(0, 4090) + '...';+ }++ return out;+}\ No newline at end of file