@openclaw-cloud/agent-controller 0.2.6 → 0.2.7
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/dist/commands/install.js +3 -0
- package/dist/commands/install.js.map +1 -1
- package/dist/config-file.d.ts +9 -0
- package/dist/config-file.js +47 -0
- package/dist/config-file.js.map +1 -0
- package/dist/connection.d.ts +1 -0
- package/dist/connection.js +27 -13
- package/dist/connection.js.map +1 -1
- package/dist/handlers/backup.js +7 -2
- package/dist/handlers/backup.js.map +1 -1
- package/dist/handlers/knowledge-sync.d.ts +2 -0
- package/dist/handlers/knowledge-sync.js +51 -0
- package/dist/handlers/knowledge-sync.js.map +1 -0
- package/dist/heartbeat.d.ts +1 -0
- package/dist/heartbeat.js +30 -0
- package/dist/heartbeat.js.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +2 -1
- package/package.json +6 -1
- package/.claude/cc-notify.sh +0 -32
- package/.claude/settings.json +0 -31
- package/.husky/pre-commit +0 -1
- package/BIZPLAN.md +0 -530
- package/CLAUDE.md +0 -172
- package/Dockerfile +0 -9
- package/__tests__/api.test.ts +0 -183
- package/__tests__/backup.test.ts +0 -145
- package/__tests__/board-handler.test.ts +0 -323
- package/__tests__/chat.test.ts +0 -191
- package/__tests__/config.test.ts +0 -100
- package/__tests__/connection.test.ts +0 -289
- package/__tests__/file-delete.test.ts +0 -90
- package/__tests__/file-write.test.ts +0 -119
- package/__tests__/gateway-adapter.test.ts +0 -366
- package/__tests__/gateway-client.test.ts +0 -272
- package/__tests__/handlers.test.ts +0 -150
- package/__tests__/heartbeat.test.ts +0 -124
- package/__tests__/onboarding.test.ts +0 -55
- package/__tests__/package-install.test.ts +0 -109
- package/__tests__/pair.test.ts +0 -60
- package/__tests__/self-update.test.ts +0 -123
- package/__tests__/stop.test.ts +0 -38
- package/jest.config.ts +0 -16
- package/src/api.ts +0 -62
- package/src/commands/install.ts +0 -68
- package/src/commands/self-update.ts +0 -43
- package/src/commands/uninstall.ts +0 -19
- package/src/config-file.ts +0 -56
- package/src/connection.ts +0 -203
- package/src/debug.ts +0 -11
- package/src/handlers/backup.ts +0 -101
- package/src/handlers/board-handler.ts +0 -155
- package/src/handlers/chat.ts +0 -79
- package/src/handlers/config.ts +0 -48
- package/src/handlers/deploy.ts +0 -32
- package/src/handlers/exec.ts +0 -32
- package/src/handlers/file-delete.ts +0 -46
- package/src/handlers/file-write.ts +0 -65
- package/src/handlers/knowledge-sync.ts +0 -53
- package/src/handlers/onboarding.ts +0 -19
- package/src/handlers/package-install.ts +0 -69
- package/src/handlers/pair.ts +0 -26
- package/src/handlers/restart.ts +0 -19
- package/src/handlers/stop.ts +0 -17
- package/src/heartbeat.ts +0 -110
- package/src/index.ts +0 -97
- package/src/openclaw/gateway-adapter.ts +0 -129
- package/src/openclaw/gateway-client.ts +0 -131
- package/src/openclaw/index.ts +0 -17
- package/src/openclaw/types.ts +0 -41
- package/src/platform/linux.ts +0 -108
- package/src/platform/macos.ts +0 -122
- package/src/platform/windows.ts +0 -92
- package/src/types.ts +0 -94
- package/tsconfig.json +0 -18
package/src/platform/macos.ts
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { exec } from 'node:child_process';
|
|
2
|
-
import { writeFileSync, mkdirSync } from 'node:fs';
|
|
3
|
-
import { homedir } from 'node:os';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
|
|
6
|
-
export interface PlatformConfig {
|
|
7
|
-
centrifugoUrl: string;
|
|
8
|
-
agentToken: string;
|
|
9
|
-
agentId: string;
|
|
10
|
-
backendInternalUrl: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function execAsync(cmd: string): Promise<string> {
|
|
14
|
-
return new Promise((resolve, reject) => {
|
|
15
|
-
exec(cmd, (err, stdout) => {
|
|
16
|
-
if (err) reject(err);
|
|
17
|
-
else resolve(stdout.toString().trim());
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async function which(bin: string): Promise<string> {
|
|
23
|
-
try {
|
|
24
|
-
return await execAsync(`which "${bin}"`);
|
|
25
|
-
} catch {
|
|
26
|
-
return '';
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export async function installMacOS(config: PlatformConfig): Promise<void> {
|
|
31
|
-
const home = homedir();
|
|
32
|
-
const launchAgentsDir = join(home, 'Library', 'LaunchAgents');
|
|
33
|
-
const plistPath = join(launchAgentsDir, 'com.openclaw.agent-controller.plist');
|
|
34
|
-
const logDir = join(home, 'Library', 'Logs');
|
|
35
|
-
const logFile = join(logDir, 'agent-controller.log');
|
|
36
|
-
const errFile = join(logDir, 'agent-controller.err');
|
|
37
|
-
|
|
38
|
-
const nodePath = process.execPath;
|
|
39
|
-
let agentControllerPath = await which('agent-controller');
|
|
40
|
-
if (!agentControllerPath) {
|
|
41
|
-
// Fallback: derive from node path
|
|
42
|
-
agentControllerPath = join(nodePath, '..', 'agent-controller');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
mkdirSync(launchAgentsDir, { recursive: true });
|
|
46
|
-
|
|
47
|
-
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
48
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
49
|
-
<plist version="1.0">
|
|
50
|
-
<dict>
|
|
51
|
-
<key>Label</key>
|
|
52
|
-
<string>com.openclaw.agent-controller</string>
|
|
53
|
-
<key>ProgramArguments</key>
|
|
54
|
-
<array>
|
|
55
|
-
<string>${nodePath}</string>
|
|
56
|
-
<string>${agentControllerPath}</string>
|
|
57
|
-
</array>
|
|
58
|
-
<key>EnvironmentVariables</key>
|
|
59
|
-
<dict>
|
|
60
|
-
<key>CENTRIFUGO_URL</key>
|
|
61
|
-
<string>${config.centrifugoUrl}</string>
|
|
62
|
-
<key>AGENT_TOKEN</key>
|
|
63
|
-
<string>${config.agentToken}</string>
|
|
64
|
-
<key>AGENT_ID</key>
|
|
65
|
-
<string>${config.agentId}</string>
|
|
66
|
-
<key>BACKEND_INTERNAL_URL</key>
|
|
67
|
-
<string>${config.backendInternalUrl}</string>
|
|
68
|
-
</dict>
|
|
69
|
-
<key>RunAtLoad</key>
|
|
70
|
-
<true/>
|
|
71
|
-
<key>KeepAlive</key>
|
|
72
|
-
<true/>
|
|
73
|
-
<key>StandardOutPath</key>
|
|
74
|
-
<string>${logFile}</string>
|
|
75
|
-
<key>StandardErrorPath</key>
|
|
76
|
-
<string>${errFile}</string>
|
|
77
|
-
</dict>
|
|
78
|
-
</plist>
|
|
79
|
-
`;
|
|
80
|
-
|
|
81
|
-
writeFileSync(plistPath, plist, 'utf8');
|
|
82
|
-
console.log(`Written: ${plistPath}`);
|
|
83
|
-
|
|
84
|
-
try {
|
|
85
|
-
await execAsync(`launchctl load -w "${plistPath}"`);
|
|
86
|
-
console.log('Service loaded via launchctl.');
|
|
87
|
-
} catch (err) {
|
|
88
|
-
console.warn('launchctl load failed (may already be loaded):', err instanceof Error ? err.message : err);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
console.log('');
|
|
92
|
-
console.log('Agent Controller installed as a macOS LaunchAgent.');
|
|
93
|
-
console.log('');
|
|
94
|
-
console.log('Useful commands:');
|
|
95
|
-
console.log(` Start: launchctl load -w "${plistPath}"`);
|
|
96
|
-
console.log(` Stop: launchctl unload "${plistPath}"`);
|
|
97
|
-
console.log(` Logs: tail -f "${logFile}"`);
|
|
98
|
-
console.log(` Errors: tail -f "${errFile}"`);
|
|
99
|
-
console.log(` Uninstall: agent-controller uninstall`);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export async function uninstallMacOS(): Promise<void> {
|
|
103
|
-
const home = homedir();
|
|
104
|
-
const plistPath = join(home, 'Library', 'LaunchAgents', 'com.openclaw.agent-controller.plist');
|
|
105
|
-
|
|
106
|
-
try {
|
|
107
|
-
await execAsync(`launchctl unload "${plistPath}"`);
|
|
108
|
-
console.log('Service unloaded via launchctl.');
|
|
109
|
-
} catch (err) {
|
|
110
|
-
console.warn('launchctl unload failed (may not be loaded):', err instanceof Error ? err.message : err);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const { unlinkSync, existsSync } = await import('node:fs');
|
|
114
|
-
if (existsSync(plistPath)) {
|
|
115
|
-
unlinkSync(plistPath);
|
|
116
|
-
console.log(`Removed: ${plistPath}`);
|
|
117
|
-
} else {
|
|
118
|
-
console.log(`Plist not found: ${plistPath}`);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
console.log('Agent Controller uninstalled.');
|
|
122
|
-
}
|
package/src/platform/windows.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { exec } from 'node:child_process';
|
|
2
|
-
import { writeFileSync, mkdirSync } from 'node:fs';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
|
|
5
|
-
export interface PlatformConfig {
|
|
6
|
-
centrifugoUrl: string;
|
|
7
|
-
agentToken: string;
|
|
8
|
-
agentId: string;
|
|
9
|
-
backendInternalUrl: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function execAsync(cmd: string): Promise<string> {
|
|
13
|
-
return new Promise((resolve, reject) => {
|
|
14
|
-
exec(cmd, (err, stdout) => {
|
|
15
|
-
if (err) reject(err);
|
|
16
|
-
else resolve(stdout.toString().trim());
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async function which(bin: string): Promise<string> {
|
|
22
|
-
try {
|
|
23
|
-
return await execAsync(`where "${bin}"`);
|
|
24
|
-
} catch {
|
|
25
|
-
return '';
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export async function installWindows(config: PlatformConfig): Promise<void> {
|
|
30
|
-
const appData = process.env['APPDATA'] ?? join(process.env['USERPROFILE'] ?? 'C:\\Users\\Default', 'AppData', 'Roaming');
|
|
31
|
-
const openclawDir = join(appData, 'openclaw');
|
|
32
|
-
const wrapperPath = join(openclawDir, 'agent-controller.cmd');
|
|
33
|
-
|
|
34
|
-
const nodePath = process.execPath;
|
|
35
|
-
let agentControllerPath = await which('agent-controller');
|
|
36
|
-
if (!agentControllerPath) {
|
|
37
|
-
agentControllerPath = join(nodePath, '..', 'agent-controller');
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
mkdirSync(openclawDir, { recursive: true });
|
|
41
|
-
|
|
42
|
-
const wrapper = `@echo off
|
|
43
|
-
set CENTRIFUGO_URL=${config.centrifugoUrl}
|
|
44
|
-
set AGENT_TOKEN=${config.agentToken}
|
|
45
|
-
set AGENT_ID=${config.agentId}
|
|
46
|
-
set BACKEND_INTERNAL_URL=${config.backendInternalUrl}
|
|
47
|
-
"${nodePath}" "${agentControllerPath}"
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
writeFileSync(wrapperPath, wrapper, 'utf8');
|
|
51
|
-
console.log(`Written: ${wrapperPath}`);
|
|
52
|
-
|
|
53
|
-
try {
|
|
54
|
-
await execAsync(
|
|
55
|
-
`schtasks /create /tn "OpenClaw Agent Controller" /tr "${wrapperPath}" /sc ONLOGON /rl HIGHEST /f`
|
|
56
|
-
);
|
|
57
|
-
console.log('Scheduled task created.');
|
|
58
|
-
} catch (err) {
|
|
59
|
-
console.warn('schtasks create failed:', err instanceof Error ? err.message : err);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
console.log('');
|
|
63
|
-
console.log('Agent Controller installed as a Windows scheduled task (ONLOGON).');
|
|
64
|
-
console.log('');
|
|
65
|
-
console.log('Useful commands:');
|
|
66
|
-
console.log(' Start: schtasks /run /tn "OpenClaw Agent Controller"');
|
|
67
|
-
console.log(' Stop: schtasks /end /tn "OpenClaw Agent Controller"');
|
|
68
|
-
console.log(' Uninstall: agent-controller uninstall');
|
|
69
|
-
console.log(` Wrapper: ${wrapperPath}`);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export async function uninstallWindows(): Promise<void> {
|
|
73
|
-
try {
|
|
74
|
-
await execAsync('schtasks /delete /tn "OpenClaw Agent Controller" /f');
|
|
75
|
-
console.log('Scheduled task deleted.');
|
|
76
|
-
} catch (err) {
|
|
77
|
-
console.warn('schtasks delete failed (may not exist):', err instanceof Error ? err.message : err);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const appData = process.env['APPDATA'] ?? join(process.env['USERPROFILE'] ?? 'C:\\Users\\Default', 'AppData', 'Roaming');
|
|
81
|
-
const wrapperPath = join(appData, 'openclaw', 'agent-controller.cmd');
|
|
82
|
-
|
|
83
|
-
const { unlinkSync, existsSync } = await import('node:fs');
|
|
84
|
-
if (existsSync(wrapperPath)) {
|
|
85
|
-
unlinkSync(wrapperPath);
|
|
86
|
-
console.log(`Removed: ${wrapperPath}`);
|
|
87
|
-
} else {
|
|
88
|
-
console.log(`Wrapper not found: ${wrapperPath}`);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
console.log('Agent Controller uninstalled.');
|
|
92
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centrifugo channel layout:
|
|
3
|
-
* agent:<agentId> — commands from backend, responses from agent
|
|
4
|
-
* heartbeat:<agentId> — heartbeat publications from agent
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export type CommandType =
|
|
8
|
-
| 'exec' | 'restart' | 'deploy' | 'config' | 'pair' | 'stop' | 'backup'
|
|
9
|
-
| 'chat_list_sessions' | 'chat_history' | 'chat_send'
|
|
10
|
-
| 'package_install' | 'file_write' | 'file_delete' | 'onboarding_complete'
|
|
11
|
-
| 'knowledge_sync' | 'self_update';
|
|
12
|
-
|
|
13
|
-
export interface AgentCommand {
|
|
14
|
-
id: string;
|
|
15
|
-
type: CommandType;
|
|
16
|
-
payload: Record<string, unknown>;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface AgentResponse {
|
|
20
|
-
id: string;
|
|
21
|
-
type: CommandType;
|
|
22
|
-
success: boolean;
|
|
23
|
-
data?: Record<string, unknown>;
|
|
24
|
-
error?: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface HeartbeatPayload {
|
|
28
|
-
type: 'heartbeat';
|
|
29
|
-
agentId: string;
|
|
30
|
-
ts: number;
|
|
31
|
-
version: string;
|
|
32
|
-
metrics: {
|
|
33
|
-
cpu: number;
|
|
34
|
-
mem: number;
|
|
35
|
-
uptime: number;
|
|
36
|
-
};
|
|
37
|
-
boardStatus?: BoardState;
|
|
38
|
-
lastMessageAt?: string | null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface BoardState {
|
|
42
|
-
state: 'idle' | 'working';
|
|
43
|
-
cardId: string | null;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface BoardEvent {
|
|
47
|
-
event: 'card:entered' | 'card:claimed' | 'card:moved' | 'card:commented';
|
|
48
|
-
cardId: string;
|
|
49
|
-
columnId?: string;
|
|
50
|
-
columnName?: string;
|
|
51
|
-
title?: string;
|
|
52
|
-
description?: string;
|
|
53
|
-
priority?: string;
|
|
54
|
-
agentId?: string;
|
|
55
|
-
fromColumnId?: string;
|
|
56
|
-
toColumnId?: string;
|
|
57
|
-
authorType?: string;
|
|
58
|
-
authorId?: string;
|
|
59
|
-
content?: string;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface BoardInfo {
|
|
63
|
-
board: {
|
|
64
|
-
id: string;
|
|
65
|
-
workspaceId: string;
|
|
66
|
-
columns: Array<{
|
|
67
|
-
id: string;
|
|
68
|
-
name: string;
|
|
69
|
-
type: string;
|
|
70
|
-
position: number;
|
|
71
|
-
cards: Array<{
|
|
72
|
-
id: string;
|
|
73
|
-
title: string;
|
|
74
|
-
description?: string;
|
|
75
|
-
priority?: string;
|
|
76
|
-
assignedAgentId?: string | null;
|
|
77
|
-
createdAt?: string;
|
|
78
|
-
}>;
|
|
79
|
-
}>;
|
|
80
|
-
myColumnIds: string[];
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface CardDetail {
|
|
85
|
-
card: {
|
|
86
|
-
id: string;
|
|
87
|
-
title: string;
|
|
88
|
-
description?: string;
|
|
89
|
-
priority?: string;
|
|
90
|
-
columnId: string;
|
|
91
|
-
columnName?: string;
|
|
92
|
-
assignedAgentId?: string | null;
|
|
93
|
-
};
|
|
94
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "ES2022",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"forceConsistentCasingInFileNames": true,
|
|
10
|
-
"outDir": "dist",
|
|
11
|
-
"rootDir": "src",
|
|
12
|
-
"declaration": true,
|
|
13
|
-
"resolveJsonModule": true,
|
|
14
|
-
"sourceMap": true
|
|
15
|
-
},
|
|
16
|
-
"include": ["src"],
|
|
17
|
-
"exclude": ["node_modules", "dist", "__tests__"]
|
|
18
|
-
}
|