@swarmclawai/swarmclaw 0.6.7 → 0.7.0
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/README.md +82 -39
- package/next.config.ts +31 -6
- package/package.json +3 -2
- package/src/app/api/agents/[id]/thread/route.ts +1 -0
- package/src/app/api/agents/route.ts +19 -5
- package/src/app/api/approvals/route.ts +22 -0
- package/src/app/api/chatrooms/[id]/chat/route.ts +4 -0
- package/src/app/api/clawhub/install/route.ts +2 -2
- package/src/app/api/eval/run/route.ts +37 -0
- package/src/app/api/eval/scenarios/route.ts +24 -0
- package/src/app/api/eval/suite/route.ts +29 -0
- package/src/app/api/mcp-servers/[id]/conformance/route.ts +26 -0
- package/src/app/api/mcp-servers/[id]/invoke/route.ts +81 -0
- package/src/app/api/memory/graph/route.ts +46 -0
- package/src/app/api/memory/route.ts +36 -5
- package/src/app/api/notifications/route.ts +3 -0
- package/src/app/api/plugins/install/route.ts +57 -5
- package/src/app/api/plugins/marketplace/route.ts +73 -22
- package/src/app/api/plugins/route.ts +61 -1
- package/src/app/api/plugins/ui/route.ts +34 -0
- package/src/app/api/sessions/[id]/checkpoints/route.ts +31 -0
- package/src/app/api/sessions/[id]/restore/route.ts +36 -0
- package/src/app/api/settings/route.ts +62 -0
- package/src/app/api/setup/doctor/route.ts +22 -5
- package/src/app/api/souls/[id]/route.ts +65 -0
- package/src/app/api/souls/route.ts +70 -0
- package/src/app/api/tasks/[id]/approve/route.ts +4 -3
- package/src/app/api/tasks/[id]/route.ts +16 -3
- package/src/app/api/tasks/route.ts +10 -2
- package/src/app/api/usage/route.ts +9 -2
- package/src/app/globals.css +27 -0
- package/src/app/page.tsx +10 -5
- package/src/cli/index.js +37 -0
- package/src/components/activity/activity-feed.tsx +9 -2
- package/src/components/agents/agent-avatar.tsx +5 -1
- package/src/components/agents/agent-card.tsx +55 -9
- package/src/components/agents/agent-sheet.tsx +112 -34
- package/src/components/agents/inspector-panel.tsx +1 -1
- package/src/components/agents/soul-library-picker.tsx +84 -13
- package/src/components/auth/access-key-gate.tsx +63 -54
- package/src/components/auth/user-picker.tsx +37 -32
- package/src/components/chat/activity-moment.tsx +2 -0
- package/src/components/chat/chat-area.tsx +11 -0
- package/src/components/chat/chat-header.tsx +69 -25
- package/src/components/chat/chat-tool-toggles.tsx +2 -2
- package/src/components/chat/checkpoint-timeline.tsx +112 -0
- package/src/components/chat/code-block.tsx +3 -1
- package/src/components/chat/exec-approval-card.tsx +8 -1
- package/src/components/chat/message-bubble.tsx +164 -4
- package/src/components/chat/message-list.tsx +46 -4
- package/src/components/chat/session-approval-card.tsx +80 -0
- package/src/components/chat/session-debug-panel.tsx +106 -84
- package/src/components/chat/streaming-bubble.tsx +6 -5
- package/src/components/chat/task-approval-card.tsx +78 -0
- package/src/components/chat/thinking-indicator.tsx +48 -12
- package/src/components/chat/tool-call-bubble.tsx +3 -0
- package/src/components/chat/tool-request-banner.tsx +39 -20
- package/src/components/chatrooms/chatroom-list.tsx +11 -4
- package/src/components/chatrooms/chatroom-sheet.tsx +7 -2
- package/src/components/connectors/connector-list.tsx +33 -11
- package/src/components/connectors/connector-sheet.tsx +37 -7
- package/src/components/home/home-view.tsx +54 -24
- package/src/components/input/chat-input.tsx +22 -1
- package/src/components/knowledge/knowledge-list.tsx +17 -18
- package/src/components/knowledge/knowledge-sheet.tsx +9 -5
- package/src/components/layout/app-layout.tsx +87 -19
- package/src/components/mcp-servers/mcp-server-list.tsx +352 -50
- package/src/components/mcp-servers/mcp-server-sheet.tsx +25 -9
- package/src/components/memory/memory-browser.tsx +73 -45
- package/src/components/memory/memory-graph-view.tsx +203 -0
- package/src/components/memory/memory-list.tsx +20 -13
- package/src/components/plugins/plugin-list.tsx +214 -60
- package/src/components/plugins/plugin-sheet.tsx +119 -24
- package/src/components/projects/project-list.tsx +17 -9
- package/src/components/providers/provider-list.tsx +21 -6
- package/src/components/providers/provider-sheet.tsx +42 -25
- package/src/components/runs/run-list.tsx +17 -13
- package/src/components/schedules/schedule-card.tsx +10 -3
- package/src/components/schedules/schedule-list.tsx +2 -2
- package/src/components/schedules/schedule-sheet.tsx +28 -9
- package/src/components/secrets/secret-sheet.tsx +7 -2
- package/src/components/secrets/secrets-list.tsx +18 -5
- package/src/components/sessions/new-session-sheet.tsx +183 -376
- package/src/components/sessions/session-card.tsx +10 -2
- package/src/components/settings/gateway-connection-panel.tsx +9 -8
- package/src/components/shared/command-palette.tsx +13 -5
- package/src/components/shared/empty-state.tsx +20 -8
- package/src/components/shared/hint-tip.tsx +31 -0
- package/src/components/shared/notification-center.tsx +134 -86
- package/src/components/shared/profile-sheet.tsx +4 -0
- package/src/components/shared/settings/plugin-manager.tsx +360 -135
- package/src/components/shared/settings/section-capability-policy.tsx +3 -3
- package/src/components/shared/settings/section-runtime-loop.tsx +149 -4
- package/src/components/skills/clawhub-browser.tsx +1 -0
- package/src/components/skills/skill-list.tsx +31 -12
- package/src/components/skills/skill-sheet.tsx +20 -7
- package/src/components/tasks/approvals-panel.tsx +224 -0
- package/src/components/tasks/task-board.tsx +20 -12
- package/src/components/tasks/task-card.tsx +21 -7
- package/src/components/tasks/task-column.tsx +4 -3
- package/src/components/tasks/task-list.tsx +1 -1
- package/src/components/tasks/task-sheet.tsx +130 -1
- package/src/components/ui/dialog.tsx +1 -0
- package/src/components/ui/sheet.tsx +1 -0
- package/src/components/usage/metrics-dashboard.tsx +72 -48
- package/src/components/wallets/wallet-panel.tsx +65 -41
- package/src/components/wallets/wallet-section.tsx +9 -3
- package/src/components/webhooks/webhook-list.tsx +21 -12
- package/src/components/webhooks/webhook-sheet.tsx +13 -3
- package/src/lib/approval-display.test.ts +45 -0
- package/src/lib/approval-display.ts +62 -0
- package/src/lib/clipboard.ts +38 -0
- package/src/lib/memory.ts +8 -0
- package/src/lib/providers/claude-cli.ts +5 -3
- package/src/lib/providers/index.ts +67 -21
- package/src/lib/runtime-loop.ts +3 -2
- package/src/lib/server/approvals.ts +150 -0
- package/src/lib/server/chat-execution.ts +319 -74
- package/src/lib/server/chatroom-helpers.ts +63 -5
- package/src/lib/server/chatroom-orchestration.ts +74 -0
- package/src/lib/server/clawhub-client.ts +82 -6
- package/src/lib/server/connectors/manager.ts +27 -1
- package/src/lib/server/context-manager.ts +132 -50
- package/src/lib/server/cost.test.ts +73 -0
- package/src/lib/server/cost.ts +165 -34
- package/src/lib/server/daemon-state.ts +112 -1
- package/src/lib/server/data-dir.ts +18 -1
- package/src/lib/server/eval/runner.ts +126 -0
- package/src/lib/server/eval/scenarios.ts +218 -0
- package/src/lib/server/eval/scorer.ts +96 -0
- package/src/lib/server/eval/store.ts +37 -0
- package/src/lib/server/eval/types.ts +48 -0
- package/src/lib/server/execution-log.ts +12 -8
- package/src/lib/server/guardian.ts +34 -0
- package/src/lib/server/heartbeat-service.ts +53 -1
- package/src/lib/server/integrity-monitor.ts +208 -0
- package/src/lib/server/langgraph-checkpoint.ts +10 -0
- package/src/lib/server/link-understanding.ts +55 -0
- package/src/lib/server/llm-response-cache.test.ts +102 -0
- package/src/lib/server/llm-response-cache.ts +227 -0
- package/src/lib/server/main-agent-loop.ts +115 -16
- package/src/lib/server/main-session.ts +6 -3
- package/src/lib/server/mcp-conformance.test.ts +18 -0
- package/src/lib/server/mcp-conformance.ts +233 -0
- package/src/lib/server/memory-db.ts +193 -19
- package/src/lib/server/memory-retrieval.test.ts +56 -0
- package/src/lib/server/mmr.ts +73 -0
- package/src/lib/server/orchestrator-lg.ts +7 -1
- package/src/lib/server/orchestrator.ts +4 -3
- package/src/lib/server/plugins.ts +662 -132
- package/src/lib/server/process-manager.ts +18 -0
- package/src/lib/server/query-expansion.ts +57 -0
- package/src/lib/server/queue.ts +280 -11
- package/src/lib/server/runtime-settings.ts +9 -0
- package/src/lib/server/session-run-manager.test.ts +23 -0
- package/src/lib/server/session-run-manager.ts +32 -2
- package/src/lib/server/session-tools/canvas.ts +85 -50
- package/src/lib/server/session-tools/chatroom.ts +130 -127
- package/src/lib/server/session-tools/connector.ts +233 -454
- package/src/lib/server/session-tools/context-mgmt.ts +87 -105
- package/src/lib/server/session-tools/crud.ts +84 -7
- package/src/lib/server/session-tools/delegate.ts +351 -752
- package/src/lib/server/session-tools/discovery.ts +198 -0
- package/src/lib/server/session-tools/edit_file.ts +82 -0
- package/src/lib/server/session-tools/file-send.test.ts +39 -0
- package/src/lib/server/session-tools/file.ts +257 -425
- package/src/lib/server/session-tools/git.ts +87 -47
- package/src/lib/server/session-tools/http.ts +95 -33
- package/src/lib/server/session-tools/index.ts +217 -138
- package/src/lib/server/session-tools/memory.ts +154 -239
- package/src/lib/server/session-tools/monitor.ts +126 -0
- package/src/lib/server/session-tools/normalize-tool-args.test.ts +61 -0
- package/src/lib/server/session-tools/normalize-tool-args.ts +48 -0
- package/src/lib/server/session-tools/openclaw-nodes.ts +82 -99
- package/src/lib/server/session-tools/openclaw-workspace.ts +103 -93
- package/src/lib/server/session-tools/platform.ts +86 -0
- package/src/lib/server/session-tools/plugin-creator.ts +239 -0
- package/src/lib/server/session-tools/sample-ui.ts +97 -0
- package/src/lib/server/session-tools/sandbox.ts +175 -148
- package/src/lib/server/session-tools/schedule.ts +78 -0
- package/src/lib/server/session-tools/session-info.ts +104 -410
- package/src/lib/server/session-tools/shell-normalize.test.ts +43 -0
- package/src/lib/server/session-tools/shell.ts +171 -143
- package/src/lib/server/session-tools/subagent.ts +77 -77
- package/src/lib/server/session-tools/wallet.ts +182 -106
- package/src/lib/server/session-tools/web.ts +181 -327
- package/src/lib/server/storage.ts +36 -0
- package/src/lib/server/stream-agent-chat.ts +348 -242
- package/src/lib/server/task-quality-gate.test.ts +44 -0
- package/src/lib/server/task-quality-gate.ts +67 -0
- package/src/lib/server/task-validation.test.ts +78 -0
- package/src/lib/server/task-validation.ts +67 -2
- package/src/lib/server/tool-aliases.ts +68 -0
- package/src/lib/server/tool-capability-policy.ts +24 -5
- package/src/lib/server/tool-retry.ts +62 -0
- package/src/lib/server/transcript-repair.ts +72 -0
- package/src/lib/setup-defaults.ts +1 -0
- package/src/lib/tasks.ts +7 -1
- package/src/lib/tool-definitions.ts +24 -23
- package/src/lib/validation/schemas.ts +13 -0
- package/src/lib/view-routes.ts +2 -23
- package/src/stores/use-app-store.ts +23 -1
- package/src/types/index.ts +155 -10
|
@@ -4,39 +4,39 @@ export interface ToolDefinition {
|
|
|
4
4
|
description: string
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Standard dynamic tools.
|
|
9
|
+
* Many granular tools (read_file, write_file, etc.) are now unified under 'files'.
|
|
10
|
+
*/
|
|
7
11
|
export const AVAILABLE_TOOLS: ToolDefinition[] = [
|
|
8
|
-
{ id: 'shell', label: 'Shell', description: 'Execute commands in the working directory' },
|
|
9
|
-
{ id: 'files', label: 'Files', description: '
|
|
10
|
-
{ id: '
|
|
11
|
-
{ id: '
|
|
12
|
-
{ id: '
|
|
13
|
-
{ id: 'edit_file', label: 'Edit File', description: 'Search-and-replace editing within files' },
|
|
14
|
-
{ id: 'process', label: 'Process', description: 'Monitor and control long-running shell commands' },
|
|
15
|
-
{ id: 'web_search', label: 'Web Search', description: 'Search the web via DuckDuckGo' },
|
|
16
|
-
{ id: 'web_fetch', label: 'Web Fetch', description: 'Fetch and extract text from URLs' },
|
|
17
|
-
{ id: 'claude_code', label: 'Claude Code', description: 'Delegate complex tasks to Claude Code CLI' },
|
|
18
|
-
{ id: 'codex_cli', label: 'Codex CLI', description: 'Delegate complex tasks to OpenAI Codex CLI' },
|
|
19
|
-
{ id: 'opencode_cli', label: 'OpenCode CLI', description: 'Delegate complex tasks to OpenCode CLI' },
|
|
12
|
+
{ id: 'shell', label: 'Shell', description: 'Execute commands in the working directory and manage background processes' },
|
|
13
|
+
{ id: 'files', label: 'Files', description: 'Complete file management: read, write, list, move, copy, delete, and send' },
|
|
14
|
+
{ id: 'edit_file', label: 'Edit File', description: 'Surgical search-and-replace within files' },
|
|
15
|
+
{ id: 'web', label: 'Web', description: 'Search the web via DuckDuckGo and fetch text from URLs' },
|
|
16
|
+
{ id: 'delegate', label: 'Delegate', description: 'Delegate complex tasks to specialized backends (Claude Code, Codex, OpenCode)' },
|
|
20
17
|
{ id: 'browser', label: 'Browser', description: 'Playwright — browse, scrape, interact with web pages' },
|
|
21
18
|
{ id: 'memory', label: 'Memory', description: 'Store and retrieve long-term memories across conversations' },
|
|
22
|
-
{ id: 'sandbox', label: 'Sandbox', description: '
|
|
19
|
+
{ id: 'sandbox', label: 'Sandbox', description: 'Secure isolated code execution for JS, TS, and Python' },
|
|
23
20
|
{ id: 'create_document', label: 'Create Document', description: 'Render markdown to PDF, HTML, or image' },
|
|
24
21
|
{ id: 'create_spreadsheet', label: 'Create Spreadsheet', description: 'Create Excel or CSV files from structured data' },
|
|
25
|
-
{ id: 'http_request', label: 'HTTP Request', description: 'Make HTTP API calls
|
|
22
|
+
{ id: 'http_request', label: 'HTTP Request', description: 'Make direct HTTP API calls with custom methods, headers, and bodies' },
|
|
26
23
|
{ id: 'git', label: 'Git', description: 'Run structured git operations (status, commit, push, diff, etc.)' },
|
|
27
24
|
{ id: 'wallet', label: 'Wallet', description: 'Manage agent crypto wallet — check balance, send SOL, view transactions' },
|
|
25
|
+
{ id: 'monitor', label: 'Monitor', description: 'System observability: check resource usage, watch logs, and ping endpoints' },
|
|
26
|
+
{ id: 'plugin_creator', label: 'Plugin Creator', description: 'Design, write, and test custom SwarmClaw plugins dynamically' },
|
|
27
|
+
{ id: 'sample_ui', label: 'Sample UI', description: 'Demonstration of dynamic UI injection into Sidebar and Chat Header' },
|
|
28
28
|
]
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Platform capability tools.
|
|
32
|
+
* Granular CRUD tools are now unified under 'manage_platform'.
|
|
33
|
+
*/
|
|
30
34
|
export const PLATFORM_TOOLS: ToolDefinition[] = [
|
|
31
|
-
{ id: '
|
|
32
|
-
{ id: '
|
|
33
|
-
{ id: '
|
|
34
|
-
{ id: '
|
|
35
|
-
{ id: '
|
|
36
|
-
{ id: 'manage_webhooks', label: 'Webhooks', description: 'Register webhooks that trigger agent workflows' },
|
|
37
|
-
{ id: 'manage_connectors', label: 'Connectors', description: 'Create, edit, and delete connectors' },
|
|
38
|
-
{ id: 'manage_sessions', label: 'Chats', description: 'List chats, send messages, and spawn agent work' },
|
|
39
|
-
{ id: 'manage_secrets', label: 'Secrets', description: 'Store and retrieve encrypted service secrets' },
|
|
35
|
+
{ id: 'manage_platform', label: 'Platform', description: 'Unified management of agents, tasks, schedules, skills, documents, and secrets' },
|
|
36
|
+
{ id: 'manage_connectors', label: 'Connectors', description: 'Manage chat platform bridges and send outbound messages' },
|
|
37
|
+
{ id: 'manage_chatrooms', label: 'Chatrooms', description: 'Manage SwarmClaw routing rules and multi-agent chatrooms' },
|
|
38
|
+
{ id: 'delegate_to_agent', label: 'Assign Agent', description: 'Delegate a task to another specific agent' },
|
|
39
|
+
{ id: 'schedule_wake', label: 'Reminders', description: 'Schedule a proactive wake event in the current chat' },
|
|
40
40
|
]
|
|
41
41
|
|
|
42
42
|
export const ALL_TOOLS: ToolDefinition[] = [...AVAILABLE_TOOLS, ...PLATFORM_TOOLS]
|
|
@@ -45,3 +45,4 @@ export const ALL_TOOLS: ToolDefinition[] = [...AVAILABLE_TOOLS, ...PLATFORM_TOOL
|
|
|
45
45
|
export const TOOL_LABELS: Record<string, string> = Object.fromEntries(
|
|
46
46
|
ALL_TOOLS.map((t) => [t.id, t.label]),
|
|
47
47
|
)
|
|
48
|
+
|
|
@@ -14,6 +14,11 @@ export const AgentCreateSchema = z.object({
|
|
|
14
14
|
capabilities: z.array(z.string()).optional().default([]),
|
|
15
15
|
thinkingLevel: z.string().optional(),
|
|
16
16
|
soul: z.string().optional(),
|
|
17
|
+
autoRecovery: z.boolean().optional().default(false),
|
|
18
|
+
monthlyBudget: z.number().positive().nullable().optional().default(null),
|
|
19
|
+
dailyBudget: z.number().positive().nullable().optional().default(null),
|
|
20
|
+
hourlyBudget: z.number().positive().nullable().optional().default(null),
|
|
21
|
+
budgetAction: z.enum(['warn', 'block']).optional().default('warn'),
|
|
17
22
|
})
|
|
18
23
|
|
|
19
24
|
export const ConnectorCreateSchema = z.object({
|
|
@@ -45,6 +50,14 @@ export const TaskCreateSchema = z.object({
|
|
|
45
50
|
retryBackoffSec: z.number().optional(),
|
|
46
51
|
priority: z.enum(['low', 'medium', 'high', 'critical']).optional(),
|
|
47
52
|
dueAt: z.number().nullable().optional(),
|
|
53
|
+
qualityGate: z.object({
|
|
54
|
+
enabled: z.boolean().optional(),
|
|
55
|
+
minResultChars: z.number().optional(),
|
|
56
|
+
minEvidenceItems: z.number().optional(),
|
|
57
|
+
requireVerification: z.boolean().optional(),
|
|
58
|
+
requireArtifact: z.boolean().optional(),
|
|
59
|
+
requireReport: z.boolean().optional(),
|
|
60
|
+
}).nullable().optional(),
|
|
48
61
|
})
|
|
49
62
|
|
|
50
63
|
export const ChatroomCreateSchema = z.object({
|
package/src/lib/view-routes.ts
CHANGED
|
@@ -1,30 +1,9 @@
|
|
|
1
1
|
import type { AppView } from '@/types'
|
|
2
|
+
import { VIEW_ROUTE_PATHS } from '../../view-route-paths'
|
|
2
3
|
|
|
3
4
|
export const DEFAULT_VIEW: AppView = 'home'
|
|
4
5
|
|
|
5
|
-
export const VIEW_TO_PATH: Record<AppView, string> =
|
|
6
|
-
home: '/',
|
|
7
|
-
agents: '/agents',
|
|
8
|
-
chatrooms: '/chatrooms',
|
|
9
|
-
schedules: '/schedules',
|
|
10
|
-
memory: '/memory',
|
|
11
|
-
tasks: '/tasks',
|
|
12
|
-
secrets: '/secrets',
|
|
13
|
-
providers: '/providers',
|
|
14
|
-
skills: '/skills',
|
|
15
|
-
connectors: '/connectors',
|
|
16
|
-
webhooks: '/webhooks',
|
|
17
|
-
mcp_servers: '/mcp-servers',
|
|
18
|
-
knowledge: '/knowledge',
|
|
19
|
-
plugins: '/plugins',
|
|
20
|
-
usage: '/usage',
|
|
21
|
-
wallets: '/wallets',
|
|
22
|
-
runs: '/runs',
|
|
23
|
-
logs: '/logs',
|
|
24
|
-
settings: '/settings',
|
|
25
|
-
projects: '/projects',
|
|
26
|
-
activity: '/activity',
|
|
27
|
-
}
|
|
6
|
+
export const VIEW_TO_PATH: Record<AppView, string> = VIEW_ROUTE_PATHS
|
|
28
7
|
|
|
29
8
|
const entries = Object.entries(VIEW_TO_PATH) as [AppView, string][]
|
|
30
9
|
export const PATH_TO_VIEW: Record<string, AppView> = Object.fromEntries(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import { create } from 'zustand'
|
|
4
|
-
import type { Sessions, Session, NetworkInfo, Directory, ProviderInfo, Credentials, Agent, Schedule, AppView, BoardTask, AppSettings, OrchestratorSecret, ProviderConfig, Skill, Connector, Webhook, McpServerConfig, PluginMeta, Project, FleetFilter, ActivityEntry, AppNotification } from '../types'
|
|
4
|
+
import type { Sessions, Session, NetworkInfo, Directory, ProviderInfo, Credentials, Agent, Schedule, AppView, BoardTask, AppSettings, OrchestratorSecret, ProviderConfig, Skill, Connector, Webhook, McpServerConfig, PluginMeta, Project, FleetFilter, ActivityEntry, AppNotification, ApprovalRequest } from '../types'
|
|
5
5
|
import { fetchSessions, fetchDirs, fetchProviders, fetchCredentials } from '../lib/sessions'
|
|
6
6
|
import { fetchAgents } from '../lib/agents'
|
|
7
7
|
import { fetchSchedules } from '../lib/schedules'
|
|
@@ -198,6 +198,11 @@ interface AppState {
|
|
|
198
198
|
lastReadTimestamps: Record<string, number>
|
|
199
199
|
markChatRead: (id: string) => void
|
|
200
200
|
|
|
201
|
+
// Approvals
|
|
202
|
+
approvals: Record<string, ApprovalRequest>
|
|
203
|
+
loadApprovals: () => Promise<void>
|
|
204
|
+
submitApprovalDecision: (id: string, approved: boolean) => Promise<void>
|
|
205
|
+
|
|
201
206
|
// Notifications
|
|
202
207
|
notifications: AppNotification[]
|
|
203
208
|
unreadNotificationCount: number
|
|
@@ -643,6 +648,23 @@ export const useAppStore = create<AppState>((set, get) => ({
|
|
|
643
648
|
safeStorageSet('sc_last_read', JSON.stringify(ts))
|
|
644
649
|
},
|
|
645
650
|
|
|
651
|
+
// Approvals
|
|
652
|
+
approvals: {},
|
|
653
|
+
loadApprovals: async () => {
|
|
654
|
+
try {
|
|
655
|
+
const list = await api<ApprovalRequest[]>('GET', '/approvals')
|
|
656
|
+
const approvals: Record<string, ApprovalRequest> = {}
|
|
657
|
+
for (const a of list) approvals[a.id] = a
|
|
658
|
+
set({ approvals })
|
|
659
|
+
} catch { /* ignore */ }
|
|
660
|
+
},
|
|
661
|
+
submitApprovalDecision: async (id, approved) => {
|
|
662
|
+
try {
|
|
663
|
+
await api('POST', '/approvals', { id, approved })
|
|
664
|
+
await get().loadApprovals()
|
|
665
|
+
} catch { /* ignore */ }
|
|
666
|
+
},
|
|
667
|
+
|
|
646
668
|
// Notifications
|
|
647
669
|
notifications: [],
|
|
648
670
|
unreadNotificationCount: 0,
|
package/src/types/index.ts
CHANGED
|
@@ -14,12 +14,14 @@ export interface Message {
|
|
|
14
14
|
attachedFiles?: string[]
|
|
15
15
|
toolEvents?: MessageToolEvent[]
|
|
16
16
|
thinking?: string
|
|
17
|
-
kind?: 'chat' | 'heartbeat' | 'system' | 'context-clear'
|
|
17
|
+
kind?: 'chat' | 'heartbeat' | 'system' | 'context-clear' | 'plugin-ui'
|
|
18
18
|
suppressed?: boolean
|
|
19
19
|
bookmarked?: boolean
|
|
20
20
|
suggestions?: string[]
|
|
21
21
|
replyToId?: string
|
|
22
22
|
source?: MessageSource
|
|
23
|
+
/** True while the message is still being streamed — cleared on final persist. */
|
|
24
|
+
streaming?: boolean
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
export type ProviderType = 'claude-cli' | 'codex-cli' | 'opencode-cli' | 'openai' | 'ollama' | 'anthropic' | 'openclaw' | 'google' | 'deepseek' | 'groq' | 'together' | 'mistral' | 'xai' | 'fireworks'
|
|
@@ -75,6 +77,8 @@ export interface Session {
|
|
|
75
77
|
heartbeatIntervalSec?: number | null
|
|
76
78
|
heartbeatTarget?: 'last' | 'none' | string | null
|
|
77
79
|
lastAutoMemoryAt?: number | null
|
|
80
|
+
lastHeartbeatText?: string | null
|
|
81
|
+
lastHeartbeatSentAt?: number | null
|
|
78
82
|
mainLoopState?: {
|
|
79
83
|
goal?: string | null
|
|
80
84
|
goalContract?: GoalContract | null
|
|
@@ -102,6 +106,8 @@ export interface Session {
|
|
|
102
106
|
note: string
|
|
103
107
|
status?: 'idle' | 'progress' | 'blocked' | 'ok'
|
|
104
108
|
}>
|
|
109
|
+
missionTokens?: number
|
|
110
|
+
missionCostUsd?: number
|
|
105
111
|
followupChainCount?: number
|
|
106
112
|
metaMissCount?: number
|
|
107
113
|
workingMemoryNotes?: string[]
|
|
@@ -116,6 +122,11 @@ export interface Session {
|
|
|
116
122
|
queuedCount?: number
|
|
117
123
|
currentRunId?: string | null
|
|
118
124
|
conversationTone?: string
|
|
125
|
+
emoji?: string
|
|
126
|
+
creature?: string
|
|
127
|
+
vibe?: string
|
|
128
|
+
theme?: string
|
|
129
|
+
avatar?: string
|
|
119
130
|
canvasContent?: string | null
|
|
120
131
|
}
|
|
121
132
|
|
|
@@ -136,7 +147,25 @@ export type SessionTool =
|
|
|
136
147
|
| 'http_request'
|
|
137
148
|
| 'git'
|
|
138
149
|
|
|
139
|
-
// ---
|
|
150
|
+
// --- Approvals ---
|
|
151
|
+
|
|
152
|
+
export type ApprovalCategory = 'tool_access' | 'wallet_transfer' | 'plugin_scaffold' | 'plugin_install' | 'task_tool'
|
|
153
|
+
|
|
154
|
+
export interface ApprovalRequest {
|
|
155
|
+
id: string
|
|
156
|
+
category: ApprovalCategory
|
|
157
|
+
agentId?: string | null
|
|
158
|
+
sessionId?: string | null
|
|
159
|
+
taskId?: string | null
|
|
160
|
+
title: string
|
|
161
|
+
description?: string
|
|
162
|
+
data: Record<string, unknown>
|
|
163
|
+
createdAt: number
|
|
164
|
+
updatedAt: number
|
|
165
|
+
status: 'pending' | 'approved' | 'rejected'
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export type Approvals = Record<string, ApprovalRequest>
|
|
140
169
|
|
|
141
170
|
export interface UsageRecord {
|
|
142
171
|
sessionId: string
|
|
@@ -148,6 +177,7 @@ export interface UsageRecord {
|
|
|
148
177
|
totalTokens: number
|
|
149
178
|
estimatedCost: number
|
|
150
179
|
timestamp: number
|
|
180
|
+
durationMs?: number
|
|
151
181
|
}
|
|
152
182
|
|
|
153
183
|
// --- Plugin System ---
|
|
@@ -155,15 +185,78 @@ export interface UsageRecord {
|
|
|
155
185
|
export interface PluginHooks {
|
|
156
186
|
beforeAgentStart?: (ctx: { session: Session; message: string }) => Promise<void> | void
|
|
157
187
|
afterAgentComplete?: (ctx: { session: Session; response: string }) => Promise<void> | void
|
|
158
|
-
beforeToolExec?: (ctx: { toolName: string; input:
|
|
159
|
-
afterToolExec?: (ctx: { toolName: string; input:
|
|
188
|
+
beforeToolExec?: (ctx: { toolName: string; input: Record<string, unknown> | null }) => Promise<Record<string, unknown> | void> | Record<string, unknown> | void
|
|
189
|
+
afterToolExec?: (ctx: { toolName: string; input: Record<string, unknown> | null; output: string }) => Promise<void> | void
|
|
160
190
|
onMessage?: (ctx: { session: Session; message: Message }) => Promise<void> | void
|
|
191
|
+
|
|
192
|
+
// Orchestration & Swarm Hooks
|
|
193
|
+
onTaskComplete?: (ctx: { taskId: string; result: unknown }) => Promise<void> | void
|
|
194
|
+
onAgentDelegation?: (ctx: { sourceAgentId: string; targetAgentId: string; task: string }) => Promise<void> | void
|
|
195
|
+
|
|
196
|
+
// Chat Middleware (Transform messages)
|
|
197
|
+
transformInboundMessage?: (ctx: { session: Session; text: string }) => Promise<string> | string
|
|
198
|
+
transformOutboundMessage?: (ctx: { session: Session; text: string }) => Promise<string> | string
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface PluginToolDef {
|
|
202
|
+
name: string
|
|
203
|
+
description: string
|
|
204
|
+
parameters: Record<string, unknown>
|
|
205
|
+
execute: (args: Record<string, unknown>, ctx: { session: Session; message: string }) => Promise<string | object> | string | object
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface PluginUIExtension {
|
|
209
|
+
sidebarItems?: Array<{
|
|
210
|
+
id: string
|
|
211
|
+
label: string
|
|
212
|
+
icon?: string
|
|
213
|
+
href: string
|
|
214
|
+
position?: 'top' | 'bottom'
|
|
215
|
+
}>
|
|
216
|
+
headerWidgets?: Array<{
|
|
217
|
+
id: string
|
|
218
|
+
label: string
|
|
219
|
+
icon?: string
|
|
220
|
+
}>
|
|
221
|
+
chatInputActions?: Array<{
|
|
222
|
+
id: string
|
|
223
|
+
label: string
|
|
224
|
+
icon?: string
|
|
225
|
+
tooltip?: string
|
|
226
|
+
action: 'message' | 'link' | 'tool'
|
|
227
|
+
value: string
|
|
228
|
+
}>
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export interface PluginProviderExtension {
|
|
232
|
+
id: string
|
|
233
|
+
name: string
|
|
234
|
+
models: string[]
|
|
235
|
+
requiresApiKey: boolean
|
|
236
|
+
requiresEndpoint: boolean
|
|
237
|
+
defaultEndpoint?: string
|
|
238
|
+
streamChat: (opts: any) => Promise<string>
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface PluginConnectorExtension {
|
|
242
|
+
id: string
|
|
243
|
+
name: string
|
|
244
|
+
description: string
|
|
245
|
+
// For sending outbound
|
|
246
|
+
sendMessage?: (params: any) => Promise<any>
|
|
247
|
+
// For polling/listening
|
|
248
|
+
startListener?: (onMessage: (msg: any) => void) => Promise<() => void>
|
|
161
249
|
}
|
|
162
250
|
|
|
163
251
|
export interface Plugin {
|
|
164
252
|
name: string
|
|
253
|
+
version?: string
|
|
165
254
|
description?: string
|
|
166
|
-
hooks
|
|
255
|
+
hooks?: PluginHooks
|
|
256
|
+
tools?: PluginToolDef[]
|
|
257
|
+
ui?: PluginUIExtension
|
|
258
|
+
providers?: PluginProviderExtension[]
|
|
259
|
+
connectors?: PluginConnectorExtension[]
|
|
167
260
|
}
|
|
168
261
|
|
|
169
262
|
export interface PluginMeta {
|
|
@@ -175,8 +268,18 @@ export interface PluginMeta {
|
|
|
175
268
|
version?: string
|
|
176
269
|
source?: 'local' | 'marketplace'
|
|
177
270
|
openclaw?: boolean
|
|
271
|
+
failureCount?: number
|
|
272
|
+
lastFailureAt?: number
|
|
273
|
+
lastFailureStage?: string
|
|
274
|
+
lastFailureError?: string
|
|
275
|
+
autoDisabled?: boolean
|
|
276
|
+
toolCount?: number
|
|
277
|
+
hookCount?: number
|
|
278
|
+
hasUI?: boolean
|
|
279
|
+
providerCount?: number
|
|
280
|
+
connectorCount?: number
|
|
281
|
+
createdByAgentId?: string | null
|
|
178
282
|
}
|
|
179
|
-
|
|
180
283
|
export interface MarketplacePlugin {
|
|
181
284
|
id: string
|
|
182
285
|
name: string
|
|
@@ -184,9 +287,10 @@ export interface MarketplacePlugin {
|
|
|
184
287
|
author: string
|
|
185
288
|
version: string
|
|
186
289
|
url: string
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
290
|
+
source?: 'swarmclaw' | 'clawhub'
|
|
291
|
+
tags?: string[]
|
|
292
|
+
openclaw?: boolean
|
|
293
|
+
downloads?: number
|
|
190
294
|
}
|
|
191
295
|
|
|
192
296
|
export interface SSEEvent {
|
|
@@ -233,6 +337,11 @@ export interface Agent {
|
|
|
233
337
|
name: string
|
|
234
338
|
description: string
|
|
235
339
|
soul?: string
|
|
340
|
+
emoji?: string
|
|
341
|
+
creature?: string
|
|
342
|
+
vibe?: string
|
|
343
|
+
theme?: string
|
|
344
|
+
avatar?: string
|
|
236
345
|
systemPrompt: string
|
|
237
346
|
provider: ProviderType
|
|
238
347
|
model: string
|
|
@@ -273,9 +382,18 @@ export interface Agent {
|
|
|
273
382
|
openclawAllowedSkills?: string[]
|
|
274
383
|
walletId?: string | null
|
|
275
384
|
monthlyBudget?: number | null
|
|
385
|
+
dailyBudget?: number | null
|
|
386
|
+
hourlyBudget?: number | null
|
|
387
|
+
autoRecovery?: boolean
|
|
388
|
+
|
|
276
389
|
budgetAction?: 'warn' | 'block'
|
|
277
390
|
/** Runtime-enriched: current month's spend. Populated by GET /api/agents when monthlyBudget is set. */
|
|
278
391
|
monthlySpend?: number
|
|
392
|
+
/** Runtime-enriched: current day's spend. Populated by GET /api/agents when dailyBudget is set. */
|
|
393
|
+
dailySpend?: number
|
|
394
|
+
/** Runtime-enriched: trailing 1-hour spend. Populated by GET /api/agents when hourlyBudget is set. */
|
|
395
|
+
hourlySpend?: number
|
|
396
|
+
maxFollowupChain?: number
|
|
279
397
|
createdAt: number
|
|
280
398
|
updatedAt: number
|
|
281
399
|
}
|
|
@@ -408,7 +526,7 @@ export interface MemoryEntry {
|
|
|
408
526
|
}
|
|
409
527
|
|
|
410
528
|
export type SessionType = 'human' | 'orchestrated'
|
|
411
|
-
export type AppView = 'home' | 'agents' | 'chatrooms' | 'schedules' | 'memory' | 'tasks' | 'secrets' | 'providers' | 'skills' | 'connectors' | 'webhooks' | 'mcp_servers' | 'knowledge' | 'plugins' | 'usage' | 'wallets' | 'runs' | 'logs' | 'settings' | 'projects' | 'activity'
|
|
529
|
+
export type AppView = 'home' | 'agents' | 'chatrooms' | 'schedules' | 'memory' | 'tasks' | 'approvals' | 'secrets' | 'providers' | 'skills' | 'connectors' | 'webhooks' | 'mcp_servers' | 'knowledge' | 'plugins' | 'usage' | 'wallets' | 'runs' | 'logs' | 'settings' | 'projects' | 'activity'
|
|
412
530
|
|
|
413
531
|
// --- Chatrooms ---
|
|
414
532
|
|
|
@@ -579,8 +697,10 @@ export interface AppSettings {
|
|
|
579
697
|
agentLoopRecursionLimit?: number
|
|
580
698
|
orchestratorLoopRecursionLimit?: number
|
|
581
699
|
legacyOrchestratorMaxTurns?: number
|
|
700
|
+
delegationMaxDepth?: number
|
|
582
701
|
ongoingLoopMaxIterations?: number
|
|
583
702
|
ongoingLoopMaxRuntimeMinutes?: number
|
|
703
|
+
maxFollowupChain?: number
|
|
584
704
|
shellCommandTimeoutSec?: number
|
|
585
705
|
claudeCodeTimeoutSec?: number
|
|
586
706
|
cliProcessTimeoutSec?: number
|
|
@@ -651,6 +771,19 @@ export interface AppSettings {
|
|
|
651
771
|
alertWebhookUrl?: string | null
|
|
652
772
|
alertWebhookType?: 'discord' | 'slack' | 'custom' | null
|
|
653
773
|
alertWebhookEvents?: ('error' | 'warning')[]
|
|
774
|
+
// Deterministic LLM response cache
|
|
775
|
+
responseCacheEnabled?: boolean
|
|
776
|
+
responseCacheTtlSec?: number
|
|
777
|
+
responseCacheMaxEntries?: number
|
|
778
|
+
// Task quality gate defaults
|
|
779
|
+
taskQualityGateEnabled?: boolean
|
|
780
|
+
taskQualityGateMinResultChars?: number
|
|
781
|
+
taskQualityGateMinEvidenceItems?: number
|
|
782
|
+
taskQualityGateRequireVerification?: boolean
|
|
783
|
+
taskQualityGateRequireArtifact?: boolean
|
|
784
|
+
taskQualityGateRequireReport?: boolean
|
|
785
|
+
// Integrity monitor
|
|
786
|
+
integrityMonitorEnabled?: boolean
|
|
654
787
|
}
|
|
655
788
|
|
|
656
789
|
// --- Orchestrator Secrets ---
|
|
@@ -678,6 +811,15 @@ export interface TaskComment {
|
|
|
678
811
|
createdAt: number
|
|
679
812
|
}
|
|
680
813
|
|
|
814
|
+
export interface TaskQualityGateConfig {
|
|
815
|
+
enabled?: boolean
|
|
816
|
+
minResultChars?: number
|
|
817
|
+
minEvidenceItems?: number
|
|
818
|
+
requireVerification?: boolean
|
|
819
|
+
requireArtifact?: boolean
|
|
820
|
+
requireReport?: boolean
|
|
821
|
+
}
|
|
822
|
+
|
|
681
823
|
// --- Custom Providers ---
|
|
682
824
|
|
|
683
825
|
export interface ProviderConfig {
|
|
@@ -809,6 +951,8 @@ export interface BoardTask {
|
|
|
809
951
|
createdByAgentId?: string | null
|
|
810
952
|
createdInSessionId?: string | null
|
|
811
953
|
delegatedByAgentId?: string | null
|
|
954
|
+
delegatedFromTaskId?: string | null
|
|
955
|
+
delegationDepth?: number | null
|
|
812
956
|
createdAt: number
|
|
813
957
|
updatedAt: number
|
|
814
958
|
queuedAt?: number | null
|
|
@@ -862,6 +1006,7 @@ export interface BoardTask {
|
|
|
862
1006
|
priority?: 'low' | 'medium' | 'high' | 'critical'
|
|
863
1007
|
// Dedup fingerprint
|
|
864
1008
|
fingerprint?: string
|
|
1009
|
+
qualityGate?: TaskQualityGateConfig | null
|
|
865
1010
|
}
|
|
866
1011
|
|
|
867
1012
|
// --- MCP Servers ---
|