From e4a240c70d4ad0d1a92b6622cc364af9af8651ac Mon Sep 17 00:00:00 2001 From: Agustin Armellini Fischer Date: Sun, 1 Dec 2024 01:47:10 +0100 Subject: [PATCH 1/6] Add Goat plugin --- packages/plugin-goat/README.md | 12 ++ packages/plugin-goat/package.json | 22 ++++ packages/plugin-goat/src/actions.ts | 186 ++++++++++++++++++++++++++++ packages/plugin-goat/src/index.ts | 29 +++++ packages/plugin-goat/src/wallet.ts | 31 +++++ packages/plugin-goat/tsconfig.json | 9 ++ packages/plugin-goat/tsup.config.ts | 21 ++++ 7 files changed, 310 insertions(+) create mode 100644 packages/plugin-goat/README.md create mode 100644 packages/plugin-goat/package.json create mode 100644 packages/plugin-goat/src/actions.ts create mode 100644 packages/plugin-goat/src/index.ts create mode 100644 packages/plugin-goat/src/wallet.ts create mode 100644 packages/plugin-goat/tsconfig.json create mode 100644 packages/plugin-goat/tsup.config.ts diff --git a/packages/plugin-goat/README.md b/packages/plugin-goat/README.md new file mode 100644 index 00000000000..fcac78c5737 --- /dev/null +++ b/packages/plugin-goat/README.md @@ -0,0 +1,12 @@ +# Goat Plugin +Example plugin setup of how you can integrate [Goat](https://ohmygoat.dev/) tools and plugins with Eliza. + +Adds onchain capabilities to your agent to send and check balances of ETH and USDC. Add all the capabilities you need by adding more plugins! + +## Setup +1. Configure your wallet (key pair, smart wallet, etc. see all available wallets at [https://ohmygoat.dev/wallets](https://ohmygoat.dev/wallets)) +2. Add the plugins you need (uniswap, zora, polymarket, etc. see all available plugins at [https://ohmygoat.dev/chains-wallets-plugins](https://ohmygoat.dev/chains-wallets-plugins)) +3. Select a chain (see all available chains at [https://ohmygoat.dev/chains](https://ohmygoat.dev/chains)) +4. Import and add the plugin to your Eliza agent +5. Build the project +6. Add the necessary environment variables to set up your wallet and plugins diff --git a/packages/plugin-goat/package.json b/packages/plugin-goat/package.json new file mode 100644 index 00000000000..5a68deab2cc --- /dev/null +++ b/packages/plugin-goat/package.json @@ -0,0 +1,22 @@ +{ + "name": "@ai16z/plugin-goat", + "version": "0.0.1", + "main": "dist/index.js", + "type": "module", + "types": "dist/index.d.ts", + "dependencies": { + "@ai16z/eliza": "workspace:*", + "@ai16z/plugin-trustdb": "workspace:*", + "@goat-sdk/core": "0.3.7", + "@goat-sdk/plugin-erc20": "0.1.5", + "@goat-sdk/wallet-viem": "0.1.3", + "tsup": "^8.3.5", + "viem": "^2.21.45" + }, + "scripts": { + "build": "tsup --format esm --dts" + }, + "peerDependencies": { + "whatwg-url": "7.1.0" + } +} diff --git a/packages/plugin-goat/src/actions.ts b/packages/plugin-goat/src/actions.ts new file mode 100644 index 00000000000..3be441b7a30 --- /dev/null +++ b/packages/plugin-goat/src/actions.ts @@ -0,0 +1,186 @@ +import { + type WalletClient, + type Plugin, + getDeferredTools, + parametersToJsonExample, + addParametersToDescription, + type ChainForWalletClient, + type DeferredTool, +} from "@goat-sdk/core"; +import { + type Action, + generateText, + type HandlerCallback, + type IAgentRuntime, + type Memory, + ModelClass, + type State, + composeContext, + generateObject, +} from "@ai16z/eliza"; + +type GetOnChainActionsParams = { + chain: ChainForWalletClient; + getWalletClient: (runtime: IAgentRuntime) => Promise; + plugins: Plugin[]; + supportsSmartWallets?: boolean; +}; + +/** + * Get all the on chain actions for the given wallet client and plugins + * + * @param params + * @returns + */ +export async function getOnChainActions({ + getWalletClient, + plugins, + chain, + supportsSmartWallets, +}: GetOnChainActionsParams): Promise { + const tools = await getDeferredTools({ + plugins, + wordForTool: "action", + chain, + supportsSmartWallets, + }); + + return tools + .map((action) => ({ + ...action, + name: action.name.toUpperCase(), + })) + .map((tool) => createAction(tool, getWalletClient)) +} + +function createAction( + tool: DeferredTool, + getWalletClient: (runtime: IAgentRuntime) => Promise +): Action { + return { + name: tool.name, + similes: [], + description: tool.description, + validate: async () => true, + handler: async ( + runtime: IAgentRuntime, + message: Memory, + state: State | undefined, + options?: Record, + callback?: HandlerCallback + ): Promise => { + try { + const walletClient = await getWalletClient(runtime); + let currentState = + state ?? (await runtime.composeState(message)); + currentState = + await runtime.updateRecentMessageState(currentState); + + const parameterContext = composeParameterContext( + tool, + currentState + ); + const parameters = await generateParameters( + runtime, + parameterContext + ); + + const parsedParameters = tool.parameters.safeParse(parameters); + if (!parsedParameters.success) { + callback?.({ + text: `Invalid parameters for action ${tool.name}: ${parsedParameters.error.message}`, + content: { error: parsedParameters.error.message }, + }); + return false; + } + + const result = await tool.method( + walletClient, + parsedParameters.data + ); + const responseContext = composeResponseContext( + tool, + result, + currentState + ); + const response = await generateResponse( + runtime, + responseContext + ); + + callback?.({ text: response, content: result }); + return true; + } catch (error) { + const errorMessage = + error instanceof Error ? error.message : String(error); + callback?.({ + text: `Error executing action ${tool.name}: ${errorMessage}`, + content: { error: errorMessage }, + }); + return false; + } + }, + examples: [], + }; +} + +function composeParameterContext( + tool: DeferredTool, + state: State +): string { + const contextTemplate = `Respond with a JSON markdown block containing only the extracted values for action "${ + tool.name + }". Use null for any values that cannot be determined. + +Example response: +\`\`\`json +${parametersToJsonExample(tool.parameters)} +\`\`\` + +{{recentMessages}} + +Given the recent messages, extract the following information for the action "${ + tool.name + }": +${addParametersToDescription("", tool.parameters)} +`; + return composeContext({ state, template: contextTemplate }); +} + +async function generateParameters( + runtime: IAgentRuntime, + context: string +): Promise { + return generateObject({ + runtime, + context, + modelClass: ModelClass.SMALL, + }); +} + +function composeResponseContext( + tool: DeferredTool, + result: unknown, + state: State +): string { + const responseTemplate = ` +The action "${tool.name}" was executed successfully. +Here is the result: +${JSON.stringify(result)} + +Respond to the message knowing that the action was successful and these were the previous messages: +{{recentMessages}} + `; + return composeContext({ state, template: responseTemplate }); +} + +async function generateResponse( + runtime: IAgentRuntime, + context: string +): Promise { + return generateText({ + runtime, + context, + modelClass: ModelClass.SMALL, + }); +} diff --git a/packages/plugin-goat/src/index.ts b/packages/plugin-goat/src/index.ts new file mode 100644 index 00000000000..47d0cc11108 --- /dev/null +++ b/packages/plugin-goat/src/index.ts @@ -0,0 +1,29 @@ +import type { Plugin } from '@ai16z/eliza' +import { base } from 'viem/chains'; +import { getOnChainActions } from './actions'; +import { erc20, USDC } from '@goat-sdk/plugin-erc20'; +import { getWalletClient } from './wallet'; +import { sendETH } from '@goat-sdk/core'; + +export const goatPlugin: Plugin = { + name: "[GOAT] Onchain Actions", + description: "Base integration plugin", + providers: [], + evaluators: [], + services: [], + actions: [ + ...(await getOnChainActions({ + getWalletClient, + // Add plugins here based on what actions you want to use + // See all available plugins at https://ohmygoat.dev/chains-wallets-plugins#plugins + plugins: [sendETH(), erc20({ tokens: [USDC] })], + // Add the chain you want to use + chain: { + type: "evm", + id: base.id, + }, + })), + ], +}; + +export default goatPlugin diff --git a/packages/plugin-goat/src/wallet.ts b/packages/plugin-goat/src/wallet.ts new file mode 100644 index 00000000000..df4e5483f56 --- /dev/null +++ b/packages/plugin-goat/src/wallet.ts @@ -0,0 +1,31 @@ +import { createWalletClient, http } from "viem"; +import { privateKeyToAccount } from "viem/accounts"; +import { base } from "viem/chains"; + +import { type IAgentRuntime } from "@ai16z/eliza"; +import { viem } from "@goat-sdk/wallet-viem"; + +/** + * Create a wallet client for the given runtime. + * + * You can change it to use a different wallet client such as Crossmint smart wallets or others. + * + * See all available wallet clients at https://ohmygoat.dev/wallets + * + * @param runtime + * @returns Wallet client + */ +export async function getWalletClient(runtime: IAgentRuntime) { + const privateKey = runtime.getSetting("EVM_PRIVATE_KEY"); + if (!privateKey) throw new Error("EVM_PRIVATE_KEY not configured"); + + const provider = runtime.getSetting("EVM_PROVIDER_URL"); + if (!provider) throw new Error("EVM_PROVIDER_URL not configured"); + + const walletClient = createWalletClient({ + account: privateKeyToAccount(privateKey as `0x${string}`), + chain: base, + transport: http(provider), + }); + return viem(walletClient); +} diff --git a/packages/plugin-goat/tsconfig.json b/packages/plugin-goat/tsconfig.json new file mode 100644 index 00000000000..a29f5acc13b --- /dev/null +++ b/packages/plugin-goat/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "dist", + "rootDir": "./src", + "declaration": true + }, + "include": ["src"] +} diff --git a/packages/plugin-goat/tsup.config.ts b/packages/plugin-goat/tsup.config.ts new file mode 100644 index 00000000000..b0c1a8a9f46 --- /dev/null +++ b/packages/plugin-goat/tsup.config.ts @@ -0,0 +1,21 @@ +import { defineConfig } from "tsup"; + +export default defineConfig({ + entry: ["src/index.ts"], + outDir: "dist", + sourcemap: true, + clean: true, + format: ["esm"], // Ensure you're targeting CommonJS + external: [ + "dotenv", // Externalize dotenv to prevent bundling + "fs", // Externalize fs to use Node.js built-in module + "path", // Externalize other built-ins if necessary + "@reflink/reflink", + "@node-llama-cpp", + "https", + "http", + "agentkeepalive", + "viem", + "@lifi/sdk" + ], +}); From 3a8c45af8251e7d6a60cf4b89af8af65c741e64a Mon Sep 17 00:00:00 2001 From: Agustin Armellini Fischer Date: Sun, 1 Dec 2024 03:03:43 +0100 Subject: [PATCH 2/6] Remove unnecessary dependency --- .env.example | 1 + packages/plugin-goat/package.json | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index b9a808d7564..1ad0c8ff2fa 100644 --- a/.env.example +++ b/.env.example @@ -87,6 +87,7 @@ HEURIST_IMAGE_MODEL= # EVM EVM_PRIVATE_KEY= EVM_PUBLIC_KEY= +EVM_PROVIDER_URL= # Solana SOLANA_PRIVATE_KEY= diff --git a/packages/plugin-goat/package.json b/packages/plugin-goat/package.json index 5a68deab2cc..7fb59012b73 100644 --- a/packages/plugin-goat/package.json +++ b/packages/plugin-goat/package.json @@ -6,7 +6,6 @@ "types": "dist/index.d.ts", "dependencies": { "@ai16z/eliza": "workspace:*", - "@ai16z/plugin-trustdb": "workspace:*", "@goat-sdk/core": "0.3.7", "@goat-sdk/plugin-erc20": "0.1.5", "@goat-sdk/wallet-viem": "0.1.3", From bad009906d465d6f93927be636108e0d8945a393 Mon Sep 17 00:00:00 2001 From: Agustin Armellini Fischer Date: Sun, 1 Dec 2024 09:58:23 +0100 Subject: [PATCH 3/6] Use generateObjectV2, add wallet provider, centralize chain config --- packages/plugin-goat/package.json | 4 +- packages/plugin-goat/src/actions.ts | 62 +++++++++++++------ packages/plugin-goat/src/index.ts | 8 +-- .../src/{wallet.ts => provider.ts} | 27 +++++++- 4 files changed, 72 insertions(+), 29 deletions(-) rename packages/plugin-goat/src/{wallet.ts => provider.ts} (54%) diff --git a/packages/plugin-goat/package.json b/packages/plugin-goat/package.json index 7fb59012b73..88c73c51040 100644 --- a/packages/plugin-goat/package.json +++ b/packages/plugin-goat/package.json @@ -6,8 +6,8 @@ "types": "dist/index.d.ts", "dependencies": { "@ai16z/eliza": "workspace:*", - "@goat-sdk/core": "0.3.7", - "@goat-sdk/plugin-erc20": "0.1.5", + "@goat-sdk/core": "0.3.8", + "@goat-sdk/plugin-erc20": "0.1.6", "@goat-sdk/wallet-viem": "0.1.3", "tsup": "^8.3.5", "viem": "^2.21.45" diff --git a/packages/plugin-goat/src/actions.ts b/packages/plugin-goat/src/actions.ts index 3be441b7a30..dea5da8e349 100644 --- a/packages/plugin-goat/src/actions.ts +++ b/packages/plugin-goat/src/actions.ts @@ -2,7 +2,6 @@ import { type WalletClient, type Plugin, getDeferredTools, - parametersToJsonExample, addParametersToDescription, type ChainForWalletClient, type DeferredTool, @@ -16,7 +15,7 @@ import { ModelClass, type State, composeContext, - generateObject, + generateObjectV2, } from "@ai16z/eliza"; type GetOnChainActionsParams = { @@ -50,7 +49,7 @@ export async function getOnChainActions({ ...action, name: action.name.toUpperCase(), })) - .map((tool) => createAction(tool, getWalletClient)) + .map((tool) => createAction(tool, getWalletClient)); } function createAction( @@ -82,9 +81,12 @@ function createAction( ); const parameters = await generateParameters( runtime, - parameterContext + parameterContext, + tool ); + console.log(`Parameters: ${JSON.stringify(parameters)}`); + const parsedParameters = tool.parameters.safeParse(parameters); if (!parsedParameters.success) { callback?.({ @@ -94,6 +96,12 @@ function createAction( return false; } + console.log( + `Executing action ${tool.name} with parameters: ${JSON.stringify( + parsedParameters.data + )}` + ); + const result = await tool.method( walletClient, parsedParameters.data @@ -128,34 +136,27 @@ function composeParameterContext( tool: DeferredTool, state: State ): string { - const contextTemplate = `Respond with a JSON markdown block containing only the extracted values for action "${ - tool.name - }". Use null for any values that cannot be determined. - -Example response: -\`\`\`json -${parametersToJsonExample(tool.parameters)} -\`\`\` + const contextTemplate = `{{recentMessages}} -{{recentMessages}} - -Given the recent messages, extract the following information for the action "${ - tool.name - }": +Given the recent messages, extract the following information for the action "${tool.name}": ${addParametersToDescription("", tool.parameters)} `; return composeContext({ state, template: contextTemplate }); } -async function generateParameters( +async function generateParameters( runtime: IAgentRuntime, - context: string + context: string, + tool: DeferredTool ): Promise { - return generateObject({ + const { object } = await generateObjectV2({ runtime, context, modelClass: ModelClass.SMALL, + schema: tool.parameters, }); + + return object; } function composeResponseContext( @@ -164,10 +165,31 @@ function composeResponseContext( state: State ): string { const responseTemplate = ` + # Action Examples +{{actionExamples}} +(Action examples are for reference only. Do not use the information from them in your response.) + +# Knowledge +{{knowledge}} + +# Task: Generate dialog and actions for the character {{agentName}}. +About {{agentName}}: +{{bio}} +{{lore}} + +{{providers}} + +{{attachments}} + +# Capabilities +Note that {{agentName}} is capable of reading/seeing/hearing various forms of media, including images, videos, audio, plaintext and PDFs. Recent attachments have been included above under the "Attachments" section. + The action "${tool.name}" was executed successfully. Here is the result: ${JSON.stringify(result)} +{{actions}} + Respond to the message knowing that the action was successful and these were the previous messages: {{recentMessages}} `; diff --git a/packages/plugin-goat/src/index.ts b/packages/plugin-goat/src/index.ts index 47d0cc11108..281d95a1621 100644 --- a/packages/plugin-goat/src/index.ts +++ b/packages/plugin-goat/src/index.ts @@ -1,14 +1,13 @@ import type { Plugin } from '@ai16z/eliza' -import { base } from 'viem/chains'; import { getOnChainActions } from './actions'; import { erc20, USDC } from '@goat-sdk/plugin-erc20'; -import { getWalletClient } from './wallet'; +import { chain, getWalletClient, walletProvider } from './provider'; import { sendETH } from '@goat-sdk/core'; export const goatPlugin: Plugin = { name: "[GOAT] Onchain Actions", description: "Base integration plugin", - providers: [], + providers: [walletProvider], evaluators: [], services: [], actions: [ @@ -17,10 +16,9 @@ export const goatPlugin: Plugin = { // Add plugins here based on what actions you want to use // See all available plugins at https://ohmygoat.dev/chains-wallets-plugins#plugins plugins: [sendETH(), erc20({ tokens: [USDC] })], - // Add the chain you want to use chain: { type: "evm", - id: base.id, + id: chain.id, }, })), ], diff --git a/packages/plugin-goat/src/wallet.ts b/packages/plugin-goat/src/provider.ts similarity index 54% rename from packages/plugin-goat/src/wallet.ts rename to packages/plugin-goat/src/provider.ts index df4e5483f56..20b4356b6f1 100644 --- a/packages/plugin-goat/src/wallet.ts +++ b/packages/plugin-goat/src/provider.ts @@ -2,9 +2,14 @@ import { createWalletClient, http } from "viem"; import { privateKeyToAccount } from "viem/accounts"; import { base } from "viem/chains"; -import { type IAgentRuntime } from "@ai16z/eliza"; +import { Memory, Provider, State, type IAgentRuntime } from "@ai16z/eliza"; import { viem } from "@goat-sdk/wallet-viem"; + +// Add the chain you want to use, remember to update also +// the EVM_PROVIDER_URL to the correct one for the chain +export const chain = base; + /** * Create a wallet client for the given runtime. * @@ -24,8 +29,26 @@ export async function getWalletClient(runtime: IAgentRuntime) { const walletClient = createWalletClient({ account: privateKeyToAccount(privateKey as `0x${string}`), - chain: base, + chain: chain, transport: http(provider), }); return viem(walletClient); } + +export const walletProvider: Provider = { + async get( + runtime: IAgentRuntime, + message: Memory, + state?: State + ): Promise { + try { + const walletClient = await getWalletClient(runtime); + const address = walletClient.getAddress(); + const balance = await walletClient.balanceOf(address); + return `EVM Wallet Address: ${address}\nBalance: ${balance} ETH`; + } catch (error) { + console.error("Error in EVM wallet provider:", error); + return null; + } + }, +}; From 2d7bdbf14d1442d333abb86b587a7abff69b7f9f Mon Sep 17 00:00:00 2001 From: Agustin Armellini Fischer Date: Sun, 1 Dec 2024 09:59:38 +0100 Subject: [PATCH 4/6] Remove console logs --- packages/plugin-goat/src/actions.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/packages/plugin-goat/src/actions.ts b/packages/plugin-goat/src/actions.ts index dea5da8e349..a69ab6378e6 100644 --- a/packages/plugin-goat/src/actions.ts +++ b/packages/plugin-goat/src/actions.ts @@ -85,8 +85,6 @@ function createAction( tool ); - console.log(`Parameters: ${JSON.stringify(parameters)}`); - const parsedParameters = tool.parameters.safeParse(parameters); if (!parsedParameters.success) { callback?.({ @@ -96,12 +94,6 @@ function createAction( return false; } - console.log( - `Executing action ${tool.name} with parameters: ${JSON.stringify( - parsedParameters.data - )}` - ); - const result = await tool.method( walletClient, parsedParameters.data From 9408709dcd3859db85d046bc04fc52efa93f4a96 Mon Sep 17 00:00:00 2001 From: Agustin Armellini Fischer Date: Sun, 1 Dec 2024 10:02:10 +0100 Subject: [PATCH 5/6] Update .env.example --- .env.example | 1 - 1 file changed, 1 deletion(-) diff --git a/.env.example b/.env.example index b8954089a8c..4905550ad15 100644 --- a/.env.example +++ b/.env.example @@ -88,7 +88,6 @@ HEURIST_IMAGE_MODEL= EVM_PRIVATE_KEY= EVM_PROVIDER_URL= - # Solana SOLANA_PRIVATE_KEY= SOLANA_PUBLIC_KEY= From 9abeb1c158816fda79a308a1efe4d570565c0d5f Mon Sep 17 00:00:00 2001 From: Shaw Date: Sun, 1 Dec 2024 15:43:51 -0800 Subject: [PATCH 6/6] integrate goat plugin --- agent/package.json | 1 + agent/src/index.ts | 20 +---- packages/plugin-goat/tsconfig.json | 8 +- pnpm-lock.yaml | 125 ++++++++++++++++------------- scripts/build.sh | 122 ---------------------------- 5 files changed, 76 insertions(+), 200 deletions(-) delete mode 100644 scripts/build.sh diff --git a/agent/package.json b/agent/package.json index bd28750dc2d..f1f6a0a1bd4 100644 --- a/agent/package.json +++ b/agent/package.json @@ -32,6 +32,7 @@ "@ai16z/plugin-node": "workspace:*", "@ai16z/plugin-solana": "workspace:*", "@ai16z/plugin-0g": "workspace:*", + "@ai16z/plugin-goat": "workspace:*", "@ai16z/plugin-starknet": "workspace:*", "@ai16z/plugin-icp": "workspace:*", "@ai16z/plugin-tee": "workspace:*", diff --git a/agent/src/index.ts b/agent/src/index.ts index 158581990a5..3cedec5b5a0 100644 --- a/agent/src/index.ts +++ b/agent/src/index.ts @@ -23,6 +23,7 @@ import { validateCharacterConfig, } from "@ai16z/eliza"; import { zgPlugin } from "@ai16z/plugin-0g"; +import { goatPlugin } from "@ai16z/plugin-goat"; import { bootstrapPlugin } from "@ai16z/plugin-bootstrap"; // import { buttplugPlugin } from "@ai16z/plugin-buttplug"; import { @@ -90,24 +91,6 @@ export async function loadCharacters( .map((filePath) => filePath.trim()); const loadedCharacters = []; - // Add logging here - elizaLogger.info("Character loading details:", { - characterPaths, - cwd: process.cwd(), - dirname: __dirname, - fullPath: path.resolve( - process.cwd(), - "characters/8bitoracle.laozi.character.json" - ), - exists: fs.existsSync( - path.resolve( - process.cwd(), - "characters/8bitoracle.laozi.character.json" - ) - ), - dirContents: fs.readdirSync(process.cwd()), - }); - if (characterPaths?.length > 0) { for (const characterPath of characterPaths) { let content = null; @@ -393,6 +376,7 @@ export function createAgent( ? [coinbaseMassPaymentsPlugin, tradePlugin] : []), getSecret(character, "WALLET_SECRET_SALT") ? teePlugin : null, + getSecret(character, "ALCHEMY_API_KEY") ? goatPlugin : null, ].filter(Boolean), providers: [], actions: [], diff --git a/packages/plugin-goat/tsconfig.json b/packages/plugin-goat/tsconfig.json index a29f5acc13b..33e9858f482 100644 --- a/packages/plugin-goat/tsconfig.json +++ b/packages/plugin-goat/tsconfig.json @@ -1,9 +1,11 @@ { - "extends": "../../tsconfig.json", + "extends": "../core/tsconfig.json", "compilerOptions": { "outDir": "dist", "rootDir": "./src", "declaration": true }, - "include": ["src"] -} + "include": [ + "src" + ] +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 111d74fe793..2ba0c663a50 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -138,6 +138,9 @@ importers: '@ai16z/plugin-evm': specifier: workspace:* version: link:../packages/plugin-evm + '@ai16z/plugin-goat': + specifier: workspace:* + version: link:../packages/plugin-goat '@ai16z/plugin-icp': specifier: workspace:* version: link:../packages/plugin-icp @@ -870,6 +873,30 @@ importers: specifier: 7.1.0 version: 7.1.0 + packages/plugin-goat: + dependencies: + '@ai16z/eliza': + specifier: workspace:* + version: link:../core + '@goat-sdk/core': + specifier: 0.3.8 + version: 0.3.8(bufferutil@4.0.8)(encoding@0.1.13)(typescript@5.6.3)(utf-8-validate@5.0.10) + '@goat-sdk/plugin-erc20': + specifier: 0.1.6 + version: 0.1.6(@goat-sdk/core@0.3.8(bufferutil@4.0.8)(encoding@0.1.13)(typescript@5.6.3)(utf-8-validate@5.0.10))(viem@2.21.53(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8)) + '@goat-sdk/wallet-viem': + specifier: 0.1.3 + version: 0.1.3(@goat-sdk/core@0.3.8(bufferutil@4.0.8)(encoding@0.1.13)(typescript@5.6.3)(utf-8-validate@5.0.10))(viem@2.21.53(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8)) + tsup: + specifier: ^8.3.5 + version: 8.3.5(@swc/core@1.9.3(@swc/helpers@0.5.15))(jiti@2.4.0)(postcss@8.4.49)(typescript@5.6.3)(yaml@2.6.1) + viem: + specifier: ^2.21.45 + version: 2.21.53(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8) + whatwg-url: + specifier: 7.1.0 + version: 7.1.0 + packages/plugin-icp: dependencies: '@ai16z/eliza': @@ -3622,6 +3649,24 @@ packages: '@floating-ui/utils@0.2.8': resolution: {integrity: sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig==} + '@goat-sdk/core@0.3.8': + resolution: {integrity: sha512-1H8Cziyjj3bN78M4GETGN8+/fAQhtTPqMowSyAgIZtC/MGWvf41H2SR0FNba/xhfCOALhb0UfhGOsXCswvM5iA==} + engines: {node: '>=20.12.2 <21', npm: please-use-pnpm, pnpm: '>=9', yarn: please-use-pnpm} + + '@goat-sdk/plugin-erc20@0.1.6': + resolution: {integrity: sha512-vX0TQmAHSFMqjsYFyp+XYgV7a7TMvfQykQB5f0wMRFFbUgJKqcWxG8O/3WPjBcXTm7/B9C2Ebq0ByXowboHLjw==} + engines: {node: '>=20.12.2 <21', npm: please-use-pnpm, pnpm: '>=9', yarn: please-use-pnpm} + peerDependencies: + '@goat-sdk/core': 0.3.7 + viem: ^2.21.49 + + '@goat-sdk/wallet-viem@0.1.3': + resolution: {integrity: sha512-2uofsH/dVmeJk/4V2/tJ1rDk6/ZFQlthUO50tg366hjq0vjINJXMQqYGwSLnv5Z3PMmdfPCSd5xikFEfA+1ZZw==} + engines: {node: '>=20.12.2 <21', npm: please-use-pnpm, pnpm: '>=9', yarn: please-use-pnpm} + peerDependencies: + '@goat-sdk/core': 0.3.4 + viem: ^2.21.49 + '@google-cloud/vertexai@1.9.0': resolution: {integrity: sha512-8brlcJwFXI4fPuBtsDNQqCdWZmz8gV9jeEKOU0vc5H2SjehCQpXK/NwuSEr916zbhlBHtg/sU37qQQdgvh5BRA==} engines: {node: '>=18.0.0'} @@ -5785,9 +5830,6 @@ packages: '@types/babel__traverse@7.20.6': resolution: {integrity: sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==} - '@types/better-sqlite3@7.6.11': - resolution: {integrity: sha512-i8KcD3PgGtGBLl3+mMYA8PdKkButvPyARxA7IQAd6qeslht13qxb1zzO8dRCtE7U3IoJS782zDBAeoKiM695kg==} - '@types/better-sqlite3@7.6.12': resolution: {integrity: sha512-fnQmj8lELIj7BSrZQAdBMHEHX8OZLYIHXqAKT1O7tDfLxaINzf00PMjw22r3N/xXh0w/sGHlO6SVaCQ2mj78lg==} @@ -6980,9 +7022,6 @@ packages: bent@7.3.12: resolution: {integrity: sha512-T3yrKnVGB63zRuoco/7Ybl7BwwGZR0lceoVG5XmQyMIH9s19SV5m+a8qam4if0zQuAmOQTyPTPmsQBdAorGK3w==} - better-sqlite3@11.5.0: - resolution: {integrity: sha512-e/6eggfOutzoK0JWiU36jsisdWoHOfN9iWiW/SieKvb7SAa6aGNmBM/UKyp+/wWSXpLlWNN8tCPwoDNPhzUvuQ==} - better-sqlite3@11.6.0: resolution: {integrity: sha512-2J6k/eVxcFYY2SsTxsXrj6XylzHWPxveCn4fKPKZFv/Vqn/Cd7lOuX4d7rGQXT5zL+97MkNL3nSbCrIoe3LkgA==} @@ -14029,49 +14068,26 @@ packages: sql.js@1.12.0: resolution: {integrity: sha512-Bi+43yMx/tUFZVYD4AUscmdL6NHn3gYQ+CM+YheFWLftOmrEC/Mz6Yh7E96Y2WDHYz3COSqT+LP6Z79zgrwJlA==} - sqlite-vec-darwin-arm64@0.1.4-alpha.2: - resolution: {integrity: sha512-eOZwQ3Z0pX/ALHLq71ZF0HAQLPRHu6b9PhH17xI2euqN6u9vdL2jDkem6d99O+wV4vYnShj4Vzt25LDet4Ehsg==} - cpu: [arm64] - os: [darwin] - sqlite-vec-darwin-arm64@0.1.6: resolution: {integrity: sha512-5duw/xhM3xE6BCQd//eAkyHgBp9FIwK6veldRhPG96dT6Zpjov3bG02RuE7JAQj0SVJYRW8bJwZ4LxqW0+Q7Dw==} cpu: [arm64] os: [darwin] - sqlite-vec-darwin-x64@0.1.4-alpha.2: - resolution: {integrity: sha512-uEyfy1ZdBP3KJNxY3jEaqDwZG2QYthKOGYpcC1OPNVspbLBU98dxFs2p3mDAOF3VarDzoLazQVRo14m+MqM5uw==} - cpu: [x64] - os: [darwin] - sqlite-vec-darwin-x64@0.1.6: resolution: {integrity: sha512-MFkKjNfJ5pamFHhyTsrqdxALrjuvpSEZdu6Q/0vMxFa6sr5YlfabeT5xGqEbuH0iobsT1Hca5EZxLhLy0jHYkw==} cpu: [x64] os: [darwin] - sqlite-vec-linux-x64@0.1.4-alpha.2: - resolution: {integrity: sha512-n8/slC9CuQ2TWXLqoyiRT4e2WN2/Ph5hq6RwinUWjyShqKgCtnTSalGyXEElYb1Pa/BXU3P3Odzc8N7zj2ryoQ==} - cpu: [x64] - os: [linux] - sqlite-vec-linux-x64@0.1.6: resolution: {integrity: sha512-411tWPswywIzdkp+zsAUav4A03f0FjnNfpZFlOw8fBebFR74RSFkwM8Xryf18gLHiYAXUBI4mjY9+/xjwBjKpg==} cpu: [x64] os: [linux] - sqlite-vec-windows-x64@0.1.4-alpha.2: - resolution: {integrity: sha512-YErL7ewC74PzGVS0UFfZrZ6lEy1WZ2OQPZt3lQDUC/qNo7rVZ5l4ZhRb2JczB7uKPVYEZoTdMbseDrM77gFg+A==} - cpu: [x64] - os: [win32] - sqlite-vec-windows-x64@0.1.6: resolution: {integrity: sha512-Dy9/KlKJDrjuQ/RRkBqGkMZuSh5bTJDMMOFZft9VJZaXzpYxb5alpgdvD4bbKegpDdfPi2BT4+PBivsNJSlMoQ==} cpu: [x64] os: [win32] - sqlite-vec@0.1.4-alpha.2: - resolution: {integrity: sha512-FAdsljvZHdSK4w5wWYiRoVOmnaatO0m2HHRNk1P0y4kl1Nb/MzWvMJriZwa/Kj8sEqFpIwHWg/+woRKB0X1jhg==} - sqlite-vec@0.1.6: resolution: {integrity: sha512-hQZU700TU2vWPXZYDULODjKXeMio6rKX7UpPN7Tq9qjPW671IEgURGrcC5LDBMl0q9rBvAuzmcmJmImMqVibYQ==} @@ -19202,6 +19218,29 @@ snapshots: '@floating-ui/utils@0.2.8': {} + '@goat-sdk/core@0.3.8(bufferutil@4.0.8)(encoding@0.1.13)(typescript@5.6.3)(utf-8-validate@5.0.10)': + dependencies: + '@solana/web3.js': 1.95.5(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) + abitype: 1.0.6(typescript@5.6.3)(zod@3.23.8) + viem: 2.21.53(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8) + zod: 3.23.8 + transitivePeerDependencies: + - bufferutil + - encoding + - typescript + - utf-8-validate + + '@goat-sdk/plugin-erc20@0.1.6(@goat-sdk/core@0.3.8(bufferutil@4.0.8)(encoding@0.1.13)(typescript@5.6.3)(utf-8-validate@5.0.10))(viem@2.21.53(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8))': + dependencies: + '@goat-sdk/core': 0.3.8(bufferutil@4.0.8)(encoding@0.1.13)(typescript@5.6.3)(utf-8-validate@5.0.10) + viem: 2.21.53(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8) + zod: 3.23.8 + + '@goat-sdk/wallet-viem@0.1.3(@goat-sdk/core@0.3.8(bufferutil@4.0.8)(encoding@0.1.13)(typescript@5.6.3)(utf-8-validate@5.0.10))(viem@2.21.53(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8))': + dependencies: + '@goat-sdk/core': 0.3.8(bufferutil@4.0.8)(encoding@0.1.13)(typescript@5.6.3)(utf-8-validate@5.0.10) + viem: 2.21.53(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8) + '@google-cloud/vertexai@1.9.0(encoding@0.1.13)': dependencies: google-auth-library: 9.15.0(encoding@0.1.13) @@ -21878,10 +21917,6 @@ snapshots: dependencies: '@babel/types': 7.26.0 - '@types/better-sqlite3@7.6.11': - dependencies: - '@types/node': 22.8.4 - '@types/better-sqlite3@7.6.12': dependencies: '@types/node': 22.8.4 @@ -23342,11 +23377,6 @@ snapshots: caseless: 0.12.0 is-stream: 2.0.1 - better-sqlite3@11.5.0: - dependencies: - bindings: 1.5.0 - prebuild-install: 7.1.2 - better-sqlite3@11.6.0: dependencies: bindings: 1.5.0 @@ -32191,37 +32221,18 @@ snapshots: sql.js@1.12.0: {} - sqlite-vec-darwin-arm64@0.1.4-alpha.2: - optional: true - sqlite-vec-darwin-arm64@0.1.6: optional: true - sqlite-vec-darwin-x64@0.1.4-alpha.2: - optional: true - sqlite-vec-darwin-x64@0.1.6: optional: true - sqlite-vec-linux-x64@0.1.4-alpha.2: - optional: true - sqlite-vec-linux-x64@0.1.6: optional: true - sqlite-vec-windows-x64@0.1.4-alpha.2: - optional: true - sqlite-vec-windows-x64@0.1.6: optional: true - sqlite-vec@0.1.4-alpha.2: - optionalDependencies: - sqlite-vec-darwin-arm64: 0.1.4-alpha.2 - sqlite-vec-darwin-x64: 0.1.4-alpha.2 - sqlite-vec-linux-x64: 0.1.4-alpha.2 - sqlite-vec-windows-x64: 0.1.4-alpha.2 - sqlite-vec@0.1.6: optionalDependencies: sqlite-vec-darwin-arm64: 0.1.6 diff --git a/scripts/build.sh b/scripts/build.sh deleted file mode 100644 index 28e935c1022..00000000000 --- a/scripts/build.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/bash - -# Check Node.js version -REQUIRED_NODE_VERSION=22 -CURRENT_NODE_VERSION=$(node -v | cut -d'.' -f1 | sed 's/v//') - -if ((CURRENT_NODE_VERSION < REQUIRED_NODE_VERSION)); then - echo "Error: Node.js version must be $REQUIRED_NODE_VERSION or higher. Current version is $CURRENT_NODE_VERSION." - exit 1 -fi - -# Navigate to the script's directory -cd "$(dirname "$0")"/.. - -# Check if the packages directory exists -if [ ! -d "packages" ]; then - echo "Error: 'packages' directory not found." - exit 1 -fi - -# Define packages to build in order -PACKAGES=( - "core" - "adapter-postgres" - "adapter-sqlite" - "adapter-sqljs" - "adapter-supabase" - # "plugin-buttplug" - "plugin-node" - "plugin-trustdb" - "plugin-solana" - "plugin-starknet" - "plugin-icp" - "plugin-conflux" - "plugin-0g" - "plugin-bootstrap" - "plugin-image-generation" - "plugin-coinbase" - "plugin-evm" - "plugin-tee" - "client-auto" - "client-direct" - "client-discord" - "client-telegram" - "client-twitter" - "client-whatsapp" - "plugin-web-search" -) - -# Build packages in specified order -for package in "${PACKAGES[@]}"; do - package_path="packages/$package" - - if [ ! -d "$package_path" ]; then - echo -e "\033[1mPackage directory '$package' not found, skipping...\033[0m" - continue - fi - - echo -e "\033[1mBuilding package: $package\033[0m" - cd "$package_path" || continue - - if [ -f "package.json" ]; then - if npm run build; then - echo -e "\033[1;32mSuccessfully built $package\033[0m\n" - else - echo -e "\033[1;31mFailed to build $package\033[0m" - exit 1 - fi - else - echo "No package.json found in $package, skipping..." - fi - - cd - >/dev/null || exit -done - -# Download the latest intiface-engine release from GitHub based on OS (linux/macos/win) -# Determine OS type -# OS="" -# case "$(uname -s)" in -# Linux*) OS="linux" ;; -# Darwin*) OS="macos" ;; -# MINGW* | MSYS* | CYGWIN*) OS="win" ;; -# *) -# echo "Unsupported OS" -# exit 1 -# ;; -# esac - -# echo -e "\033[1mDownloading intiface-engine for $OS...\033[0m" - -# # Get latest release info from GitHub API -# LATEST_RELEASE=$(curl -s https://api.github.com/repos/intiface/intiface-engine/releases/latest) -# DOWNLOAD_URL=$(echo "$LATEST_RELEASE" | grep -o "https://.*intiface-engine-$OS-x64-Release\.zip" | head -n 1) - -# if [ -z "$DOWNLOAD_URL" ]; then -# echo -e "\033[1;31mCould not find download URL for $OS\033[0m" -# exit 1 -# fi - -# # Download and extract into packages/plugin-buttplug/intiface-engine -# if curl -L "$DOWNLOAD_URL" -o "packages/plugin-buttplug/intiface-engine.zip"; then -# echo -e "\033[1;32mSuccessfully downloaded intiface-engine\033[0m" - -# # Clean previous installation if exists -# rm -rf packages/plugin-buttplug/intiface-engine - -# # Extract -# unzip -q packages/plugin-buttplug/intiface-engine.zip -d packages/plugin-buttplug/intiface-engine -# rm packages/plugin-buttplug/intiface-engine.zip - -# # Make binary executable on Unix-like systems -# if [ "$OS" != "win" ]; then -# chmod +x packages/plugin-buttplug/intiface-engine/intiface-engine -# fi - -# echo -e "\033[1;32mSuccessfully set up intiface-engine\033[0m" -# else -# echo -e "\033[1;31mFailed to download intiface-engine\033[0m" -# exit 1 -# fi - -echo -e "\033[1mBuild process completed.😎\033[0m"