Skip to content

Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI, Telegram or More.

fix: Windows path permission issues — use path.sep for scope matching, add Windows path patterns to cwd check

Mercury [Bot]81422c5587f2
diff --git a/package.json b/package.json
index 8240d80b..b3b610d4 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@cosmicstack/mercury-agent",
- "version": "0.2.0",
+ "version": "0.2.1",
"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/capabilities/permissions.ts b/src/capabilities/permissions.ts
index 965a8ae6..6e718cab 100644
--- a/src/capabilities/permissions.ts
+++ b/src/capabilities/permissions.ts
@@ -1,5 +1,5 @@
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
-import { join, resolve } from 'node:path';
+import { join, resolve, sep } from 'node:path';
import { homedir } from 'node:os';
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
import { getMercuryHome } from '../utils/config.js';
@@ -325,7 +325,7 @@ export class PermissionManager {
const scopes = this.manifest.capabilities.filesystem.scopes;
for (const scope of scopes) {
const scopeResolved = resolve(scope.path.replace(/^~/, homedir()));
- if (resolvedPath === scopeResolved || resolvedPath.startsWith(scopeResolved + '/')) {
+ if (resolvedPath === scopeResolved || resolvedPath.startsWith(scopeResolved + sep)) {
return scope;
}
}
@@ -367,6 +367,8 @@ export class PermissionManager {
/(?:^|\s)(\/[^\s]+)/,
/(?:^|\s)(~\/[^\s]+)/,
/(?:^|\s)\.\.\/([^\s]+)/,
+ /(?:^|\s)([A-Za-z]:\\[^\s]+)/,
+ /(?:^|\s)(\\\\[^\s]+)/,
];
for (const p of pathPatterns) {
const match = command.match(p);
diff --git a/src/index.ts b/src/index.ts
index 9ddc1f50..e7858b08 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -33,7 +33,7 @@ function banner() {
}
console.log('');
console.log(chalk.white(' an AI agent for personal tasks'));
- console.log(chalk.dim(' v0.2.0 · by Cosmic Stack · mercury.cosmicstack.org'));
+ console.log(chalk.dim(' v0.2.1 · by Cosmic Stack · mercury.cosmicstack.org'));
console.log('');
}
@@ -360,7 +360,7 @@ const program = new Command();
program
.name('mercury')
.description('Mercury — Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access.')
- .version('0.2.0')
+ .version('0.2.1')
.option('-v, --verbose', 'Show debug logs')
.action(async () => {
if (!isSetupComplete()) {