@swarmclawai/swarmclaw 1.2.6 → 1.2.9

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 (269) hide show
  1. package/README.md +54 -23
  2. package/next.config.ts +1 -0
  3. package/package.json +4 -3
  4. package/scripts/easy-setup.mjs +1 -1
  5. package/scripts/postinstall.mjs +1 -1
  6. package/skills/swarmclaw.md +115 -0
  7. package/skills/tools/browser.md +131 -0
  8. package/skills/tools/execute.md +98 -0
  9. package/skills/tools/files.md +98 -0
  10. package/skills/tools/memory.md +104 -0
  11. package/skills/tools/platform.md +144 -0
  12. package/skills/tools/skills.md +83 -0
  13. package/src/app/agents/[id]/page.tsx +1 -18
  14. package/src/app/api/agents/thread-route.test.ts +0 -1
  15. package/src/app/api/approvals/route.test.ts +6 -22
  16. package/src/app/api/chats/[id]/messages/route.ts +23 -19
  17. package/src/app/api/chats/messages-route.test.ts +105 -51
  18. package/src/app/api/connectors/route.ts +2 -2
  19. package/src/app/api/mcp-servers/[id]/test/route.ts +3 -2
  20. package/src/app/api/openclaw/deploy/route.ts +2 -0
  21. package/src/app/api/portability/export/route.ts +8 -0
  22. package/src/app/api/portability/import/route.test.ts +80 -0
  23. package/src/app/api/portability/import/route.ts +28 -0
  24. package/src/app/api/settings/route.ts +0 -2
  25. package/src/app/api/setup/doctor/route.ts +4 -4
  26. package/src/app/api/wallets/[id]/route.ts +15 -157
  27. package/src/app/api/wallets/generate/route.ts +22 -0
  28. package/src/app/api/wallets/route.test.ts +147 -0
  29. package/src/app/api/wallets/route.ts +13 -95
  30. package/src/app/autonomy/page.tsx +2 -57
  31. package/src/app/protocols/page.tsx +2 -21
  32. package/src/app/settings/page.tsx +0 -9
  33. package/src/app/wallets/page.tsx +105 -5
  34. package/src/cli/index.js +21 -33
  35. package/src/cli/spec.js +19 -30
  36. package/src/components/agents/agent-chat-list.tsx +23 -1
  37. package/src/components/agents/agent-sheet.tsx +2 -40
  38. package/src/components/agents/inspector-panel.tsx +165 -131
  39. package/src/components/chat/chat-area.tsx +38 -9
  40. package/src/components/chat/chat-card.tsx +0 -31
  41. package/src/components/chat/message-bubble.tsx +1 -108
  42. package/src/components/chat/message-list.tsx +33 -19
  43. package/src/components/connectors/connector-sheet.tsx +25 -1
  44. package/src/components/gateways/gateway-sheet.tsx +5 -2
  45. package/src/components/layout/sidebar-rail.tsx +6 -10
  46. package/src/components/projects/project-detail.tsx +3 -35
  47. package/src/components/projects/tabs/overview-tab.tsx +3 -59
  48. package/src/components/projects/tabs/work-tab.tsx +7 -77
  49. package/src/components/protocols/structured-session-launcher.tsx +1 -22
  50. package/src/components/shared/connector-platform-icon.tsx +1 -0
  51. package/src/components/tasks/task-card.tsx +4 -34
  52. package/src/components/tasks/task-sheet.tsx +6 -36
  53. package/src/components/wallets/wallet-list.tsx +150 -0
  54. package/src/lib/agent-execute-defaults.test.ts +24 -0
  55. package/src/lib/agent-execute-defaults.ts +62 -0
  56. package/src/lib/app/navigation.test.ts +0 -13
  57. package/src/lib/app/navigation.ts +2 -7
  58. package/src/lib/app/view-constants.ts +14 -19
  59. package/src/lib/chat/queued-message-queue.test.ts +134 -1
  60. package/src/lib/chat/queued-message-queue.ts +77 -2
  61. package/src/lib/server/agents/agent-service.ts +5 -0
  62. package/src/lib/server/agents/agent-thread-session.ts +0 -1
  63. package/src/lib/server/agents/delegation-advisory.test.ts +0 -1
  64. package/src/lib/server/agents/delegation-jobs.test.ts +0 -69
  65. package/src/lib/server/agents/delegation-jobs.ts +0 -25
  66. package/src/lib/server/agents/main-agent-loop.ts +1 -49
  67. package/src/lib/server/agents/subagent-runtime.ts +0 -1
  68. package/src/lib/server/approval-match.ts +0 -85
  69. package/src/lib/server/approvals.test.ts +6 -6
  70. package/src/lib/server/approvals.ts +0 -6
  71. package/src/lib/server/autonomy/supervisor-reflection.test.ts +0 -1
  72. package/src/lib/server/builtin-extensions.ts +1 -2
  73. package/src/lib/server/capability-router.test.ts +0 -2
  74. package/src/lib/server/chat-execution/chat-execution-advanced.test.ts +1 -1
  75. package/src/lib/server/chat-execution/chat-execution-tool-events.test.ts +15 -14
  76. package/src/lib/server/chat-execution/chat-execution-types.ts +0 -2
  77. package/src/lib/server/chat-execution/chat-execution-utils.ts +2 -4
  78. package/src/lib/server/chat-execution/chat-streaming-utils.ts +2 -30
  79. package/src/lib/server/chat-execution/chat-turn-finalization.ts +1 -36
  80. package/src/lib/server/chat-execution/chat-turn-preparation.ts +81 -64
  81. package/src/lib/server/chat-execution/chat-turn-stream-execution.ts +4 -0
  82. package/src/lib/server/chat-execution/continuation-evaluator.ts +8 -0
  83. package/src/lib/server/chat-execution/iteration-event-handler.ts +0 -24
  84. package/src/lib/server/chat-execution/memory-mutation-tools.ts +1 -1
  85. package/src/lib/server/chat-execution/message-classifier.test.ts +0 -45
  86. package/src/lib/server/chat-execution/message-classifier.ts +11 -16
  87. package/src/lib/server/chat-execution/prompt-builder.test.ts +27 -0
  88. package/src/lib/server/chat-execution/prompt-builder.ts +14 -31
  89. package/src/lib/server/chat-execution/prompt-mode.test.ts +24 -0
  90. package/src/lib/server/chat-execution/prompt-mode.ts +5 -1
  91. package/src/lib/server/chat-execution/prompt-sections.ts +0 -1
  92. package/src/lib/server/chat-execution/situational-awareness.test.ts +2 -73
  93. package/src/lib/server/chat-execution/situational-awareness.ts +4 -38
  94. package/src/lib/server/chat-execution/stream-agent-chat.test.ts +13 -126
  95. package/src/lib/server/chat-execution/stream-agent-chat.ts +46 -21
  96. package/src/lib/server/chat-execution/stream-continuation.test.ts +4 -52
  97. package/src/lib/server/chat-execution/stream-continuation.ts +6 -48
  98. package/src/lib/server/chatrooms/chatroom-routing.test.ts +4 -0
  99. package/src/lib/server/chatrooms/session-mailbox.ts +0 -10
  100. package/src/lib/server/chats/chat-session-service.ts +3 -5
  101. package/src/lib/server/connectors/connector-inbound.ts +0 -1
  102. package/src/lib/server/connectors/connector-lifecycle.ts +19 -3
  103. package/src/lib/server/connectors/connector-service.ts +39 -9
  104. package/src/lib/server/connectors/discord.ts +2 -2
  105. package/src/lib/server/connectors/matrix.ts +3 -2
  106. package/src/lib/server/connectors/signal.ts +5 -4
  107. package/src/lib/server/connectors/slack.ts +10 -9
  108. package/src/lib/server/connectors/swarmdock-bidding.ts +74 -0
  109. package/src/lib/server/connectors/swarmdock-payloads.test.ts +85 -0
  110. package/src/lib/server/connectors/swarmdock-secret.test.ts +128 -0
  111. package/src/lib/server/connectors/swarmdock-secret.ts +152 -0
  112. package/src/lib/server/connectors/swarmdock-tasks.ts +119 -0
  113. package/src/lib/server/connectors/swarmdock.ts +255 -0
  114. package/src/lib/server/connectors/teams.ts +3 -2
  115. package/src/lib/server/connectors/telegram.ts +4 -4
  116. package/src/lib/server/connectors/whatsapp.ts +2 -2
  117. package/src/lib/server/daemon/controller.ts +7 -0
  118. package/src/lib/server/execution-brief.test.ts +2 -25
  119. package/src/lib/server/execution-brief.ts +12 -35
  120. package/src/lib/server/execution-engine/task-attempt.ts +0 -1
  121. package/src/lib/server/gateways/gateway-profile-service.ts +19 -1
  122. package/src/lib/server/messages/message-repository.test.ts +70 -0
  123. package/src/lib/server/messages/message-repository.ts +11 -6
  124. package/src/lib/server/openclaw/deploy.ts +32 -2
  125. package/src/lib/server/persistence/storage-context.ts +0 -5
  126. package/src/lib/server/plugins-advanced.test.ts +1 -2
  127. package/src/lib/server/portability/export.ts +109 -0
  128. package/src/lib/server/portability/import.ts +159 -0
  129. package/src/lib/server/protocols/protocol-normalization.ts +0 -4
  130. package/src/lib/server/protocols/protocol-queries.ts +0 -6
  131. package/src/lib/server/protocols/protocol-run-lifecycle.ts +4 -32
  132. package/src/lib/server/protocols/protocol-service.ts +0 -1
  133. package/src/lib/server/protocols/protocol-step-helpers.ts +0 -4
  134. package/src/lib/server/protocols/protocol-step-processors.ts +0 -6
  135. package/src/lib/server/protocols/protocol-swarm.ts +0 -2
  136. package/src/lib/server/protocols/protocol-types.ts +0 -2
  137. package/src/lib/server/provider-health.ts +1 -10
  138. package/src/lib/server/runtime/daemon-state/core.ts +0 -9
  139. package/src/lib/server/runtime/daemon-state.test.ts +0 -35
  140. package/src/lib/server/runtime/heartbeat-service.ts +3 -23
  141. package/src/lib/server/runtime/process-manager.ts +13 -9
  142. package/src/lib/server/runtime/queue/core.ts +11 -33
  143. package/src/lib/server/runtime/runtime-storage-write-paths.test.ts +6 -6
  144. package/src/lib/server/runtime/scheduler.ts +0 -13
  145. package/src/lib/server/runtime/session-run-manager/drain.ts +0 -24
  146. package/src/lib/server/runtime/session-run-manager/enqueue.ts +0 -1
  147. package/src/lib/server/runtime/session-run-manager/queries.ts +15 -1
  148. package/src/lib/server/runtime/session-run-manager/recovery.ts +0 -1
  149. package/src/lib/server/runtime/session-run-manager.test.ts +58 -28
  150. package/src/lib/server/sandbox/session-runtime.test.ts +18 -1
  151. package/src/lib/server/sandbox/session-runtime.ts +40 -28
  152. package/src/lib/server/session-tools/autonomy-tools.test.ts +7 -9
  153. package/src/lib/server/session-tools/context.ts +1 -1
  154. package/src/lib/server/session-tools/credential-env.ts +109 -0
  155. package/src/lib/server/session-tools/crud.ts +3 -17
  156. package/src/lib/server/session-tools/delegate.ts +0 -4
  157. package/src/lib/server/session-tools/edit_file.ts +3 -2
  158. package/src/lib/server/session-tools/execute.test.ts +58 -0
  159. package/src/lib/server/session-tools/execute.ts +334 -0
  160. package/src/lib/server/session-tools/files-tool.ts +635 -0
  161. package/src/lib/server/session-tools/index.ts +14 -8
  162. package/src/lib/server/session-tools/memory-tool.ts +242 -0
  163. package/src/lib/server/session-tools/memory.ts +1 -1
  164. package/src/lib/server/session-tools/openclaw-nodes.ts +3 -2
  165. package/src/lib/server/session-tools/openclaw-workspace.ts +3 -2
  166. package/src/lib/server/session-tools/platform-tool.ts +617 -0
  167. package/src/lib/server/session-tools/session-info.ts +3 -2
  168. package/src/lib/server/session-tools/session-tools-wiring.test.ts +3 -4
  169. package/src/lib/server/session-tools/shell.ts +7 -122
  170. package/src/lib/server/session-tools/skills-tool.ts +396 -0
  171. package/src/lib/server/session-tools/team-context.ts +0 -3
  172. package/src/lib/server/session-tools/web.ts +2 -2
  173. package/src/lib/server/storage-normalization.ts +10 -0
  174. package/src/lib/server/storage.ts +18 -45
  175. package/src/lib/server/tasks/task-checkout.ts +59 -0
  176. package/src/lib/server/tasks/task-lifecycle.ts +2 -0
  177. package/src/lib/server/tasks/task-route-service.ts +4 -26
  178. package/src/lib/server/tasks/task-service.ts +0 -7
  179. package/src/lib/server/tool-aliases.ts +2 -2
  180. package/src/lib/server/tool-capability-policy-advanced.test.ts +13 -6
  181. package/src/lib/server/tool-capability-policy.test.ts +2 -1
  182. package/src/lib/server/tool-capability-policy.ts +60 -35
  183. package/src/lib/server/tool-planning.ts +11 -12
  184. package/src/lib/server/universal-tool-access.ts +0 -1
  185. package/src/lib/server/wallets/wallet-crypto.ts +33 -0
  186. package/src/lib/server/wallets/wallet-repository.ts +24 -0
  187. package/src/lib/server/wallets/wallet-service.ts +119 -0
  188. package/src/lib/server/working-state/extraction.ts +8 -42
  189. package/src/lib/server/working-state/normalization.ts +10 -103
  190. package/src/lib/server/working-state/service.ts +12 -21
  191. package/src/lib/setup-defaults.ts +5 -0
  192. package/src/lib/strip-internal-metadata.test.ts +1 -1
  193. package/src/lib/strip-internal-metadata.ts +1 -1
  194. package/src/lib/tool-definitions.ts +1 -1
  195. package/src/lib/validation/schemas.test.ts +16 -0
  196. package/src/lib/validation/schemas.ts +49 -2
  197. package/src/stores/slices/data-slice.ts +5 -1
  198. package/src/stores/slices/ui-slice.ts +0 -4
  199. package/src/stores/use-chat-store.test.ts +231 -0
  200. package/src/stores/use-chat-store.ts +62 -13
  201. package/src/types/agent.ts +264 -0
  202. package/src/types/app-settings.ts +173 -0
  203. package/src/types/approval.ts +25 -0
  204. package/src/types/connector.ts +188 -0
  205. package/src/types/extension.ts +386 -0
  206. package/src/types/index.ts +16 -3555
  207. package/src/types/message.ts +56 -0
  208. package/src/types/misc.ts +737 -0
  209. package/src/types/protocol.ts +420 -0
  210. package/src/types/provider.ts +52 -0
  211. package/src/types/run.ts +180 -0
  212. package/src/types/schedule.ts +59 -0
  213. package/src/types/session.ts +215 -0
  214. package/src/types/skill.ts +157 -0
  215. package/src/types/swarmdock.ts +29 -0
  216. package/src/types/task.ts +144 -0
  217. package/src/types/working-state.ts +204 -0
  218. package/src/views/settings/section-heartbeat.tsx +2 -2
  219. package/src/views/settings/section-runtime-loop.tsx +0 -14
  220. package/src/app/api/canvas/[sessionId]/route.ts +0 -35
  221. package/src/app/api/missions/[id]/actions/route.ts +0 -31
  222. package/src/app/api/missions/[id]/events/route.ts +0 -14
  223. package/src/app/api/missions/[id]/route.ts +0 -10
  224. package/src/app/api/missions/route.test.ts +0 -244
  225. package/src/app/api/missions/route.ts +0 -57
  226. package/src/app/api/wallets/[id]/approve/route.ts +0 -79
  227. package/src/app/api/wallets/[id]/balance-history/route.ts +0 -18
  228. package/src/app/api/wallets/[id]/send/route.ts +0 -113
  229. package/src/app/api/wallets/[id]/transactions/route.ts +0 -18
  230. package/src/app/missions/[id]/page.tsx +0 -3
  231. package/src/app/missions/page.tsx +0 -685
  232. package/src/components/canvas/canvas-panel.tsx +0 -267
  233. package/src/components/wallets/wallet-approval-dialog.tsx +0 -107
  234. package/src/components/wallets/wallet-panel.tsx +0 -1010
  235. package/src/components/wallets/wallet-section.tsx +0 -260
  236. package/src/features/missions/queries.ts +0 -23
  237. package/src/lib/canvas-content.test.ts +0 -360
  238. package/src/lib/canvas-content.ts +0 -198
  239. package/src/lib/server/canvas-content.test.ts +0 -32
  240. package/src/lib/server/canvas-content.ts +0 -6
  241. package/src/lib/server/ethereum.ts +0 -591
  242. package/src/lib/server/evm-swap.ts +0 -476
  243. package/src/lib/server/missions/mission-intent.test.ts +0 -63
  244. package/src/lib/server/missions/mission-intent.ts +0 -569
  245. package/src/lib/server/missions/mission-repository.ts +0 -74
  246. package/src/lib/server/missions/mission-service/actions.ts +0 -6
  247. package/src/lib/server/missions/mission-service/bindings.ts +0 -9
  248. package/src/lib/server/missions/mission-service/context.ts +0 -4
  249. package/src/lib/server/missions/mission-service/core.ts +0 -2271
  250. package/src/lib/server/missions/mission-service/queries.ts +0 -12
  251. package/src/lib/server/missions/mission-service/recovery.ts +0 -5
  252. package/src/lib/server/missions/mission-service/ticks.ts +0 -9
  253. package/src/lib/server/missions/mission-service.test.ts +0 -888
  254. package/src/lib/server/missions/mission-service.ts +0 -6
  255. package/src/lib/server/session-tools/canvas.ts +0 -105
  256. package/src/lib/server/session-tools/sandbox.ts +0 -281
  257. package/src/lib/server/session-tools/wallet-tool.test.ts +0 -150
  258. package/src/lib/server/session-tools/wallet.ts +0 -1287
  259. package/src/lib/server/solana.ts +0 -327
  260. package/src/lib/server/wallet/wallet-execution.test.ts +0 -198
  261. package/src/lib/server/wallet/wallet-portfolio.test.ts +0 -98
  262. package/src/lib/server/wallet/wallet-portfolio.ts +0 -772
  263. package/src/lib/server/wallet/wallet-service.test.ts +0 -81
  264. package/src/lib/server/wallet/wallet-service.ts +0 -225
  265. package/src/lib/wallet/wallet-transactions.test.ts +0 -75
  266. package/src/lib/wallet/wallet-transactions.ts +0 -43
  267. package/src/lib/wallet/wallet.test.ts +0 -333
  268. package/src/lib/wallet/wallet.ts +0 -183
  269. package/src/views/settings/section-wallets.tsx +0 -35
@@ -0,0 +1,737 @@
1
+ import type { MessageToolEvent } from './message'
2
+ import type { MessageSource } from './connector'
3
+ import type { ExtensionDefinitionCost, ExtensionInvocationRecord } from './extension'
4
+ import type { SkillInstallOption, SkillRequirements } from './skill'
5
+
6
+ export interface SSEEvent {
7
+ t: 'd' | 'md' | 'r' | 'done' | 'err' | 'tool_call' | 'tool_result' | 'status' | 'thinking' | 'reset' | 'cr_agent_start' | 'cr_agent_done'
8
+ text?: string
9
+ toolName?: string
10
+ toolInput?: string
11
+ toolOutput?: string
12
+ toolCallId?: string
13
+ agentId?: string
14
+ agentName?: string
15
+ }
16
+
17
+ export interface Directory {
18
+ name: string
19
+ path: string
20
+ }
21
+
22
+ export interface DevServerStatus {
23
+ running: boolean
24
+ url?: string
25
+ }
26
+
27
+ export interface DeployResult {
28
+ ok: boolean
29
+ output?: string
30
+ error?: string
31
+ }
32
+
33
+ export interface UploadResult {
34
+ path: string
35
+ size: number
36
+ url: string
37
+ }
38
+
39
+ export interface NetworkInfo {
40
+ ip: string
41
+ port: number
42
+ }
43
+
44
+ export interface UsageRecord {
45
+ sessionId: string
46
+ messageIndex: number
47
+ model: string
48
+ provider: string
49
+ inputTokens: number
50
+ outputTokens: number
51
+ totalTokens: number
52
+ estimatedCost: number
53
+ timestamp: number
54
+ durationMs?: number
55
+ agentId?: string | null
56
+ projectId?: string | null
57
+ extensionDefinitionCosts?: ExtensionDefinitionCost[]
58
+ extensionInvocations?: ExtensionInvocationRecord[]
59
+ }
60
+
61
+ // --- Chatrooms ---
62
+
63
+ export interface ChatroomRoutingRule {
64
+ id: string
65
+ type: 'keyword' | 'capability'
66
+ pattern?: string
67
+ keywords?: string[]
68
+ agentId: string
69
+ priority: number
70
+ }
71
+
72
+ export interface ChatroomMember {
73
+ agentId: string
74
+ role: 'admin' | 'moderator' | 'member'
75
+ mutedUntil?: string
76
+ }
77
+
78
+ export interface ChatroomReaction {
79
+ emoji: string
80
+ reactorId: string // 'user' or agentId
81
+ time: number
82
+ }
83
+
84
+ export interface ChatroomMessage {
85
+ id: string
86
+ senderId: string // 'user' or agentId
87
+ senderName: string
88
+ role: 'user' | 'assistant'
89
+ text: string
90
+ mentions: string[] // parsed agentIds
91
+ reactions: ChatroomReaction[]
92
+ toolEvents?: MessageToolEvent[]
93
+ time: number
94
+ attachedFiles?: string[]
95
+ imagePath?: string
96
+ replyToId?: string
97
+ targetAgentId?: string
98
+ source?: MessageSource
99
+ historyExcluded?: boolean
100
+ }
101
+
102
+ export interface Chatroom {
103
+ id: string
104
+ name: string
105
+ description?: string
106
+ agentIds: string[]
107
+ members?: ChatroomMember[]
108
+ messages: ChatroomMessage[]
109
+ pinnedMessageIds?: string[]
110
+ chatMode?: 'sequential' | 'parallel'
111
+ autoAddress?: boolean
112
+ routingGuidance?: string | null
113
+ /** Legacy deterministic routing config kept only for migration/read compatibility. */
114
+ routingRules?: ChatroomRoutingRule[]
115
+ temporary?: boolean
116
+ topic?: string
117
+ hidden?: boolean
118
+ archivedAt?: number | null
119
+ protocolRunId?: string | null
120
+ parentChatroomId?: string | null
121
+ createdAt: number
122
+ updatedAt: number
123
+ }
124
+
125
+ // --- Activity / Audit Trail ---
126
+
127
+ export interface ActivityEntry {
128
+ id: string
129
+ entityType: 'agent' | 'task' | 'connector' | 'session' | 'webhook' | 'schedule' | 'delegation' | 'swarm' | 'chatroom' | 'coordination'
130
+ entityId: string
131
+ action: 'created' | 'updated' | 'deleted' | 'started' | 'stopped' | 'queued' | 'completed' | 'failed' | 'archived' | 'restored' | 'approved' | 'rejected' | 'delegated' | 'queried' | 'spawned' | 'timeout' | 'cancelled' | 'incident' | 'running' | 'claimed'
132
+ actor: 'user' | 'agent' | 'system' | 'daemon'
133
+ actorId?: string
134
+ summary: string
135
+ detail?: Record<string, unknown>
136
+ timestamp: number
137
+ }
138
+
139
+ // --- Webhook Retry Queue ---
140
+
141
+ export interface WebhookRetryEntry {
142
+ id: string
143
+ webhookId: string
144
+ event: string
145
+ payload: string
146
+ attempts: number
147
+ maxAttempts: number
148
+ nextRetryAt: number
149
+ deadLettered: boolean
150
+ createdAt: number
151
+ }
152
+
153
+ export interface Project {
154
+ id: string
155
+ name: string
156
+ description: string
157
+ color?: string
158
+ objective?: string
159
+ audience?: string
160
+ priorities?: string[]
161
+ openObjectives?: string[]
162
+ capabilityHints?: string[]
163
+ credentialRequirements?: string[]
164
+ successMetrics?: string[]
165
+ heartbeatPrompt?: string
166
+ heartbeatIntervalSec?: number
167
+ createdAt: number
168
+ updatedAt: number
169
+ }
170
+
171
+ // --- Notifications ---
172
+
173
+ export interface AppNotification {
174
+ id: string
175
+ type: 'info' | 'success' | 'warning' | 'error'
176
+ title: string
177
+ message?: string
178
+ actionLabel?: string
179
+ actionUrl?: string
180
+ entityType?: string
181
+ entityId?: string
182
+ dedupKey?: string
183
+ read: boolean
184
+ createdAt: number
185
+ updatedAt?: number
186
+ occurrenceCount?: number
187
+ }
188
+
189
+ // --- Webhook Logs ---
190
+
191
+ export interface WebhookLogEntry {
192
+ id: string
193
+ webhookId: string
194
+ event: string
195
+ payload: string
196
+ status: 'success' | 'error'
197
+ sessionId?: string
198
+ runId?: string
199
+ error?: string
200
+ timestamp: number
201
+ }
202
+
203
+ // --- Agent Secrets ---
204
+
205
+ export interface StoredSecret {
206
+ id: string
207
+ name: string
208
+ service: string // e.g. 'gmail', 'ahrefs', 'custom'
209
+ encryptedValue: string
210
+ scope: 'global' | 'agent'
211
+ agentIds: string[] // if scope === 'agent', which agents can use it
212
+ projectId?: string
213
+ createdAt: number
214
+ updatedAt: number
215
+ }
216
+
217
+ export interface Webhook {
218
+ id: string
219
+ name: string
220
+ source: string
221
+ events: string[]
222
+ agentId?: string | null
223
+ secret?: string
224
+ isEnabled: boolean
225
+ createdAt: number
226
+ updatedAt: number
227
+ }
228
+
229
+ export interface DocumentRevision {
230
+ id: string
231
+ documentId: string
232
+ version: number
233
+ content: string
234
+ createdAt: number
235
+ createdBy?: string | null
236
+ }
237
+
238
+ export interface DocumentEntry {
239
+ id: string
240
+ title: string
241
+ fileName: string
242
+ sourcePath: string
243
+ content: string
244
+ method: string
245
+ textLength: number
246
+ currentVersion?: number
247
+ metadata?: Record<string, unknown>
248
+ createdAt: number
249
+ updatedAt: number
250
+ }
251
+
252
+ // --- Browser Sessions ---
253
+
254
+ export type BrowserSessionStatus = 'active' | 'idle' | 'closed' | 'error'
255
+
256
+ export interface BrowserSessionTab {
257
+ index: number
258
+ title?: string | null
259
+ url?: string | null
260
+ }
261
+
262
+ export interface BrowserSessionArtifact {
263
+ kind: 'snapshot' | 'screenshot' | 'download' | 'pdf'
264
+ path: string
265
+ url?: string | null
266
+ filename?: string | null
267
+ createdAt: number
268
+ }
269
+
270
+ export interface BrowserObservationLink {
271
+ text: string
272
+ href: string
273
+ }
274
+
275
+ export interface BrowserObservationFormField {
276
+ name?: string | null
277
+ label?: string | null
278
+ type: string
279
+ required?: boolean
280
+ }
281
+
282
+ export interface BrowserObservationForm {
283
+ index: number
284
+ action?: string | null
285
+ method?: string | null
286
+ fields: BrowserObservationFormField[]
287
+ }
288
+
289
+ export interface BrowserObservationTable {
290
+ index: number
291
+ headers: string[]
292
+ rowCount: number
293
+ rows?: string[][]
294
+ }
295
+
296
+ export interface BrowserObservation {
297
+ capturedAt: number
298
+ url?: string | null
299
+ title?: string | null
300
+ textPreview?: string | null
301
+ activeTabIndex?: number | null
302
+ tabs?: BrowserSessionTab[]
303
+ links?: BrowserObservationLink[]
304
+ forms?: BrowserObservationForm[]
305
+ tables?: BrowserObservationTable[]
306
+ errors?: string[]
307
+ }
308
+
309
+ export interface BrowserSandboxRuntimeInfo {
310
+ scopeKey?: string | null
311
+ containerName?: string | null
312
+ cdpEndpoint?: string | null
313
+ cdpPort?: number | null
314
+ noVncPort?: number | null
315
+ bridgeUrl?: string | null
316
+ }
317
+
318
+ export interface BrowserSessionRecord {
319
+ id: string
320
+ sessionId: string
321
+ profileId: string
322
+ profileDir: string
323
+ status: BrowserSessionStatus
324
+ runtime?: 'host' | 'sandbox-browser' | null
325
+ sandbox?: BrowserSandboxRuntimeInfo | null
326
+ inheritedFromSessionId?: string | null
327
+ currentUrl?: string | null
328
+ pageTitle?: string | null
329
+ activeTabIndex?: number | null
330
+ tabs?: BrowserSessionTab[]
331
+ lastAction?: string | null
332
+ lastError?: string | null
333
+ lastObservation?: BrowserObservation | null
334
+ artifacts?: BrowserSessionArtifact[]
335
+ createdAt: number
336
+ updatedAt: number
337
+ lastUsedAt: number
338
+ }
339
+
340
+ // --- Watch Jobs ---
341
+
342
+ export type WatchJobType = 'time' | 'http' | 'file' | 'task' | 'webhook' | 'page' | 'email' | 'mailbox' | 'approval'
343
+ export type WatchJobStatus = 'active' | 'triggered' | 'failed' | 'cancelled'
344
+
345
+ export interface WatchJob {
346
+ id: string
347
+ type: WatchJobType
348
+ status: WatchJobStatus
349
+ description?: string | null
350
+ sessionId?: string | null
351
+ agentId?: string | null
352
+ createdByAgentId?: string | null
353
+ browserProfileId?: string | null
354
+ resumeMessage: string
355
+ target: Record<string, unknown>
356
+ condition: Record<string, unknown>
357
+ runAt?: number | null
358
+ nextCheckAt?: number | null
359
+ intervalMs?: number | null
360
+ timeoutAt?: number | null
361
+ lastCheckedAt?: number | null
362
+ lastTriggeredAt?: number | null
363
+ lastError?: string | null
364
+ result?: Record<string, unknown> | null
365
+ createdAt: number
366
+ updatedAt: number
367
+ }
368
+
369
+ // --- Delegation Jobs ---
370
+
371
+ export type DelegationJobKind = 'subagent' | 'delegate'
372
+ export type DelegationJobStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled'
373
+
374
+ export interface DelegationJobCheckpoint {
375
+ at: number
376
+ note: string
377
+ status?: DelegationJobStatus
378
+ }
379
+
380
+ export interface DelegationJobArtifact {
381
+ type: 'text' | 'file' | 'image' | 'link'
382
+ value: string
383
+ label?: string | null
384
+ }
385
+
386
+ export interface DelegationJobRecord {
387
+ id: string
388
+ kind: DelegationJobKind
389
+ status: DelegationJobStatus
390
+ backend?: 'claude' | 'codex' | 'opencode' | 'gemini' | null
391
+ parentSessionId?: string | null
392
+ childSessionId?: string | null
393
+ agentId?: string | null
394
+ agentName?: string | null
395
+ cwd?: string | null
396
+ task: string
397
+ result?: string | null
398
+ resultPreview?: string | null
399
+ error?: string | null
400
+ checkpoints?: DelegationJobCheckpoint[]
401
+ artifacts?: DelegationJobArtifact[]
402
+ resumeId?: string | null
403
+ resumeIds?: {
404
+ claudeCode?: string | null
405
+ codex?: string | null
406
+ opencode?: string | null
407
+ gemini?: string | null
408
+ }
409
+ requesterRunId?: string | null
410
+ childRunId?: string | null
411
+ createdAt: number
412
+ updatedAt: number
413
+ startedAt?: number | null
414
+ completedAt?: number | null
415
+ }
416
+
417
+ // --- File & Memory References ---
418
+
419
+ export interface FileReference {
420
+ path: string
421
+ contextSnippet?: string
422
+ kind?: 'file' | 'folder' | 'project'
423
+ projectRoot?: string
424
+ projectName?: string
425
+ exists?: boolean
426
+ timestamp: number
427
+ }
428
+
429
+ export interface MemoryReference {
430
+ type: 'project' | 'folder' | 'file' | 'task' | 'session' | 'url'
431
+ path?: string
432
+ projectRoot?: string
433
+ projectName?: string
434
+ title?: string
435
+ note?: string
436
+ exists?: boolean
437
+ timestamp: number
438
+ }
439
+
440
+ export interface MemoryImage {
441
+ path: string
442
+ mimeType?: string
443
+ width?: number
444
+ height?: number
445
+ sizeBytes?: number
446
+ }
447
+
448
+ export interface MemoryEntry {
449
+ id: string
450
+ agentId?: string | null
451
+ sessionId?: string | null
452
+ category: string
453
+ title: string
454
+ content: string
455
+ metadata?: Record<string, unknown>
456
+ references?: MemoryReference[]
457
+ filePaths?: FileReference[]
458
+ image?: MemoryImage | null
459
+ imagePath?: string | null
460
+ linkedMemoryIds?: string[]
461
+ pinned?: boolean
462
+ sharedWith?: string[]
463
+ accessCount?: number
464
+ lastAccessedAt?: number
465
+ contentHash?: string
466
+ reinforcementCount?: number
467
+ abstract?: string | null
468
+ createdAt: number
469
+ updatedAt: number
470
+ }
471
+
472
+ // --- MCP Servers ---
473
+
474
+ export type McpTransport = 'stdio' | 'sse' | 'streamable-http'
475
+
476
+ export interface McpServerConfig {
477
+ id: string
478
+ name: string
479
+ transport: McpTransport
480
+ command?: string // for stdio transport
481
+ args?: string[] // for stdio transport
482
+ url?: string // for sse/streamable-http transport
483
+ env?: Record<string, string> // environment variables
484
+ headers?: Record<string, string> // HTTP headers for sse/streamable-http
485
+ createdAt: number
486
+ updatedAt: number
487
+ }
488
+
489
+ // --- Gateways ---
490
+
491
+ export type GatewayProvider = 'openclaw'
492
+ export type GatewayHealthState = 'unknown' | 'healthy' | 'degraded' | 'offline' | 'pending'
493
+ export type OpenClawDeploymentMethod = 'local' | 'bundle' | 'ssh' | 'imported'
494
+ export type OpenClawDeploymentProvider =
495
+ | 'local'
496
+ | 'hetzner'
497
+ | 'digitalocean'
498
+ | 'vultr'
499
+ | 'linode'
500
+ | 'lightsail'
501
+ | 'gcp'
502
+ | 'azure'
503
+ | 'oci'
504
+ | 'generic'
505
+ | 'render'
506
+ | 'fly'
507
+ | 'railway'
508
+ export type OpenClawRemoteDeployTarget = 'docker' | 'render' | 'fly' | 'railway'
509
+ export type OpenClawUseCaseTemplate = 'local-dev' | 'single-vps' | 'private-tailnet' | 'browser-heavy' | 'team-control'
510
+ export type OpenClawExposurePreset = 'private-lan' | 'tailscale' | 'caddy' | 'nginx' | 'ssh-tunnel'
511
+
512
+ export interface OpenClawGatewayStats {
513
+ nodeCount?: number
514
+ connectedNodeCount?: number
515
+ pendingNodePairings?: number
516
+ pairedDeviceCount?: number
517
+ pendingDevicePairings?: number
518
+ externalRuntimeCount?: number
519
+ }
520
+
521
+ export interface OpenClawDeploymentConfig {
522
+ method?: OpenClawDeploymentMethod | null
523
+ provider?: OpenClawDeploymentProvider | null
524
+ remoteTarget?: OpenClawRemoteDeployTarget | null
525
+ useCase?: OpenClawUseCaseTemplate | null
526
+ exposure?: OpenClawExposurePreset | null
527
+ managedBy?: 'swarmclaw' | 'manual' | null
528
+ localInstanceId?: string | null
529
+ localPort?: number | null
530
+ targetHost?: string | null
531
+ sshHost?: string | null
532
+ sshUser?: string | null
533
+ sshPort?: number | null
534
+ sshKeyPath?: string | null
535
+ sshTargetDir?: string | null
536
+ image?: string | null
537
+ version?: string | null
538
+ lastDeployAt?: number | null
539
+ lastDeployAction?: string | null
540
+ lastDeployProcessId?: string | null
541
+ lastDeploySummary?: string | null
542
+ lastVerifiedAt?: number | null
543
+ lastVerifiedOk?: boolean | null
544
+ lastVerifiedMessage?: string | null
545
+ lastBackupPath?: string | null
546
+ }
547
+
548
+ export interface GatewayProfile {
549
+ id: string
550
+ name: string
551
+ provider: GatewayProvider
552
+ endpoint: string
553
+ wsUrl?: string | null
554
+ credentialId?: string | null
555
+ status: GatewayHealthState
556
+ notes?: string | null
557
+ tags?: string[]
558
+ lastError?: string | null
559
+ lastCheckedAt?: number | null
560
+ lastModelCount?: number | null
561
+ discoveredHost?: string | null
562
+ discoveredPort?: number | null
563
+ deployment?: OpenClawDeploymentConfig | null
564
+ stats?: OpenClawGatewayStats | null
565
+ isDefault?: boolean
566
+ createdAt: number
567
+ updatedAt: number
568
+ }
569
+
570
+ export interface OpenClawNode {
571
+ nodeId: string
572
+ displayName?: string
573
+ platform?: string
574
+ version?: string
575
+ coreVersion?: string
576
+ uiVersion?: string
577
+ deviceFamily?: string
578
+ modelIdentifier?: string
579
+ remoteIp?: string
580
+ caps?: string[]
581
+ commands?: string[]
582
+ pathEnv?: string[]
583
+ permissions?: string[]
584
+ connectedAtMs?: number
585
+ paired?: boolean
586
+ connected?: boolean
587
+ }
588
+
589
+ export interface OpenClawNodePairRequest {
590
+ requestId: string
591
+ nodeId?: string
592
+ displayName?: string
593
+ platform?: string
594
+ remoteIp?: string
595
+ createdAtMs?: number
596
+ }
597
+
598
+ export interface OpenClawPairedDevice {
599
+ deviceId: string
600
+ displayName?: string
601
+ role?: string
602
+ remoteIp?: string
603
+ platform?: string
604
+ tokens?: Array<{ role?: string; scopes?: string[]; createdAtMs?: number; rotatedAtMs?: number; revokedAtMs?: number }>
605
+ }
606
+
607
+ export interface OpenClawDevicePairRequest {
608
+ requestId: string
609
+ deviceId?: string
610
+ displayName?: string
611
+ role?: string
612
+ platform?: string
613
+ remoteIp?: string
614
+ createdAtMs?: number
615
+ }
616
+
617
+ export interface OpenClawPairingSnapshot {
618
+ pending?: OpenClawDevicePairRequest[]
619
+ paired?: OpenClawPairedDevice[]
620
+ }
621
+
622
+ // --- ClawHub ---
623
+
624
+ export interface ClawHubSkill {
625
+ id: string
626
+ name: string
627
+ description: string
628
+ author: string
629
+ tags: string[]
630
+ downloads: number
631
+ stars?: number
632
+ url: string
633
+ version: string
634
+ changelog?: string
635
+ createdAt?: number
636
+ updatedAt?: number
637
+ metadata?: Record<string, unknown> | null
638
+ }
639
+
640
+ // --- OpenClaw Execution Approvals ---
641
+
642
+ export interface PendingExecApproval {
643
+ id: string
644
+ agentId: string
645
+ sessionKey: string
646
+ command: string
647
+ cwd?: string
648
+ host?: string
649
+ security?: string
650
+ ask?: string
651
+ createdAtMs: number
652
+ expiresAtMs: number
653
+ resolving?: boolean
654
+ error?: string
655
+ }
656
+
657
+ export type ExecApprovalDecision = 'allow-once' | 'allow-always' | 'deny'
658
+
659
+ // --- OpenClaw Skills ---
660
+
661
+ export interface OpenClawSkillEntry {
662
+ name: string
663
+ description?: string
664
+ source: 'bundled' | 'managed' | 'personal' | 'workspace'
665
+ eligible: boolean
666
+ requirements?: string[]
667
+ missing?: string[]
668
+ disabled?: boolean
669
+ installOptions?: SkillInstallOption[]
670
+ skillRequirements?: SkillRequirements
671
+ configChecks?: { key: string; ok: boolean }[]
672
+ skillKey?: string
673
+ baseDir?: string
674
+ }
675
+
676
+ // --- Fleet Sidebar Filters (F16) ---
677
+ export type FleetFilter = 'all' | 'running' | 'approvals'
678
+
679
+ // --- Exec Approval Config (F8) ---
680
+ export interface ExecApprovalConfig {
681
+ security: 'deny' | 'allowlist' | 'full'
682
+ askMode: 'off' | 'on-miss' | 'always'
683
+ patterns: string[]
684
+ }
685
+
686
+ export interface ExecApprovalSnapshot {
687
+ path: string
688
+ exists: boolean
689
+ hash: string
690
+ file: ExecApprovalConfig
691
+ }
692
+
693
+ // --- Permission Presets (F9) ---
694
+ export type PermissionPreset = 'conservative' | 'collaborative' | 'autonomous'
695
+
696
+ // --- Personality Builder (F10) ---
697
+ export interface PersonalityDraft {
698
+ identity: { name?: string; creature?: string; vibe?: string; emoji?: string }
699
+ user: { name?: string; callThem?: string; pronouns?: string; timezone?: string; notes?: string; context?: string }
700
+ soul: { coreTruths?: string; boundaries?: string; vibe?: string; continuity?: string }
701
+ }
702
+
703
+ // --- Cron Jobs (F12) ---
704
+ export interface GatewayCronJob {
705
+ id: string
706
+ name: string
707
+ agentId: string
708
+ enabled: boolean
709
+ schedule: { kind: 'at' | 'every' | 'cron'; value: string; timezone?: string }
710
+ payload: {
711
+ kind: 'systemEvent' | 'agentTurn'
712
+ text?: string
713
+ message?: string
714
+ model?: string
715
+ deliver?: { mode: 'none' | 'announce'; channel?: string }
716
+ }
717
+ sessionTarget: 'main' | 'isolated'
718
+ state?: { nextRun?: string; lastRun?: string; lastStatus?: string }
719
+ }
720
+
721
+ // --- Rich Chat Traces (F13) ---
722
+ export interface ChatTraceBlock {
723
+ type: 'thinking' | 'tool-call' | 'tool-result'
724
+ content: string
725
+ label?: string
726
+ collapsed?: boolean
727
+ }
728
+
729
+ // --- Chat History Sync (F18) ---
730
+ export interface GatewaySessionPreview {
731
+ sessionKey: string
732
+ epoch: number
733
+ messages: Array<{ role: string; content: string; ts: number }>
734
+ }
735
+
736
+ // --- Gateway Reload Mode (F21) ---
737
+ export type GatewayReloadMode = 'hot' | 'hybrid' | 'full'