@openclaw-cloud/agent-controller 0.2.5 → 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.
Files changed (76) hide show
  1. package/bin/agent-controller.js +5 -0
  2. package/dist/commands/install.js +3 -0
  3. package/dist/commands/install.js.map +1 -1
  4. package/dist/config-file.d.ts +9 -0
  5. package/dist/config-file.js +47 -0
  6. package/dist/config-file.js.map +1 -0
  7. package/dist/connection.d.ts +1 -0
  8. package/dist/connection.js +27 -13
  9. package/dist/connection.js.map +1 -1
  10. package/dist/handlers/backup.js +7 -2
  11. package/dist/handlers/backup.js.map +1 -1
  12. package/dist/handlers/knowledge-sync.d.ts +2 -0
  13. package/dist/handlers/knowledge-sync.js +51 -0
  14. package/dist/handlers/knowledge-sync.js.map +1 -0
  15. package/dist/heartbeat.d.ts +1 -0
  16. package/dist/heartbeat.js +30 -0
  17. package/dist/heartbeat.js.map +1 -1
  18. package/dist/index.js +7 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/types.d.ts +2 -1
  21. package/package.json +6 -1
  22. package/.claude/cc-notify.sh +0 -32
  23. package/.claude/settings.json +0 -31
  24. package/.husky/pre-commit +0 -1
  25. package/BIZPLAN.md +0 -530
  26. package/CLAUDE.md +0 -172
  27. package/Dockerfile +0 -9
  28. package/__tests__/api.test.ts +0 -183
  29. package/__tests__/backup.test.ts +0 -145
  30. package/__tests__/board-handler.test.ts +0 -323
  31. package/__tests__/chat.test.ts +0 -191
  32. package/__tests__/config.test.ts +0 -100
  33. package/__tests__/connection.test.ts +0 -289
  34. package/__tests__/file-delete.test.ts +0 -90
  35. package/__tests__/file-write.test.ts +0 -119
  36. package/__tests__/gateway-adapter.test.ts +0 -366
  37. package/__tests__/gateway-client.test.ts +0 -272
  38. package/__tests__/handlers.test.ts +0 -150
  39. package/__tests__/heartbeat.test.ts +0 -124
  40. package/__tests__/onboarding.test.ts +0 -55
  41. package/__tests__/package-install.test.ts +0 -109
  42. package/__tests__/pair.test.ts +0 -60
  43. package/__tests__/self-update.test.ts +0 -123
  44. package/__tests__/stop.test.ts +0 -38
  45. package/jest.config.ts +0 -16
  46. package/src/api.ts +0 -62
  47. package/src/commands/install.ts +0 -64
  48. package/src/commands/self-update.ts +0 -43
  49. package/src/commands/uninstall.ts +0 -19
  50. package/src/connection.ts +0 -203
  51. package/src/debug.ts +0 -11
  52. package/src/handlers/backup.ts +0 -101
  53. package/src/handlers/board-handler.ts +0 -155
  54. package/src/handlers/chat.ts +0 -79
  55. package/src/handlers/config.ts +0 -48
  56. package/src/handlers/deploy.ts +0 -32
  57. package/src/handlers/exec.ts +0 -32
  58. package/src/handlers/file-delete.ts +0 -46
  59. package/src/handlers/file-write.ts +0 -65
  60. package/src/handlers/knowledge-sync.ts +0 -53
  61. package/src/handlers/onboarding.ts +0 -19
  62. package/src/handlers/package-install.ts +0 -69
  63. package/src/handlers/pair.ts +0 -26
  64. package/src/handlers/restart.ts +0 -19
  65. package/src/handlers/stop.ts +0 -17
  66. package/src/heartbeat.ts +0 -110
  67. package/src/index.ts +0 -97
  68. package/src/openclaw/gateway-adapter.ts +0 -129
  69. package/src/openclaw/gateway-client.ts +0 -131
  70. package/src/openclaw/index.ts +0 -17
  71. package/src/openclaw/types.ts +0 -41
  72. package/src/platform/linux.ts +0 -108
  73. package/src/platform/macos.ts +0 -122
  74. package/src/platform/windows.ts +0 -92
  75. package/src/types.ts +0 -94
  76. package/tsconfig.json +0 -18
@@ -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
- }