@openclaw-cloud/agent-controller 0.1.3 → 0.1.5

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 (64) hide show
  1. package/.husky/pre-commit +1 -0
  2. package/CLAUDE.md +59 -0
  3. package/__tests__/api.test.ts +123 -0
  4. package/__tests__/board-handler.test.ts +6 -3
  5. package/__tests__/chat.test.ts +191 -0
  6. package/__tests__/config.test.ts +100 -0
  7. package/__tests__/file-write.test.ts +119 -0
  8. package/__tests__/gateway-adapter.test.ts +366 -0
  9. package/__tests__/gateway-client.test.ts +272 -0
  10. package/__tests__/onboarding.test.ts +55 -0
  11. package/__tests__/package-install.test.ts +109 -0
  12. package/__tests__/pair.test.ts +60 -0
  13. package/__tests__/self-update.test.ts +123 -0
  14. package/__tests__/stop.test.ts +38 -0
  15. package/bin/agent-controller.js +15 -2
  16. package/dist/commands/self-update.d.ts +1 -0
  17. package/dist/commands/self-update.js +41 -0
  18. package/dist/commands/self-update.js.map +1 -0
  19. package/dist/connection.js +24 -0
  20. package/dist/connection.js.map +1 -1
  21. package/dist/handlers/board-handler.d.ts +1 -0
  22. package/dist/handlers/board-handler.js +5 -2
  23. package/dist/handlers/board-handler.js.map +1 -1
  24. package/dist/handlers/chat.d.ts +4 -0
  25. package/dist/handlers/chat.js +62 -0
  26. package/dist/handlers/chat.js.map +1 -0
  27. package/dist/handlers/file-write.d.ts +2 -0
  28. package/dist/handlers/file-write.js +59 -0
  29. package/dist/handlers/file-write.js.map +1 -0
  30. package/dist/handlers/onboarding.d.ts +2 -0
  31. package/dist/handlers/onboarding.js +18 -0
  32. package/dist/handlers/onboarding.js.map +1 -0
  33. package/dist/handlers/package-install.d.ts +2 -0
  34. package/dist/handlers/package-install.js +59 -0
  35. package/dist/handlers/package-install.js.map +1 -0
  36. package/dist/index.js +18 -3
  37. package/dist/index.js.map +1 -1
  38. package/dist/openclaw/gateway-adapter.d.ts +22 -0
  39. package/dist/openclaw/gateway-adapter.js +108 -0
  40. package/dist/openclaw/gateway-adapter.js.map +1 -0
  41. package/dist/openclaw/gateway-client.d.ts +21 -0
  42. package/dist/openclaw/gateway-client.js +114 -0
  43. package/dist/openclaw/gateway-client.js.map +1 -0
  44. package/dist/openclaw/index.d.ts +8 -0
  45. package/dist/openclaw/index.js +12 -0
  46. package/dist/openclaw/index.js.map +1 -0
  47. package/dist/openclaw/types.d.ts +36 -0
  48. package/dist/openclaw/types.js +2 -0
  49. package/dist/openclaw/types.js.map +1 -0
  50. package/dist/types.d.ts +2 -1
  51. package/package.json +4 -2
  52. package/src/commands/self-update.ts +43 -0
  53. package/src/connection.ts +25 -0
  54. package/src/handlers/board-handler.ts +5 -2
  55. package/src/handlers/chat.ts +79 -0
  56. package/src/handlers/file-write.ts +65 -0
  57. package/src/handlers/onboarding.ts +19 -0
  58. package/src/handlers/package-install.ts +69 -0
  59. package/src/index.ts +19 -3
  60. package/src/openclaw/gateway-adapter.ts +129 -0
  61. package/src/openclaw/gateway-client.ts +131 -0
  62. package/src/openclaw/index.ts +17 -0
  63. package/src/openclaw/types.ts +41 -0
  64. package/src/types.ts +5 -1
@@ -0,0 +1,41 @@
1
+ export interface ChatSession {
2
+ key: string;
3
+ sessionId: string;
4
+ kind: string;
5
+ updatedAt: number;
6
+ model?: string;
7
+ }
8
+
9
+ export interface ChatMessage {
10
+ role: 'user' | 'assistant';
11
+ content: string; // normalized to plain text
12
+ timestamp: string; // ISO 8601
13
+ }
14
+
15
+ export interface ChatAttachment {
16
+ type: 'image';
17
+ mimeType: string;
18
+ content: string; // base64
19
+ }
20
+
21
+ export interface IChatProvider {
22
+ listSessions(): Promise<ChatSession[]>;
23
+ getHistory(sessionKey: string, limit?: number): Promise<ChatMessage[]>;
24
+
25
+ /**
26
+ * Send message. Returns after the agent finishes (full response).
27
+ * Calls onDelta with accumulated text during streaming.
28
+ * Calls onDone when agent response is complete.
29
+ */
30
+ sendMessage(params: {
31
+ sessionKey: string;
32
+ text: string;
33
+ idempotencyKey: string;
34
+ attachments?: ChatAttachment[];
35
+ onDelta?: (accumulatedText: string) => void;
36
+ onDone?: (finalText: string) => void;
37
+ onError?: (error: string) => void;
38
+ }): Promise<void>;
39
+
40
+ abort(sessionKey: string, runId?: string): Promise<void>;
41
+ }
package/src/types.ts CHANGED
@@ -4,7 +4,10 @@
4
4
  * heartbeat:<agentId> — heartbeat publications from agent
5
5
  */
6
6
 
7
- export type CommandType = 'exec' | 'restart' | 'deploy' | 'config' | 'pair' | 'stop' | 'backup';
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' | 'onboarding_complete';
8
11
 
9
12
  export interface AgentCommand {
10
13
  id: string;
@@ -56,6 +59,7 @@ export interface BoardEvent {
56
59
  export interface BoardInfo {
57
60
  board: {
58
61
  id: string;
62
+ workspaceId: string;
59
63
  columns: Array<{
60
64
  id: string;
61
65
  name: string;