@swarmclawai/swarmclaw 1.2.8 → 1.3.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 +39 -6
- package/package.json +2 -2
- package/src/app/agents/[id]/page.tsx +1 -18
- package/src/app/api/activity/route.ts +9 -23
- package/src/app/api/agents/route.ts +17 -1
- 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/approvals/route.ts +13 -5
- package/src/app/api/connectors/route.ts +2 -2
- package/src/app/api/credentials/[id]/route.ts +2 -0
- package/src/app/api/credentials/route.ts +4 -1
- package/src/app/api/goals/[id]/route.ts +28 -0
- package/src/app/api/goals/route.ts +33 -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/protocols/templates/[id]/route.ts +2 -1
- package/src/app/api/protocols/templates/route.ts +2 -1
- package/src/app/api/settings/route.ts +13 -2
- 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/home/page.tsx +3 -0
- 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 +32 -33
- package/src/cli/spec.js +26 -27
- package/src/components/agents/agent-sheet.tsx +2 -40
- package/src/components/agents/inspector-panel.tsx +0 -83
- package/src/components/chat/chat-card.tsx +0 -31
- package/src/components/chat/message-bubble.tsx +1 -108
- package/src/components/connectors/connector-sheet.tsx +25 -1
- 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/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/server/activity/activity-log.ts +16 -1
- package/src/lib/server/agents/agent-service.ts +24 -11
- 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 +14 -85
- package/src/lib/server/approvals/approval-hooks.ts +81 -0
- package/src/lib/server/approvals.test.ts +6 -6
- package/src/lib/server/approvals.ts +11 -6
- package/src/lib/server/autonomy/supervisor-reflection.test.ts +0 -1
- package/src/lib/server/builtin-extensions.ts +0 -2
- package/src/lib/server/capability-router.test.ts +0 -2
- package/src/lib/server/chat-execution/chat-execution-tool-events.test.ts +14 -14
- package/src/lib/server/chat-execution/chat-execution-types.ts +0 -2
- package/src/lib/server/chat-execution/chat-execution-utils.ts +0 -2
- 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 +2 -22
- package/src/lib/server/chat-execution/iteration-event-handler.ts +0 -24
- package/src/lib/server/chat-execution/message-classifier.test.ts +0 -45
- package/src/lib/server/chat-execution/message-classifier.ts +1 -16
- package/src/lib/server/chat-execution/prompt-builder.test.ts +0 -1
- package/src/lib/server/chat-execution/prompt-builder.ts +0 -30
- 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 +8 -123
- package/src/lib/server/chat-execution/stream-agent-chat.ts +1 -5
- 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/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/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 +127 -0
- package/src/lib/server/connectors/swarmdock.ts +285 -0
- package/src/lib/server/execution-brief.test.ts +2 -25
- package/src/lib/server/execution-brief.ts +30 -35
- package/src/lib/server/execution-engine/task-attempt.ts +0 -1
- package/src/lib/server/goals/goal-repository.ts +19 -0
- package/src/lib/server/goals/goal-service.ts +143 -0
- package/src/lib/server/persistence/storage-context.ts +0 -5
- 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 +0 -9
- 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/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 +0 -1
- package/src/lib/server/runtime/session-run-manager/recovery.ts +0 -1
- package/src/lib/server/runtime/session-run-manager.test.ts +0 -28
- package/src/lib/server/session-tools/crud.ts +0 -14
- package/src/lib/server/session-tools/delegate.ts +0 -4
- package/src/lib/server/session-tools/index.ts +0 -4
- package/src/lib/server/session-tools/team-context.ts +0 -3
- package/src/lib/server/storage-normalization.ts +13 -0
- package/src/lib/server/storage.ts +75 -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 +0 -1
- package/src/lib/server/tool-capability-policy-advanced.test.ts +4 -4
- package/src/lib/server/tool-capability-policy.ts +0 -2
- package/src/lib/server/tool-planning.ts +0 -12
- package/src/lib/server/universal-tool-access.ts +0 -1
- package/src/lib/server/usage/cost-rollup.ts +124 -0
- package/src/lib/server/usage/usage-repository.ts +6 -0
- 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/strip-internal-metadata.test.ts +1 -1
- package/src/lib/strip-internal-metadata.ts +1 -1
- package/src/lib/tool-definitions.ts +0 -1
- package/src/lib/validation/schemas.ts +36 -32
- package/src/lib/validation/server-schemas.ts +35 -0
- package/src/stores/slices/data-slice.ts +5 -1
- package/src/stores/slices/ui-slice.ts +0 -4
- package/src/types/agent.ts +10 -84
- package/src/types/app-settings.ts +6 -2
- package/src/types/approval.ts +3 -2
- package/src/types/connector.ts +1 -0
- package/src/types/goal.ts +30 -0
- package/src/types/index.ts +2 -1
- package/src/types/message.ts +0 -1
- package/src/types/misc.ts +2 -4
- package/src/types/protocol.ts +0 -2
- package/src/types/run.ts +0 -3
- package/src/types/session.ts +1 -51
- package/src/types/swarmdock.ts +29 -0
- package/src/types/task.ts +9 -3
- package/src/types/working-state.ts +2 -9
- 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/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/types/mission.ts +0 -185
- package/src/views/settings/section-wallets.tsx +0 -35
|
@@ -15,7 +15,6 @@ import { AgentAvatar } from '@/components/agents/agent-avatar'
|
|
|
15
15
|
import { timeAgoShort } from '@/lib/time-format'
|
|
16
16
|
import { toast } from 'sonner'
|
|
17
17
|
import { getEnabledCapabilityIds } from '@/lib/capability-selection'
|
|
18
|
-
import { getMissionPath } from '@/lib/app/navigation'
|
|
19
18
|
|
|
20
19
|
function shortPath(p: string): string {
|
|
21
20
|
return (p || '').replace(/^\/Users\/\w+/, '~')
|
|
@@ -80,7 +79,6 @@ export function ChatCard({ session, active, onClick }: Props) {
|
|
|
80
79
|
: session.name
|
|
81
80
|
const connector = getSessionConnector(session, connectors)
|
|
82
81
|
const queuedCount = Math.max(session.queuedCount ?? 0, optimisticQueuedCount)
|
|
83
|
-
const mission = session.missionSummary || null
|
|
84
82
|
const loopIsOngoing = appSettings.loopMode === 'ongoing'
|
|
85
83
|
const explicitOptIn = session.heartbeatEnabled === true || agent?.heartbeatEnabled === true
|
|
86
84
|
const intervalRaw = session.heartbeatIntervalSec ?? agent?.heartbeatIntervalSec ?? appSettings.heartbeatIntervalSec ?? DEFAULT_HEARTBEAT_INTERVAL_SEC
|
|
@@ -199,35 +197,6 @@ export function ChatCard({ session, active, onClick }: Props) {
|
|
|
199
197
|
<span className="w-1.5 h-1.5 rounded-full bg-amber-400" />
|
|
200
198
|
{queuedCount} queued {queuedCount === 1 ? 'message' : 'messages'} waiting
|
|
201
199
|
</div>
|
|
202
|
-
) : mission ? (
|
|
203
|
-
<div className="mt-1 flex items-center gap-2">
|
|
204
|
-
<div className={`min-w-0 truncate text-[13px] leading-relaxed flex items-center gap-1.5 ${
|
|
205
|
-
mission.status === 'waiting' || mission.status === 'failed' || mission.status === 'cancelled'
|
|
206
|
-
? 'text-amber-300/75'
|
|
207
|
-
: mission.status === 'completed'
|
|
208
|
-
? 'text-emerald-300/75'
|
|
209
|
-
: 'text-sky-300/75'
|
|
210
|
-
}`}>
|
|
211
|
-
<span className={`w-1.5 h-1.5 rounded-full ${
|
|
212
|
-
mission.status === 'waiting' || mission.status === 'failed' || mission.status === 'cancelled'
|
|
213
|
-
? 'bg-amber-400'
|
|
214
|
-
: mission.status === 'completed'
|
|
215
|
-
? 'bg-emerald-400'
|
|
216
|
-
: 'bg-sky-400'
|
|
217
|
-
}`} />
|
|
218
|
-
<span className="truncate">{mission.waitingReason || mission.currentStep || mission.objective}</span>
|
|
219
|
-
</div>
|
|
220
|
-
<button
|
|
221
|
-
type="button"
|
|
222
|
-
onClick={(event) => {
|
|
223
|
-
event.stopPropagation()
|
|
224
|
-
router.push(getMissionPath(mission.id))
|
|
225
|
-
}}
|
|
226
|
-
className="shrink-0 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]"
|
|
227
|
-
>
|
|
228
|
-
Mission
|
|
229
|
-
</button>
|
|
230
|
-
</div>
|
|
231
200
|
) : (
|
|
232
201
|
<div className="text-[13px] text-text-2/50 truncate mt-1 leading-relaxed">{preview}</div>
|
|
233
202
|
)}
|
|
@@ -337,23 +337,6 @@ export const MessageBubble = memo(function MessageBubble({ message, assistantNam
|
|
|
337
337
|
return null
|
|
338
338
|
}, [message.text, isUser])
|
|
339
339
|
|
|
340
|
-
const walletRequest = useMemo(() => {
|
|
341
|
-
if (isUser) return null
|
|
342
|
-
try {
|
|
343
|
-
const data = JSON.parse(message.text)
|
|
344
|
-
if (data.type === 'extension_wallet_transfer_request') return data
|
|
345
|
-
} catch { /* ignore */ }
|
|
346
|
-
return null
|
|
347
|
-
}, [message.text, isUser])
|
|
348
|
-
|
|
349
|
-
const walletActionRequest = useMemo(() => {
|
|
350
|
-
if (isUser) return null
|
|
351
|
-
try {
|
|
352
|
-
const data = JSON.parse(message.text)
|
|
353
|
-
if (data.type === 'extension_wallet_action_request') return data
|
|
354
|
-
} catch { /* ignore */ }
|
|
355
|
-
return null
|
|
356
|
-
}, [message.text, isUser])
|
|
357
340
|
const currentUser = useAppStore((s) => s.currentUser)
|
|
358
341
|
const isDesktop = useMediaQuery('(min-width: 768px)')
|
|
359
342
|
const setPreviewContent = useChatStore((s) => s.setPreviewContent)
|
|
@@ -560,8 +543,6 @@ export const MessageBubble = memo(function MessageBubble({ message, assistantNam
|
|
|
560
543
|
const hasPrimaryAttachments = Boolean(message.imagePath || message.imageUrl || message.attachedFiles?.length)
|
|
561
544
|
const shouldRenderBubbleShell = hasPrimaryAttachments
|
|
562
545
|
|| Boolean(allToolMedia)
|
|
563
|
-
|| Boolean(walletRequest)
|
|
564
|
-
|| Boolean(walletActionRequest)
|
|
565
546
|
|| Boolean(installRequest)
|
|
566
547
|
|| Boolean(scaffoldRequest)
|
|
567
548
|
|| isExtensionUI
|
|
@@ -703,95 +684,7 @@ export const MessageBubble = memo(function MessageBubble({ message, assistantNam
|
|
|
703
684
|
) : shouldRenderBubbleShell ? (
|
|
704
685
|
/* Message bubble */
|
|
705
686
|
<div className={`${isStructured ? 'max-w-[92%] md:max-w-[85%]' : 'max-w-[85%] md:max-w-[72%]'} ${isUser ? 'bubble-user px-5 py-3.5' : isHeartbeat ? 'bubble-ai px-4 py-3' : 'bubble-ai px-5 py-3.5'}`}>
|
|
706
|
-
{
|
|
707
|
-
<div className="flex flex-col gap-3 p-4 rounded-[18px] bg-sky-500/[0.03] border border-sky-500/20 shadow-[0_0_20px_rgba(14,165,233,0.05)]">
|
|
708
|
-
<div className="flex items-center gap-2 mb-1">
|
|
709
|
-
<div className="w-5 h-5 rounded-full bg-sky-500/20 flex items-center justify-center text-sky-400">
|
|
710
|
-
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5">
|
|
711
|
-
<path d="M12 1v22M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6" />
|
|
712
|
-
</svg>
|
|
713
|
-
</div>
|
|
714
|
-
<span className="text-[11px] font-700 uppercase tracking-wider text-sky-400/80">Wallet Transfer Request</span>
|
|
715
|
-
</div>
|
|
716
|
-
<p className="text-[13px] text-text-2/90 leading-relaxed">{walletRequest.message}</p>
|
|
717
|
-
<div className="p-3 rounded-[12px] bg-black/40 border border-white/5 flex flex-col gap-2">
|
|
718
|
-
<div className="flex justify-between items-center">
|
|
719
|
-
<span className="text-[11px] text-text-3/60 font-600 uppercase">Amount</span>
|
|
720
|
-
<span className="text-[13px] font-700 text-sky-400">{walletRequest.amountDisplay || `${walletRequest.amountSol} SOL`}</span>
|
|
721
|
-
</div>
|
|
722
|
-
<div className="flex flex-col gap-1">
|
|
723
|
-
<span className="text-[11px] text-text-3/60 font-600 uppercase">To Address</span>
|
|
724
|
-
<span className="text-[11px] font-mono text-text-2/70 break-all">{walletRequest.toAddress}</span>
|
|
725
|
-
</div>
|
|
726
|
-
{walletRequest.memo && (
|
|
727
|
-
<div className="flex flex-col gap-1 border-t border-white/5 pt-2">
|
|
728
|
-
<span className="text-[11px] text-text-3/60 font-600 uppercase">Memo</span>
|
|
729
|
-
<span className="text-[12px] text-text-3/80 italic">"{walletRequest.memo}"</span>
|
|
730
|
-
</div>
|
|
731
|
-
)}
|
|
732
|
-
</div>
|
|
733
|
-
<div className="flex gap-2 mt-1">
|
|
734
|
-
<button
|
|
735
|
-
onClick={() => useChatStore.getState().sendMessage(`I approve this transfer of ${walletRequest.amountDisplay || `${walletRequest.amountSol} SOL`} to ${walletRequest.toAddress}. Proceed with wallet_tool and set approved=true.`)}
|
|
736
|
-
className="px-4 py-2 rounded-[12px] bg-sky-500 text-black text-[13px] font-700 hover:bg-sky-400 transition-all active:scale-[0.98]"
|
|
737
|
-
>
|
|
738
|
-
Approve & Send
|
|
739
|
-
</button>
|
|
740
|
-
<button
|
|
741
|
-
onClick={() => useChatStore.getState().sendMessage(`I do not approve this transaction. Cancel it.`)}
|
|
742
|
-
className="px-4 py-2 rounded-[12px] bg-white/[0.05] hover:bg-white/[0.1] text-text-2 text-[13px] font-600 transition-all border border-white/10"
|
|
743
|
-
>
|
|
744
|
-
Reject
|
|
745
|
-
</button>
|
|
746
|
-
</div>
|
|
747
|
-
</div>
|
|
748
|
-
) : walletActionRequest ? (
|
|
749
|
-
<div className="flex flex-col gap-3 p-4 rounded-[18px] bg-violet-500/[0.03] border border-violet-500/20 shadow-[0_0_20px_rgba(139,92,246,0.05)]">
|
|
750
|
-
<div className="flex items-center gap-2 mb-1">
|
|
751
|
-
<div className="w-5 h-5 rounded-full bg-violet-500/20 flex items-center justify-center text-violet-400">
|
|
752
|
-
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5">
|
|
753
|
-
<path d="M12 2v8" />
|
|
754
|
-
<path d="M8 6h8" />
|
|
755
|
-
<path d="m5 19 4-4 3 3 7-7" />
|
|
756
|
-
</svg>
|
|
757
|
-
</div>
|
|
758
|
-
<span className="text-[11px] font-700 uppercase tracking-wider text-violet-400/80">Wallet Action Request</span>
|
|
759
|
-
</div>
|
|
760
|
-
<p className="text-[13px] text-text-2/90 leading-relaxed">{walletActionRequest.message}</p>
|
|
761
|
-
<div className="p-3 rounded-[12px] bg-black/40 border border-white/5 flex flex-col gap-2">
|
|
762
|
-
<div className="flex justify-between items-center gap-3">
|
|
763
|
-
<span className="text-[11px] text-text-3/60 font-600 uppercase">Action</span>
|
|
764
|
-
<span className="text-[13px] font-700 text-violet-400">{walletActionRequest.action || 'wallet_action'}</span>
|
|
765
|
-
</div>
|
|
766
|
-
{(walletActionRequest.chain || walletActionRequest.network) && (
|
|
767
|
-
<div className="flex justify-between items-center gap-3">
|
|
768
|
-
<span className="text-[11px] text-text-3/60 font-600 uppercase">Chain</span>
|
|
769
|
-
<span className="text-[12px] text-text-2/80">{[walletActionRequest.chain, walletActionRequest.network].filter(Boolean).join(' / ')}</span>
|
|
770
|
-
</div>
|
|
771
|
-
)}
|
|
772
|
-
{walletActionRequest.summary && (
|
|
773
|
-
<div className="flex flex-col gap-1 border-t border-white/5 pt-2">
|
|
774
|
-
<span className="text-[11px] text-text-3/60 font-600 uppercase">Summary</span>
|
|
775
|
-
<span className="text-[12px] text-text-2/80 whitespace-pre-wrap break-words">{walletActionRequest.summary}</span>
|
|
776
|
-
</div>
|
|
777
|
-
)}
|
|
778
|
-
</div>
|
|
779
|
-
<div className="flex gap-2 mt-1">
|
|
780
|
-
<button
|
|
781
|
-
onClick={() => useChatStore.getState().sendMessage(`I approve this wallet action (${walletActionRequest.action || 'wallet_action'}). Proceed with wallet_tool and set approved=true.`)}
|
|
782
|
-
className="px-4 py-2 rounded-[12px] bg-violet-500 text-black text-[13px] font-700 hover:bg-violet-400 transition-all active:scale-[0.98]"
|
|
783
|
-
>
|
|
784
|
-
Approve Action
|
|
785
|
-
</button>
|
|
786
|
-
<button
|
|
787
|
-
onClick={() => useChatStore.getState().sendMessage('I do not approve this wallet action. Cancel it.')}
|
|
788
|
-
className="px-4 py-2 rounded-[12px] bg-white/[0.05] hover:bg-white/[0.1] text-text-2 text-[13px] font-600 transition-all border border-white/10"
|
|
789
|
-
>
|
|
790
|
-
Reject
|
|
791
|
-
</button>
|
|
792
|
-
</div>
|
|
793
|
-
</div>
|
|
794
|
-
) : installRequest ? (
|
|
687
|
+
{installRequest ? (
|
|
795
688
|
<div className="flex flex-col gap-3 p-4 rounded-[18px] bg-emerald-500/[0.03] border border-emerald-500/20 shadow-[0_0_20px_rgba(16,185,129,0.05)]">
|
|
796
689
|
<div className="flex items-center gap-2 mb-1">
|
|
797
690
|
<div className="w-5 h-5 rounded-full bg-emerald-500/20 flex items-center justify-center text-emerald-400">
|
|
@@ -96,6 +96,8 @@ const FIELD_HINTS: Record<string, string> = {
|
|
|
96
96
|
dmAddressingMode: 'Control whether DMs need to address the agent by name before it replies',
|
|
97
97
|
ownerSenderId: 'Optional sender ID that should route to the main owner thread for direct agent connectors',
|
|
98
98
|
scopes: 'Press Enter after each scope to add it',
|
|
99
|
+
walletAddress: 'Base L2 Ethereum address for receiving USDC payments from completed tasks',
|
|
100
|
+
maxBudget: 'USDC with 6 decimal places. $1.00 = 1000000, $5.00 = 5000000',
|
|
99
101
|
}
|
|
100
102
|
|
|
101
103
|
const BOOLEAN_SELECT_OPTIONS: ConnectorConfigOption[] = [
|
|
@@ -344,6 +346,26 @@ const PLATFORMS: {
|
|
|
344
346
|
{ key: 'signalCliHttpUrl', label: 'HTTP API URL', placeholder: 'http://localhost:8080', help: 'Only needed for http mode', section: 'advanced' },
|
|
345
347
|
],
|
|
346
348
|
},
|
|
349
|
+
{
|
|
350
|
+
id: 'swarmdock',
|
|
351
|
+
label: 'SwarmDock',
|
|
352
|
+
color: '#F59E0B',
|
|
353
|
+
setupSteps: [
|
|
354
|
+
'Generate an Ed25519 keypair for agent identity',
|
|
355
|
+
'Set your Base L2 wallet address for receiving USDC payments',
|
|
356
|
+
'Configure skills and auto-discovery preferences',
|
|
357
|
+
],
|
|
358
|
+
tokenLabel: 'SwarmDock Identity Key',
|
|
359
|
+
tokenHelp: 'Encrypted Ed25519 private key used to authenticate this agent on SwarmDock.',
|
|
360
|
+
configFields: [
|
|
361
|
+
{ key: 'apiUrl', label: 'API URL', placeholder: 'https://api.swarmdock.ai', help: 'SwarmDock marketplace API endpoint' },
|
|
362
|
+
{ key: 'walletAddress', label: 'Base L2 Wallet Address', placeholder: '0x...', help: 'USDC wallet on Base L2 for payments' },
|
|
363
|
+
{ key: 'agentDescription', label: 'Marketplace Description', placeholder: 'Specialized in...', help: 'Description on your SwarmDock profile' },
|
|
364
|
+
{ key: 'skills', label: 'Skills (comma-separated)', placeholder: 'data-analysis,web-design', help: 'Skill IDs for task matching' },
|
|
365
|
+
{ key: 'autoDiscover', label: 'Auto-Discover Tasks', placeholder: 'false', help: 'Automatically bid on matching tasks' },
|
|
366
|
+
{ key: 'maxBudget', label: 'Max Budget (USDC micro-units)', placeholder: '5000000', help: '$1 = 1000000, $5 = 5000000' },
|
|
367
|
+
],
|
|
368
|
+
},
|
|
347
369
|
]
|
|
348
370
|
|
|
349
371
|
const COMMON_CONFIG_FIELDS: ConnectorConfigField[] = [
|
|
@@ -1181,7 +1203,9 @@ export function ConnectorSheet() {
|
|
|
1181
1203
|
try {
|
|
1182
1204
|
const cred = await createCredentialMutation.mutateAsync({
|
|
1183
1205
|
provider: platform,
|
|
1184
|
-
name: newCredName.trim() ||
|
|
1206
|
+
name: newCredName.trim() || (platform === 'swarmdock'
|
|
1207
|
+
? `${platformConfig.label} Identity Key`
|
|
1208
|
+
: `${platformConfig.label} Bot Token`),
|
|
1185
1209
|
apiKey: newCredValue.trim(),
|
|
1186
1210
|
})
|
|
1187
1211
|
await credentialsQuery.refetch()
|
|
@@ -270,11 +270,7 @@ export function SidebarRail({
|
|
|
270
270
|
<path d="M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2" /><rect x="9" y="3" width="6" height="4" rx="1" /><path d="M9 14l2 2 4-4" />
|
|
271
271
|
</svg>
|
|
272
272
|
</NavItem>
|
|
273
|
-
|
|
274
|
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round">
|
|
275
|
-
<path d="M12 3 4 7v5c0 5 3.4 8.8 8 10 4.6-1.2 8-5 8-10V7l-8-4Z" /><path d="m9.5 12 1.8 1.8L15 10" />
|
|
276
|
-
</svg>
|
|
277
|
-
</NavItem>
|
|
273
|
+
|
|
278
274
|
<NavItem view="schedules" label="Schedules" expanded={railExpanded} isActive={isNavActive('schedules')} onClick={() => handleNavClick('schedules')}>
|
|
279
275
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round">
|
|
280
276
|
<circle cx="12" cy="12" r="10" /><polyline points="12 6 12 12 16 14" />
|
|
@@ -343,6 +339,11 @@ export function SidebarRail({
|
|
|
343
339
|
<rect x="3" y="11" width="18" height="11" rx="2" ry="2" /><path d="M7 11V7a5 5 0 0 1 10 0v4" />
|
|
344
340
|
</svg>
|
|
345
341
|
</NavItem>
|
|
342
|
+
<NavItem view="wallets" label="Wallets" expanded={railExpanded} isActive={isNavActive('wallets')} onClick={() => handleNavClick('wallets')}>
|
|
343
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
344
|
+
<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" />
|
|
345
|
+
</svg>
|
|
346
|
+
</NavItem>
|
|
346
347
|
<NavItem view="providers" label="Providers" expanded={railExpanded} isActive={isNavActive('providers')} onClick={() => handleNavClick('providers')}>
|
|
347
348
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round">
|
|
348
349
|
<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z" />
|
|
@@ -365,11 +366,6 @@ export function SidebarRail({
|
|
|
365
366
|
<path d="M12 16h.01" />
|
|
366
367
|
</svg>
|
|
367
368
|
</NavItem>
|
|
368
|
-
<NavItem view="wallets" label="Wallets" expanded={railExpanded} isActive={isNavActive('wallets')} onClick={() => handleNavClick('wallets')}>
|
|
369
|
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
370
|
-
<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" />
|
|
371
|
-
</svg>
|
|
372
|
-
</NavItem>
|
|
373
369
|
<NavItem view="logs" label="Logs" expanded={railExpanded} isActive={isNavActive('logs')} onClick={() => handleNavClick('logs')}>
|
|
374
370
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round">
|
|
375
371
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" /><polyline points="14 2 14 8 20 8" /><line x1="16" y1="13" x2="8" y2="13" /><line x1="16" y1="17" x2="8" y2="17" /><polyline points="10 9 9 9 8 9" />
|
|
@@ -8,7 +8,7 @@ import { OverviewTab } from './tabs/overview-tab'
|
|
|
8
8
|
import { WorkTab } from './tabs/work-tab'
|
|
9
9
|
import { OperationsTab } from './tabs/operations-tab'
|
|
10
10
|
import { ActivityTab } from './tabs/activity-tab'
|
|
11
|
-
import type { BoardTask
|
|
11
|
+
import type { BoardTask } from '@/types'
|
|
12
12
|
|
|
13
13
|
export function ProjectDetail() {
|
|
14
14
|
const activeProjectFilter = useAppStore((s) => s.activeProjectFilter)
|
|
@@ -17,43 +17,11 @@ export function ProjectDetail() {
|
|
|
17
17
|
const activeTab = useAppStore((s) => s.projectDetailTab)
|
|
18
18
|
const loadSecrets = useAppStore((s) => s.loadSecrets)
|
|
19
19
|
|
|
20
|
-
const [projectMissionSnapshot, setProjectMissionSnapshot] = useState<{ projectId: string | null; missions: Mission[] }>({
|
|
21
|
-
projectId: null,
|
|
22
|
-
missions: [],
|
|
23
|
-
})
|
|
24
|
-
|
|
25
20
|
useEffect(() => {
|
|
26
21
|
if (!activeProjectFilter) return
|
|
27
22
|
void loadSecrets()
|
|
28
23
|
}, [activeProjectFilter, loadSecrets])
|
|
29
24
|
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
let cancelled = false
|
|
32
|
-
if (!activeProjectFilter) return
|
|
33
|
-
void api<Mission[]>('GET', `/missions?projectId=${encodeURIComponent(activeProjectFilter)}&status=non_terminal&limit=8`)
|
|
34
|
-
.then((missions) => {
|
|
35
|
-
if (!cancelled) {
|
|
36
|
-
setProjectMissionSnapshot({
|
|
37
|
-
projectId: activeProjectFilter,
|
|
38
|
-
missions: Array.isArray(missions) ? missions : [],
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
.catch(() => {
|
|
43
|
-
if (!cancelled) {
|
|
44
|
-
setProjectMissionSnapshot({
|
|
45
|
-
projectId: activeProjectFilter,
|
|
46
|
-
missions: [],
|
|
47
|
-
})
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
return () => { cancelled = true }
|
|
51
|
-
}, [activeProjectFilter])
|
|
52
|
-
|
|
53
|
-
const projectMissions = projectMissionSnapshot.projectId === activeProjectFilter
|
|
54
|
-
? projectMissionSnapshot.missions
|
|
55
|
-
: []
|
|
56
|
-
|
|
57
25
|
const project = activeProjectFilter ? projects[activeProjectFilter] : null
|
|
58
26
|
|
|
59
27
|
const projectTasks = useMemo(
|
|
@@ -107,10 +75,10 @@ export function ProjectDetail() {
|
|
|
107
75
|
/>
|
|
108
76
|
<div className="flex-1 overflow-y-auto">
|
|
109
77
|
{activeTab === 'overview' && (
|
|
110
|
-
<OverviewTab project={project}
|
|
78
|
+
<OverviewTab project={project} />
|
|
111
79
|
)}
|
|
112
80
|
{activeTab === 'work' && (
|
|
113
|
-
<WorkTab
|
|
81
|
+
<WorkTab />
|
|
114
82
|
)}
|
|
115
83
|
{activeTab === 'operations' && (
|
|
116
84
|
<OperationsTab project={project} />
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import { useEffect, useMemo, useState } from 'react'
|
|
4
|
-
import { useRouter } from 'next/navigation'
|
|
5
4
|
import { useAppStore } from '@/stores/use-app-store'
|
|
6
5
|
import { relativeDate } from '../project-utils'
|
|
7
|
-
import {
|
|
8
|
-
import type { BoardTask, Mission, Project, Schedule } from '@/types'
|
|
6
|
+
import type { BoardTask, Project, Schedule } from '@/types'
|
|
9
7
|
|
|
10
8
|
interface OverviewTabProps {
|
|
11
9
|
project: Project
|
|
12
|
-
missions: Mission[]
|
|
13
10
|
}
|
|
14
11
|
|
|
15
|
-
export function OverviewTab({ project
|
|
16
|
-
const router = useRouter()
|
|
12
|
+
export function OverviewTab({ project }: OverviewTabProps) {
|
|
17
13
|
const tasks = useAppStore((s) => s.tasks) as Record<string, BoardTask>
|
|
18
14
|
const schedules = useAppStore((s) => s.schedules) as Record<string, Schedule>
|
|
19
15
|
const activeProjectFilter = useAppStore((s) => s.activeProjectFilter)
|
|
@@ -66,8 +62,6 @@ export function OverviewTab({ project, missions }: OverviewTabProps) {
|
|
|
66
62
|
{ label: 'Stale', value: staleCount, tone: 'text-sky-400', hint: 'No meaningful progress in 3+ days' },
|
|
67
63
|
]
|
|
68
64
|
|
|
69
|
-
const displayedMissions = missions.slice(0, 5)
|
|
70
|
-
|
|
71
65
|
return (
|
|
72
66
|
<div className="max-w-3xl mx-auto px-8 py-6 space-y-6">
|
|
73
67
|
{/* Section 1: Project Identity */}
|
|
@@ -110,57 +104,7 @@ export function OverviewTab({ project, missions }: OverviewTabProps) {
|
|
|
110
104
|
</div>
|
|
111
105
|
</div>
|
|
112
106
|
|
|
113
|
-
{/* Section 3:
|
|
114
|
-
<div>
|
|
115
|
-
<h3 className="text-[12px] font-700 uppercase tracking-[0.08em] text-text-3/60 mb-3">Active Missions</h3>
|
|
116
|
-
{displayedMissions.length === 0 ? (
|
|
117
|
-
<p className="text-[12px] text-text-3/45">No active missions.</p>
|
|
118
|
-
) : (
|
|
119
|
-
<div className="flex flex-col gap-2">
|
|
120
|
-
{displayedMissions.map((mission) => (
|
|
121
|
-
<button
|
|
122
|
-
key={mission.id}
|
|
123
|
-
onClick={() => router.push(getMissionPath(mission.id))}
|
|
124
|
-
className="w-full flex items-center justify-between gap-3 px-4 py-3 rounded-[12px] border border-white/[0.06] bg-white/[0.02] hover:bg-white/[0.04] transition-all cursor-pointer text-left"
|
|
125
|
-
style={{ fontFamily: 'inherit' }}
|
|
126
|
-
>
|
|
127
|
-
<div className="min-w-0 flex-1">
|
|
128
|
-
<div className="text-[13px] font-600 text-text truncate">{mission.objective}</div>
|
|
129
|
-
<div className="flex items-center gap-2 mt-1 flex-wrap">
|
|
130
|
-
<span className={`text-[9px] font-600 uppercase tracking-wider px-1.5 py-0.5 rounded-[4px] ${
|
|
131
|
-
mission.status === 'active' ? 'bg-sky-500/15 text-sky-400'
|
|
132
|
-
: mission.status === 'waiting' ? 'bg-amber-500/15 text-amber-400'
|
|
133
|
-
: 'bg-white/[0.06] text-text-3'
|
|
134
|
-
}`}>
|
|
135
|
-
{mission.status}
|
|
136
|
-
</span>
|
|
137
|
-
{mission.status === 'waiting' && (
|
|
138
|
-
<span className="text-[9px] font-600 px-1.5 py-0.5 rounded-[4px] bg-amber-500/10 text-amber-400/70">waiting</span>
|
|
139
|
-
)}
|
|
140
|
-
{mission.status === 'failed' && (
|
|
141
|
-
<span className="text-[9px] font-600 px-1.5 py-0.5 rounded-[4px] bg-red-500/10 text-red-400/70">blocked</span>
|
|
142
|
-
)}
|
|
143
|
-
{(mission.childMissionIds?.length || 0) > 0 && (
|
|
144
|
-
<span className="text-[9px] font-600 px-1.5 py-0.5 rounded-[4px] bg-sky-500/10 text-sky-400/70">{mission.childMissionIds?.length} children</span>
|
|
145
|
-
)}
|
|
146
|
-
{(mission.taskIds?.length || 0) > 0 && (
|
|
147
|
-
<span className="text-[9px] font-600 px-1.5 py-0.5 rounded-[4px] bg-white/[0.06] text-text-3/60">{mission.taskIds?.length} task{mission.taskIds?.length === 1 ? '' : 's'}</span>
|
|
148
|
-
)}
|
|
149
|
-
</div>
|
|
150
|
-
</div>
|
|
151
|
-
<span className="text-[10px] text-text-3/35 shrink-0">{relativeDate(mission.updatedAt)}</span>
|
|
152
|
-
</button>
|
|
153
|
-
))}
|
|
154
|
-
{missions.length > 5 && (
|
|
155
|
-
<p className="text-[11px] text-accent-bright/70 text-center py-1">
|
|
156
|
-
{missions.length - 5} more mission{missions.length - 5 === 1 ? '' : 's'}
|
|
157
|
-
</p>
|
|
158
|
-
)}
|
|
159
|
-
</div>
|
|
160
|
-
)}
|
|
161
|
-
</div>
|
|
162
|
-
|
|
163
|
-
{/* Section 4: Progress */}
|
|
107
|
+
{/* Section 3: Progress */}
|
|
164
108
|
{totalTasks > 0 && (
|
|
165
109
|
<div className="rounded-[12px] border border-white/[0.06] bg-white/[0.02] px-5 py-4">
|
|
166
110
|
<div className="flex items-center justify-between mb-2.5">
|
|
@@ -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 && (
|