@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
|
@@ -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
|
+
}
|
|
@@ -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')
|
|
@@ -13,9 +13,10 @@ const VIEW_TO_PATH: Record<AppView, string> = {
|
|
|
13
13
|
protocols: '/protocols',
|
|
14
14
|
schedules: '/schedules',
|
|
15
15
|
memory: '/memory',
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
tasks: '/tasks',
|
|
18
18
|
secrets: '/secrets',
|
|
19
|
+
wallets: '/wallets',
|
|
19
20
|
providers: '/providers',
|
|
20
21
|
skills: '/skills',
|
|
21
22
|
connectors: '/connectors',
|
|
@@ -25,7 +26,6 @@ const VIEW_TO_PATH: Record<AppView, string> = {
|
|
|
25
26
|
logs: '/logs',
|
|
26
27
|
extensions: '/extensions',
|
|
27
28
|
usage: '/usage',
|
|
28
|
-
wallets: '/wallets',
|
|
29
29
|
runs: '/runs',
|
|
30
30
|
autonomy: '/autonomy',
|
|
31
31
|
settings: '/settings',
|
|
@@ -42,11 +42,6 @@ export function getViewPath(view: AppView, id?: string | null): string {
|
|
|
42
42
|
return base
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export function getMissionPath(missionId?: string | null): string {
|
|
46
|
-
if (!missionId) return VIEW_TO_PATH.missions
|
|
47
|
-
return `${VIEW_TO_PATH.missions}/${encodeURIComponent(missionId)}`
|
|
48
|
-
}
|
|
49
|
-
|
|
50
45
|
/** Map a pathname back to an AppView. Returns null for unknown paths. */
|
|
51
46
|
export function pathToView(pathname: string): AppView | null {
|
|
52
47
|
for (const [view, path] of Object.entries(VIEW_TO_PATH)) {
|
|
@@ -9,9 +9,10 @@ export const VIEW_LABELS: Record<AppView, string> = {
|
|
|
9
9
|
protocols: 'Sessions',
|
|
10
10
|
schedules: 'Schedules',
|
|
11
11
|
memory: 'Memory',
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
tasks: 'Tasks',
|
|
14
14
|
secrets: 'Secrets',
|
|
15
|
+
wallets: 'Wallets',
|
|
15
16
|
providers: 'Providers',
|
|
16
17
|
skills: 'Skills',
|
|
17
18
|
connectors: 'Connectors',
|
|
@@ -21,7 +22,6 @@ export const VIEW_LABELS: Record<AppView, string> = {
|
|
|
21
22
|
logs: 'Logs',
|
|
22
23
|
extensions: 'Extensions',
|
|
23
24
|
usage: 'Usage',
|
|
24
|
-
wallets: 'Wallets',
|
|
25
25
|
runs: 'Runs',
|
|
26
26
|
autonomy: 'Autonomy',
|
|
27
27
|
settings: 'Settings',
|
|
@@ -53,9 +53,10 @@ export const VIEW_DESCRIPTIONS: Record<AppView, string> = {
|
|
|
53
53
|
protocols: 'Temporary structured sessions and protocol-driven runs',
|
|
54
54
|
schedules: 'Automated task schedules',
|
|
55
55
|
memory: 'Long-term agent memory store',
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
tasks: 'Task board for agent work and queued runs',
|
|
58
58
|
secrets: 'API keys, tokens, and encrypted credentials',
|
|
59
|
+
wallets: 'Crypto wallets for agent-initiated on-chain transactions',
|
|
59
60
|
providers: 'LLM providers & custom endpoints',
|
|
60
61
|
skills: 'Reusable instruction sets for agents',
|
|
61
62
|
connectors: 'Chat platform bridges (Discord, Slack, etc.)',
|
|
@@ -65,7 +66,6 @@ export const VIEW_DESCRIPTIONS: Record<AppView, string> = {
|
|
|
65
66
|
logs: 'Application logs & error tracking',
|
|
66
67
|
extensions: 'Manage external extensions and marketplace installs',
|
|
67
68
|
usage: 'Usage metrics, cost tracking & agent performance',
|
|
68
|
-
wallets: 'Agent crypto wallets — hold funds, send SOL, manage spending',
|
|
69
69
|
runs: 'Live run monitoring & history',
|
|
70
70
|
autonomy: 'Estops, incidents, and runtime autonomy controls',
|
|
71
71
|
settings: 'Manage defaults, providers, secrets, and automation settings',
|
|
@@ -89,7 +89,7 @@ export const VIEW_EMPTY_STATES: Record<Exclude<AppView, 'agents' | 'home'>, { ic
|
|
|
89
89
|
protocols: {
|
|
90
90
|
icon: 'list',
|
|
91
91
|
title: 'Structured Sessions',
|
|
92
|
-
description: 'Run temporary bounded sessions from chats, chatrooms, tasks,
|
|
92
|
+
description: 'Run temporary bounded sessions from chats, chatrooms, tasks, or schedules without turning every surface into a workflow engine.',
|
|
93
93
|
features: ['Start one-agent or multi-agent structured sessions from context', 'Use neutral built-in templates like review, discussion, and decision rounds', 'Keep a hidden transcript plus durable run events', 'Archive the outcome and post a compact summary back when needed'],
|
|
94
94
|
},
|
|
95
95
|
schedules: {
|
|
@@ -104,12 +104,7 @@ export const VIEW_EMPTY_STATES: Record<Exclude<AppView, 'agents' | 'home'>, { ic
|
|
|
104
104
|
description: 'Long-term memory store for AI agents so they can retain useful context across conversations.',
|
|
105
105
|
features: ['Agents store findings and learnings automatically', 'Full-text search across all stored memories', 'Organized by categories and agents', 'Persists across conversations for continuity'],
|
|
106
106
|
},
|
|
107
|
-
|
|
108
|
-
icon: 'target',
|
|
109
|
-
title: 'Missions',
|
|
110
|
-
description: 'Track durable objectives, blockers, waits, verification, and linked work across chats, schedules, and delegation.',
|
|
111
|
-
features: ['Inspect active and waiting missions', 'Review child missions and linked tasks', 'Understand why a mission is blocked or complete', 'Resume, replan, or retry verification from one place'],
|
|
112
|
-
},
|
|
107
|
+
|
|
113
108
|
tasks: {
|
|
114
109
|
icon: 'clipboard',
|
|
115
110
|
title: 'Task Board',
|
|
@@ -122,6 +117,12 @@ export const VIEW_EMPTY_STATES: Record<Exclude<AppView, 'agents' | 'home'>, { ic
|
|
|
122
117
|
description: 'Manage API keys and credentials that agents and integrations can access securely.',
|
|
123
118
|
features: ['Store keys for external services (Gmail, APIs, etc.)', 'Scope secrets globally or to specific agents', 'Encrypted at rest with AES-256-GCM', 'Agents retrieve secrets through configured tools'],
|
|
124
119
|
},
|
|
120
|
+
wallets: {
|
|
121
|
+
icon: 'wallet',
|
|
122
|
+
title: 'Wallets',
|
|
123
|
+
description: 'Manage crypto wallets that agents use for on-chain transactions and payments.',
|
|
124
|
+
features: ['Generate wallets with encrypted private keys', 'Assign wallets to specific agents', 'Set spending and daily USDC limits', 'Require human approval for transactions'],
|
|
125
|
+
},
|
|
125
126
|
providers: {
|
|
126
127
|
icon: 'zap',
|
|
127
128
|
title: 'Providers',
|
|
@@ -212,16 +213,10 @@ export const VIEW_EMPTY_STATES: Record<Exclude<AppView, 'agents' | 'home'>, { ic
|
|
|
212
213
|
description: 'Audit trail of all entity mutations across the system.',
|
|
213
214
|
features: ['Track agent, task, and connector changes', 'Filter by entity type and action', 'Real-time updates via WebSocket', 'Relative timestamps'],
|
|
214
215
|
},
|
|
215
|
-
wallets: {
|
|
216
|
-
icon: 'wallet',
|
|
217
|
-
title: 'Wallets',
|
|
218
|
-
description: 'Agent crypto wallets for autonomous financial operations on Solana.',
|
|
219
|
-
features: ['Create Solana wallets for agents', 'Per-transaction and daily spending limits', 'User approval for transactions', 'Balance tracking and transaction history'],
|
|
220
|
-
},
|
|
221
216
|
}
|
|
222
217
|
|
|
223
218
|
export const FULL_WIDTH_VIEWS = new Set<AppView>([
|
|
224
|
-
'home', 'org_chart', 'inbox', 'chatrooms', 'protocols', 'schedules', '
|
|
219
|
+
'home', 'org_chart', 'inbox', 'chatrooms', 'protocols', 'schedules', 'secrets', 'wallets', 'providers', 'skills',
|
|
225
220
|
'connectors', 'webhooks', 'mcp_servers', 'knowledge', 'extensions',
|
|
226
|
-
'usage', '
|
|
221
|
+
'usage', 'runs', 'autonomy', 'logs', 'settings', 'activity', 'projects',
|
|
227
222
|
])
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { loadActivity as loadStoredActivity, logActivity as writeActivityLog } from '@/lib/server/storage'
|
|
1
|
+
import { loadActivity as loadStoredActivity, logActivity as writeActivityLog, queryActivity as queryStoredActivity } from '@/lib/server/storage'
|
|
2
2
|
import { perf } from '@/lib/server/runtime/perf'
|
|
3
3
|
|
|
4
4
|
export function loadActivity() {
|
|
@@ -19,3 +19,18 @@ export function logActivity(entry: {
|
|
|
19
19
|
action: entry.action,
|
|
20
20
|
})
|
|
21
21
|
}
|
|
22
|
+
|
|
23
|
+
/** Paginated activity query — uses SQL WHERE + LIMIT/OFFSET for efficiency. */
|
|
24
|
+
export function queryActivity(filters: {
|
|
25
|
+
entityType?: string
|
|
26
|
+
entityId?: string
|
|
27
|
+
actor?: string
|
|
28
|
+
action?: string
|
|
29
|
+
since?: number
|
|
30
|
+
limit?: number
|
|
31
|
+
offset?: number
|
|
32
|
+
}): unknown[] {
|
|
33
|
+
return perf.measureSync('repository', 'activity.query', () => queryStoredActivity(filters), {
|
|
34
|
+
entityType: filters.entityType ?? 'all',
|
|
35
|
+
})
|
|
36
|
+
}
|
|
@@ -66,19 +66,22 @@ function detachAgentSessions(agentId: string): number {
|
|
|
66
66
|
|
|
67
67
|
export function listAgentsForApi(): Record<string, Agent> {
|
|
68
68
|
const agents = loadAgents()
|
|
69
|
-
const sessions = listSessions()
|
|
70
|
-
const usage = loadUsage()
|
|
71
|
-
const now = Date.now()
|
|
72
69
|
for (const agent of Object.values(agents)) {
|
|
73
|
-
|
|
74
|
-
(typeof agent.monthlyBudget === 'number' && agent.monthlyBudget > 0)
|
|
70
|
+
const hasBudget = (typeof agent.monthlyBudget === 'number' && agent.monthlyBudget > 0)
|
|
75
71
|
|| (typeof agent.dailyBudget === 'number' && agent.dailyBudget > 0)
|
|
76
72
|
|| (typeof agent.hourlyBudget === 'number' && agent.hourlyBudget > 0)
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
if (!hasBudget) continue
|
|
74
|
+
|
|
75
|
+
// Use persisted spend fields when available (push-based rollup)
|
|
76
|
+
if (typeof agent.lastSpendRollupAt === 'number' && agent.lastSpendRollupAt > 0) {
|
|
77
|
+
if (typeof agent.monthlyBudget === 'number' && agent.monthlyBudget > 0) agent.monthlySpend = (agent.spentMonthlyCents ?? 0) / 100
|
|
78
|
+
if (typeof agent.dailyBudget === 'number' && agent.dailyBudget > 0) agent.dailySpend = (agent.spentDailyCents ?? 0) / 100
|
|
79
|
+
if (typeof agent.hourlyBudget === 'number' && agent.hourlyBudget > 0) agent.hourlySpend = (agent.spentHourlyCents ?? 0) / 100
|
|
80
|
+
} else {
|
|
81
|
+
// Fallback: full scan for agents that predate the rollup system
|
|
82
|
+
const sessions = listSessions()
|
|
83
|
+
const usage = loadUsage()
|
|
84
|
+
const spend = getAgentSpendWindows(agent.id, Date.now(), { sessions, usage })
|
|
82
85
|
if (typeof agent.monthlyBudget === 'number' && agent.monthlyBudget > 0) agent.monthlySpend = spend.monthly
|
|
83
86
|
if (typeof agent.dailyBudget === 'number' && agent.dailyBudget > 0) agent.dailySpend = spend.daily
|
|
84
87
|
if (typeof agent.hourlyBudget === 'number' && agent.hourlyBudget > 0) agent.hourlySpend = spend.hourly
|
|
@@ -301,7 +304,17 @@ export function updateAgent(agentId: string, body: Record<string, unknown>): Age
|
|
|
301
304
|
updateThreadShortcutSession(agentId, updated)
|
|
302
305
|
}
|
|
303
306
|
|
|
304
|
-
|
|
307
|
+
const budgetFields = ['monthlyBudget', 'dailyBudget', 'hourlyBudget', 'budgetAction'] as const
|
|
308
|
+
const budgetChanges: Record<string, unknown> = {}
|
|
309
|
+
for (const key of budgetFields) {
|
|
310
|
+
if (key in body) budgetChanges[key] = body[key]
|
|
311
|
+
}
|
|
312
|
+
const detail: Record<string, unknown> = {}
|
|
313
|
+
if (Object.keys(budgetChanges).length > 0) detail.budgetChanges = budgetChanges
|
|
314
|
+
logActivity({ entityType: 'agent', entityId: agentId, action: 'updated', actor: 'user', summary: `Agent updated: "${updated.name}"`, detail: Object.keys(detail).length > 0 ? detail : undefined })
|
|
315
|
+
if (Object.keys(budgetChanges).length > 0) {
|
|
316
|
+
logActivity({ entityType: 'budget', entityId: agentId, action: 'configured', actor: 'user', summary: `Budget updated for agent "${updated.name}"`, detail: budgetChanges })
|
|
317
|
+
}
|
|
305
318
|
return updated
|
|
306
319
|
}
|
|
307
320
|
|
|
@@ -89,7 +89,6 @@ function buildThreadSession(agent: Agent, sessionId: string, user: string, creat
|
|
|
89
89
|
vibe: existing?.vibe,
|
|
90
90
|
theme: existing?.theme,
|
|
91
91
|
avatar: existing?.avatar,
|
|
92
|
-
canvasContent: existing?.canvasContent || null,
|
|
93
92
|
}
|
|
94
93
|
return applyResolvedRoute(
|
|
95
94
|
baseSession,
|
|
@@ -62,7 +62,6 @@ function makeClassification(overrides: Partial<MessageClassification>): MessageC
|
|
|
62
62
|
taskIntent: 'general',
|
|
63
63
|
isDeliverableTask: false,
|
|
64
64
|
isBroadGoal: false,
|
|
65
|
-
walletIntent: 'none',
|
|
66
65
|
hasHumanSignals: false,
|
|
67
66
|
hasSignificantEvent: false,
|
|
68
67
|
isResearchSynthesis: false,
|