@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,264 @@
1
+ import type { ProviderId, ProviderType, OllamaMode } from './provider'
2
+ import type { SessionResetMode, IdentityContinuityState } from './session'
3
+ import type { SkillAllowlistMode } from './skill'
4
+
5
+ // --- Agent / Delegation ---
6
+
7
+ export type AgentRole = 'worker' | 'coordinator'
8
+ export type DelegationTargetMode = 'all' | 'selected'
9
+
10
+ export interface AgentOrgChart {
11
+ parentId?: string | null
12
+ teamLabel?: string | null
13
+ teamColor?: string | null
14
+ x?: number | null
15
+ y?: number | null
16
+ }
17
+
18
+ export interface Agent {
19
+ id: string
20
+ name: string
21
+ openclawAgentId?: string | null
22
+ description: string
23
+ soul?: string
24
+ identityState?: IdentityContinuityState | null
25
+ emoji?: string
26
+ creature?: string
27
+ vibe?: string
28
+ theme?: string
29
+ avatar?: string
30
+ systemPrompt: string
31
+ provider: ProviderId
32
+ model: string
33
+ ollamaMode?: OllamaMode | null
34
+ credentialId?: string | null
35
+ fallbackCredentialIds?: string[]
36
+ apiEndpoint?: string | null
37
+ gatewayProfileId?: string | null
38
+ preferredGatewayTags?: string[]
39
+ preferredGatewayUseCase?: string | null
40
+ routingStrategy?: AgentRoutingStrategy | null
41
+ routingTargets?: AgentRoutingTarget[]
42
+ role?: AgentRole // default 'worker' — coordinators get enhanced delegation prompts
43
+ delegationEnabled?: boolean
44
+ delegationTargetMode?: DelegationTargetMode
45
+ delegationTargetAgentIds?: string[]
46
+ tools?: string[]
47
+ extensions?: string[]
48
+ skills?: string[] // e.g. ['frontend-design'] — pinned Claude Code skills to mention explicitly
49
+ skillIds?: string[] // IDs of pinned managed skills to keep always-on for this agent
50
+ mcpServerIds?: string[] // IDs of configured MCP servers to inject tools from
51
+ mcpDisabledTools?: string[] // MCP tool names disabled for this agent (denylist)
52
+ orgChart?: AgentOrgChart | null
53
+ capabilities?: string[] // e.g. ['frontend', 'screenshots', 'research', 'devops']
54
+ threadSessionId?: string | null // persistent shortcut chat session for agent-centric UI
55
+ heartbeatEnabled?: boolean
56
+ heartbeatIntervalSec?: number | null
57
+ heartbeatInterval?: string | number | null
58
+ heartbeatPrompt?: string | null
59
+ heartbeatModel?: string | null
60
+ heartbeatAckMaxChars?: number | null
61
+ heartbeatShowOk?: boolean | null
62
+ heartbeatShowAlerts?: boolean | null
63
+ heartbeatTarget?: 'last' | 'none' | string | null
64
+ heartbeatGoal?: string | null
65
+ heartbeatNextAction?: string | null
66
+ heartbeatLightContext?: boolean | null
67
+ sessionResetMode?: SessionResetMode | null
68
+ sessionIdleTimeoutSec?: number | null
69
+ sessionMaxAgeSec?: number | null
70
+ sessionDailyResetAt?: string | null
71
+ sessionResetTimezone?: string | null
72
+ thinkingLevel?: 'minimal' | 'low' | 'medium' | 'high'
73
+ memoryScopeMode?: 'auto' | 'all' | 'global' | 'agent' | 'session' | 'project' | null
74
+ memoryTierPreference?: 'working' | 'durable' | 'archive' | 'blended' | null
75
+ elevenLabsVoiceId?: string | null
76
+ projectId?: string
77
+ avatarSeed?: string
78
+ avatarUrl?: string | null
79
+ pinned?: boolean
80
+ lastUsedAt?: number
81
+ totalCost?: number
82
+ disabled?: boolean
83
+ trashedAt?: number
84
+ openclawSkillMode?: SkillAllowlistMode
85
+ openclawAllowedSkills?: string[]
86
+ responseStyle?: 'concise' | 'normal' | 'detailed' | null
87
+ responseMaxChars?: number | null
88
+ monthlyBudget?: number | null
89
+ dailyBudget?: number | null
90
+ hourlyBudget?: number | null
91
+ autoRecovery?: boolean
92
+ proactiveMemory?: boolean
93
+ /** Auto-refresh a reviewed skill draft from meaningful chat turns for this agent. */
94
+ autoDraftSkillSuggestions?: boolean
95
+ /** Controls whether file operations are confined to the workspace or allowed anywhere on the host. Default: 'workspace'. */
96
+ filesystemScope?: 'workspace' | 'machine' | null
97
+ /** Per-agent filesystem restrictions. Globs matched against resolved paths. */
98
+ fileAccessPolicy?: {
99
+ /** If set, only these paths (globs) are writable. Others are blocked. */
100
+ allowedPaths?: string[]
101
+ /** These paths (globs) are always blocked even if allowedPaths matches. */
102
+ blockedPaths?: string[]
103
+ } | null
104
+
105
+ /** Docker-backed browser sandbox settings and legacy execution sandbox compatibility fields. */
106
+ sandboxConfig?: {
107
+ enabled: boolean
108
+ mode?: 'off' | 'non-main' | 'all' // default: 'all' when enabled, modeled after OpenClaw
109
+ scope?: 'session' | 'agent' // default: 'session'
110
+ workspaceAccess?: 'ro' | 'rw' // default: 'rw'
111
+ image?: string // default: 'node:22-slim'
112
+ network?: 'none' | 'bridge' // default: 'none'
113
+ memoryMb?: number // default: 512
114
+ cpus?: number // default: 1.0
115
+ readonlyRoot?: boolean // default: false
116
+ workdir?: string // default: '/workspace'
117
+ containerPrefix?: string // default: 'swarmclaw-sb-'
118
+ pidsLimit?: number // default: 256
119
+ setupCommand?: string
120
+ browser?: {
121
+ enabled?: boolean
122
+ image?: string
123
+ containerPrefix?: string
124
+ network?: 'none' | 'bridge'
125
+ cdpPort?: number
126
+ vncPort?: number
127
+ noVncPort?: number
128
+ headless?: boolean
129
+ enableNoVnc?: boolean
130
+ mountUploads?: boolean
131
+ autoStartTimeoutMs?: number
132
+ } | null
133
+ prune?: {
134
+ idleHours?: number
135
+ maxAgeDays?: number
136
+ } | null
137
+ } | null
138
+
139
+ /** Configuration for the `execute` tool (just-bash sandbox or explicit host bash). */
140
+ executeConfig?: {
141
+ backend?: 'sandbox' | 'host'
142
+ network?: { enabled: boolean; allowedUrls?: string[] }
143
+ runtimes?: { python?: boolean; javascript?: boolean; sqlite?: boolean }
144
+ timeout?: number
145
+ credentials?: string[]
146
+ } | null
147
+
148
+ budgetAction?: 'warn' | 'block'
149
+ /** Runtime-enriched: current month's spend. Populated by GET /api/agents when monthlyBudget is set. */
150
+ monthlySpend?: number
151
+ /** Runtime-enriched: current day's spend. Populated by GET /api/agents when dailyBudget is set. */
152
+ dailySpend?: number
153
+ /** Runtime-enriched: trailing 1-hour spend. Populated by GET /api/agents when hourlyBudget is set. */
154
+ hourlySpend?: number
155
+ maxFollowupChain?: number
156
+
157
+ // Orchestrator Mode
158
+ orchestratorEnabled?: boolean
159
+ orchestratorMission?: string
160
+ orchestratorWakeInterval?: string | number | null
161
+ orchestratorGovernance?: 'autonomous' | 'approval-required' | 'notify-only'
162
+ orchestratorMaxCyclesPerDay?: number | null
163
+ orchestratorLastWakeAt?: number | null
164
+ orchestratorCycleCount?: number
165
+
166
+ createdAt: number
167
+ updatedAt: number
168
+ }
169
+
170
+ export type AgentTool = 'browser'
171
+
172
+ export interface ClaudeSkill {
173
+ id: string
174
+ name: string
175
+ description: string
176
+ }
177
+
178
+ // --- Agent Routing / Packs ---
179
+
180
+ export type AgentRoutingStrategy = 'single' | 'balanced' | 'economy' | 'premium' | 'reasoning'
181
+ export type AgentRoutingTargetRole = 'primary' | 'economy' | 'premium' | 'reasoning' | 'backup'
182
+
183
+ export interface AgentRoutingTarget {
184
+ id: string
185
+ label?: string
186
+ role?: AgentRoutingTargetRole
187
+ provider: ProviderId
188
+ model: string
189
+ ollamaMode?: OllamaMode | null
190
+ credentialId?: string | null
191
+ fallbackCredentialIds?: string[]
192
+ apiEndpoint?: string | null
193
+ gatewayProfileId?: string | null
194
+ preferredGatewayTags?: string[]
195
+ preferredGatewayUseCase?: string | null
196
+ priority?: number
197
+ }
198
+
199
+ export interface AgentPackEntry {
200
+ id: string
201
+ name: string
202
+ description?: string
203
+ provider: ProviderId
204
+ model: string
205
+ ollamaMode?: OllamaMode | null
206
+ credentialId?: string | null
207
+ fallbackCredentialIds?: string[]
208
+ apiEndpoint?: string | null
209
+ gatewayProfileId?: string | null
210
+ routingStrategy?: AgentRoutingStrategy | null
211
+ routingTargets?: AgentRoutingTarget[]
212
+ tools?: string[]
213
+ extensions?: string[]
214
+ capabilities?: string[]
215
+ elevenLabsVoiceId?: string | null
216
+ soul?: string
217
+ systemPrompt?: string
218
+ }
219
+
220
+ export interface AgentPackManifest {
221
+ schemaVersion: 1
222
+ kind: 'swarmclaw-agent-pack'
223
+ name: string
224
+ description?: string
225
+ exportedAt: number
226
+ recommendedProviders?: ProviderType[]
227
+ agents: AgentPackEntry[]
228
+ }
229
+
230
+ // --- External Agents ---
231
+
232
+ export type ExternalAgentSourceType = 'codex' | 'claude' | 'opencode' | 'openclaw' | 'custom'
233
+ export type ExternalAgentStatus = 'online' | 'idle' | 'offline' | 'stale'
234
+
235
+ export interface ExternalAgentRuntime {
236
+ id: string
237
+ name: string
238
+ sourceType: ExternalAgentSourceType
239
+ status: ExternalAgentStatus
240
+ provider?: ProviderId | null
241
+ model?: string | null
242
+ workspace?: string | null
243
+ transport?: 'http' | 'ws' | 'cli' | 'gateway' | 'custom' | null
244
+ endpoint?: string | null
245
+ agentId?: string | null
246
+ gatewayProfileId?: string | null
247
+ capabilities?: string[]
248
+ labels?: string[]
249
+ lifecycleState?: 'active' | 'draining' | 'cordoned'
250
+ gatewayTags?: string[]
251
+ gatewayUseCase?: string | null
252
+ version?: string | null
253
+ lastHealthNote?: string | null
254
+ metadata?: Record<string, unknown> | null
255
+ tokenStats?: {
256
+ inputTokens?: number
257
+ outputTokens?: number
258
+ totalTokens?: number
259
+ } | null
260
+ lastHeartbeatAt?: number | null
261
+ lastSeenAt?: number | null
262
+ createdAt: number
263
+ updatedAt: number
264
+ }
@@ -0,0 +1,173 @@
1
+ import type { SessionResetMode } from './session'
2
+
3
+ // --- App Settings ---
4
+ export type LoopMode = 'bounded' | 'ongoing'
5
+ export type AutonomyEstopLevel = 'none' | 'autonomy' | 'all'
6
+
7
+ export interface GoalContract {
8
+ objective: string
9
+ constraints?: string[]
10
+ budgetUsd?: number | null
11
+ deadlineAt?: number | null
12
+ successMetric?: string | null
13
+ }
14
+
15
+ export interface WhatsAppApprovedContact {
16
+ id: string
17
+ label: string
18
+ phone: string
19
+ }
20
+
21
+ export interface AppSettings {
22
+ userPrompt?: string
23
+ userName?: string
24
+ setupCompleted?: boolean
25
+ embeddingProvider?: 'local' | 'openai' | 'ollama' | null
26
+ embeddingModel?: string | null
27
+ embeddingCredentialId?: string | null
28
+ embeddingEndpoint?: string | null
29
+ loopMode?: LoopMode
30
+ agentLoopRecursionLimit?: number
31
+ delegationMaxDepth?: number
32
+ ongoingLoopMaxIterations?: number
33
+ ongoingLoopMaxRuntimeMinutes?: number
34
+ maxFollowupChain?: number
35
+ shellCommandTimeoutSec?: number
36
+ claudeCodeTimeoutSec?: number
37
+ cliProcessTimeoutSec?: number
38
+ streamIdleStallSec?: number
39
+ requiredToolKickoffSec?: number
40
+ userAvatarSeed?: string
41
+ elevenLabsEnabled?: boolean
42
+ elevenLabsApiKey?: string | null
43
+ elevenLabsApiKeyConfigured?: boolean
44
+ elevenLabsVoiceId?: string | null
45
+ speechRecognitionLang?: string | null
46
+ tavilyApiKey?: string | null
47
+ tavilyApiKeyConfigured?: boolean
48
+ braveApiKey?: string | null
49
+ braveApiKeyConfigured?: boolean
50
+ heartbeatPrompt?: string | null
51
+ heartbeatIntervalSec?: number | null
52
+ heartbeatInterval?: string | number | null
53
+ heartbeatModel?: string | null
54
+ heartbeatAckMaxChars?: number | null
55
+ heartbeatShowOk?: boolean | null
56
+ heartbeatShowAlerts?: boolean | null
57
+ heartbeatTarget?: 'last' | 'none' | string | null
58
+ heartbeatActiveStart?: string | null
59
+ heartbeatActiveEnd?: string | null
60
+ heartbeatTimezone?: string | null
61
+ heartbeatLightContext?: boolean | null
62
+ sessionResetMode?: SessionResetMode | null
63
+ sessionIdleTimeoutSec?: number | null
64
+ sessionMaxAgeSec?: number | null
65
+ sessionDailyResetAt?: string | null
66
+ sessionResetTimezone?: string | null
67
+ untrustedContentGuardMode?: 'off' | 'warn' | 'block'
68
+ // Task resiliency and supervision
69
+ defaultTaskMaxAttempts?: number
70
+ taskRetryBackoffSec?: number
71
+ taskStallTimeoutMin?: number
72
+ // Safety rails
73
+ safetyRequireApprovalForOutbound?: boolean
74
+ safetyMaxDailySpendUsd?: number | null
75
+ safetyBlockedTools?: string[]
76
+ capabilityPolicyMode?: 'permissive' | 'balanced' | 'strict'
77
+ capabilityBlockedTools?: string[]
78
+ capabilityBlockedCategories?: string[]
79
+ capabilityAllowedTools?: string[]
80
+ taskManagementEnabled?: boolean
81
+ projectManagementEnabled?: boolean
82
+ // Memory governance
83
+ memoryWorkingTtlHours?: number
84
+ memoryDefaultConfidence?: number
85
+ memoryPruneEnabled?: boolean
86
+ memorySummaryEnabled?: boolean
87
+ // Capability router preferences
88
+ autonomyPreferredDelegates?: Array<'claude' | 'codex' | 'opencode'>
89
+ autonomyPreferToolRouting?: boolean
90
+ // Continuous eval
91
+ autonomyEvalEnabled?: boolean
92
+ autonomyEvalCron?: string | null
93
+ supervisorEnabled?: boolean
94
+ supervisorRuntimeScope?: 'chat' | 'task' | 'both'
95
+ supervisorNoProgressLimit?: number
96
+ supervisorRepeatedToolLimit?: number
97
+ autonomyResumeApprovalsEnabled?: boolean
98
+ reflectionEnabled?: boolean
99
+ reflectionAutoWriteMemory?: boolean
100
+ memoryReferenceDepth?: number
101
+ maxMemoriesPerLookup?: number
102
+ maxLinkedMemoriesExpanded?: number
103
+ memoryMaxDepth?: number
104
+ memoryMaxPerLookup?: number
105
+ // Chat UX
106
+ suggestionsEnabled?: boolean
107
+ runtimeSkillRetrievalMode?: 'keyword' | 'embedding'
108
+ runtimeSkillTopK?: number
109
+ // Globally approved WhatsApp contacts for connector DMs
110
+ whatsappApprovedContacts?: WhatsAppApprovedContact[]
111
+ // Voice conversation
112
+ voiceAutoSendDelaySec?: number
113
+ // Default agent for main chat on startup
114
+ defaultAgentId?: string | null
115
+ // Theme
116
+ themeHue?: string
117
+ // Web search provider
118
+ webSearchProvider?: 'duckduckgo' | 'google' | 'bing' | 'searxng' | 'tavily' | 'brave'
119
+ searxngUrl?: string
120
+ // Task custom field definitions
121
+ taskCustomFieldDefs?: Array<{ key: string; label: string; type: 'text' | 'number' | 'select'; options?: string[] }>
122
+ // OpenClaw sync settings
123
+ openclawWorkspacePath?: string | null
124
+ openclawAutoSyncMemory?: boolean
125
+ openclawAutoSyncSchedules?: boolean
126
+ // Outbound ops alert webhook
127
+ alertWebhookUrl?: string | null
128
+ alertWebhookType?: 'discord' | 'slack' | 'custom' | null
129
+ alertWebhookEvents?: ('error' | 'warning')[]
130
+ // Deterministic LLM response cache
131
+ responseCacheEnabled?: boolean
132
+ responseCacheTtlSec?: number
133
+ responseCacheMaxEntries?: number
134
+ // Task quality gate defaults
135
+ taskQualityGateEnabled?: boolean
136
+ taskQualityGateMinResultChars?: number
137
+ taskQualityGateMinEvidenceItems?: number
138
+ taskQualityGateRequireVerification?: boolean
139
+ taskQualityGateRequireArtifact?: boolean
140
+ taskQualityGateRequireReport?: boolean
141
+ // Integrity monitor
142
+ integrityMonitorEnabled?: boolean
143
+ // Background daemon
144
+ daemonAutostartEnabled?: boolean
145
+ // Tool loop detection thresholds
146
+ toolLoopFrequencyWarn?: number
147
+ toolLoopFrequencyCritical?: number
148
+ toolLoopCircuitBreaker?: number
149
+ // Per-extension settings (keyed by extensionId)
150
+ extensionSettings?: Record<string, Record<string, unknown>>
151
+ }
152
+
153
+ export interface EstopState {
154
+ level: AutonomyEstopLevel
155
+ reason?: string | null
156
+ engagedAt?: number | null
157
+ engagedBy?: string | null
158
+ resumeApprovalId?: string | null
159
+ updatedAt: number
160
+ }
161
+
162
+ export interface GuardianCheckpoint {
163
+ id: string
164
+ cwd: string
165
+ head: string
166
+ branch?: string | null
167
+ status: string
168
+ createdAt: number
169
+ createdBy: string
170
+ approvalId?: string | null
171
+ restorePreparedAt?: number | null
172
+ restoredAt?: number | null
173
+ }
@@ -0,0 +1,25 @@
1
+ // --- Approvals ---
2
+
3
+ export type ApprovalCategory =
4
+ | 'tool_access'
5
+ | 'extension_scaffold'
6
+ | 'extension_install'
7
+ | 'task_tool'
8
+ | 'human_loop'
9
+ | 'connector_sender'
10
+
11
+ export interface ApprovalRequest {
12
+ id: string
13
+ category: ApprovalCategory
14
+ agentId?: string | null
15
+ sessionId?: string | null
16
+ taskId?: string | null
17
+ title: string
18
+ description?: string
19
+ data: Record<string, unknown>
20
+ createdAt: number
21
+ updatedAt: number
22
+ status: 'pending' | 'approved' | 'rejected'
23
+ }
24
+
25
+ export type Approvals = Record<string, ApprovalRequest>
@@ -0,0 +1,188 @@
1
+ import type { WhatsAppApprovedContact } from './app-settings'
2
+
3
+ // --- Connector Health Events ---
4
+
5
+ export type ConnectorHealthEventType = 'started' | 'stopped' | 'error' | 'reconnected' | 'disconnected'
6
+
7
+ export interface ConnectorHealthEvent {
8
+ id: string
9
+ connectorId: string
10
+ event: ConnectorHealthEventType
11
+ message?: string
12
+ timestamp: string
13
+ }
14
+
15
+ // --- Connectors (Chat Platform Bridges) ---
16
+
17
+ export type ConnectorPlatform =
18
+ | 'discord'
19
+ | 'telegram'
20
+ | 'slack'
21
+ | 'whatsapp'
22
+ | 'openclaw'
23
+ | 'bluebubbles'
24
+ | 'signal'
25
+ | 'teams'
26
+ | 'googlechat'
27
+ | 'matrix'
28
+ | 'email'
29
+ | 'webchat'
30
+ | 'mockmail'
31
+ | 'swarmdock'
32
+ export type ConnectorStatus = 'stopped' | 'running' | 'error'
33
+
34
+ export interface MessageSource {
35
+ platform: ConnectorPlatform
36
+ connectorId: string
37
+ connectorName: string
38
+ channelId?: string
39
+ senderId?: string
40
+ senderName?: string
41
+ messageId?: string
42
+ replyToMessageId?: string
43
+ threadId?: string
44
+ deliveryMode?: 'text' | 'voice_note'
45
+ deliveryTranscript?: string | null
46
+ }
47
+
48
+ export interface Connector {
49
+ id: string
50
+ name: string
51
+ platform: ConnectorPlatform
52
+ agentId?: string | null // which agent handles incoming messages (optional if using chatroomId)
53
+ chatroomId?: string | null // route to a chatroom instead of a single agent
54
+ credentialId?: string | null // bot token stored as encrypted credential
55
+ config: Record<string, string> // platform-specific settings
56
+ isEnabled: boolean
57
+ status: ConnectorStatus
58
+ lastError?: string | null
59
+ /** WhatsApp QR code data URL (runtime only) */
60
+ qrDataUrl?: string | null
61
+ /** WhatsApp authenticated/paired state (runtime only) */
62
+ authenticated?: boolean
63
+ /** WhatsApp has stored credentials from previous pairing (runtime only) */
64
+ hasCredentials?: boolean
65
+ /** Connector presence info (runtime only) */
66
+ presence?: { lastMessageAt?: number | null; channelId?: string | null }
67
+ createdAt: number
68
+ updatedAt: number
69
+ }
70
+
71
+ export type ConnectorDmAddressingMode = 'open' | 'addressed'
72
+
73
+ export interface ConnectorAccessSenderStatus {
74
+ senderIds: string[]
75
+ isOwnerOverride: boolean
76
+ isBlocked: boolean
77
+ isApproved: boolean
78
+ isConfigAllowed: boolean
79
+ isStoredAllowed: boolean
80
+ isGlobalAllowed: boolean
81
+ isPending: boolean
82
+ pendingCode?: string | null
83
+ dmAddressingOverride: ConnectorDmAddressingMode | null
84
+ effectiveDmAddressingMode: ConnectorDmAddressingMode
85
+ requiresDirectAddress: boolean
86
+ }
87
+
88
+ export interface ConnectorAccessSnapshot {
89
+ connectorId: string
90
+ platform: ConnectorPlatform
91
+ dmPolicy: 'open' | 'allowlist' | 'pairing' | 'disabled'
92
+ dmAddressingMode: ConnectorDmAddressingMode
93
+ allowFrom: string[]
94
+ denyFrom: string[]
95
+ ownerSenderId: string | null
96
+ storedAllowedSenderIds: string[]
97
+ senderAddressingOverrides: Array<{
98
+ senderId: string
99
+ dmAddressingMode: ConnectorDmAddressingMode
100
+ }>
101
+ pendingPairingRequests: Array<{
102
+ code: string
103
+ senderId: string
104
+ senderName?: string
105
+ channelId?: string
106
+ createdAt: number
107
+ updatedAt: number
108
+ }>
109
+ globalWhatsAppApprovedContacts: WhatsAppApprovedContact[]
110
+ senderStatus?: ConnectorAccessSenderStatus | null
111
+ }
112
+
113
+ export type ConnectorAccessMutationAction =
114
+ | 'set_policy'
115
+ | 'set_dm_addressing_mode'
116
+ | 'allow_sender'
117
+ | 'remove_allowed_sender'
118
+ | 'block_sender'
119
+ | 'unblock_sender'
120
+ | 'approve_pairing'
121
+ | 'reject_pairing'
122
+ | 'set_owner'
123
+ | 'clear_owner'
124
+ | 'set_sender_dm_addressing'
125
+ | 'clear_sender_dm_addressing'
126
+
127
+ export interface ConnectorAccessMutationResponse {
128
+ ok: boolean
129
+ snapshot: ConnectorAccessSnapshot
130
+ }
131
+
132
+ export type InboundMediaType = 'image' | 'video' | 'audio' | 'document' | 'file'
133
+
134
+ export interface InboundThreadHistoryEntry {
135
+ role: 'user' | 'assistant'
136
+ senderName: string
137
+ text: string
138
+ messageId?: string
139
+ }
140
+
141
+ export interface InboundMedia {
142
+ type: InboundMediaType
143
+ fileName?: string
144
+ mimeType?: string
145
+ sizeBytes?: number
146
+ url?: string
147
+ localPath?: string
148
+ }
149
+
150
+ export interface InboundMessage {
151
+ platform: string
152
+ channelId: string
153
+ channelIdAlt?: string
154
+ channelName?: string
155
+ senderId: string
156
+ senderIdAlt?: string
157
+ senderName: string
158
+ senderAvatarUrl?: string
159
+ text: string
160
+ isGroup?: boolean
161
+ messageId?: string
162
+ imageUrl?: string
163
+ media?: InboundMedia[]
164
+ replyToMessageId?: string
165
+ threadId?: string
166
+ threadTitle?: string
167
+ threadStarterText?: string
168
+ threadStarterSenderName?: string
169
+ threadPersonaLabel?: string
170
+ threadParentChannelId?: string
171
+ threadParentChannelName?: string
172
+ threadHistory?: InboundThreadHistoryEntry[]
173
+ mentionsBot?: boolean
174
+ agentIdOverride?: string
175
+ isOwnerConversation?: boolean
176
+ }
177
+
178
+ export interface OutboundSendOptions {
179
+ imageUrl?: string
180
+ fileUrl?: string
181
+ mediaPath?: string
182
+ mimeType?: string
183
+ fileName?: string
184
+ caption?: string
185
+ ptt?: boolean
186
+ replyToMessageId?: string
187
+ threadId?: string
188
+ }