aamp-openclaw-plugin 0.1.28 → 0.1.29

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.
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
3
+ import { cpSync, existsSync, mkdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs'
4
4
  import { homedir } from 'node:os'
5
- import { dirname, join } from 'node:path'
5
+ import { dirname, join, resolve } from 'node:path'
6
6
  import { createInterface } from 'node:readline/promises'
7
7
  import { stdin as input, stdout as output, stderr } from 'node:process'
8
8
  import { spawnSync } from 'node:child_process'
@@ -699,7 +699,18 @@ export async function main() {
699
699
  process.exitCode = 1
700
700
  }
701
701
 
702
- if (process.argv[1] === fileURLToPath(import.meta.url)) {
702
+ export function shouldRunAsCli(argv1 = process.argv[1]) {
703
+ if (!argv1) return false
704
+
705
+ const entryPath = fileURLToPath(import.meta.url)
706
+ try {
707
+ return realpathSync(argv1) === realpathSync(entryPath)
708
+ } catch {
709
+ return resolve(argv1) === entryPath
710
+ }
711
+ }
712
+
713
+ if (shouldRunAsCli()) {
703
714
  main().catch((err) => {
704
715
  stderr.write(`${err instanceof Error ? err.message : String(err)}\n`)
705
716
  process.exit(1)
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "skills"
8
8
  ],
9
9
  "license": "MIT",
10
- "version": "0.1.28",
10
+ "version": "0.1.29",
11
11
  "description": "AAMP Agent Mail Protocol — OpenClaw plugin. Gives OpenClaw an AAMP mailbox identity and lets it receive, process and reply to AAMP tasks.",
12
12
  "type": "module",
13
13
  "main": "dist/index.js",