@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.
- package/README.md +54 -23
- package/next.config.ts +1 -0
- package/package.json +4 -3
- package/scripts/easy-setup.mjs +1 -1
- package/scripts/postinstall.mjs +1 -1
- package/skills/swarmclaw.md +115 -0
- package/skills/tools/browser.md +131 -0
- package/skills/tools/execute.md +98 -0
- package/skills/tools/files.md +98 -0
- package/skills/tools/memory.md +104 -0
- package/skills/tools/platform.md +144 -0
- package/skills/tools/skills.md +83 -0
- package/src/app/agents/[id]/page.tsx +1 -18
- package/src/app/api/agents/thread-route.test.ts +0 -1
- package/src/app/api/approvals/route.test.ts +6 -22
- package/src/app/api/chats/[id]/messages/route.ts +23 -19
- package/src/app/api/chats/messages-route.test.ts +105 -51
- package/src/app/api/connectors/route.ts +2 -2
- package/src/app/api/mcp-servers/[id]/test/route.ts +3 -2
- package/src/app/api/openclaw/deploy/route.ts +2 -0
- package/src/app/api/portability/export/route.ts +8 -0
- package/src/app/api/portability/import/route.test.ts +80 -0
- package/src/app/api/portability/import/route.ts +28 -0
- package/src/app/api/settings/route.ts +0 -2
- package/src/app/api/setup/doctor/route.ts +4 -4
- package/src/app/api/wallets/[id]/route.ts +15 -157
- package/src/app/api/wallets/generate/route.ts +22 -0
- package/src/app/api/wallets/route.test.ts +147 -0
- package/src/app/api/wallets/route.ts +13 -95
- package/src/app/autonomy/page.tsx +2 -57
- package/src/app/protocols/page.tsx +2 -21
- package/src/app/settings/page.tsx +0 -9
- package/src/app/wallets/page.tsx +105 -5
- package/src/cli/index.js +21 -33
- package/src/cli/spec.js +19 -30
- package/src/components/agents/agent-chat-list.tsx +23 -1
- package/src/components/agents/agent-sheet.tsx +2 -40
- package/src/components/agents/inspector-panel.tsx +165 -131
- package/src/components/chat/chat-area.tsx +38 -9
- package/src/components/chat/chat-card.tsx +0 -31
- package/src/components/chat/message-bubble.tsx +1 -108
- package/src/components/chat/message-list.tsx +33 -19
- package/src/components/connectors/connector-sheet.tsx +25 -1
- package/src/components/gateways/gateway-sheet.tsx +5 -2
- package/src/components/layout/sidebar-rail.tsx +6 -10
- package/src/components/projects/project-detail.tsx +3 -35
- package/src/components/projects/tabs/overview-tab.tsx +3 -59
- package/src/components/projects/tabs/work-tab.tsx +7 -77
- package/src/components/protocols/structured-session-launcher.tsx +1 -22
- package/src/components/shared/connector-platform-icon.tsx +1 -0
- package/src/components/tasks/task-card.tsx +4 -34
- package/src/components/tasks/task-sheet.tsx +6 -36
- package/src/components/wallets/wallet-list.tsx +150 -0
- package/src/lib/agent-execute-defaults.test.ts +24 -0
- package/src/lib/agent-execute-defaults.ts +62 -0
- package/src/lib/app/navigation.test.ts +0 -13
- package/src/lib/app/navigation.ts +2 -7
- package/src/lib/app/view-constants.ts +14 -19
- package/src/lib/chat/queued-message-queue.test.ts +134 -1
- package/src/lib/chat/queued-message-queue.ts +77 -2
- package/src/lib/server/agents/agent-service.ts +5 -0
- package/src/lib/server/agents/agent-thread-session.ts +0 -1
- package/src/lib/server/agents/delegation-advisory.test.ts +0 -1
- package/src/lib/server/agents/delegation-jobs.test.ts +0 -69
- package/src/lib/server/agents/delegation-jobs.ts +0 -25
- package/src/lib/server/agents/main-agent-loop.ts +1 -49
- package/src/lib/server/agents/subagent-runtime.ts +0 -1
- package/src/lib/server/approval-match.ts +0 -85
- package/src/lib/server/approvals.test.ts +6 -6
- package/src/lib/server/approvals.ts +0 -6
- package/src/lib/server/autonomy/supervisor-reflection.test.ts +0 -1
- package/src/lib/server/builtin-extensions.ts +1 -2
- package/src/lib/server/capability-router.test.ts +0 -2
- package/src/lib/server/chat-execution/chat-execution-advanced.test.ts +1 -1
- package/src/lib/server/chat-execution/chat-execution-tool-events.test.ts +15 -14
- package/src/lib/server/chat-execution/chat-execution-types.ts +0 -2
- package/src/lib/server/chat-execution/chat-execution-utils.ts +2 -4
- package/src/lib/server/chat-execution/chat-streaming-utils.ts +2 -30
- package/src/lib/server/chat-execution/chat-turn-finalization.ts +1 -36
- package/src/lib/server/chat-execution/chat-turn-preparation.ts +81 -64
- package/src/lib/server/chat-execution/chat-turn-stream-execution.ts +4 -0
- package/src/lib/server/chat-execution/continuation-evaluator.ts +8 -0
- package/src/lib/server/chat-execution/iteration-event-handler.ts +0 -24
- package/src/lib/server/chat-execution/memory-mutation-tools.ts +1 -1
- package/src/lib/server/chat-execution/message-classifier.test.ts +0 -45
- package/src/lib/server/chat-execution/message-classifier.ts +11 -16
- package/src/lib/server/chat-execution/prompt-builder.test.ts +27 -0
- package/src/lib/server/chat-execution/prompt-builder.ts +14 -31
- package/src/lib/server/chat-execution/prompt-mode.test.ts +24 -0
- package/src/lib/server/chat-execution/prompt-mode.ts +5 -1
- package/src/lib/server/chat-execution/prompt-sections.ts +0 -1
- package/src/lib/server/chat-execution/situational-awareness.test.ts +2 -73
- package/src/lib/server/chat-execution/situational-awareness.ts +4 -38
- package/src/lib/server/chat-execution/stream-agent-chat.test.ts +13 -126
- package/src/lib/server/chat-execution/stream-agent-chat.ts +46 -21
- package/src/lib/server/chat-execution/stream-continuation.test.ts +4 -52
- package/src/lib/server/chat-execution/stream-continuation.ts +6 -48
- package/src/lib/server/chatrooms/chatroom-routing.test.ts +4 -0
- package/src/lib/server/chatrooms/session-mailbox.ts +0 -10
- package/src/lib/server/chats/chat-session-service.ts +3 -5
- package/src/lib/server/connectors/connector-inbound.ts +0 -1
- package/src/lib/server/connectors/connector-lifecycle.ts +19 -3
- package/src/lib/server/connectors/connector-service.ts +39 -9
- package/src/lib/server/connectors/discord.ts +2 -2
- package/src/lib/server/connectors/matrix.ts +3 -2
- package/src/lib/server/connectors/signal.ts +5 -4
- package/src/lib/server/connectors/slack.ts +10 -9
- package/src/lib/server/connectors/swarmdock-bidding.ts +74 -0
- package/src/lib/server/connectors/swarmdock-payloads.test.ts +85 -0
- package/src/lib/server/connectors/swarmdock-secret.test.ts +128 -0
- package/src/lib/server/connectors/swarmdock-secret.ts +152 -0
- package/src/lib/server/connectors/swarmdock-tasks.ts +119 -0
- package/src/lib/server/connectors/swarmdock.ts +255 -0
- package/src/lib/server/connectors/teams.ts +3 -2
- package/src/lib/server/connectors/telegram.ts +4 -4
- package/src/lib/server/connectors/whatsapp.ts +2 -2
- package/src/lib/server/daemon/controller.ts +7 -0
- package/src/lib/server/execution-brief.test.ts +2 -25
- package/src/lib/server/execution-brief.ts +12 -35
- package/src/lib/server/execution-engine/task-attempt.ts +0 -1
- package/src/lib/server/gateways/gateway-profile-service.ts +19 -1
- package/src/lib/server/messages/message-repository.test.ts +70 -0
- package/src/lib/server/messages/message-repository.ts +11 -6
- package/src/lib/server/openclaw/deploy.ts +32 -2
- package/src/lib/server/persistence/storage-context.ts +0 -5
- package/src/lib/server/plugins-advanced.test.ts +1 -2
- package/src/lib/server/portability/export.ts +109 -0
- package/src/lib/server/portability/import.ts +159 -0
- package/src/lib/server/protocols/protocol-normalization.ts +0 -4
- package/src/lib/server/protocols/protocol-queries.ts +0 -6
- package/src/lib/server/protocols/protocol-run-lifecycle.ts +4 -32
- package/src/lib/server/protocols/protocol-service.ts +0 -1
- package/src/lib/server/protocols/protocol-step-helpers.ts +0 -4
- package/src/lib/server/protocols/protocol-step-processors.ts +0 -6
- package/src/lib/server/protocols/protocol-swarm.ts +0 -2
- package/src/lib/server/protocols/protocol-types.ts +0 -2
- package/src/lib/server/provider-health.ts +1 -10
- package/src/lib/server/runtime/daemon-state/core.ts +0 -9
- package/src/lib/server/runtime/daemon-state.test.ts +0 -35
- package/src/lib/server/runtime/heartbeat-service.ts +3 -23
- package/src/lib/server/runtime/process-manager.ts +13 -9
- package/src/lib/server/runtime/queue/core.ts +11 -33
- package/src/lib/server/runtime/runtime-storage-write-paths.test.ts +6 -6
- package/src/lib/server/runtime/scheduler.ts +0 -13
- package/src/lib/server/runtime/session-run-manager/drain.ts +0 -24
- package/src/lib/server/runtime/session-run-manager/enqueue.ts +0 -1
- package/src/lib/server/runtime/session-run-manager/queries.ts +15 -1
- package/src/lib/server/runtime/session-run-manager/recovery.ts +0 -1
- package/src/lib/server/runtime/session-run-manager.test.ts +58 -28
- package/src/lib/server/sandbox/session-runtime.test.ts +18 -1
- package/src/lib/server/sandbox/session-runtime.ts +40 -28
- package/src/lib/server/session-tools/autonomy-tools.test.ts +7 -9
- package/src/lib/server/session-tools/context.ts +1 -1
- package/src/lib/server/session-tools/credential-env.ts +109 -0
- package/src/lib/server/session-tools/crud.ts +3 -17
- package/src/lib/server/session-tools/delegate.ts +0 -4
- package/src/lib/server/session-tools/edit_file.ts +3 -2
- package/src/lib/server/session-tools/execute.test.ts +58 -0
- package/src/lib/server/session-tools/execute.ts +334 -0
- package/src/lib/server/session-tools/files-tool.ts +635 -0
- package/src/lib/server/session-tools/index.ts +14 -8
- package/src/lib/server/session-tools/memory-tool.ts +242 -0
- package/src/lib/server/session-tools/memory.ts +1 -1
- package/src/lib/server/session-tools/openclaw-nodes.ts +3 -2
- package/src/lib/server/session-tools/openclaw-workspace.ts +3 -2
- package/src/lib/server/session-tools/platform-tool.ts +617 -0
- package/src/lib/server/session-tools/session-info.ts +3 -2
- package/src/lib/server/session-tools/session-tools-wiring.test.ts +3 -4
- package/src/lib/server/session-tools/shell.ts +7 -122
- package/src/lib/server/session-tools/skills-tool.ts +396 -0
- package/src/lib/server/session-tools/team-context.ts +0 -3
- package/src/lib/server/session-tools/web.ts +2 -2
- package/src/lib/server/storage-normalization.ts +10 -0
- package/src/lib/server/storage.ts +18 -45
- package/src/lib/server/tasks/task-checkout.ts +59 -0
- package/src/lib/server/tasks/task-lifecycle.ts +2 -0
- package/src/lib/server/tasks/task-route-service.ts +4 -26
- package/src/lib/server/tasks/task-service.ts +0 -7
- package/src/lib/server/tool-aliases.ts +2 -2
- package/src/lib/server/tool-capability-policy-advanced.test.ts +13 -6
- package/src/lib/server/tool-capability-policy.test.ts +2 -1
- package/src/lib/server/tool-capability-policy.ts +60 -35
- package/src/lib/server/tool-planning.ts +11 -12
- package/src/lib/server/universal-tool-access.ts +0 -1
- package/src/lib/server/wallets/wallet-crypto.ts +33 -0
- package/src/lib/server/wallets/wallet-repository.ts +24 -0
- package/src/lib/server/wallets/wallet-service.ts +119 -0
- package/src/lib/server/working-state/extraction.ts +8 -42
- package/src/lib/server/working-state/normalization.ts +10 -103
- package/src/lib/server/working-state/service.ts +12 -21
- package/src/lib/setup-defaults.ts +5 -0
- package/src/lib/strip-internal-metadata.test.ts +1 -1
- package/src/lib/strip-internal-metadata.ts +1 -1
- package/src/lib/tool-definitions.ts +1 -1
- package/src/lib/validation/schemas.test.ts +16 -0
- package/src/lib/validation/schemas.ts +49 -2
- package/src/stores/slices/data-slice.ts +5 -1
- package/src/stores/slices/ui-slice.ts +0 -4
- package/src/stores/use-chat-store.test.ts +231 -0
- package/src/stores/use-chat-store.ts +62 -13
- package/src/types/agent.ts +264 -0
- package/src/types/app-settings.ts +173 -0
- package/src/types/approval.ts +25 -0
- package/src/types/connector.ts +188 -0
- package/src/types/extension.ts +386 -0
- package/src/types/index.ts +16 -3555
- package/src/types/message.ts +56 -0
- package/src/types/misc.ts +737 -0
- package/src/types/protocol.ts +420 -0
- package/src/types/provider.ts +52 -0
- package/src/types/run.ts +180 -0
- package/src/types/schedule.ts +59 -0
- package/src/types/session.ts +215 -0
- package/src/types/skill.ts +157 -0
- package/src/types/swarmdock.ts +29 -0
- package/src/types/task.ts +144 -0
- package/src/types/working-state.ts +204 -0
- package/src/views/settings/section-heartbeat.tsx +2 -2
- package/src/views/settings/section-runtime-loop.tsx +0 -14
- package/src/app/api/canvas/[sessionId]/route.ts +0 -35
- package/src/app/api/missions/[id]/actions/route.ts +0 -31
- package/src/app/api/missions/[id]/events/route.ts +0 -14
- package/src/app/api/missions/[id]/route.ts +0 -10
- package/src/app/api/missions/route.test.ts +0 -244
- package/src/app/api/missions/route.ts +0 -57
- package/src/app/api/wallets/[id]/approve/route.ts +0 -79
- package/src/app/api/wallets/[id]/balance-history/route.ts +0 -18
- package/src/app/api/wallets/[id]/send/route.ts +0 -113
- package/src/app/api/wallets/[id]/transactions/route.ts +0 -18
- package/src/app/missions/[id]/page.tsx +0 -3
- package/src/app/missions/page.tsx +0 -685
- package/src/components/canvas/canvas-panel.tsx +0 -267
- package/src/components/wallets/wallet-approval-dialog.tsx +0 -107
- package/src/components/wallets/wallet-panel.tsx +0 -1010
- package/src/components/wallets/wallet-section.tsx +0 -260
- package/src/features/missions/queries.ts +0 -23
- package/src/lib/canvas-content.test.ts +0 -360
- package/src/lib/canvas-content.ts +0 -198
- package/src/lib/server/canvas-content.test.ts +0 -32
- package/src/lib/server/canvas-content.ts +0 -6
- package/src/lib/server/ethereum.ts +0 -591
- package/src/lib/server/evm-swap.ts +0 -476
- package/src/lib/server/missions/mission-intent.test.ts +0 -63
- package/src/lib/server/missions/mission-intent.ts +0 -569
- package/src/lib/server/missions/mission-repository.ts +0 -74
- package/src/lib/server/missions/mission-service/actions.ts +0 -6
- package/src/lib/server/missions/mission-service/bindings.ts +0 -9
- package/src/lib/server/missions/mission-service/context.ts +0 -4
- package/src/lib/server/missions/mission-service/core.ts +0 -2271
- package/src/lib/server/missions/mission-service/queries.ts +0 -12
- package/src/lib/server/missions/mission-service/recovery.ts +0 -5
- package/src/lib/server/missions/mission-service/ticks.ts +0 -9
- package/src/lib/server/missions/mission-service.test.ts +0 -888
- package/src/lib/server/missions/mission-service.ts +0 -6
- package/src/lib/server/session-tools/canvas.ts +0 -105
- package/src/lib/server/session-tools/sandbox.ts +0 -281
- package/src/lib/server/session-tools/wallet-tool.test.ts +0 -150
- package/src/lib/server/session-tools/wallet.ts +0 -1287
- package/src/lib/server/solana.ts +0 -327
- package/src/lib/server/wallet/wallet-execution.test.ts +0 -198
- package/src/lib/server/wallet/wallet-portfolio.test.ts +0 -98
- package/src/lib/server/wallet/wallet-portfolio.ts +0 -772
- package/src/lib/server/wallet/wallet-service.test.ts +0 -81
- package/src/lib/server/wallet/wallet-service.ts +0 -225
- package/src/lib/wallet/wallet-transactions.test.ts +0 -75
- package/src/lib/wallet/wallet-transactions.ts +0 -43
- package/src/lib/wallet/wallet.test.ts +0 -333
- package/src/lib/wallet/wallet.ts +0 -183
- package/src/views/settings/section-wallets.tsx +0 -35
|
@@ -4,7 +4,7 @@ import { useMemo, useState } from 'react'
|
|
|
4
4
|
import { useAppStore } from '@/stores/use-app-store'
|
|
5
5
|
import { AgentAvatar } from '@/components/agents/agent-avatar'
|
|
6
6
|
import { relativeDate, STATUS_STYLES } from '../project-utils'
|
|
7
|
-
import type { Agent, BoardTask
|
|
7
|
+
import type { Agent, BoardTask } from '@/types'
|
|
8
8
|
|
|
9
9
|
type SortKey = 'status' | 'updated' | 'agent'
|
|
10
10
|
type StatusFilter = 'all' | 'backlog' | 'queued' | 'running' | 'completed' | 'failed'
|
|
@@ -13,11 +13,7 @@ const STATUS_PRIORITY: Record<string, number> = {
|
|
|
13
13
|
failed: 0, running: 1, queued: 2, backlog: 3, deferred: 4, completed: 5, cancelled: 6, archived: 7,
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
missions: Mission[]
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function WorkTab({ missions }: WorkTabProps) {
|
|
16
|
+
export function WorkTab() {
|
|
21
17
|
const tasks = useAppStore((s) => s.tasks) as Record<string, BoardTask>
|
|
22
18
|
const agents = useAppStore((s) => s.agents) as Record<string, Agent>
|
|
23
19
|
const activeProjectFilter = useAppStore((s) => s.activeProjectFilter)
|
|
@@ -27,37 +23,20 @@ export function WorkTab({ missions }: WorkTabProps) {
|
|
|
27
23
|
const [sortKey, setSortKey] = useState<SortKey>('status')
|
|
28
24
|
const [statusFilter, setStatusFilter] = useState<StatusFilter>('all')
|
|
29
25
|
const [agentFilter, setAgentFilter] = useState<string | null>(null)
|
|
30
|
-
const [missionFilter, setMissionFilter] = useState<string | null>(null)
|
|
31
|
-
const [missionSummaryOpen, setMissionSummaryOpen] = useState(false)
|
|
32
26
|
|
|
33
27
|
const projectTasks = useMemo(
|
|
34
28
|
() => Object.values(tasks).filter((t) => t.projectId === activeProjectFilter),
|
|
35
29
|
[tasks, activeProjectFilter],
|
|
36
30
|
)
|
|
37
31
|
|
|
38
|
-
// Build taskId -> mission lookup from Mission.taskIds
|
|
39
|
-
const taskIdToMission = useMemo(() => {
|
|
40
|
-
const lookup: Record<string, Mission> = {}
|
|
41
|
-
for (const m of missions) {
|
|
42
|
-
for (const tid of m.taskIds || []) {
|
|
43
|
-
lookup[tid] = m
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return lookup
|
|
47
|
-
}, [missions])
|
|
48
|
-
|
|
49
32
|
// Filter
|
|
50
33
|
const filteredTasks = useMemo(() => {
|
|
51
34
|
return projectTasks.filter((t) => {
|
|
52
35
|
if (statusFilter !== 'all' && t.status !== statusFilter) return false
|
|
53
36
|
if (agentFilter && t.agentId !== agentFilter) return false
|
|
54
|
-
if (missionFilter) {
|
|
55
|
-
const m = taskIdToMission[t.id]
|
|
56
|
-
if (!m || m.id !== missionFilter) return false
|
|
57
|
-
}
|
|
58
37
|
return true
|
|
59
38
|
})
|
|
60
|
-
}, [projectTasks, statusFilter, agentFilter
|
|
39
|
+
}, [projectTasks, statusFilter, agentFilter])
|
|
61
40
|
|
|
62
41
|
// Sort
|
|
63
42
|
const sortedTasks = useMemo(() => {
|
|
@@ -78,56 +57,8 @@ export function WorkTab({ missions }: WorkTabProps) {
|
|
|
78
57
|
return Array.from(ids)
|
|
79
58
|
}, [projectTasks])
|
|
80
59
|
|
|
81
|
-
// Mission status summary
|
|
82
|
-
const missionStatusSummary = useMemo(() => {
|
|
83
|
-
const counts: Record<string, number> = {}
|
|
84
|
-
for (const m of missions) {
|
|
85
|
-
counts[m.status] = (counts[m.status] || 0) + 1
|
|
86
|
-
}
|
|
87
|
-
return counts
|
|
88
|
-
}, [missions])
|
|
89
|
-
|
|
90
60
|
return (
|
|
91
61
|
<div className="max-w-3xl mx-auto px-8 py-6 space-y-4">
|
|
92
|
-
{/* Mission summary (collapsible) */}
|
|
93
|
-
{missions.length > 0 && (
|
|
94
|
-
<div className="rounded-[12px] border border-white/[0.06] bg-white/[0.02] overflow-hidden">
|
|
95
|
-
<button
|
|
96
|
-
onClick={() => setMissionSummaryOpen(!missionSummaryOpen)}
|
|
97
|
-
className="w-full flex items-center justify-between px-4 py-3 cursor-pointer bg-transparent border-none text-left"
|
|
98
|
-
style={{ fontFamily: 'inherit' }}
|
|
99
|
-
>
|
|
100
|
-
<span className="text-[12px] font-600 text-text-2">
|
|
101
|
-
Missions: {Object.entries(missionStatusSummary).map(([s, c]) => `${c} ${s}`).join(', ')}
|
|
102
|
-
</span>
|
|
103
|
-
<svg
|
|
104
|
-
width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round"
|
|
105
|
-
className={`text-text-3/40 transition-transform ${missionSummaryOpen ? 'rotate-180' : ''}`}
|
|
106
|
-
>
|
|
107
|
-
<polyline points="6 9 12 15 18 9" />
|
|
108
|
-
</svg>
|
|
109
|
-
</button>
|
|
110
|
-
{missionSummaryOpen && (
|
|
111
|
-
<div className="border-t border-white/[0.06] px-4 py-2 space-y-1">
|
|
112
|
-
{missions.map((m) => (
|
|
113
|
-
<button
|
|
114
|
-
key={m.id}
|
|
115
|
-
onClick={() => setMissionFilter(missionFilter === m.id ? null : m.id)}
|
|
116
|
-
className={`w-full flex items-center justify-between px-2 py-1.5 rounded-[8px] text-left cursor-pointer bg-transparent border-none transition-colors
|
|
117
|
-
${missionFilter === m.id ? 'bg-accent-soft' : 'hover:bg-white/[0.04]'}`}
|
|
118
|
-
style={{ fontFamily: 'inherit' }}
|
|
119
|
-
>
|
|
120
|
-
<span className="text-[12px] text-text truncate">{m.objective}</span>
|
|
121
|
-
<span className={`text-[9px] font-600 uppercase tracking-wider px-1.5 py-0.5 rounded-[4px] shrink-0 ${
|
|
122
|
-
m.status === 'active' ? 'bg-sky-500/15 text-sky-400' : 'bg-white/[0.06] text-text-3'
|
|
123
|
-
}`}>{m.status}</span>
|
|
124
|
-
</button>
|
|
125
|
-
))}
|
|
126
|
-
</div>
|
|
127
|
-
)}
|
|
128
|
-
</div>
|
|
129
|
-
)}
|
|
130
|
-
|
|
131
62
|
{/* Controls row */}
|
|
132
63
|
<div className="flex items-center justify-between gap-3">
|
|
133
64
|
<div className="flex items-center gap-2">
|
|
@@ -174,9 +105,9 @@ export function WorkTab({ missions }: WorkTabProps) {
|
|
|
174
105
|
)}
|
|
175
106
|
|
|
176
107
|
{/* Clear filters */}
|
|
177
|
-
{(statusFilter !== 'all' || agentFilter
|
|
108
|
+
{(statusFilter !== 'all' || agentFilter) && (
|
|
178
109
|
<button
|
|
179
|
-
onClick={() => { setStatusFilter('all'); setAgentFilter(null)
|
|
110
|
+
onClick={() => { setStatusFilter('all'); setAgentFilter(null) }}
|
|
180
111
|
className="text-[10px] text-accent-bright/70 hover:text-accent-bright cursor-pointer bg-transparent border-none"
|
|
181
112
|
style={{ fontFamily: 'inherit' }}
|
|
182
113
|
>
|
|
@@ -212,7 +143,6 @@ export function WorkTab({ missions }: WorkTabProps) {
|
|
|
212
143
|
<div className="flex flex-col gap-1.5">
|
|
213
144
|
{sortedTasks.map((task) => {
|
|
214
145
|
const agent = task.agentId ? agents[task.agentId] : null
|
|
215
|
-
const mission = taskIdToMission[task.id]
|
|
216
146
|
return (
|
|
217
147
|
<button
|
|
218
148
|
key={task.id}
|
|
@@ -225,8 +155,8 @@ export function WorkTab({ missions }: WorkTabProps) {
|
|
|
225
155
|
</span>
|
|
226
156
|
<div className="flex-1 min-w-0">
|
|
227
157
|
<span className="text-[13px] text-text truncate block">{task.title}</span>
|
|
228
|
-
{
|
|
229
|
-
<span className="text-[10px] text-text-3/40 truncate block mt-0.5">{
|
|
158
|
+
{task.objective && (
|
|
159
|
+
<span className="text-[10px] text-text-3/40 truncate block mt-0.5">{task.objective}</span>
|
|
230
160
|
)}
|
|
231
161
|
</div>
|
|
232
162
|
{agent && (
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
import { useEffect, useMemo, useState } from 'react'
|
|
4
4
|
import { useAgentsQuery } from '@/features/agents/queries'
|
|
5
5
|
import { useChatroomsQuery } from '@/features/chatrooms/queries'
|
|
6
|
-
import { useMissionsQuery } from '@/features/missions/queries'
|
|
7
6
|
import { useCreateProtocolRunMutation, useProtocolTemplatesQuery } from '@/features/protocols/queries'
|
|
8
7
|
import { useTasksQuery } from '@/features/tasks/queries'
|
|
9
8
|
import { BottomSheet } from '@/components/shared/bottom-sheet'
|
|
10
9
|
import { SheetFooter } from '@/components/shared/sheet-footer'
|
|
11
|
-
import type { BoardTask, Chatroom,
|
|
10
|
+
import type { BoardTask, Chatroom, ProtocolRun, ProtocolTemplate } from '@/types'
|
|
12
11
|
|
|
13
12
|
export type StructuredSessionLaunchContext = {
|
|
14
13
|
templateId?: string | null
|
|
@@ -21,8 +20,6 @@ export type StructuredSessionLaunchContext = {
|
|
|
21
20
|
sessionLabel?: string | null
|
|
22
21
|
parentChatroomId?: string | null
|
|
23
22
|
parentChatroomLabel?: string | null
|
|
24
|
-
missionId?: string | null
|
|
25
|
-
missionLabel?: string | null
|
|
26
23
|
taskId?: string | null
|
|
27
24
|
taskLabel?: string | null
|
|
28
25
|
autoStart?: boolean
|
|
@@ -52,7 +49,6 @@ type FormState = {
|
|
|
52
49
|
facilitatorAgentId: string
|
|
53
50
|
sessionId: string
|
|
54
51
|
parentChatroomId: string
|
|
55
|
-
missionId: string
|
|
56
52
|
taskId: string
|
|
57
53
|
autoStart: boolean
|
|
58
54
|
createTranscript: boolean
|
|
@@ -62,7 +58,6 @@ const DEFAULT_TEMPLATE_ID = 'facilitated_discussion'
|
|
|
62
58
|
|
|
63
59
|
function buildDefaultTitle(context: StructuredSessionLaunchContext | null | undefined): string {
|
|
64
60
|
if (context?.title?.trim()) return context.title.trim()
|
|
65
|
-
if (context?.missionLabel?.trim()) return `Structured session: ${context.missionLabel.trim()}`
|
|
66
61
|
if (context?.taskLabel?.trim()) return `Structured session: ${context.taskLabel.trim()}`
|
|
67
62
|
if (context?.parentChatroomLabel?.trim()) return `Structured session: ${context.parentChatroomLabel.trim()}`
|
|
68
63
|
if (context?.sessionLabel?.trim()) return `Structured session: ${context.sessionLabel.trim()}`
|
|
@@ -81,7 +76,6 @@ function buildInitialState(context: StructuredSessionLaunchContext | null | unde
|
|
|
81
76
|
facilitatorAgentId: context?.facilitatorAgentId?.trim() || '',
|
|
82
77
|
sessionId: context?.sessionId?.trim() || '',
|
|
83
78
|
parentChatroomId: context?.parentChatroomId?.trim() || '',
|
|
84
|
-
missionId: context?.missionId?.trim() || '',
|
|
85
79
|
taskId: context?.taskId?.trim() || '',
|
|
86
80
|
autoStart: context?.autoStart !== false,
|
|
87
81
|
createTranscript: context?.createTranscript !== false,
|
|
@@ -108,19 +102,16 @@ export function StructuredSessionLauncher({
|
|
|
108
102
|
const templatesQuery = useProtocolTemplatesQuery({ enabled: open })
|
|
109
103
|
const agentsQuery = useAgentsQuery({ enabled: open })
|
|
110
104
|
const chatroomsQuery = useChatroomsQuery({ enabled: open && allowContextSelection })
|
|
111
|
-
const missionsQuery = useMissionsQuery({ enabled: open && allowContextSelection, limit: 80 })
|
|
112
105
|
const tasksQuery = useTasksQuery({ includeArchived: true, enabled: open && allowContextSelection })
|
|
113
106
|
const createRunMutation = useCreateProtocolRunMutation()
|
|
114
107
|
const templates = templatesQuery.data ?? []
|
|
115
108
|
const agents = agentsQuery.data ?? {}
|
|
116
109
|
const chatrooms = chatroomsQuery.data ?? {}
|
|
117
|
-
const missions = missionsQuery.data ?? []
|
|
118
110
|
const tasks = tasksQuery.data ?? {}
|
|
119
111
|
const loading = (
|
|
120
112
|
templatesQuery.isLoading
|
|
121
113
|
|| agentsQuery.isLoading
|
|
122
114
|
|| chatroomsQuery.isLoading
|
|
123
|
-
|| missionsQuery.isLoading
|
|
124
115
|
|| tasksQuery.isLoading
|
|
125
116
|
)
|
|
126
117
|
const breakoutMode = variant === 'breakout'
|
|
@@ -145,7 +136,6 @@ export function StructuredSessionLauncher({
|
|
|
145
136
|
() => [
|
|
146
137
|
contextChip('Chat', initialContext?.sessionLabel),
|
|
147
138
|
contextChip('Chatroom', initialContext?.parentChatroomLabel),
|
|
148
|
-
contextChip('Mission', initialContext?.missionLabel),
|
|
149
139
|
contextChip('Task', initialContext?.taskLabel),
|
|
150
140
|
].filter(Boolean) as Array<{ label: string; value: string }>,
|
|
151
141
|
[initialContext],
|
|
@@ -180,7 +170,6 @@ export function StructuredSessionLauncher({
|
|
|
180
170
|
facilitatorAgentId: form.facilitatorAgentId || null,
|
|
181
171
|
sessionId: form.sessionId || null,
|
|
182
172
|
parentChatroomId: form.parentChatroomId || null,
|
|
183
|
-
missionId: form.missionId || null,
|
|
184
173
|
taskId: form.taskId || null,
|
|
185
174
|
autoStart: form.autoStart,
|
|
186
175
|
createTranscript: form.createTranscript,
|
|
@@ -413,16 +402,6 @@ export function StructuredSessionLauncher({
|
|
|
413
402
|
<option key={chatroom.id} value={chatroom.id}>{chatroom.name}</option>
|
|
414
403
|
))}
|
|
415
404
|
</select>
|
|
416
|
-
<select
|
|
417
|
-
value={form.missionId}
|
|
418
|
-
onChange={(event) => setForm((current) => ({ ...current, missionId: event.target.value }))}
|
|
419
|
-
className="rounded-[12px] border border-white/[0.06] bg-black/20 px-3 py-2.5 text-[14px] text-text outline-none"
|
|
420
|
-
>
|
|
421
|
-
<option value="">No linked mission</option>
|
|
422
|
-
{missions.map((mission) => (
|
|
423
|
-
<option key={mission.id} value={mission.id}>{mission.objective}</option>
|
|
424
|
-
))}
|
|
425
|
-
</select>
|
|
426
405
|
<select
|
|
427
406
|
value={form.taskId}
|
|
428
407
|
onChange={(event) => setForm((current) => ({ ...current, taskId: event.target.value }))}
|
|
@@ -26,6 +26,7 @@ export const CONNECTOR_PLATFORM_META: Record<ConnectorPlatform, { label: string;
|
|
|
26
26
|
email: { label: 'Email', color: '#EA4335' },
|
|
27
27
|
webchat: { label: 'Web Chat', color: '#0EA5E9' },
|
|
28
28
|
mockmail: { label: 'MockMail', color: '#7C3AED' },
|
|
29
|
+
swarmdock: { label: 'SwarmDock', color: '#F59E0B' },
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
const FALLBACK_CONNECTOR_PLATFORM_META = { label: 'Connector', color: '#64748B' } as const
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import { useState, useCallback, useEffect } from 'react'
|
|
4
|
-
import { useRouter } from 'next/navigation'
|
|
5
4
|
import { useAppStore } from '@/stores/use-app-store'
|
|
6
|
-
import {
|
|
5
|
+
import { useNavigate } from '@/lib/app/navigation'
|
|
7
6
|
import { useUpdateTaskMutation } from '@/features/tasks/queries'
|
|
8
7
|
import { ConfirmDialog } from '@/components/shared/confirm-dialog'
|
|
9
8
|
import { AgentAvatar } from '@/components/agents/agent-avatar'
|
|
@@ -36,7 +35,6 @@ export function TaskCard({
|
|
|
36
35
|
const setTaskSheetOpen = useAppStore((s) => s.setTaskSheetOpen)
|
|
37
36
|
const setCurrentAgent = useAppStore((s) => s.setCurrentAgent)
|
|
38
37
|
const navigateTo = useNavigate()
|
|
39
|
-
const router = useRouter()
|
|
40
38
|
const updateTaskMutation = useUpdateTaskMutation()
|
|
41
39
|
const [dragging, setDragging] = useState(false)
|
|
42
40
|
const [confirmArchive, setConfirmArchive] = useState(false)
|
|
@@ -175,38 +173,10 @@ export function TaskCard({
|
|
|
175
173
|
<p className="text-[12px] text-text-3 line-clamp-2 mb-3">{task.description}</p>
|
|
176
174
|
)}
|
|
177
175
|
|
|
178
|
-
{task.
|
|
176
|
+
{task.objective && (
|
|
179
177
|
<div className="mb-3 rounded-[12px] border border-white/[0.06] bg-white/[0.02] px-3 py-2">
|
|
180
|
-
<
|
|
181
|
-
|
|
182
|
-
<div className="flex items-center gap-2">
|
|
183
|
-
<span className={`rounded-full px-2 py-0.5 text-[10px] font-700 uppercase tracking-[0.08em] ${
|
|
184
|
-
task.missionSummary.status === 'waiting' || task.missionSummary.status === 'failed' || task.missionSummary.status === 'cancelled'
|
|
185
|
-
? 'bg-amber-500/12 text-amber-300'
|
|
186
|
-
: task.missionSummary.status === 'completed'
|
|
187
|
-
? 'bg-emerald-500/12 text-emerald-300'
|
|
188
|
-
: 'bg-sky-500/12 text-sky-300'
|
|
189
|
-
}`}>
|
|
190
|
-
{task.missionSummary.status}
|
|
191
|
-
</span>
|
|
192
|
-
<button
|
|
193
|
-
type="button"
|
|
194
|
-
onClick={(event) => {
|
|
195
|
-
event.stopPropagation()
|
|
196
|
-
router.push(getMissionPath(task.missionSummary?.id || null))
|
|
197
|
-
}}
|
|
198
|
-
className="rounded-[8px] border border-white/[0.08] px-2 py-1 text-[10px] font-700 uppercase tracking-[0.08em] text-text-2 transition-colors hover:bg-white/[0.05]"
|
|
199
|
-
>
|
|
200
|
-
Open
|
|
201
|
-
</button>
|
|
202
|
-
</div>
|
|
203
|
-
</div>
|
|
204
|
-
<div className="text-[12px] font-600 text-text line-clamp-2">{task.missionSummary.objective}</div>
|
|
205
|
-
{(task.missionSummary.waitingReason || task.missionSummary.currentStep) && (
|
|
206
|
-
<div className="mt-1 text-[11px] text-text-3/70 line-clamp-2">
|
|
207
|
-
{task.missionSummary.waitingReason || task.missionSummary.currentStep}
|
|
208
|
-
</div>
|
|
209
|
-
)}
|
|
178
|
+
<span className="text-[10px] font-700 uppercase tracking-[0.08em] text-text-3/68">Objective</span>
|
|
179
|
+
<div className="text-[12px] font-600 text-text line-clamp-2 mt-1">{task.objective}</div>
|
|
210
180
|
</div>
|
|
211
181
|
)}
|
|
212
182
|
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
import { useProjectsQuery } from '@/features/projects/queries'
|
|
16
16
|
import { useAppSettingsQuery } from '@/features/settings/queries'
|
|
17
17
|
import { useProtocolRunsQuery } from '@/features/protocols/queries'
|
|
18
|
-
import { getMissionPath } from '@/lib/app/navigation'
|
|
19
18
|
import { BottomSheet } from '@/components/shared/bottom-sheet'
|
|
20
19
|
import { AgentPickerList } from '@/components/shared/agent-picker-list'
|
|
21
20
|
import { DirBrowser } from '@/components/shared/dir-browser'
|
|
@@ -342,28 +341,11 @@ export function TaskSheet() {
|
|
|
342
341
|
</div>
|
|
343
342
|
)}
|
|
344
343
|
|
|
345
|
-
{editing.
|
|
344
|
+
{editing.objective && (
|
|
346
345
|
<div className="mb-8">
|
|
347
|
-
<SectionLabel>
|
|
346
|
+
<SectionLabel>Objective</SectionLabel>
|
|
348
347
|
<div className="rounded-[14px] border border-white/[0.06] bg-surface px-4 py-3">
|
|
349
|
-
<div className="
|
|
350
|
-
<div className="text-[14px] font-600 text-text">{editing.missionSummary.objective}</div>
|
|
351
|
-
<div className="flex items-center gap-2">
|
|
352
|
-
<span className="rounded-full bg-sky-500/10 px-2.5 py-1 text-[10px] font-700 uppercase tracking-[0.08em] text-sky-300">
|
|
353
|
-
{editing.missionSummary.status}
|
|
354
|
-
</span>
|
|
355
|
-
<button
|
|
356
|
-
type="button"
|
|
357
|
-
onClick={() => router.push(getMissionPath(editing.missionSummary?.id || null))}
|
|
358
|
-
className="rounded-[8px] border border-white/[0.08] px-2 py-1 text-[10px] font-700 uppercase tracking-[0.08em] text-text-2 transition-colors hover:bg-white/[0.05]"
|
|
359
|
-
>
|
|
360
|
-
Open
|
|
361
|
-
</button>
|
|
362
|
-
</div>
|
|
363
|
-
</div>
|
|
364
|
-
<div className="text-[12px] leading-[1.7] text-text-3/72">
|
|
365
|
-
{editing.missionSummary.waitingReason || editing.missionSummary.currentStep || 'Mission linked to this task.'}
|
|
366
|
-
</div>
|
|
348
|
+
<div className="text-[14px] font-600 text-text">{editing.objective}</div>
|
|
367
349
|
</div>
|
|
368
350
|
</div>
|
|
369
351
|
)}
|
|
@@ -691,23 +673,11 @@ export function TaskSheet() {
|
|
|
691
673
|
/>
|
|
692
674
|
</div>
|
|
693
675
|
|
|
694
|
-
{editing?.
|
|
676
|
+
{editing?.objective && (
|
|
695
677
|
<div className="mb-8">
|
|
696
|
-
<SectionLabel>
|
|
678
|
+
<SectionLabel>Objective</SectionLabel>
|
|
697
679
|
<div className="rounded-[14px] border border-white/[0.06] bg-surface px-4 py-3 text-[12px] leading-[1.7] text-text-3/75">
|
|
698
|
-
<div className="
|
|
699
|
-
<div className="font-600 text-text">{editing.missionSummary.objective}</div>
|
|
700
|
-
<button
|
|
701
|
-
type="button"
|
|
702
|
-
onClick={() => router.push(getMissionPath(editing.missionSummary?.id || null))}
|
|
703
|
-
className="rounded-[8px] border border-white/[0.08] px-2 py-1 text-[10px] font-700 uppercase tracking-[0.08em] text-text-2 transition-colors hover:bg-white/[0.05]"
|
|
704
|
-
>
|
|
705
|
-
Open
|
|
706
|
-
</button>
|
|
707
|
-
</div>
|
|
708
|
-
<div className="mt-1">
|
|
709
|
-
{editing.missionSummary.waitingReason || editing.missionSummary.currentStep || `Status: ${editing.missionSummary.status}`}
|
|
710
|
-
</div>
|
|
680
|
+
<div className="font-600 text-text">{editing.objective}</div>
|
|
711
681
|
</div>
|
|
712
682
|
</div>
|
|
713
683
|
)}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from 'react'
|
|
4
|
+
import { useAppStore } from '@/stores/use-app-store'
|
|
5
|
+
import { AgentAvatar } from '@/components/agents/agent-avatar'
|
|
6
|
+
import { api } from '@/lib/app/api-client'
|
|
7
|
+
|
|
8
|
+
export function WalletList() {
|
|
9
|
+
const wallets = useAppStore((s) => s.wallets)
|
|
10
|
+
const loadWallets = useAppStore((s) => s.loadWallets)
|
|
11
|
+
const agents = useAppStore((s) => s.agents)
|
|
12
|
+
const [copiedId, setCopiedId] = useState<string | null>(null)
|
|
13
|
+
const [deletingId, setDeletingId] = useState<string | null>(null)
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
loadWallets()
|
|
17
|
+
}, [loadWallets])
|
|
18
|
+
|
|
19
|
+
const handleCopy = async (e: React.MouseEvent, address: string, walletId: string) => {
|
|
20
|
+
e.stopPropagation()
|
|
21
|
+
await navigator.clipboard.writeText(address)
|
|
22
|
+
setCopiedId(walletId)
|
|
23
|
+
setTimeout(() => setCopiedId(null), 2000)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const handleDelete = async (e: React.MouseEvent, id: string) => {
|
|
27
|
+
e.stopPropagation()
|
|
28
|
+
if (deletingId === id) {
|
|
29
|
+
await api('DELETE', `/wallets/${id}`)
|
|
30
|
+
setDeletingId(null)
|
|
31
|
+
loadWallets()
|
|
32
|
+
} else {
|
|
33
|
+
setDeletingId(id)
|
|
34
|
+
setTimeout(() => setDeletingId(null), 3000)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const truncateAddress = (addr: string) =>
|
|
39
|
+
addr.length > 12 ? `${addr.slice(0, 6)}...${addr.slice(-4)}` : addr
|
|
40
|
+
|
|
41
|
+
const walletList = Object.values(wallets)
|
|
42
|
+
|
|
43
|
+
if (!walletList.length) {
|
|
44
|
+
return (
|
|
45
|
+
<div className="flex-1 flex flex-col items-center justify-center px-6 py-12 text-center">
|
|
46
|
+
<div className="w-12 h-12 rounded-[14px] bg-white/[0.03] border border-white/[0.06] flex items-center justify-center mb-4">
|
|
47
|
+
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" className="text-text-3">
|
|
48
|
+
<rect x="2" y="6" width="20" height="14" rx="2" /><path d="M22 10H18a2 2 0 0 0 0 4h4" /><path d="M6 6V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v2" />
|
|
49
|
+
</svg>
|
|
50
|
+
</div>
|
|
51
|
+
<p className="text-[13px] text-text-3 mb-1 font-600">No wallets yet</p>
|
|
52
|
+
<p className="text-[12px] text-text-3/60">Generate a wallet for your agents to transact on Base L2</p>
|
|
53
|
+
</div>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div className="flex-1 overflow-y-auto px-5 pb-6">
|
|
59
|
+
<div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3">
|
|
60
|
+
{walletList.map((wallet, idx) => {
|
|
61
|
+
const agent = agents[wallet.agentId]
|
|
62
|
+
return (
|
|
63
|
+
<div
|
|
64
|
+
key={wallet.id}
|
|
65
|
+
className="w-full text-left p-4 rounded-[14px] bg-surface border border-white/[0.06]
|
|
66
|
+
hover:border-white/[0.12] hover:bg-white/[0.02] transition-all group"
|
|
67
|
+
style={{
|
|
68
|
+
fontFamily: 'inherit',
|
|
69
|
+
animation: 'spring-in 0.5s var(--ease-spring) both',
|
|
70
|
+
animationDelay: `${idx * 0.05}s`,
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
{/* Header: agent + delete */}
|
|
74
|
+
<div className="flex items-center gap-2.5 mb-2">
|
|
75
|
+
{agent ? (
|
|
76
|
+
<AgentAvatar seed={agent.avatarSeed} avatarUrl={agent.avatarUrl} name={agent.name} size={20} />
|
|
77
|
+
) : (
|
|
78
|
+
<div className="w-5 h-5 rounded-full bg-white/[0.06]" />
|
|
79
|
+
)}
|
|
80
|
+
<span className="text-[13px] font-600 text-text truncate flex-1">
|
|
81
|
+
{agent?.name || 'Unknown Agent'}
|
|
82
|
+
</span>
|
|
83
|
+
<button
|
|
84
|
+
onClick={(e) => handleDelete(e, wallet.id)}
|
|
85
|
+
className={`text-[10px] font-600 px-1.5 py-0.5 rounded-[6px] transition-colors cursor-pointer ${
|
|
86
|
+
deletingId === wallet.id
|
|
87
|
+
? 'text-red-400 bg-red-400/10'
|
|
88
|
+
: 'text-text-3/40 hover:text-red-400'
|
|
89
|
+
}`}
|
|
90
|
+
title={deletingId === wallet.id ? 'Click again to confirm' : 'Delete wallet'}
|
|
91
|
+
>
|
|
92
|
+
{deletingId === wallet.id ? 'Confirm?' : (
|
|
93
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round">
|
|
94
|
+
<path d="M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
|
|
95
|
+
</svg>
|
|
96
|
+
)}
|
|
97
|
+
</button>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
{/* Address row */}
|
|
101
|
+
<div className="flex items-center gap-2 mb-2">
|
|
102
|
+
<span className="text-[12px] font-mono text-text-3 truncate">{truncateAddress(wallet.walletAddress)}</span>
|
|
103
|
+
<button
|
|
104
|
+
onClick={(e) => handleCopy(e, wallet.walletAddress, wallet.id)}
|
|
105
|
+
className="text-text-3/40 hover:text-text-2 transition-colors shrink-0 cursor-pointer"
|
|
106
|
+
title="Copy address"
|
|
107
|
+
>
|
|
108
|
+
{copiedId === wallet.id ? (
|
|
109
|
+
<span className="text-[10px] font-600 text-emerald-400">Copied!</span>
|
|
110
|
+
) : (
|
|
111
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round">
|
|
112
|
+
<rect x="9" y="9" width="13" height="13" rx="2" /><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
|
|
113
|
+
</svg>
|
|
114
|
+
)}
|
|
115
|
+
</button>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
{/* Badges row */}
|
|
119
|
+
<div className="flex items-center gap-2 flex-wrap">
|
|
120
|
+
<span className="text-[10px] font-600 px-1.5 py-0.5 rounded-[6px] bg-blue-500/10 text-blue-400">
|
|
121
|
+
Base L2
|
|
122
|
+
</span>
|
|
123
|
+
{wallet.requireApproval && (
|
|
124
|
+
<span className="text-[10px] font-600 px-1.5 py-0.5 rounded-[6px] bg-amber-500/10 text-amber-400">
|
|
125
|
+
Approval Required
|
|
126
|
+
</span>
|
|
127
|
+
)}
|
|
128
|
+
{wallet.spendingLimitUsdc && (
|
|
129
|
+
<span className="text-[10px] font-600 text-text-3/60">
|
|
130
|
+
Limit: ${wallet.spendingLimitUsdc} USDC
|
|
131
|
+
</span>
|
|
132
|
+
)}
|
|
133
|
+
{wallet.dailyLimitUsdc && (
|
|
134
|
+
<span className="text-[10px] font-600 text-text-3/60">
|
|
135
|
+
Daily: ${wallet.dailyLimitUsdc} USDC
|
|
136
|
+
</span>
|
|
137
|
+
)}
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
{/* Label */}
|
|
141
|
+
{wallet.label && (
|
|
142
|
+
<div className="mt-2 text-[11px] text-text-3/60 truncate">{wallet.label}</div>
|
|
143
|
+
)}
|
|
144
|
+
</div>
|
|
145
|
+
)
|
|
146
|
+
})}
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
)
|
|
150
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import assert from 'node:assert/strict'
|
|
2
|
+
import test from 'node:test'
|
|
3
|
+
import {
|
|
4
|
+
DEFAULT_AGENT_EXECUTE_CONFIG,
|
|
5
|
+
normalizeAgentExecuteConfig,
|
|
6
|
+
} from '@/lib/agent-execute-defaults'
|
|
7
|
+
|
|
8
|
+
test('normalizeAgentExecuteConfig defaults to sandbox with network enabled', () => {
|
|
9
|
+
const normalized = normalizeAgentExecuteConfig(undefined)
|
|
10
|
+
|
|
11
|
+
assert.equal(normalized.backend, 'sandbox')
|
|
12
|
+
assert.equal(normalized.network?.enabled, true)
|
|
13
|
+
assert.equal(normalized.timeout, DEFAULT_AGENT_EXECUTE_CONFIG.timeout)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
test('normalizeAgentExecuteConfig preserves explicit host backend and clamps timeout', () => {
|
|
17
|
+
const normalized = normalizeAgentExecuteConfig({
|
|
18
|
+
backend: 'host',
|
|
19
|
+
timeout: 999,
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
assert.equal(normalized.backend, 'host')
|
|
23
|
+
assert.equal(normalized.timeout, 300)
|
|
24
|
+
})
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Agent } from '@/types'
|
|
2
|
+
|
|
3
|
+
export type AgentExecuteConfig = NonNullable<Agent['executeConfig']>
|
|
4
|
+
|
|
5
|
+
export const DEFAULT_AGENT_EXECUTE_CONFIG: AgentExecuteConfig = {
|
|
6
|
+
backend: 'sandbox',
|
|
7
|
+
network: {
|
|
8
|
+
enabled: true,
|
|
9
|
+
},
|
|
10
|
+
timeout: 30,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function asRecord(value: unknown): Record<string, unknown> | null {
|
|
14
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) return null
|
|
15
|
+
return value as Record<string, unknown>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function normalizeStringList(value: unknown): string[] | undefined {
|
|
19
|
+
if (!Array.isArray(value)) return undefined
|
|
20
|
+
const values = value
|
|
21
|
+
.filter((entry): entry is string => typeof entry === 'string' && entry.trim().length > 0)
|
|
22
|
+
.map((entry) => entry.trim())
|
|
23
|
+
return values.length > 0 ? values : undefined
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function normalizePositiveInt(value: unknown, fallback: number, min: number, max: number): number {
|
|
27
|
+
const parsed = typeof value === 'number'
|
|
28
|
+
? value
|
|
29
|
+
: typeof value === 'string'
|
|
30
|
+
? Number.parseInt(value, 10)
|
|
31
|
+
: Number.NaN
|
|
32
|
+
if (!Number.isFinite(parsed)) return fallback
|
|
33
|
+
return Math.max(min, Math.min(max, Math.trunc(parsed)))
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function normalizeAgentExecuteConfig(config: Agent['executeConfig'] | unknown): AgentExecuteConfig {
|
|
37
|
+
const input = asRecord(config)
|
|
38
|
+
const networkInput = asRecord(input?.network)
|
|
39
|
+
const runtimesInput = asRecord(input?.runtimes)
|
|
40
|
+
const defaultNetworkEnabled = DEFAULT_AGENT_EXECUTE_CONFIG.network?.enabled ?? true
|
|
41
|
+
const allowedUrls = normalizeStringList(networkInput?.allowedUrls)
|
|
42
|
+
const credentials = normalizeStringList(input?.credentials)
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
backend: input?.backend === 'host' ? 'host' : DEFAULT_AGENT_EXECUTE_CONFIG.backend,
|
|
46
|
+
network: {
|
|
47
|
+
enabled: networkInput?.enabled === false ? false : defaultNetworkEnabled,
|
|
48
|
+
...(allowedUrls ? { allowedUrls } : {}),
|
|
49
|
+
},
|
|
50
|
+
...(runtimesInput
|
|
51
|
+
? {
|
|
52
|
+
runtimes: {
|
|
53
|
+
...(typeof runtimesInput.python === 'boolean' ? { python: runtimesInput.python } : {}),
|
|
54
|
+
...(typeof runtimesInput.javascript === 'boolean' ? { javascript: runtimesInput.javascript } : {}),
|
|
55
|
+
...(typeof runtimesInput.sqlite === 'boolean' ? { sqlite: runtimesInput.sqlite } : {}),
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
: {}),
|
|
59
|
+
timeout: normalizePositiveInt(input?.timeout, DEFAULT_AGENT_EXECUTE_CONFIG.timeout ?? 30, 1, 300),
|
|
60
|
+
...(credentials ? { credentials } : {}),
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -39,19 +39,6 @@ describe('getViewPath', () => {
|
|
|
39
39
|
})
|
|
40
40
|
})
|
|
41
41
|
|
|
42
|
-
describe('getMissionPath', () => {
|
|
43
|
-
it('returns /missions when no ID is provided', () => {
|
|
44
|
-
assert.equal(mod.getMissionPath(), '/missions')
|
|
45
|
-
assert.equal(mod.getMissionPath(null), '/missions')
|
|
46
|
-
assert.equal(mod.getMissionPath(''), '/missions')
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
it('returns /missions/{encoded} with an ID', () => {
|
|
50
|
-
assert.equal(mod.getMissionPath('m-42'), '/missions/m-42')
|
|
51
|
-
assert.equal(mod.getMissionPath('has/slash'), '/missions/has%2Fslash')
|
|
52
|
-
})
|
|
53
|
-
})
|
|
54
|
-
|
|
55
42
|
describe('pathToView', () => {
|
|
56
43
|
it('matches exact path', () => {
|
|
57
44
|
assert.equal(mod.pathToView('/agents'), 'agents')
|