Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI, Telegram or More.
v0.4.0 — persistent cwd, cd tool, Ollama, Telegram messaging, relative paths
Salman Qureshif54e1a6c06c3
diff --git a/RELEASE.md b/RELEASE.mdnew file mode 100644index 00000000..d42ea4cb--- /dev/null+++ b/RELEASE.md@@ -0,0 +1,46 @@+# Release v0.4.0++## ☿ Mercury Agent v0.4.0++**Persistent working directory, Ollama support, Telegram messaging, and more.**++### Highlights++- **`cd` tool** — Change directories persistently. All subsequent file, shell, and git operations use the new working directory. No more lost `cd` between commands.+- **Relative path support** — All 8 filesystem tools and all 6 git tools now resolve relative paths against the current working directory instead of `process.cwd()`.+- **`run_command` learns `cd`** — Running `cd /some/path` or `cd /some/path && ls` in `run_command` automatically updates the persistent working directory.+- **Ollama provider** — Run Mercury fully locally with Ollama. Added during onboarding with model selection.+- **Telegram paired messaging** — New `send_message` tool lets the agent proactively send messages to the paired Telegram chat.+- **Improved onboarding** — Relaxed provider setup, better Telegram guidance, Ollama configuration flow.++### What's New++- `cd` tool — persistent directory changes across all tool calls+- `currentCwd` state in `CapabilityRegistry` with `getCwd()`/`setCwd()`+- `send_message` capability for paired Telegram chats+- Ollama provider (`ollama-ai-provider`) with onboarding setup+- Enhanced Telegram channel with paired messaging support++### Fixes & Improvements++- All filesystem tools (`read_file`, `write_file`, `create_file`, `list_dir`, `delete_file`, `edit_file`, `send_file`, `approve_scope`) now resolve relative paths against current working directory+- All git tools (`git_status`, `git_diff`, `git_log`, `git_add`, `git_commit`, `git_push`) now use `cwd: getCwd()` in `execSync`+- `run_command` uses persistent `cwd` and auto-detects directory changes+- Improved provider onboarding flow with Ollama support+- Enhanced `.env.example` with all available configuration options+- Updated documentation with new tools and provider setup++### Migration from v0.3.x++No configuration changes required. The `cd` tool is automatically registered. Existing relative paths in tool calls will now resolve against the persistent working directory (defaults to `process.cwd()` on startup, same as before).++### Credits++- Persistent working directory implementation — @salmanqureshi+- Ollama provider & onboarding improvements — @salmanqureshi+- Telegram paired messaging — @salmanqureshi+- Social media & documentation updates — reviewed by PR #3 contributors++---++**Full Changelog**: https://github.com/cosmicstack-labs/mercury-agent/compare/v0.3.4...v0.4.0\ No newline at end of filediff --git a/package-lock.json b/package-lock.jsonindex 01a15ef1..e18d9414 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,12 +1,12 @@{"name": "@cosmicstack/mercury-agent",- "version": "0.2.6",+ "version": "0.4.0","lockfileVersion": 2,"requires": true,"packages": {"": {"name": "@cosmicstack/mercury-agent",- "version": "0.2.6",+ "version": "0.4.0","license": "MIT","dependencies": {"@ai-sdk/anthropic": "^1.2.0",@@ -16,7 +16,6 @@"chalk": "^5.4.0","commander": "^12.1.0","dotenv": "^16.4.7",- "figlet": "^1.11.0","grammy": "^1.42.0","js-tiktoken": "^1.0.19","marked": "^14.1.4",@@ -1444,28 +1443,6 @@}}},- "node_modules/figlet": {- "version": "1.11.0",- "resolved": "https://registry.npmjs.org/figlet/-/figlet-1.11.0.tgz",- "integrity": "sha512-EEx3OS/l2bFqcUNN2NM9FPJp8vAMrgbCxsbl2hbcJNNxOEwVe3mEzrhan7TbJQViZa8mMqhihlbCaqD+LyYKTQ==",- "dependencies": {- "commander": "^14.0.0"- },- "bin": {- "figlet": "bin/index.js"- },- "engines": {- "node": ">= 17.0.0"- }- },- "node_modules/figlet/node_modules/commander": {- "version": "14.0.3",- "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz",- "integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==",- "engines": {- "node": ">=20"- }- },"node_modules/fix-dts-default-cjs-exports": {"version": "1.0.1","resolved": "https://registry.npmjs.org/fix-dts-default-cjs-exports/-/fix-dts-default-cjs-exports-1.0.1.tgz",@@ -1702,7 +1679,6 @@"version": "1.2.0","resolved": "https://registry.npmjs.org/ollama-ai-provider/-/ollama-ai-provider-1.2.0.tgz","integrity": "sha512-jTNFruwe3O/ruJeppI/quoOUxG7NA6blG3ZyQj3lei4+NnJo7bi3eIRWqlVpRlu/mbzbFXeJSBuYQWF6pzGKww==",- "license": "Apache-2.0","dependencies": {"@ai-sdk/provider": "^1.0.0","@ai-sdk/provider-utils": "^2.0.0",@@ -1728,34 +1704,12 @@"node": ">=14.0.0"}},- "node_modules/onetime": {- "version": "5.1.2",- "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",- "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",- "dependencies": {- "mimic-fn": "^2.1.0"- },- "engines": {- "node": ">=6"- },- "funding": {- "url": "https://github.com/sponsors/sindresorhus"- }- },"node_modules/partial-json": {"version": "0.1.7","resolved": "https://registry.npmjs.org/partial-json/-/partial-json-0.1.7.tgz","integrity": "sha512-Njv/59hHaokb/hRUjce3Hdv12wd60MtM9Z5Olmn+nehe0QDAsRtRbJPvJ0Z91TusF0SuZRIvnM+S4l6EIP8leA==","license": "MIT"},- "node_modules/patch-console": {- "version": "2.0.0",- "resolved": "https://registry.npmjs.org/patch-console/-/patch-console-2.0.0.tgz",- "integrity": "sha512-0YNdUceMdaQwoKce1gatDScmMo5pu/tfABfnzEqeG0gtTmd7mh/WcwgUjtAeOU7N8nFFlbQBnFK2gXW5fGvmMA==",- "engines": {- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"- }- },"node_modules/pathe": {"version": "2.0.3","resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",@@ -3858,21 +3812,6 @@"dev": true,"requires": {}},- "figlet": {- "version": "1.11.0",- "resolved": "https://registry.npmjs.org/figlet/-/figlet-1.11.0.tgz",- "integrity": "sha512-EEx3OS/l2bFqcUNN2NM9FPJp8vAMrgbCxsbl2hbcJNNxOEwVe3mEzrhan7TbJQViZa8mMqhihlbCaqD+LyYKTQ==",- "requires": {- "commander": "^14.0.0"- },- "dependencies": {- "commander": {- "version": "14.0.3",- "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz",- "integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw=="- }- }- },"fix-dts-default-cjs-exports": {"version": "1.0.1","resolved": "https://registry.npmjs.org/fix-dts-default-cjs-exports/-/fix-dts-default-cjs-exports-1.0.1.tgz",@@ -4054,24 +3993,11 @@"resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz","integrity": "sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA=="},- "onetime": {- "version": "5.1.2",- "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",- "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",- "requires": {- "mimic-fn": "^2.1.0"- }- },"partial-json": {"version": "0.1.7","resolved": "https://registry.npmjs.org/partial-json/-/partial-json-0.1.7.tgz","integrity": "sha512-Njv/59hHaokb/hRUjce3Hdv12wd60MtM9Z5Olmn+nehe0QDAsRtRbJPvJ0Z91TusF0SuZRIvnM+S4l6EIP8leA=="},- "patch-console": {- "version": "2.0.0",- "resolved": "https://registry.npmjs.org/patch-console/-/patch-console-2.0.0.tgz",- "integrity": "sha512-0YNdUceMdaQwoKce1gatDScmMo5pu/tfABfnzEqeG0gtTmd7mh/WcwgUjtAeOU7N8nFFlbQBnFK2gXW5fGvmMA=="- },"pathe": {"version": "2.0.3","resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",diff --git a/package.json b/package.jsonindex 0fd85bfb..837dc617 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "@cosmicstack/mercury-agent",- "version": "0.3.4",+ "version": "0.4.0","description": "Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI or Telegram.","type": "module","main": "dist/index.js",diff --git a/src/index.ts b/src/index.tsindex 436a39ed..8a6413e6 100644--- a/src/index.ts+++ b/src/index.ts@@ -4,7 +4,7 @@ import { dirname, join } from 'node:path';import { Command } from 'commander';import readline from 'node:readline';import chalk from 'chalk';-import figlet from 'figlet';+import { loadConfig, saveConfig, isSetupComplete, getMercuryHome, ensureCreatorField, clearTelegramPairing, isProviderConfigured } from './utils/config.js';import type { MercuryConfig } from './utils/config.js';import type { ProviderName } from './utils/config.js';