@swarmclawai/swarmclaw 0.6.7 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -39
- package/next.config.ts +31 -6
- package/package.json +3 -2
- package/src/app/api/agents/[id]/thread/route.ts +1 -0
- package/src/app/api/agents/route.ts +19 -5
- package/src/app/api/approvals/route.ts +22 -0
- package/src/app/api/chatrooms/[id]/chat/route.ts +4 -0
- package/src/app/api/clawhub/install/route.ts +2 -2
- package/src/app/api/eval/run/route.ts +37 -0
- package/src/app/api/eval/scenarios/route.ts +24 -0
- package/src/app/api/eval/suite/route.ts +29 -0
- package/src/app/api/mcp-servers/[id]/conformance/route.ts +26 -0
- package/src/app/api/mcp-servers/[id]/invoke/route.ts +81 -0
- package/src/app/api/memory/graph/route.ts +46 -0
- package/src/app/api/memory/route.ts +36 -5
- package/src/app/api/notifications/route.ts +3 -0
- package/src/app/api/plugins/install/route.ts +57 -5
- package/src/app/api/plugins/marketplace/route.ts +73 -22
- package/src/app/api/plugins/route.ts +61 -1
- package/src/app/api/plugins/ui/route.ts +34 -0
- package/src/app/api/sessions/[id]/checkpoints/route.ts +31 -0
- package/src/app/api/sessions/[id]/restore/route.ts +36 -0
- package/src/app/api/settings/route.ts +62 -0
- package/src/app/api/setup/doctor/route.ts +22 -5
- package/src/app/api/souls/[id]/route.ts +65 -0
- package/src/app/api/souls/route.ts +70 -0
- package/src/app/api/tasks/[id]/approve/route.ts +4 -3
- package/src/app/api/tasks/[id]/route.ts +16 -3
- package/src/app/api/tasks/route.ts +10 -2
- package/src/app/api/usage/route.ts +9 -2
- package/src/app/globals.css +27 -0
- package/src/app/page.tsx +10 -5
- package/src/cli/index.js +37 -0
- package/src/components/activity/activity-feed.tsx +9 -2
- package/src/components/agents/agent-avatar.tsx +5 -1
- package/src/components/agents/agent-card.tsx +55 -9
- package/src/components/agents/agent-sheet.tsx +112 -34
- package/src/components/agents/inspector-panel.tsx +1 -1
- package/src/components/agents/soul-library-picker.tsx +84 -13
- package/src/components/auth/access-key-gate.tsx +63 -54
- package/src/components/auth/user-picker.tsx +37 -32
- package/src/components/chat/activity-moment.tsx +2 -0
- package/src/components/chat/chat-area.tsx +11 -0
- package/src/components/chat/chat-header.tsx +69 -25
- package/src/components/chat/chat-tool-toggles.tsx +2 -2
- package/src/components/chat/checkpoint-timeline.tsx +112 -0
- package/src/components/chat/code-block.tsx +3 -1
- package/src/components/chat/exec-approval-card.tsx +8 -1
- package/src/components/chat/message-bubble.tsx +164 -4
- package/src/components/chat/message-list.tsx +46 -4
- package/src/components/chat/session-approval-card.tsx +80 -0
- package/src/components/chat/session-debug-panel.tsx +106 -84
- package/src/components/chat/streaming-bubble.tsx +6 -5
- package/src/components/chat/task-approval-card.tsx +78 -0
- package/src/components/chat/thinking-indicator.tsx +48 -12
- package/src/components/chat/tool-call-bubble.tsx +3 -0
- package/src/components/chat/tool-request-banner.tsx +39 -20
- package/src/components/chatrooms/chatroom-list.tsx +11 -4
- package/src/components/chatrooms/chatroom-sheet.tsx +7 -2
- package/src/components/connectors/connector-list.tsx +33 -11
- package/src/components/connectors/connector-sheet.tsx +37 -7
- package/src/components/home/home-view.tsx +54 -24
- package/src/components/input/chat-input.tsx +22 -1
- package/src/components/knowledge/knowledge-list.tsx +17 -18
- package/src/components/knowledge/knowledge-sheet.tsx +9 -5
- package/src/components/layout/app-layout.tsx +87 -19
- package/src/components/mcp-servers/mcp-server-list.tsx +352 -50
- package/src/components/mcp-servers/mcp-server-sheet.tsx +25 -9
- package/src/components/memory/memory-browser.tsx +73 -45
- package/src/components/memory/memory-graph-view.tsx +203 -0
- package/src/components/memory/memory-list.tsx +20 -13
- package/src/components/plugins/plugin-list.tsx +214 -60
- package/src/components/plugins/plugin-sheet.tsx +119 -24
- package/src/components/projects/project-list.tsx +17 -9
- package/src/components/providers/provider-list.tsx +21 -6
- package/src/components/providers/provider-sheet.tsx +42 -25
- package/src/components/runs/run-list.tsx +17 -13
- package/src/components/schedules/schedule-card.tsx +10 -3
- package/src/components/schedules/schedule-list.tsx +2 -2
- package/src/components/schedules/schedule-sheet.tsx +28 -9
- package/src/components/secrets/secret-sheet.tsx +7 -2
- package/src/components/secrets/secrets-list.tsx +18 -5
- package/src/components/sessions/new-session-sheet.tsx +183 -376
- package/src/components/sessions/session-card.tsx +10 -2
- package/src/components/settings/gateway-connection-panel.tsx +9 -8
- package/src/components/shared/command-palette.tsx +13 -5
- package/src/components/shared/empty-state.tsx +20 -8
- package/src/components/shared/hint-tip.tsx +31 -0
- package/src/components/shared/notification-center.tsx +134 -86
- package/src/components/shared/profile-sheet.tsx +4 -0
- package/src/components/shared/settings/plugin-manager.tsx +360 -135
- package/src/components/shared/settings/section-capability-policy.tsx +3 -3
- package/src/components/shared/settings/section-runtime-loop.tsx +149 -4
- package/src/components/skills/clawhub-browser.tsx +1 -0
- package/src/components/skills/skill-list.tsx +31 -12
- package/src/components/skills/skill-sheet.tsx +20 -7
- package/src/components/tasks/approvals-panel.tsx +224 -0
- package/src/components/tasks/task-board.tsx +20 -12
- package/src/components/tasks/task-card.tsx +21 -7
- package/src/components/tasks/task-column.tsx +4 -3
- package/src/components/tasks/task-list.tsx +1 -1
- package/src/components/tasks/task-sheet.tsx +130 -1
- package/src/components/ui/dialog.tsx +1 -0
- package/src/components/ui/sheet.tsx +1 -0
- package/src/components/usage/metrics-dashboard.tsx +72 -48
- package/src/components/wallets/wallet-panel.tsx +65 -41
- package/src/components/wallets/wallet-section.tsx +9 -3
- package/src/components/webhooks/webhook-list.tsx +21 -12
- package/src/components/webhooks/webhook-sheet.tsx +13 -3
- package/src/lib/approval-display.test.ts +45 -0
- package/src/lib/approval-display.ts +62 -0
- package/src/lib/clipboard.ts +38 -0
- package/src/lib/memory.ts +8 -0
- package/src/lib/providers/claude-cli.ts +5 -3
- package/src/lib/providers/index.ts +67 -21
- package/src/lib/runtime-loop.ts +3 -2
- package/src/lib/server/approvals.ts +150 -0
- package/src/lib/server/chat-execution.ts +319 -74
- package/src/lib/server/chatroom-helpers.ts +63 -5
- package/src/lib/server/chatroom-orchestration.ts +74 -0
- package/src/lib/server/clawhub-client.ts +82 -6
- package/src/lib/server/connectors/manager.ts +27 -1
- package/src/lib/server/context-manager.ts +132 -50
- package/src/lib/server/cost.test.ts +73 -0
- package/src/lib/server/cost.ts +165 -34
- package/src/lib/server/daemon-state.ts +112 -1
- package/src/lib/server/data-dir.ts +18 -1
- package/src/lib/server/eval/runner.ts +126 -0
- package/src/lib/server/eval/scenarios.ts +218 -0
- package/src/lib/server/eval/scorer.ts +96 -0
- package/src/lib/server/eval/store.ts +37 -0
- package/src/lib/server/eval/types.ts +48 -0
- package/src/lib/server/execution-log.ts +12 -8
- package/src/lib/server/guardian.ts +34 -0
- package/src/lib/server/heartbeat-service.ts +53 -1
- package/src/lib/server/integrity-monitor.ts +208 -0
- package/src/lib/server/langgraph-checkpoint.ts +10 -0
- package/src/lib/server/link-understanding.ts +55 -0
- package/src/lib/server/llm-response-cache.test.ts +102 -0
- package/src/lib/server/llm-response-cache.ts +227 -0
- package/src/lib/server/main-agent-loop.ts +115 -16
- package/src/lib/server/main-session.ts +6 -3
- package/src/lib/server/mcp-conformance.test.ts +18 -0
- package/src/lib/server/mcp-conformance.ts +233 -0
- package/src/lib/server/memory-db.ts +193 -19
- package/src/lib/server/memory-retrieval.test.ts +56 -0
- package/src/lib/server/mmr.ts +73 -0
- package/src/lib/server/orchestrator-lg.ts +7 -1
- package/src/lib/server/orchestrator.ts +4 -3
- package/src/lib/server/plugins.ts +662 -132
- package/src/lib/server/process-manager.ts +18 -0
- package/src/lib/server/query-expansion.ts +57 -0
- package/src/lib/server/queue.ts +280 -11
- package/src/lib/server/runtime-settings.ts +9 -0
- package/src/lib/server/session-run-manager.test.ts +23 -0
- package/src/lib/server/session-run-manager.ts +32 -2
- package/src/lib/server/session-tools/canvas.ts +85 -50
- package/src/lib/server/session-tools/chatroom.ts +130 -127
- package/src/lib/server/session-tools/connector.ts +233 -454
- package/src/lib/server/session-tools/context-mgmt.ts +87 -105
- package/src/lib/server/session-tools/crud.ts +84 -7
- package/src/lib/server/session-tools/delegate.ts +351 -752
- package/src/lib/server/session-tools/discovery.ts +198 -0
- package/src/lib/server/session-tools/edit_file.ts +82 -0
- package/src/lib/server/session-tools/file-send.test.ts +39 -0
- package/src/lib/server/session-tools/file.ts +257 -425
- package/src/lib/server/session-tools/git.ts +87 -47
- package/src/lib/server/session-tools/http.ts +95 -33
- package/src/lib/server/session-tools/index.ts +217 -138
- package/src/lib/server/session-tools/memory.ts +154 -239
- package/src/lib/server/session-tools/monitor.ts +126 -0
- package/src/lib/server/session-tools/normalize-tool-args.test.ts +61 -0
- package/src/lib/server/session-tools/normalize-tool-args.ts +48 -0
- package/src/lib/server/session-tools/openclaw-nodes.ts +82 -99
- package/src/lib/server/session-tools/openclaw-workspace.ts +103 -93
- package/src/lib/server/session-tools/platform.ts +86 -0
- package/src/lib/server/session-tools/plugin-creator.ts +239 -0
- package/src/lib/server/session-tools/sample-ui.ts +97 -0
- package/src/lib/server/session-tools/sandbox.ts +175 -148
- package/src/lib/server/session-tools/schedule.ts +78 -0
- package/src/lib/server/session-tools/session-info.ts +104 -410
- package/src/lib/server/session-tools/shell-normalize.test.ts +43 -0
- package/src/lib/server/session-tools/shell.ts +171 -143
- package/src/lib/server/session-tools/subagent.ts +77 -77
- package/src/lib/server/session-tools/wallet.ts +182 -106
- package/src/lib/server/session-tools/web.ts +181 -327
- package/src/lib/server/storage.ts +36 -0
- package/src/lib/server/stream-agent-chat.ts +348 -242
- package/src/lib/server/task-quality-gate.test.ts +44 -0
- package/src/lib/server/task-quality-gate.ts +67 -0
- package/src/lib/server/task-validation.test.ts +78 -0
- package/src/lib/server/task-validation.ts +67 -2
- package/src/lib/server/tool-aliases.ts +68 -0
- package/src/lib/server/tool-capability-policy.ts +24 -5
- package/src/lib/server/tool-retry.ts +62 -0
- package/src/lib/server/transcript-repair.ts +72 -0
- package/src/lib/setup-defaults.ts +1 -0
- package/src/lib/tasks.ts +7 -1
- package/src/lib/tool-definitions.ts +24 -23
- package/src/lib/validation/schemas.ts +13 -0
- package/src/lib/view-routes.ts +2 -23
- package/src/stores/use-app-store.ts +23 -1
- package/src/types/index.ts +155 -10
|
@@ -2,123 +2,199 @@ import { z } from 'zod'
|
|
|
2
2
|
import { tool, type StructuredToolInterface } from '@langchain/core/tools'
|
|
3
3
|
import type { ToolBuildContext } from './context'
|
|
4
4
|
import { loadWallets, loadWalletTransactions } from '../storage'
|
|
5
|
-
import type { AgentWallet, WalletTransaction } from '@/types'
|
|
5
|
+
import type { AgentWallet, WalletTransaction, Plugin, PluginHooks } from '@/types'
|
|
6
|
+
import { getPluginManager } from '../plugins'
|
|
7
|
+
import { normalizeToolInputArgs } from './normalize-tool-args'
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Core Wallet Execution Logic
|
|
11
|
+
*/
|
|
12
|
+
async function executeWalletAction(args: any, context: { agentId?: string | null }) {
|
|
13
|
+
const normalized = normalizeToolInputArgs((args ?? {}) as Record<string, unknown>)
|
|
14
|
+
const action = normalized.action as string | undefined
|
|
15
|
+
const toAddress = (normalized.toAddress ?? normalized.to) as string | undefined
|
|
16
|
+
const amountSol = normalized.amountSol as number | undefined
|
|
17
|
+
const memo = normalized.memo as string | undefined
|
|
18
|
+
const limit = normalized.limit as number | undefined
|
|
19
|
+
const agentId = context.agentId
|
|
9
20
|
|
|
10
|
-
|
|
21
|
+
if (!agentId) return JSON.stringify({ error: 'No agent ID in context' })
|
|
22
|
+
|
|
23
|
+
const wallets = loadWallets() as Record<string, AgentWallet>
|
|
24
|
+
const wallet = Object.values(wallets).find((w) => w.agentId === agentId) ?? null
|
|
11
25
|
|
|
12
|
-
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
if (!wallet) {
|
|
27
|
+
if (action === 'address' || action === 'balance' || action === 'transactions') {
|
|
28
|
+
return JSON.stringify({
|
|
29
|
+
status: 'wallet_not_linked',
|
|
30
|
+
message: 'No wallet linked to this agent yet.',
|
|
31
|
+
setup: {
|
|
32
|
+
endpoint: '/wallets',
|
|
33
|
+
method: 'POST',
|
|
34
|
+
body: { agentId, chain: 'solana' },
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
return JSON.stringify({ error: 'No wallet linked to this agent. Ask the user to create one in the Wallets section.' })
|
|
16
39
|
}
|
|
17
40
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
41
|
+
switch (action) {
|
|
42
|
+
case 'balance': {
|
|
43
|
+
try {
|
|
44
|
+
const { getBalance, lamportsToSol } = await import('../solana')
|
|
45
|
+
const balanceLamports = await getBalance(wallet.publicKey)
|
|
46
|
+
const sol = lamportsToSol(balanceLamports)
|
|
47
|
+
|
|
48
|
+
// Return a Rich UI Card for balance
|
|
49
|
+
return JSON.stringify({
|
|
50
|
+
kind: 'plugin-ui',
|
|
51
|
+
text: `### Wallet Balance\n\n**Address:** \`${wallet.publicKey}\`\n**Balance:** \`${sol} SOL\``,
|
|
52
|
+
actions: [
|
|
53
|
+
{ id: 'view-solscan', label: 'View on Solscan', href: `https://solscan.io/account/${wallet.publicKey}` }
|
|
54
|
+
]
|
|
55
|
+
})
|
|
56
|
+
} catch (err: unknown) {
|
|
57
|
+
return JSON.stringify({ error: `Failed to fetch balance: ${err instanceof Error ? err.message : String(err)}` })
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
case 'address': return JSON.stringify({ address: wallet.publicKey, chain: wallet.chain })
|
|
61
|
+
case 'send': {
|
|
62
|
+
if (!toAddress) return JSON.stringify({ error: 'toAddress is required for send' })
|
|
63
|
+
if (!amountSol || amountSol <= 0) return JSON.stringify({ error: 'amountSol must be positive' })
|
|
64
|
+
|
|
65
|
+
if (normalized.approved !== true) {
|
|
66
|
+
const { requestApproval } = await import('../approvals')
|
|
67
|
+
requestApproval({
|
|
68
|
+
category: 'wallet_transfer',
|
|
69
|
+
title: `Send ${amountSol} SOL`,
|
|
70
|
+
description: `Transfer to ${toAddress}. Memo: ${memo || 'none'}`,
|
|
71
|
+
data: { toAddress, amountSol, memo },
|
|
72
|
+
agentId: context.agentId,
|
|
73
|
+
})
|
|
74
|
+
return JSON.stringify({
|
|
75
|
+
type: 'plugin_wallet_transfer_request',
|
|
76
|
+
amountSol,
|
|
77
|
+
toAddress,
|
|
78
|
+
memo,
|
|
79
|
+
message: `I'm requesting to send ${amountSol} SOL to ${toAddress}. Please approve this transaction.`
|
|
80
|
+
})
|
|
81
|
+
}
|
|
48
82
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
const { isValidSolanaAddress, solToLamports, lamportsToSol } = await import('../solana')
|
|
84
|
+
if (!isValidSolanaAddress(toAddress)) return JSON.stringify({ error: 'Invalid Solana address' })
|
|
85
|
+
const amountLamports = solToLamports(amountSol)
|
|
86
|
+
const perTxLimit = wallet.spendingLimitLamports ?? 100_000_000
|
|
87
|
+
if (amountLamports > perTxLimit) return JSON.stringify({ error: `Amount ${amountSol} SOL exceeds limit of ${lamportsToSol(perTxLimit)} SOL` })
|
|
88
|
+
try {
|
|
89
|
+
const baseUrl = process.env.NEXTAUTH_URL || `http://localhost:${process.env.PORT || 3456}`
|
|
90
|
+
const res = await fetch(`${baseUrl}/api/wallets/${wallet.id}/send`, {
|
|
91
|
+
method: 'POST',
|
|
92
|
+
headers: { 'Content-Type': 'application/json', 'X-Access-Key': process.env.ACCESS_KEY || '' },
|
|
93
|
+
body: JSON.stringify({ toAddress, amountLamports, memo }),
|
|
94
|
+
})
|
|
95
|
+
const data = await res.json()
|
|
96
|
+
|
|
97
|
+
if (data.signature) {
|
|
98
|
+
return JSON.stringify({
|
|
99
|
+
kind: 'plugin-ui',
|
|
100
|
+
text: `### Transaction Sent!\n\n**Amount:** \`${amountSol} SOL\`\n**To:** \`${toAddress}\`\n**Sig:** \`${data.signature.slice(0, 8)}...\``,
|
|
101
|
+
actions: [
|
|
102
|
+
{ id: 'view-tx', label: 'View Transaction', href: `https://solscan.io/tx/${data.signature}` }
|
|
103
|
+
]
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
return JSON.stringify(data)
|
|
107
|
+
} catch (err: unknown) {
|
|
108
|
+
return JSON.stringify({ error: `Send failed: ${err instanceof Error ? err.message : String(err)}` })
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
case 'transactions': {
|
|
112
|
+
const allTxs = loadWalletTransactions() as Record<string, WalletTransaction>
|
|
113
|
+
const walletTxs = Object.values(allTxs)
|
|
114
|
+
.filter((tx) => tx.walletId === wallet.id)
|
|
115
|
+
.sort((a, b) => b.timestamp - a.timestamp)
|
|
116
|
+
.slice(0, limit ?? 5)
|
|
117
|
+
|
|
118
|
+
const txLines = walletTxs.map(tx => `- **${tx.type.toUpperCase()}**: ${tx.amountLamports / 1e9} SOL (${tx.status})`).join('\n')
|
|
119
|
+
|
|
120
|
+
return JSON.stringify({
|
|
121
|
+
kind: 'plugin-ui',
|
|
122
|
+
text: `### Recent Transactions\n\n${txLines || 'No recent transactions found.'}`,
|
|
123
|
+
actions: [
|
|
124
|
+
{ id: 'view-history', label: 'Full History', href: `https://solscan.io/account/${wallet.publicKey}#transfers` }
|
|
125
|
+
]
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
default: return JSON.stringify({ error: `Unknown action: ${action}` })
|
|
129
|
+
}
|
|
130
|
+
}
|
|
85
131
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Register as a Built-in Plugin with UI extensions
|
|
134
|
+
*/
|
|
135
|
+
const WalletPlugin: Plugin = {
|
|
136
|
+
name: 'Core Wallet',
|
|
137
|
+
description: 'Manage agent crypto wallet: check balance, send SOL, view transactions.',
|
|
138
|
+
hooks: {} as PluginHooks,
|
|
139
|
+
ui: {
|
|
140
|
+
sidebarItems: [
|
|
141
|
+
{
|
|
142
|
+
id: 'wallet-dashboard',
|
|
143
|
+
label: 'Wallet',
|
|
144
|
+
href: '/wallets',
|
|
145
|
+
position: 'top'
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
headerWidgets: [
|
|
149
|
+
{
|
|
150
|
+
id: 'wallet-status',
|
|
151
|
+
label: '💎 Wallet Active'
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
tools: [
|
|
156
|
+
{
|
|
157
|
+
name: 'wallet_tool',
|
|
158
|
+
description: 'Manage your own crypto wallet.',
|
|
159
|
+
parameters: {
|
|
160
|
+
type: 'object',
|
|
161
|
+
properties: {
|
|
162
|
+
action: { type: 'string', enum: ['balance', 'address', 'send', 'transactions'] },
|
|
163
|
+
toAddress: { type: 'string' },
|
|
164
|
+
amountSol: { type: 'number' },
|
|
165
|
+
memo: { type: 'string' },
|
|
166
|
+
limit: { type: 'number' },
|
|
167
|
+
approved: { type: 'boolean', description: 'Set to true only after user has manually approved the transfer request.' }
|
|
168
|
+
},
|
|
169
|
+
required: ['action']
|
|
170
|
+
},
|
|
171
|
+
execute: async (args, context) => executeWalletAction(args, { agentId: context.session.agentId })
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
}
|
|
103
175
|
|
|
104
|
-
|
|
105
|
-
}
|
|
176
|
+
getPluginManager().registerBuiltin('wallet', WalletPlugin)
|
|
106
177
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
178
|
+
/**
|
|
179
|
+
* Legacy Bridge
|
|
180
|
+
*/
|
|
181
|
+
export function buildWalletTools(bctx: ToolBuildContext): StructuredToolInterface[] {
|
|
182
|
+
if (!bctx.hasTool('wallet')) return []
|
|
183
|
+
return [
|
|
184
|
+
tool(
|
|
185
|
+
async (args) => executeWalletAction(args, { agentId: bctx.ctx?.agentId }),
|
|
111
186
|
{
|
|
112
187
|
name: 'wallet_tool',
|
|
113
|
-
description:
|
|
188
|
+
description: WalletPlugin.tools![0].description,
|
|
114
189
|
schema: z.object({
|
|
115
|
-
action: z.enum(['balance', 'address', 'send', 'transactions'])
|
|
116
|
-
toAddress: z.string().optional()
|
|
117
|
-
amountSol: z.number().optional()
|
|
118
|
-
memo: z.string().optional()
|
|
119
|
-
limit: z.number().optional()
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
190
|
+
action: z.enum(['balance', 'address', 'send', 'transactions']),
|
|
191
|
+
toAddress: z.string().optional(),
|
|
192
|
+
amountSol: z.number().optional(),
|
|
193
|
+
memo: z.string().optional(),
|
|
194
|
+
limit: z.number().optional(),
|
|
195
|
+
approved: z.boolean().optional()
|
|
196
|
+
})
|
|
197
|
+
}
|
|
198
|
+
)
|
|
123
199
|
]
|
|
124
200
|
}
|