@daomar/agentfleet 2.0.0
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/LICENSE +21 -0
- package/README.md +310 -0
- package/README.zh-CN.md +310 -0
- package/assets/icon.png +0 -0
- package/assets/icon.svg +51 -0
- package/assets/og-image.svg +57 -0
- package/assets/paypal-donation.png +0 -0
- package/assets/wechat-donation.jpg +0 -0
- package/dist/cli.js +86 -0
- package/dist/commands/install.js +68 -0
- package/dist/commands/run.js +136 -0
- package/dist/commands/status.js +215 -0
- package/dist/commands/stop.js +37 -0
- package/dist/commands/submit.js +72 -0
- package/dist/commands/uninstall.js +41 -0
- package/dist/locales/en-US.json +162 -0
- package/dist/locales/zh-CN.json +162 -0
- package/dist/services/agent-executor.js +143 -0
- package/dist/services/auto-start.js +41 -0
- package/dist/services/bootstrap.js +24 -0
- package/dist/services/daemon.js +192 -0
- package/dist/services/i18n.js +150 -0
- package/dist/services/logger.js +99 -0
- package/dist/services/macos-auto-start.js +126 -0
- package/dist/services/onedrive-detector.js +158 -0
- package/dist/services/provider-selection.js +132 -0
- package/dist/services/result-writer.js +85 -0
- package/dist/services/setup.js +219 -0
- package/dist/services/shortcut.js +159 -0
- package/dist/services/task-watcher.js +199 -0
- package/dist/services/version-checker.js +93 -0
- package/dist/services/windows-service.js +125 -0
- package/dist/types/index.js +12 -0
- package/package.json +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 daomar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/icon.svg" alt="AgentFleet icon" width="160" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
[English](README.md) | [简体中文](README.zh-CN.md)
|
|
6
|
+
|
|
7
|
+
# AgentFleet
|
|
8
|
+
|
|
9
|
+
> Distributed agent orchestration, without a control plane.
|
|
10
|
+
|
|
11
|
+
AgentFleet is a decentralized, multi-machine coding agent fabric built on top of OneDrive sync. Any enrolled machine can dispatch work. Every machine can execute it. There is no central scheduler, broker, or control plane to keep alive.
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
AgentFleet lets you fan out coding tasks across all of your machines simultaneously. Submit a task from any machine, and every machine running AgentFleet will see the same task, execute it locally with its installed coding agent, and write back machine-scoped results.
|
|
16
|
+
|
|
17
|
+
**How it works:**
|
|
18
|
+
1. Your machines share a synced OneDrive workspace.
|
|
19
|
+
2. AgentFleet exposes stable local paths under `~/.agentfleet/`.
|
|
20
|
+
3. Any machine can create a task in the shared `tasks/` directory.
|
|
21
|
+
4. Every machine running `agentfleet run` picks up that task independently.
|
|
22
|
+
5. Results land in a shared `output/` directory with hostname-prefixed files to avoid collisions.
|
|
23
|
+
|
|
24
|
+
No servers, no databases, no control plane — just distributed coordination through sync.
|
|
25
|
+
|
|
26
|
+
## Prerequisites
|
|
27
|
+
|
|
28
|
+
- **Windows** with PowerShell, or **macOS**
|
|
29
|
+
- **Node.js** >= 18
|
|
30
|
+
- **OneDrive** installed and syncing, with either a personal account, a business account, or both
|
|
31
|
+
- A coding agent CLI (for example GitHub Copilot CLI or Claude Code)
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx -y @daomar/agentfleet run
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
On first run, AgentFleet automatically creates `agentfleet` and `dma` shortcut commands in your npm global directory, so you can use either command directly without restarting the terminal. If you've already installed globally via `npm install -g @daomar/agentfleet`, shortcut creation is skipped.
|
|
40
|
+
|
|
41
|
+
Or install globally:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install -g @daomar/agentfleet
|
|
45
|
+
agentfleet run
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
### Run
|
|
51
|
+
|
|
52
|
+
Start AgentFleet on this machine. On first use, it auto-detects OneDrive and creates the necessary symlinks and config. On subsequent runs, it loads the existing config and starts the task watcher. Only tasks that arrive **after** AgentFleet starts will be processed — existing tasks are never replayed, even after a restart or on a new machine.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
agentfleet run
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Options:
|
|
59
|
+
- `--poll-interval <seconds>` — Polling interval (default: `10`)
|
|
60
|
+
- `--concurrency <number>` — Maximum concurrent agent processes (default: `1`)
|
|
61
|
+
- `--daemon` or `-d` — Run as a background daemon process (detached from the terminal)
|
|
62
|
+
- `--log-file <path>` — Log file path when running as a daemon (default: `~/.agentfleet/agentfleet.log`)
|
|
63
|
+
|
|
64
|
+
#### Daemon Mode
|
|
65
|
+
|
|
66
|
+
Run AgentFleet in the background so it persists after you close the terminal:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
agentfleet run --daemon
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
This spawns a detached process, writes its PID to `~/.agentfleet/agentfleet.pid`, and redirects all output to `~/.agentfleet/agentfleet.log`. Only one daemon instance is allowed at a time.
|
|
73
|
+
|
|
74
|
+
To use a custom log file:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
agentfleet run --daemon --log-file /tmp/agentfleet.log
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
> **Note:** Only one AgentFleet instance is allowed at a time, whether foreground, daemon, or auto-start.
|
|
81
|
+
|
|
82
|
+
#### Auto-Start on Login
|
|
83
|
+
|
|
84
|
+
For machines that need AgentFleet to run permanently, set up auto-start on login:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npx -y @daomar/agentfleet install
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
This installs a platform-appropriate auto-start registration that runs `npx -y @daomar/agentfleet run -d` using the latest published version. The daemon starts immediately after installation. No administrator privileges are required on supported platforms.
|
|
91
|
+
|
|
92
|
+
- **Windows:** installs a Scheduled Task named `AgentFleet`, starts on login, and re-triggers after wake from sleep or hibernation.
|
|
93
|
+
- **macOS:** installs a LaunchAgent named `dev.daomar.agentfleet`, starts on login, and starts the daemon immediately after installation.
|
|
94
|
+
|
|
95
|
+
**Uninstall auto-start:**
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npx -y @daomar/agentfleet uninstall
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
This stops the running instance and removes the current platform's auto-start registration.
|
|
102
|
+
|
|
103
|
+
### Stop
|
|
104
|
+
|
|
105
|
+
Stop the running AgentFleet instance:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
agentfleet stop
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
This sends SIGTERM to the running process and cleans up the PID file. Works for all run modes (foreground, daemon, auto-start). If auto-start is configured, AgentFleet will restart on the next login. On Windows, Scheduled Task mode also restarts after wake from sleep or hibernation.
|
|
112
|
+
|
|
113
|
+
AgentFleet checks both OneDrive for Business and personal OneDrive accounts.
|
|
114
|
+
|
|
115
|
+
- If exactly one supported account is available, AgentFleet uses it automatically.
|
|
116
|
+
- If both personal and business OneDrive are available, AgentFleet picks the first one detected.
|
|
117
|
+
- On macOS, detection checks `~/Library/CloudStorage/OneDrive*` first, then legacy `~/OneDrive*` paths.
|
|
118
|
+
|
|
119
|
+
This creates `~/.agentfleet/` and points its `tasks/` and `output/` directories at your selected OneDrive workspace under `AgentFleet/`.
|
|
120
|
+
|
|
121
|
+
### Submit a Task
|
|
122
|
+
|
|
123
|
+
Create a task that every enrolled machine will execute:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
agentfleet submit --prompt "Add error handling to all API endpoints" --title "Error handling" --working-dir "C:\work\myproject"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Options:
|
|
130
|
+
- `--prompt <text>` — The instruction for the coding agent (required)
|
|
131
|
+
- `--title <text>` — Short task title
|
|
132
|
+
- `--working-dir <path>` — Working directory for the agent (default: current directory)
|
|
133
|
+
- `--agent <command>` — Override the default agent command template
|
|
134
|
+
|
|
135
|
+
### Check Status
|
|
136
|
+
|
|
137
|
+
Show version info, running AgentFleet process info (PID, mode, log file), and list all tasks with their machine results:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
agentfleet status
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The status output shows:
|
|
144
|
+
- **Version**: Current version and latest version on npm (with upgrade prompt if outdated)
|
|
145
|
+
- **Process info**: PID, run mode (foreground / daemon / auto-start on login), log file location
|
|
146
|
+
- **Tasks**: All tasks with execution results per machine
|
|
147
|
+
|
|
148
|
+
View details for a specific task:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
agentfleet status task-20260402120000-abc123
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Architecture
|
|
155
|
+
|
|
156
|
+
```text
|
|
157
|
+
~/.agentfleet/
|
|
158
|
+
├── config.json # Local machine config (not synced)
|
|
159
|
+
├── processed.json # IDs of tasks already executed on this machine
|
|
160
|
+
├── agentfleet.pid # PID file (present when running in any mode)
|
|
161
|
+
├── agentfleet.log # Log file (daemon and auto-start modes)
|
|
162
|
+
├── tasks/ → OneDrive # Symlink to the selected <OneDrive>\AgentFleet\tasks
|
|
163
|
+
│ ├── task-001.json
|
|
164
|
+
│ └── task-002.json
|
|
165
|
+
└── output/ → OneDrive # Symlink to the selected <OneDrive>\AgentFleet\output
|
|
166
|
+
├── task-001/
|
|
167
|
+
│ ├── DESKTOP-A-result.json
|
|
168
|
+
│ ├── DESKTOP-A-stdout.log
|
|
169
|
+
│ ├── LAPTOP-B-result.json
|
|
170
|
+
│ └── LAPTOP-B-stdout.log
|
|
171
|
+
└── task-002/
|
|
172
|
+
└── ...
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Platform-specific auto-start files live outside `~/.agentfleet/`:
|
|
176
|
+
- **Windows:** `~/.agentfleet/start-agentfleet.vbs`
|
|
177
|
+
- **macOS:** `~/Library/LaunchAgents/dev.daomar.agentfleet.plist`
|
|
178
|
+
|
|
179
|
+
## Security & Compliance
|
|
180
|
+
|
|
181
|
+
AgentFleet is designed with a zero-infrastructure security model:
|
|
182
|
+
|
|
183
|
+
- **No tunnels** — Machines never open inbound connections or tunnels. There is nothing to attack from the outside.
|
|
184
|
+
- **No exposed ports** — No listening services, no open ports, no attack surface. Each machine only syncs files through OneDrive's existing, authenticated channel.
|
|
185
|
+
- **No data movement** — AgentFleet does not transfer, copy, or relay any data. Task files and results live in the user's own OneDrive (Business or Personal). Data never leaves the Microsoft 365 tenant boundary.
|
|
186
|
+
- **No central server** — There is no AgentFleet backend, broker, or control plane. Coordination happens entirely through OneDrive sync, which is already approved and managed by your organization's IT policies.
|
|
187
|
+
|
|
188
|
+
This architecture means AgentFleet inherits the security, compliance, and data residency guarantees of your existing OneDrive and Microsoft 365 environment — with nothing additional to audit, secure, or maintain.
|
|
189
|
+
|
|
190
|
+
## Task File Format
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"id": "task-20260402120000-abc123",
|
|
195
|
+
"title": "Add error handling",
|
|
196
|
+
"prompt": "Add try-catch blocks to all API route handlers...",
|
|
197
|
+
"workingDirectory": "C:\\work\\myproject",
|
|
198
|
+
"createdAt": "2026-04-02T12:00:00Z",
|
|
199
|
+
"createdBy": "DESKTOP-A"
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Task files are immutable once written. AgentFleet only processes tasks that arrive after the daemon starts — old tasks are never replayed, ensuring safe restarts and new machine onboarding.
|
|
204
|
+
|
|
205
|
+
## Development
|
|
206
|
+
|
|
207
|
+
Build the CLI:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
npm run build
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Run the automated test suite:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
npm test
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
The test suite covers task-watcher startup behavior, shortcut registration, Windows scheduled-task and macOS LaunchAgent auto-start behavior, daemon management, run/install/stop/uninstall commands, CLI branding, bootstrap, OneDrive detection, provider selection, result writing, and legacy workspace migration.
|
|
220
|
+
|
|
221
|
+
## Web Dashboard
|
|
222
|
+
|
|
223
|
+
A browser-based dashboard is available at **[https://agentfleet.daomar.dev/](https://agentfleet.daomar.dev/)**.
|
|
224
|
+
|
|
225
|
+
### What it does
|
|
226
|
+
|
|
227
|
+
- **Submit tasks** to all your AgentFleet machines simultaneously from any browser
|
|
228
|
+
- **Monitor nodes** — see which machines are active, their last activity, and task counts
|
|
229
|
+
- **Browse task history** — paginated list of all submitted tasks with status indicators
|
|
230
|
+
- **View task results** — per-machine results with exit codes, duration, and timestamps
|
|
231
|
+
- **Mobile-friendly** — progressive web app (PWA) installable on iOS and Android
|
|
232
|
+
|
|
233
|
+
### Access
|
|
234
|
+
|
|
235
|
+
Open **[https://agentfleet.daomar.dev/](https://agentfleet.daomar.dev/)** in your browser and sign in with the Microsoft account that owns the OneDrive where AgentFleet is installed.
|
|
236
|
+
|
|
237
|
+
> **Important:** Sign in with the **same Microsoft account** used by your machines' OneDrive sync. If your OneDrive is linked to `user@example.com`, log in with that account.
|
|
238
|
+
|
|
239
|
+
### Security model
|
|
240
|
+
|
|
241
|
+
- **Authentication:** Microsoft Entra ID with PKCE authorization code flow — no secrets stored in the browser
|
|
242
|
+
- **Token storage:** MSAL.js manages tokens in `localStorage` for persistent login across browser sessions and PWA reopens
|
|
243
|
+
- **Permissions:** `Files.Read`, `Files.ReadWrite`, and `User.Read` (delegated — only the signed-in user's files are accessible)
|
|
244
|
+
- **Input sanitization:** Shell metacharacters are stripped from task prompts before submission; `workingDirectory` field is not exposed in the UI; an optional agent command can be specified by power users
|
|
245
|
+
- **Content Security Policy:** Enforced via HTTP header; restricts scripts, styles, and connections to trusted origins only
|
|
246
|
+
- **No backend:** All API calls go directly from the browser to Microsoft Graph — no AgentFleet server is involved
|
|
247
|
+
|
|
248
|
+
### Mobile install (PWA)
|
|
249
|
+
|
|
250
|
+
**iOS (Safari):** Open [https://agentfleet.daomar.dev/](https://agentfleet.daomar.dev/) → tap the **Share** button → **Add to Home Screen**
|
|
251
|
+
|
|
252
|
+
**Android (Chrome):** Open [https://agentfleet.daomar.dev/](https://agentfleet.daomar.dev/) → tap the **⋮** menu → **Add to Home screen** (or wait for the install prompt)
|
|
253
|
+
|
|
254
|
+
### Entra ID app registration
|
|
255
|
+
|
|
256
|
+
The web dashboard uses a pre-registered Microsoft Entra ID application:
|
|
257
|
+
|
|
258
|
+
| Property | Value |
|
|
259
|
+
|---|---|
|
|
260
|
+
| Client ID | `b94f9687-adcf-48ea-9861-c4ce4b5c01a0` |
|
|
261
|
+
| Tenant | `91dde955-43a9-40a9-a406-694cffb04f28` (multi-tenant) |
|
|
262
|
+
| Sign-in audience | AzureAD and personal Microsoft accounts |
|
|
263
|
+
| Redirect URIs | `https://agentfleet.daomar.dev/`, `http://localhost:5173/` |
|
|
264
|
+
| Permissions | `Files.Read`, `Files.ReadWrite`, `User.Read` (delegated) |
|
|
265
|
+
|
|
266
|
+
To self-host the dashboard, register your own Entra ID app and update `web/public/config.js` with your `clientId`. See [Microsoft documentation](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app) for app registration steps.
|
|
267
|
+
|
|
268
|
+
### Local development
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
cd web
|
|
272
|
+
npm install
|
|
273
|
+
npm run dev # Start dev server at http://localhost:5173
|
|
274
|
+
npm run build # Production build to web/dist/
|
|
275
|
+
npm test # Run unit tests (Vitest)
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Support
|
|
279
|
+
|
|
280
|
+
AgentFleet is free and open-source. If it helps your workflow, consider supporting the project:
|
|
281
|
+
|
|
282
|
+
<table>
|
|
283
|
+
<tr>
|
|
284
|
+
<td align="center"><strong>PayPal</strong><br/>(international)</td>
|
|
285
|
+
<td align="center"><strong>WeChat Pay</strong><br/>(国内用户)</td>
|
|
286
|
+
</tr>
|
|
287
|
+
<tr>
|
|
288
|
+
<td align="center"><a href="https://paypal.me/chenxizhang2026"><img src="assets/paypal-donation.png" alt="PayPal QR Code" width="200" /></a></td>
|
|
289
|
+
<td align="center"><img src="assets/wechat-donation.jpg" alt="WeChat Pay QR Code" width="200" /></td>
|
|
290
|
+
</tr>
|
|
291
|
+
</table>
|
|
292
|
+
|
|
293
|
+
### Supporters
|
|
294
|
+
|
|
295
|
+
<table>
|
|
296
|
+
<tr>
|
|
297
|
+
<td align="center" valign="top" width="128">
|
|
298
|
+
<a href="https://github.com/hjunxu" title="@hjunxu">
|
|
299
|
+
<img src="https://github.com/hjunxu.png?size=96" alt="@hjunxu" width="64" height="64" /><br />
|
|
300
|
+
<sub><strong>hjunxu</strong></sub>
|
|
301
|
+
</a>
|
|
302
|
+
</td>
|
|
303
|
+
</tr>
|
|
304
|
+
</table>
|
|
305
|
+
|
|
306
|
+
All supporters will be recognized on this page.
|
|
307
|
+
|
|
308
|
+
## License
|
|
309
|
+
|
|
310
|
+
ISC
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/icon.svg" alt="AgentFleet 图标" width="160" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
[English](README.md) | [简体中文](README.zh-CN.md)
|
|
6
|
+
|
|
7
|
+
# AgentFleet
|
|
8
|
+
|
|
9
|
+
> 分布式智能体编排,无需控制平面。
|
|
10
|
+
|
|
11
|
+
AgentFleet 是一个基于 OneDrive 同步构建的去中心化、多机器编码智能体编排工具。任何已注册的机器都可以分发工作,每台机器都可以执行任务。没有中央调度器、代理或控制平面需要维护。
|
|
12
|
+
|
|
13
|
+
## 概述
|
|
14
|
+
|
|
15
|
+
AgentFleet 让您可以将编码任务同时分发到所有机器上。从任意机器提交任务,所有运行 AgentFleet 的机器都会看到同一个任务,使用本地安装的编码智能体独立执行,并将机器级别的结果写回。
|
|
16
|
+
|
|
17
|
+
**工作原理:**
|
|
18
|
+
1. 您的机器共享一个同步的 OneDrive 工作区。
|
|
19
|
+
2. AgentFleet 在 `~/.agentfleet/` 下提供稳定的本地路径。
|
|
20
|
+
3. 任何机器都可以在共享的 `tasks/` 目录中创建任务。
|
|
21
|
+
4. 每台运行 `agentfleet run` 的机器都会独立处理该任务。
|
|
22
|
+
5. 结果保存在共享的 `output/` 目录中,使用主机名前缀的文件以避免冲突。
|
|
23
|
+
|
|
24
|
+
无需服务器、数据库或控制平面——仅通过同步实现分布式协调。
|
|
25
|
+
|
|
26
|
+
## 前提条件
|
|
27
|
+
|
|
28
|
+
- **Windows** 及 PowerShell,或 **macOS**
|
|
29
|
+
- **Node.js** >= 18
|
|
30
|
+
- **OneDrive** 已安装并同步,使用个人账户、商业账户或两者兼有
|
|
31
|
+
- 编码智能体 CLI(例如 GitHub Copilot CLI 或 Claude Code)
|
|
32
|
+
|
|
33
|
+
## 安装
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx -y @daomar/agentfleet run
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
首次运行时,AgentFleet 会自动在 npm 全局目录中创建 `agentfleet` 和 `dma` 快捷命令,因此您可以直接使用任一命令,无需重启终端即可生效。如果您已通过 `npm install -g @daomar/agentfleet` 全局安装,将跳过快捷方式创建。
|
|
40
|
+
|
|
41
|
+
或全局安装:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install -g @daomar/agentfleet
|
|
45
|
+
agentfleet run
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 使用方法
|
|
49
|
+
|
|
50
|
+
### 运行
|
|
51
|
+
|
|
52
|
+
在当前机器上启动 AgentFleet。首次使用时,它会自动检测 OneDrive 并创建必要的符号链接和配置。后续运行时,它会加载现有配置并启动任务监视器。只有在 AgentFleet 启动**之后**到达的任务才会被处理——已有的任务永远不会被重放,即使在重启或新机器上也是如此。
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
agentfleet run
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
选项:
|
|
59
|
+
- `--poll-interval <seconds>` — 轮询间隔(默认:`10`)
|
|
60
|
+
- `--concurrency <number>` — 最大并发智能体进程数(默认:`1`)
|
|
61
|
+
- `--daemon` 或 `-d` — 作为后台守护进程运行(与终端分离)
|
|
62
|
+
- `--log-file <path>` — 作为守护进程运行时的日志文件路径(默认:`~/.agentfleet/agentfleet.log`)
|
|
63
|
+
|
|
64
|
+
#### 守护进程模式
|
|
65
|
+
|
|
66
|
+
在后台运行 AgentFleet,使其在关闭终端后继续运行:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
agentfleet run --daemon
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
这将生成一个分离的进程,将其 PID 写入 `~/.agentfleet/agentfleet.pid`,并将所有输出重定向到 `~/.agentfleet/agentfleet.log`。同一时间只允许一个守护进程实例。
|
|
73
|
+
|
|
74
|
+
使用自定义日志文件:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
agentfleet run --daemon --log-file /tmp/agentfleet.log
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
> **注意:** 同一时间只允许一个 AgentFleet 实例运行,无论是前台模式、守护进程模式还是自动启动模式。
|
|
81
|
+
|
|
82
|
+
#### 登录时自动启动
|
|
83
|
+
|
|
84
|
+
对于需要 AgentFleet 常驻运行的机器,设置登录时自动启动:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npx -y @daomar/agentfleet install
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
这会安装与当前平台对应的登录自启动项,并使用最新发布版本运行 `npx -y @daomar/agentfleet run -d`。安装后守护进程会立即启动。在受支持的平台上无需管理员权限。
|
|
91
|
+
|
|
92
|
+
- **Windows:** 安装名为 `AgentFleet` 的计划任务,在登录时启动,并会在系统从睡眠或休眠唤醒后再次触发。
|
|
93
|
+
- **macOS:** 安装名为 `dev.daomar.agentfleet` 的 LaunchAgent,在登录时启动,并在安装后立即拉起守护进程。
|
|
94
|
+
|
|
95
|
+
**卸载自动启动:**
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npx -y @daomar/agentfleet uninstall
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
这将停止正在运行的实例并删除当前平台上的自启动项。
|
|
102
|
+
|
|
103
|
+
### 停止
|
|
104
|
+
|
|
105
|
+
停止正在运行的 AgentFleet 实例:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
agentfleet stop
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
这会向运行中的进程发送 SIGTERM 信号并清理 PID 文件。适用于所有运行模式(前台、守护进程、自动启动)。如果配置了自动启动,AgentFleet 将在下次登录时重新启动;在 Windows 的计划任务模式下,还会在从睡眠或休眠唤醒后重新触发。
|
|
112
|
+
|
|
113
|
+
AgentFleet 会检查 OneDrive 商业版和个人版账户。
|
|
114
|
+
|
|
115
|
+
- 如果恰好有一个支持的账户可用,AgentFleet 会自动使用它。
|
|
116
|
+
- 如果个人版和商业版 OneDrive 同时可用,AgentFleet 会选择第一个检测到的。
|
|
117
|
+
- 在 macOS 上,会优先检查 `~/Library/CloudStorage/OneDrive*`,然后回退到旧版 `~/OneDrive*` 路径。
|
|
118
|
+
|
|
119
|
+
这将创建 `~/.agentfleet/` 并将其 `tasks/` 和 `output/` 目录指向您选定的 OneDrive 工作区中的 `AgentFleet/`。
|
|
120
|
+
|
|
121
|
+
### 提交任务
|
|
122
|
+
|
|
123
|
+
创建一个所有已注册机器都将执行的任务:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
agentfleet submit --prompt "Add error handling to all API endpoints" --title "Error handling" --working-dir "C:\work\myproject"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
选项:
|
|
130
|
+
- `--prompt <text>` — 给编码智能体的指令(必填)
|
|
131
|
+
- `--title <text>` — 简短的任务标题
|
|
132
|
+
- `--working-dir <path>` — 智能体的工作目录(默认:当前目录)
|
|
133
|
+
- `--agent <command>` — 覆盖默认的智能体命令模板
|
|
134
|
+
|
|
135
|
+
### 查看状态
|
|
136
|
+
|
|
137
|
+
显示版本信息、运行中的 AgentFleet 进程信息(PID、模式、日志文件),并列出所有任务及其各机器的结果:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
agentfleet status
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
状态输出显示:
|
|
144
|
+
- **版本**:当前版本和 npm 上的最新版本(如果过时会提示升级)
|
|
145
|
+
- **进程信息**:PID、运行模式(前台 / 守护进程 / 登录时自动启动)、日志文件位置
|
|
146
|
+
- **任务**:所有任务及每台机器的执行结果
|
|
147
|
+
|
|
148
|
+
查看特定任务的详细信息:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
agentfleet status task-20260402120000-abc123
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## 架构
|
|
155
|
+
|
|
156
|
+
```text
|
|
157
|
+
~/.agentfleet/
|
|
158
|
+
├── config.json # 本机配置(不同步)
|
|
159
|
+
├── processed.json # 已在本机执行的任务 ID
|
|
160
|
+
├── agentfleet.pid # PID 文件(任何模式运行时存在)
|
|
161
|
+
├── agentfleet.log # 日志文件(守护进程和自动启动模式)
|
|
162
|
+
├── tasks/ → OneDrive # 指向选定的 <OneDrive>\AgentFleet\tasks 的符号链接
|
|
163
|
+
│ ├── task-001.json
|
|
164
|
+
│ └── task-002.json
|
|
165
|
+
└── output/ → OneDrive # 指向选定的 <OneDrive>\AgentFleet\output 的符号链接
|
|
166
|
+
├── task-001/
|
|
167
|
+
│ ├── DESKTOP-A-result.json
|
|
168
|
+
│ ├── DESKTOP-A-stdout.log
|
|
169
|
+
│ ├── LAPTOP-B-result.json
|
|
170
|
+
│ └── LAPTOP-B-stdout.log
|
|
171
|
+
└── task-002/
|
|
172
|
+
└── ...
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
平台相关的自启动文件位于 `~/.agentfleet/` 之外:
|
|
176
|
+
- **Windows:** `~/.agentfleet/start-agentfleet.vbs`
|
|
177
|
+
- **macOS:** `~/Library/LaunchAgents/dev.daomar.agentfleet.plist`
|
|
178
|
+
|
|
179
|
+
## 安全与合规
|
|
180
|
+
|
|
181
|
+
AgentFleet 采用零基础设施安全模型设计:
|
|
182
|
+
|
|
183
|
+
- **无隧道** — 机器永远不会打开入站连接或隧道。外部没有任何可攻击的入口。
|
|
184
|
+
- **无暴露端口** — 没有监听服务、没有开放端口、没有攻击面。每台机器仅通过 OneDrive 现有的、已认证的通道同步文件。
|
|
185
|
+
- **无数据移动** — AgentFleet 不传输、复制或中转任何数据。任务文件和结果存储在用户自己的 OneDrive(商业版或个人版)中。数据永远不会离开 Microsoft 365 租户边界。
|
|
186
|
+
- **无中央服务器** — 没有 AgentFleet 后端、代理或控制平面。协调完全通过 OneDrive 同步完成,该同步已获得您组织 IT 策略的批准和管理。
|
|
187
|
+
|
|
188
|
+
这种架构意味着 AgentFleet 继承了您现有 OneDrive 和 Microsoft 365 环境的安全性、合规性和数据驻留保证——无需额外审计、安全加固或维护。
|
|
189
|
+
|
|
190
|
+
## 任务文件格式
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"id": "task-20260402120000-abc123",
|
|
195
|
+
"title": "Add error handling",
|
|
196
|
+
"prompt": "Add try-catch blocks to all API route handlers...",
|
|
197
|
+
"workingDirectory": "C:\\work\\myproject",
|
|
198
|
+
"createdAt": "2026-04-02T12:00:00Z",
|
|
199
|
+
"createdBy": "DESKTOP-A"
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
任务文件一旦写入即不可变。AgentFleet 只处理守护进程启动后到达的任务——旧任务永远不会被重放,确保安全重启和新机器接入。
|
|
204
|
+
|
|
205
|
+
## 开发
|
|
206
|
+
|
|
207
|
+
构建 CLI:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
npm run build
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
运行自动化测试套件:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
npm test
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
测试套件涵盖任务监视器启动行为、快捷方式注册、Windows 计划任务与 macOS LaunchAgent 的自启动行为、守护进程管理、run/install/stop/uninstall 命令、CLI 品牌标识、引导程序、OneDrive 检测、提供者选择、结果写入和旧工作区迁移。
|
|
220
|
+
|
|
221
|
+
## Web 仪表板
|
|
222
|
+
|
|
223
|
+
基于浏览器的仪表板可在 **[https://agentfleet.daomar.dev/](https://agentfleet.daomar.dev/)** 访问。
|
|
224
|
+
|
|
225
|
+
### 功能
|
|
226
|
+
|
|
227
|
+
- **提交任务** — 从任何浏览器同时向所有 AgentFleet 机器提交任务
|
|
228
|
+
- **监控节点** — 查看哪些机器处于活跃状态、最后活动时间和任务数量
|
|
229
|
+
- **浏览任务历史** — 分页显示所有已提交任务及其状态指标
|
|
230
|
+
- **查看任务结果** — 每台机器的结果,包括退出码、耗时和时间戳
|
|
231
|
+
- **移动端友好** — 渐进式 Web 应用(PWA),可安装在 iOS 和 Android 上
|
|
232
|
+
|
|
233
|
+
### 访问
|
|
234
|
+
|
|
235
|
+
在浏览器中打开 **[https://agentfleet.daomar.dev/](https://agentfleet.daomar.dev/)**,使用拥有 AgentFleet 所在 OneDrive 的 Microsoft 账户登录。
|
|
236
|
+
|
|
237
|
+
> **重要:** 请使用与您机器 OneDrive 同步**相同的 Microsoft 账户**登录。如果您的 OneDrive 关联的是 `user@example.com`,请使用该账户登录。
|
|
238
|
+
|
|
239
|
+
### 安全模型
|
|
240
|
+
|
|
241
|
+
- **认证:** Microsoft Entra ID 使用 PKCE 授权码流——浏览器中不存储任何密钥
|
|
242
|
+
- **令牌存储:** MSAL.js 在 `localStorage` 中管理令牌,以实现跨浏览器会话和 PWA 重新打开的持久登录
|
|
243
|
+
- **权限:** `Files.Read`、`Files.ReadWrite` 和 `User.Read`(委派权限——仅可访问已登录用户的文件)
|
|
244
|
+
- **输入清理:** 提交前会从任务提示中剥离 Shell 元字符;UI 中不暴露 `workingDirectory` 字段;高级用户可指定可选的智能体命令
|
|
245
|
+
- **内容安全策略:** 通过 HTTP 头强制执行;将脚本、样式和连接限制为仅受信来源
|
|
246
|
+
- **无后端:** 所有 API 调用直接从浏览器发送到 Microsoft Graph——不涉及 AgentFleet 服务器
|
|
247
|
+
|
|
248
|
+
### 移动端安装(PWA)
|
|
249
|
+
|
|
250
|
+
**iOS (Safari):** 打开 [https://agentfleet.daomar.dev/](https://agentfleet.daomar.dev/) → 点击**分享**按钮 → **添加到主屏幕**
|
|
251
|
+
|
|
252
|
+
**Android (Chrome):** 打开 [https://agentfleet.daomar.dev/](https://agentfleet.daomar.dev/) → 点击 **⋮** 菜单 → **添加到主屏幕**(或等待安装提示)
|
|
253
|
+
|
|
254
|
+
### Entra ID 应用注册
|
|
255
|
+
|
|
256
|
+
Web 仪表板使用预注册的 Microsoft Entra ID 应用:
|
|
257
|
+
|
|
258
|
+
| 属性 | 值 |
|
|
259
|
+
|---|---|
|
|
260
|
+
| 客户端 ID | `b94f9687-adcf-48ea-9861-c4ce4b5c01a0` |
|
|
261
|
+
| 租户 | `91dde955-43a9-40a9-a406-694cffb04f28`(多租户) |
|
|
262
|
+
| 登录受众 | Azure AD 和个人 Microsoft 账户 |
|
|
263
|
+
| 重定向 URI | `https://agentfleet.daomar.dev/`、`http://localhost:5173/` |
|
|
264
|
+
| 权限 | `Files.Read`、`Files.ReadWrite`、`User.Read`(委派权限) |
|
|
265
|
+
|
|
266
|
+
如需自托管仪表板,请注册您自己的 Entra ID 应用并使用您的 `clientId` 更新 `web/public/config.js`。请参阅 [Microsoft 文档](https://learn.microsoft.com/zh-cn/entra/identity-platform/quickstart-register-app)了解应用注册步骤。
|
|
267
|
+
|
|
268
|
+
### 本地开发
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
cd web
|
|
272
|
+
npm install
|
|
273
|
+
npm run dev # 在 http://localhost:5173 启动开发服务器
|
|
274
|
+
npm run build # 生产构建到 web/dist/
|
|
275
|
+
npm test # 运行单元测试(Vitest)
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## 支持
|
|
279
|
+
|
|
280
|
+
AgentFleet 是免费的开源项目。如果它对您的工作有帮助,欢迎支持本项目:
|
|
281
|
+
|
|
282
|
+
<table>
|
|
283
|
+
<tr>
|
|
284
|
+
<td align="center"><strong>PayPal</strong><br/>(国际用户)</td>
|
|
285
|
+
<td align="center"><strong>微信支付</strong><br/>(国内用户)</td>
|
|
286
|
+
</tr>
|
|
287
|
+
<tr>
|
|
288
|
+
<td align="center"><a href="https://paypal.me/chenxizhang2026"><img src="assets/paypal-donation.png" alt="PayPal 二维码" width="200" /></a></td>
|
|
289
|
+
<td align="center"><img src="assets/wechat-donation.jpg" alt="微信支付二维码" width="200" /></td>
|
|
290
|
+
</tr>
|
|
291
|
+
</table>
|
|
292
|
+
|
|
293
|
+
### 赞助者
|
|
294
|
+
|
|
295
|
+
<table>
|
|
296
|
+
<tr>
|
|
297
|
+
<td align="center" valign="top" width="128">
|
|
298
|
+
<a href="https://github.com/hjunxu" title="@hjunxu">
|
|
299
|
+
<img src="https://github.com/hjunxu.png?size=96" alt="@hjunxu" width="64" height="64" /><br />
|
|
300
|
+
<sub><strong>hjunxu</strong></sub>
|
|
301
|
+
</a>
|
|
302
|
+
</td>
|
|
303
|
+
</tr>
|
|
304
|
+
</table>
|
|
305
|
+
|
|
306
|
+
所有赞赏者将在此页面获得致谢。
|
|
307
|
+
|
|
308
|
+
## 许可证
|
|
309
|
+
|
|
310
|
+
ISC
|
package/assets/icon.png
ADDED
|
Binary file
|