@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.
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ShortcutService = void 0;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ const child_process_1 = require("child_process");
40
+ const i18n_1 = require("./i18n");
41
+ class ShortcutService {
42
+ constructor(deps = {}) {
43
+ this.deps = deps;
44
+ }
45
+ getPlatform() {
46
+ return this.deps.platform ?? process.platform;
47
+ }
48
+ isWindows() {
49
+ return this.getPlatform() === 'win32';
50
+ }
51
+ exec(cmd) {
52
+ const execFn = this.deps.execSyncFn ?? ((c) => (0, child_process_1.execSync)(c, {
53
+ encoding: 'utf-8',
54
+ windowsHide: true,
55
+ stdio: ['pipe', 'pipe', 'pipe'],
56
+ }));
57
+ return execFn(cmd);
58
+ }
59
+ /**
60
+ * Get the npm global bin directory (already in PATH from Node.js install).
61
+ */
62
+ getNpmGlobalBin() {
63
+ const prefix = this.exec('npm config get prefix').trim();
64
+ return this.isWindows() ? prefix : path.join(prefix, 'bin');
65
+ }
66
+ /**
67
+ * Check if the current process was invoked via npx (script path contains _npx).
68
+ */
69
+ isNpxInvocation() {
70
+ const scriptPath = this.deps.scriptPath ?? (process.argv[1] || '');
71
+ return scriptPath.includes('_npx');
72
+ }
73
+ /**
74
+ * Check if AgentFleet is globally installed (excluding npx cache paths).
75
+ */
76
+ isGloballyInstalled() {
77
+ try {
78
+ return ShortcutService.BINARIES.every((binary) => {
79
+ const lookupCommand = this.isWindows() ? `where ${binary}` : `which -a ${binary}`;
80
+ const result = this.exec(lookupCommand).trim();
81
+ const paths = result.split(/\r?\n/).map(p => p.trim()).filter(Boolean);
82
+ const globalPaths = paths.filter(p => !p.includes('_npx') && !p.includes('npm-cache'));
83
+ return globalPaths.length > 0;
84
+ });
85
+ }
86
+ catch {
87
+ return false;
88
+ }
89
+ }
90
+ /**
91
+ * Check if the wrapper .cmd file already exists in npm global bin.
92
+ */
93
+ wrapperExists() {
94
+ try {
95
+ const binDir = this.getNpmGlobalBin();
96
+ return ShortcutService.BINARIES.every((binary) => fs.existsSync(path.join(binDir, this.isWindows() ? `${binary}.cmd` : binary)));
97
+ }
98
+ catch {
99
+ return false;
100
+ }
101
+ }
102
+ /**
103
+ * Create the AgentFleet wrappers in the npm global bin directory.
104
+ * This directory is already in PATH, so the command is immediately available.
105
+ */
106
+ createWrapper() {
107
+ const binDir = this.getNpmGlobalBin();
108
+ fs.mkdirSync(binDir, { recursive: true });
109
+ if (this.isWindows()) {
110
+ for (const binary of ShortcutService.BINARIES) {
111
+ const wrapperPath = path.join(binDir, `${binary}.cmd`);
112
+ fs.writeFileSync(wrapperPath, '@npx -y @daomar/agentfleet %*\r\n', 'utf-8');
113
+ }
114
+ return;
115
+ }
116
+ for (const binary of ShortcutService.BINARIES) {
117
+ const wrapperPath = path.join(binDir, binary);
118
+ fs.writeFileSync(wrapperPath, '#!/bin/sh\nnpx -y @daomar/agentfleet "$@"\n', 'utf-8');
119
+ fs.chmodSync(wrapperPath, 0o755);
120
+ }
121
+ }
122
+ /**
123
+ * Main entry point: ensure local AgentFleet shortcuts are available.
124
+ * Only runs on install/run commands invoked via npx.
125
+ */
126
+ ensureShortcut() {
127
+ try {
128
+ // Gate 1: must be invoked via npx
129
+ if (!this.isNpxInvocation()) {
130
+ return { shortcutAvailable: this.wrapperExists(), action: 'skipped-not-npx' };
131
+ }
132
+ // Gate 2: must be install or run command
133
+ const argv = this.deps.argv ?? process.argv;
134
+ const command = argv.find(a => a === 'install' || a === 'run');
135
+ if (!command) {
136
+ return { shortcutAvailable: this.wrapperExists(), action: 'skipped-not-run-or-install' };
137
+ }
138
+ // Check if globally installed
139
+ if (this.isGloballyInstalled()) {
140
+ return { shortcutAvailable: true, action: 'skipped-global-exists' };
141
+ }
142
+ // Check if wrapper already exists
143
+ if (this.wrapperExists()) {
144
+ return { shortcutAvailable: true, action: 'skipped-wrapper-exists' };
145
+ }
146
+ // Create wrapper and add to PATH
147
+ this.createWrapper();
148
+ console.log(`\n🔗 ${(0, i18n_1.t)('shortcut.available')}\n`);
149
+ return { shortcutAvailable: true, action: 'wrapper-created' };
150
+ }
151
+ catch (err) {
152
+ console.warn(`⚠ ${(0, i18n_1.t)('shortcut.failed', { error: err.message })}`);
153
+ return { shortcutAvailable: false, action: 'error' };
154
+ }
155
+ }
156
+ }
157
+ exports.ShortcutService = ShortcutService;
158
+ ShortcutService.BINARIES = ['agentfleet', 'dma'];
159
+ //# sourceMappingURL=shortcut.js.map
@@ -0,0 +1,199 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.TaskWatcher = void 0;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ const chokidar = __importStar(require("chokidar"));
40
+ const i18n_1 = require("./i18n");
41
+ class TaskWatcher {
42
+ constructor(tasksDir, processedPath, pollIntervalSeconds = 10) {
43
+ this.watcher = null;
44
+ this.pollTimer = null;
45
+ this.handler = null;
46
+ this.inProgressIds = new Set();
47
+ this.tasksDir = tasksDir;
48
+ this.processedPath = processedPath;
49
+ this.pollIntervalMs = pollIntervalSeconds * 1000;
50
+ this.processedIds = this.loadProcessed();
51
+ this.startupTimestamp = Date.now();
52
+ }
53
+ /**
54
+ * Set the handler to call when a new task is detected.
55
+ */
56
+ onTask(handler) {
57
+ this.handler = handler;
58
+ }
59
+ /**
60
+ * Start watching. Only processes tasks that arrive after startup.
61
+ */
62
+ async start() {
63
+ if (!this.handler) {
64
+ throw new Error('No task handler set. Call onTask() before start().');
65
+ }
66
+ // Start file watcher
67
+ this.watcher = chokidar.watch(this.tasksDir, {
68
+ ignoreInitial: true,
69
+ depth: 0,
70
+ awaitWriteFinish: {
71
+ stabilityThreshold: 1000,
72
+ pollInterval: 200,
73
+ },
74
+ });
75
+ this.watcher.on('add', (filePath) => {
76
+ if (path.extname(filePath).toLowerCase() === '.json') {
77
+ this.processFile(filePath);
78
+ }
79
+ });
80
+ this.watcher.on('error', (error) => {
81
+ console.error((0, i18n_1.t)('watcher.error', { message: error.message }));
82
+ });
83
+ // Start polling fallback
84
+ this.pollTimer = setInterval(() => {
85
+ this.scanExisting();
86
+ }, this.pollIntervalMs);
87
+ console.log(`✓ ${(0, i18n_1.t)('watcher.watching', { dir: this.tasksDir })}`);
88
+ console.log(` ${(0, i18n_1.t)('watcher.poll_interval', { seconds: this.pollIntervalMs / 1000 })}`);
89
+ }
90
+ /**
91
+ * Stop watching.
92
+ */
93
+ async stop() {
94
+ if (this.watcher) {
95
+ await this.watcher.close();
96
+ this.watcher = null;
97
+ }
98
+ if (this.pollTimer) {
99
+ clearInterval(this.pollTimer);
100
+ this.pollTimer = null;
101
+ }
102
+ console.log((0, i18n_1.t)('watcher.stopped'));
103
+ }
104
+ /**
105
+ * Mark a task as processed so it won't be picked up again.
106
+ */
107
+ markProcessed(taskId) {
108
+ this.inProgressIds.delete(taskId);
109
+ this.processedIds.add(taskId);
110
+ this.saveProcessed();
111
+ }
112
+ async scanExisting() {
113
+ try {
114
+ const files = fs.readdirSync(this.tasksDir)
115
+ .filter(f => f.endsWith('.json'))
116
+ .map(f => path.join(this.tasksDir, f));
117
+ for (const filePath of files) {
118
+ // Only process files modified after startup (polling fallback for missed events)
119
+ try {
120
+ const stat = fs.statSync(filePath);
121
+ if (stat.mtimeMs <= this.startupTimestamp) {
122
+ continue;
123
+ }
124
+ }
125
+ catch {
126
+ continue;
127
+ }
128
+ this.processFile(filePath);
129
+ }
130
+ }
131
+ catch (err) {
132
+ console.error((0, i18n_1.t)('watcher.scan_error', { message: err.message }));
133
+ }
134
+ }
135
+ processFile(filePath) {
136
+ const ext = path.extname(filePath).toLowerCase();
137
+ if (ext !== '.json') {
138
+ return;
139
+ }
140
+ try {
141
+ const content = fs.readFileSync(filePath, 'utf-8');
142
+ const task = this.parseAndValidate(content, filePath);
143
+ if (!task)
144
+ return;
145
+ // Check if already processed or in progress
146
+ if (this.processedIds.has(task.id) || this.inProgressIds.has(task.id)) {
147
+ return;
148
+ }
149
+ this.inProgressIds.add(task.id);
150
+ console.log(`\n📋 ${(0, i18n_1.t)('watcher.new_task', { taskId: task.id, title: task.title ? ` - ${task.title}` : '' })}`);
151
+ this.handler(task, filePath);
152
+ }
153
+ catch (err) {
154
+ console.warn(`⚠ ${(0, i18n_1.t)('watcher.read_error', { file: path.basename(filePath), message: err.message })}`);
155
+ }
156
+ }
157
+ parseAndValidate(content, filePath) {
158
+ let parsed;
159
+ try {
160
+ parsed = JSON.parse(content);
161
+ }
162
+ catch {
163
+ console.warn(`⚠ ${(0, i18n_1.t)('watcher.invalid_json', { file: path.basename(filePath) })}`);
164
+ return null;
165
+ }
166
+ const obj = parsed;
167
+ // Validate required fields
168
+ const missing = [];
169
+ if (typeof obj.id !== 'string' || !obj.id)
170
+ missing.push('id');
171
+ if (typeof obj.prompt !== 'string' || !obj.prompt)
172
+ missing.push('prompt');
173
+ if (missing.length > 0) {
174
+ console.warn(`⚠ ${(0, i18n_1.t)('watcher.missing_fields', { file: path.basename(filePath), fields: missing.join(', ') })}`);
175
+ return null;
176
+ }
177
+ return obj;
178
+ }
179
+ loadProcessed() {
180
+ try {
181
+ if (fs.existsSync(this.processedPath)) {
182
+ const data = JSON.parse(fs.readFileSync(this.processedPath, 'utf-8'));
183
+ return new Set(data.processedIds);
184
+ }
185
+ }
186
+ catch {
187
+ console.warn(`⚠ ${(0, i18n_1.t)('watcher.load_processed_error')}`);
188
+ }
189
+ return new Set();
190
+ }
191
+ saveProcessed() {
192
+ const data = {
193
+ processedIds: Array.from(this.processedIds),
194
+ };
195
+ fs.writeFileSync(this.processedPath, JSON.stringify(data, null, 2));
196
+ }
197
+ }
198
+ exports.TaskWatcher = TaskWatcher;
199
+ //# sourceMappingURL=task-watcher.js.map
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.VersionChecker = void 0;
37
+ const https = __importStar(require("https"));
38
+ const http = __importStar(require("http"));
39
+ class VersionChecker {
40
+ constructor(deps = {}) {
41
+ this.deps = deps;
42
+ }
43
+ async checkVersion() {
44
+ const current = this.deps.currentVersion ?? this._loadCurrentVersion();
45
+ const fetchFn = this.deps.fetchFn ?? this._defaultFetch;
46
+ try {
47
+ const body = await fetchFn('https://registry.npmjs.org/@daomar%2fagentfleet/latest');
48
+ const data = JSON.parse(body);
49
+ const latest = data.version;
50
+ return {
51
+ current,
52
+ latest,
53
+ updateAvailable: this._isNewer(latest, current),
54
+ };
55
+ }
56
+ catch {
57
+ return { current, latest: null, updateAvailable: false };
58
+ }
59
+ }
60
+ _loadCurrentVersion() {
61
+ try {
62
+ return require('../../package.json').version;
63
+ }
64
+ catch {
65
+ return 'unknown';
66
+ }
67
+ }
68
+ _isNewer(latest, current) {
69
+ const latestParts = latest.split('.').map(Number);
70
+ const currentParts = current.split('.').map(Number);
71
+ for (let i = 0; i < 3; i++) {
72
+ if ((latestParts[i] || 0) > (currentParts[i] || 0))
73
+ return true;
74
+ if ((latestParts[i] || 0) < (currentParts[i] || 0))
75
+ return false;
76
+ }
77
+ return false;
78
+ }
79
+ _defaultFetch(url) {
80
+ return new Promise((resolve, reject) => {
81
+ const client = url.startsWith('https') ? https : http;
82
+ const req = client.get(url, { timeout: 5000 }, (res) => {
83
+ let body = '';
84
+ res.on('data', (chunk) => { body += chunk.toString(); });
85
+ res.on('end', () => resolve(body));
86
+ });
87
+ req.on('error', reject);
88
+ req.on('timeout', () => { req.destroy(); reject(new Error('timeout')); });
89
+ });
90
+ }
91
+ }
92
+ exports.VersionChecker = VersionChecker;
93
+ //# sourceMappingURL=version-checker.js.map
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ScheduledTaskManager = void 0;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ const os = __importStar(require("os"));
40
+ const child_process_1 = require("child_process");
41
+ const TASK_NAME = 'AgentFleet';
42
+ class ScheduledTaskManager {
43
+ constructor(deps = {}) {
44
+ this.deps = deps;
45
+ const home = deps.homedir ?? os.homedir();
46
+ this.agentfleetDir = path.join(home, '.agentfleet');
47
+ }
48
+ getTaskName() {
49
+ return TASK_NAME;
50
+ }
51
+ isSupported() {
52
+ return true;
53
+ }
54
+ exec(cmd) {
55
+ const execFn = this.deps.execSyncFn ?? ((c, opts) => (0, child_process_1.execSync)(c, { encoding: 'utf-8', ...opts }));
56
+ return execFn(cmd);
57
+ }
58
+ queryTaskState() {
59
+ try {
60
+ this.exec(`powershell -NoProfile -Command "Get-ScheduledTask -TaskName '${TASK_NAME}' -ErrorAction Stop | Out-Null" 2>$null`);
61
+ return 'installed';
62
+ }
63
+ catch {
64
+ return 'not-installed';
65
+ }
66
+ }
67
+ queryState() {
68
+ return this.queryTaskState();
69
+ }
70
+ install() {
71
+ const npxPath = this.findNpx();
72
+ // Create a VBS launcher to run npx completely hidden (no window flash)
73
+ if (!fs.existsSync(this.agentfleetDir)) {
74
+ fs.mkdirSync(this.agentfleetDir, { recursive: true });
75
+ }
76
+ const vbsPath = path.join(this.agentfleetDir, 'start-agentfleet.vbs');
77
+ const vbsContent = `Set WshShell = CreateObject("WScript.Shell")\nWshShell.Run """${npxPath}"" -y @daomar/agentfleet run -d", 0, False`;
78
+ fs.writeFileSync(vbsPath, vbsContent, 'utf-8');
79
+ const psCmd = [
80
+ `$action = New-ScheduledTaskAction -Execute 'wscript.exe' -Argument '"${vbsPath}"'`,
81
+ `$trigger1 = New-ScheduledTaskTrigger -AtLogOn -User $env:USERNAME`,
82
+ `$class = Get-CimClass MSFT_TaskEventTrigger root/Microsoft/Windows/TaskScheduler`,
83
+ `$trigger2 = $class | New-CimInstance -ClientOnly`,
84
+ `$trigger2.Enabled = $true`,
85
+ `$q = [char]34`,
86
+ `$trigger2.Subscription = '<QueryList><Query Id=' + $q + '0' + $q + ' Path=' + $q + 'System' + $q + '><Select Path=' + $q + 'System' + $q + '>*[System[Provider[@Name=''Microsoft-Windows-Power-Troubleshooter''] and EventID=1]]</Select></Query></QueryList>'`,
87
+ `$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 0 -RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 1) -StartWhenAvailable`,
88
+ `Register-ScheduledTask -TaskName '${TASK_NAME}' -Action $action -Trigger @($trigger1, $trigger2) -Settings $settings -Description 'AgentFleet agent orchestration' -Force`,
89
+ ].join('; ');
90
+ this.exec(`powershell -NoProfile -Command "${psCmd}"`);
91
+ }
92
+ uninstall() {
93
+ this.exec(`powershell -NoProfile -Command "Unregister-ScheduledTask -TaskName '${TASK_NAME}' -Confirm:$false"`);
94
+ // Clean up VBS launcher
95
+ const vbsPath = path.join(this.agentfleetDir, 'start-agentfleet.vbs');
96
+ try {
97
+ if (fs.existsSync(vbsPath))
98
+ fs.unlinkSync(vbsPath);
99
+ }
100
+ catch { /* ignore */ }
101
+ }
102
+ startTask() {
103
+ this.exec(`powershell -NoProfile -Command "Start-ScheduledTask -TaskName '${TASK_NAME}'"`);
104
+ }
105
+ start() {
106
+ this.startTask();
107
+ }
108
+ getName() {
109
+ return this.getTaskName();
110
+ }
111
+ findNpx() {
112
+ // Find the npx executable path
113
+ try {
114
+ const result = this.exec('where npx').trim().split(/\r?\n/);
115
+ // Prefer the .cmd version on Windows
116
+ const cmd = result.find(p => p.endsWith('.cmd')) ?? result[0];
117
+ return cmd.trim();
118
+ }
119
+ catch {
120
+ return 'npx';
121
+ }
122
+ }
123
+ }
124
+ exports.ScheduledTaskManager = ScheduledTaskManager;
125
+ //# sourceMappingURL=windows-service.js.map
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_CONFIG = void 0;
4
+ exports.DEFAULT_CONFIG = {
5
+ defaultAgent: 'claude-code',
6
+ defaultAgentCommand: 'claude -p {prompt}',
7
+ pollIntervalSeconds: 10,
8
+ maxConcurrency: 1,
9
+ taskTimeoutMinutes: 30,
10
+ outputSizeLimitBytes: 1024 * 1024, // 1MB
11
+ };
12
+ //# sourceMappingURL=index.js.map
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@daomar/agentfleet",
3
+ "version": "2.0.0",
4
+ "description": "Distributed agent orchestration, without a control plane.",
5
+ "main": "dist/cli.js",
6
+ "bin": {
7
+ "agentfleet": "dist/cli.js",
8
+ "dma": "dist/cli.js"
9
+ },
10
+ "scripts": {
11
+ "copy-locales": "node -e \"const fs=require('fs'),p=require('path');const s=p.join('src','locales'),d=p.join('dist','locales');fs.mkdirSync(d,{recursive:true});fs.readdirSync(s).filter(f=>f.endsWith('.json')).forEach(f=>fs.copyFileSync(p.join(s,f),p.join(d,f)))\"",
12
+ "build": "tsc && npm run copy-locales",
13
+ "start": "node dist/cli.js",
14
+ "dev": "tsc --watch",
15
+ "test": "npm run build && node --test test/*.test.js",
16
+ "web:dev": "cd web && npm run dev",
17
+ "web:build": "cd web && npm run build",
18
+ "web:test": "cd web && npx vitest run"
19
+ },
20
+ "keywords": [
21
+ "agent",
22
+ "orchestration",
23
+ "distributed",
24
+ "decentralized",
25
+ "onedrive",
26
+ "multi-machine",
27
+ "coding-agent",
28
+ "分布式",
29
+ "智能体",
30
+ "编排",
31
+ "多机器",
32
+ "代理"
33
+ ],
34
+ "author": "",
35
+ "license": "MIT",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/daomar-dev/agentfleet.git"
39
+ },
40
+ "homepage": "https://github.com/daomar-dev/agentfleet#readme",
41
+ "type": "commonjs",
42
+ "engines": {
43
+ "node": ">=18.0.0"
44
+ },
45
+ "files": [
46
+ "dist/**/*",
47
+ "!dist/**/*.map",
48
+ "assets/**/*",
49
+ "README.md"
50
+ ],
51
+ "dependencies": {
52
+ "chokidar": "^5.0.0",
53
+ "commander": "^14.0.3",
54
+ "typescript": "^6.0.2"
55
+ },
56
+ "devDependencies": {
57
+ "@types/node": "^25.5.0"
58
+ }
59
+ }