@miruzero/zero-agent 0.3.1 → 0.3.2

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/README.md CHANGED
@@ -1,34 +1,19 @@
1
- # Zero Agent
1
+ # Zero Agent
2
2
 
3
3
  Local worker agent for Zero MCP multi-device execution.
4
4
 
5
- ## One-command start
6
-
7
- For a normal user, start with npm/npx and let the agent create local files automatically:
5
+ ## Quick start
8
6
 
9
7
  ```powershell
10
- npx @miruzero/zero-agent@latest start --name TON --code ZERO-XXXX
8
+ npx @miruzero/zero-agent@latest start --once
11
9
  ```
12
10
 
13
- Or inside this package:
14
-
15
- ```powershell
16
- npm start
17
- ```
18
-
19
- On first start, the agent creates:
20
-
21
- ```text
22
- %USERPROFILE%\.zero-agent\device.json
23
- %USERPROFILE%\.zero-agent\start-zero-agent.cmd
24
- %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\MiruZeroAgent.vbs
25
- %USERPROFILE%\.zero-agent\logs\zero-agent.log
26
- ```
11
+ On first run, `start` creates local config, a launcher, and a Windows user-logon autostart file automatically.
27
12
 
28
13
  ## Commands
29
14
 
30
15
  ```powershell
31
- zero-agent setup --server https://zero.miru.work --name TON --code ZERO-XXXX
16
+ zero-agent setup --name TON --code ZERO-XXXX
32
17
  zero-agent start --once
33
18
  zero-agent start
34
19
  zero-agent status
@@ -38,15 +23,17 @@ zero-agent tools
38
23
  zero-agent capabilities
39
24
  ```
40
25
 
41
- ## State
26
+ ## Autostart
42
27
 
43
28
  Default state path:
44
29
 
45
30
  ```text
46
31
  %USERPROFILE%\.zero-agent\device.json
32
+ %USERPROFILE%\.zero-agent\start-zero-agent.cmd
33
+ %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\MiruZeroAgent.vbs
47
34
  ```
48
35
 
49
- Device names default to the local PC hostname. Use --name only when you want a custom display name.
36
+ The launcher uses `npx -y @miruzero/zero-agent@<current-version> start` so the user-logon agent does not depend on a stale global install.
50
37
 
51
38
  Device tokens are local secrets and must not be printed or committed.
52
39
 
@@ -55,4 +42,4 @@ Device tokens are local secrets and must not be printed or committed.
55
42
  ```powershell
56
43
  npm test
57
44
  npm pack --dry-run
58
- ```
45
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miruzero/zero-agent",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "MiruZero local worker agent for multi-device tool execution.",
5
5
  "type": "commonjs",
6
6
  "bin": {
package/src/autostart.js CHANGED
@@ -1,9 +1,10 @@
1
- 'use strict';
1
+ 'use strict';
2
2
 
3
3
  const fs = require('node:fs');
4
4
  const os = require('node:os');
5
5
  const path = require('node:path');
6
6
  const config = require('./config');
7
+ const pkg = require('../package.json');
7
8
 
8
9
  const DEFAULT_INTERVAL = 30000;
9
10
 
@@ -23,7 +24,6 @@ const startupDir = (env = process.env) => {
23
24
  const appData = env.APPDATA || path.join(os.homedir(), 'AppData', 'Roaming');
24
25
  return path.join(appData, 'Microsoft', 'Windows', 'Start Menu', 'Programs', 'Startup');
25
26
  };
26
-
27
27
  const paths = (env = process.env) => {
28
28
  const home = config.agentHome(env);
29
29
  return {
@@ -34,8 +34,11 @@ const paths = (env = process.env) => {
34
34
  };
35
35
  };
36
36
 
37
+ const packageSpec = () => pkg.name + '@' + pkg.version;
38
+
37
39
  const launcherContent = ({ interval = DEFAULT_INTERVAL, roots, logFile }, env = process.env) => {
38
40
  const home = config.agentHome(env);
41
+ const spec = packageSpec();
39
42
  return [
40
43
  '@echo off',
41
44
  'setlocal',
@@ -45,8 +48,8 @@ const launcherContent = ({ interval = DEFAULT_INTERVAL, roots, logFile }, env =
45
48
  'set "ZERO_AGENT_INTERVAL=' + Number(interval || DEFAULT_INTERVAL) + '"',
46
49
  'rem interval=' + Number(interval || DEFAULT_INTERVAL) + 'ms',
47
50
  'if not exist ' + q(winPath(path.dirname(logFile))) + ' mkdir ' + q(winPath(path.dirname(logFile))),
48
- 'echo [%date% %time%] starting zero-agent >> ' + q(winPath(logFile)),
49
- 'zero-agent start --interval %ZERO_AGENT_INTERVAL% >> ' + q(winPath(logFile)) + ' 2>&1',
51
+ 'echo [%date% %time%] starting ' + spec + ' >> ' + q(winPath(logFile)),
52
+ 'npx -y ' + spec + ' start --interval %ZERO_AGENT_INTERVAL% >> ' + q(winPath(logFile)) + ' 2>&1',
50
53
  ''
51
54
  ].join('\r\n');
52
55
  };
@@ -74,8 +77,8 @@ const autostart = {
74
77
  DEFAULT_INTERVAL,
75
78
  defaultRoots,
76
79
  paths,
77
- prepare
80
+ prepare,
81
+ launcherContent
78
82
  };
79
83
 
80
- Object.assign(exports, autostart);
81
-
84
+ Object.assign(exports, autostart);