Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into v1.51
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfsayo committed Feb 3, 2025
2 parents 265e8d8 + 085e970 commit 0725b41
Show file tree
Hide file tree
Showing 110 changed files with 4,354 additions and 203 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -952,4 +952,7 @@ ARBITRAGE_EVM_PRIVATE_KEY= # Private key for the wallet executi
FLASHBOTS_RELAY_SIGNING_KEY= # Signing key for Flashbots relay interactions
BUNDLE_EXECUTOR_ADDRESS= # Address of the bundle executor contract

# DESK Exchange Plugin Configration
DESK_EXCHANGE_PRIVATE_KEY= # Required for trading and cancelling orders
DESK_EXCHANGE_NETWORK= # "mainnet" or "testnet

4 changes: 2 additions & 2 deletions agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@
"@elizaos/plugin-coinmarketcap": "workspace:*",
"@elizaos/plugin-conflux": "workspace:*",
"@elizaos/plugin-cosmos": "workspace:*",
"@elizaos/plugin-desk-exchange": "workspace:*",
"@elizaos/plugin-echochambers": "workspace:*",
"@elizaos/plugin-evm": "workspace:*",
"@elizaos/plugin-edwin": "workspace:*",
"@elizaos/plugin-flow": "workspace:*",
"@elizaos/plugin-gelato": "workspace:*",
"@elizaos/plugin-giphy": "workspace:*",
Expand All @@ -66,9 +68,7 @@
"@elizaos/plugin-icp": "workspace:*",
"@elizaos/plugin-initia": "workspace:*",
"@elizaos/plugin-image-generation": "workspace:*",
"@elizaos/plugin-intiface": "workspace:*",
"@elizaos/plugin-lens-network": "workspace:*",
"@elizaos/plugin-letzai": "workspace:*",
"@elizaos/plugin-lit": "workspace:*",
"@elizaos/plugin-massa": "workspace:*",
"@elizaos/plugin-mind-network": "workspace:*",
Expand Down
10 changes: 10 additions & 0 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ import { coinmarketcapPlugin } from "@elizaos/plugin-coinmarketcap";
import { confluxPlugin } from "@elizaos/plugin-conflux";
import { createCosmosPlugin } from "@elizaos/plugin-cosmos";
import { cronosZkEVMPlugin } from "@elizaos/plugin-cronoszkevm";
import { deskExchangePlugin } from "@elizaos/plugin-desk-exchange";
import { evmPlugin } from "@elizaos/plugin-evm";
import { edwinPlugin } from "@elizaos/plugin-edwin";
import { flowPlugin } from "@elizaos/plugin-flow";
import { fuelPlugin } from "@elizaos/plugin-fuel";
import { genLayerPlugin } from "@elizaos/plugin-genlayer";
Expand Down Expand Up @@ -921,6 +923,10 @@ export async function createAgent(
(getSecret(character, "WALLET_PUBLIC_KEY")?.startsWith("0x"))
? evmPlugin
: null,
(getSecret(character, "EVM_PRIVATE_KEY") ||
getSecret(character, "SOLANA_PRIVATE_KEY"))
? edwinPlugin
: null,
(getSecret(character, "EVM_PUBLIC_KEY") ||
getSecret(character, "INJECTIVE_PUBLIC_KEY")) &&
getSecret(character, "INJECTIVE_PRIVATE_KEY")
Expand Down Expand Up @@ -1149,6 +1155,10 @@ export async function createAgent(
getSecret(character, "ARBITRAGE_BUNDLE_EXECUTOR_ADDRESS")
? arbitragePlugin
: null,
getSecret(character, "DESK_EXCHANGE_PRIVATE_KEY") ||
getSecret(character, "DESK_EXCHANGE_NETWORK")
? deskExchangePlugin
: null,
]
.flat()
.filter(Boolean),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The conversation focused on integrating @bigdookie's artwork as bumpers in their
- Do we need video producers? Why is it complicated for comfy stuff to be fast-paced? (asked by [boom](09:56))
- What are the next steps in establishing a Creative Studio and bidding on projects? How does budget influence project success? (asked by [whobody, boom](10:27))
- How will the open-source approach help us? How can Banodoco handle bids on their end? (asked by [boom (10:00)])
- Can we prompt an engineer to help the story arch or main punchlines for AI-assisted writing? How does it come together with human and AI collaboration in filmmaking? (asked by [boom] (10:05))
- Can we prompt an engineer to help the story arc or main punchlines for AI-assisted writing? How does it come together with human and AI collaboration in filmmaking? (asked by [boom] (10:05))

## Who Helped Who

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Summary

In the chat, Cyfer785 sought assistance for creating a frontend interface that would display AI-generated content in a retro style with live scrolling text, reminiscent of Claude's capabilities but tailored to their own AI pipe output. DegenSpartan and Poe engaged in the conversation, suggesting that Cyfer785 was essentially attempting to replicate features from existing projects like Infinite Backrooms and Claude without adding original value. The discussion highlighted a divergence of interests as Cyfer785's vision did not align with what DegenSpartan and Poe were willing or able to provide, leading to the conclusion that they were not suitable collaborators for this project. Despite some initial enthusiasm from other participants like astr0x., who humorously claimed a share of non-existent profits, the technical focus remained on Cyfer785's request for a unique AI interface development.
In the chat, Cyfer785 sought assistance for creating a frontend interface that would display AI-generated content in a retro style with live scrolling text, reminiscent of Claude's capabilities but tailored to their own AI pipe output. DegenSpartan and Poe engaged in the conversation, suggesting that Cyfer785 was essentially attempting to replicate features from existing projects like Infinite Backrooms and Claude without adding original value. The discussion highlighted a divergence of interests as Cyfer785's vision did not align with what DegenSpartan and Poe were willing or able to provide, leading to the conclusion that they were not suitable collaborators for this project. Despite some initial enthusiasm from other participants like astr0x, who humorously claimed a share of non-existent profits, the technical focus remained on Cyfer785's request for a unique AI interface development.

## FAQ

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/parsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export function parseJSONObjectFromText(
} catch (e) {
console.error("Error parsing JSON:", e);
console.error("Text is not JSON", text);
return extractAttributes(parsingText);
return extractAttributes(text);
}
} else {
const objectPattern = /{[\s\S]*?}/;
Expand All @@ -165,7 +165,7 @@ export function parseJSONObjectFromText(
} catch (e) {
console.error("Error parsing JSON:", e);
console.error("Text is not JSON", text);
return extractAttributes(parsingText);
return extractAttributes(text);
}
}
}
Expand Down
41 changes: 41 additions & 0 deletions packages/plugin-0g/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"noUnusedVariables": "error"
},
"suspicious": {
"noExplicitAny": "error"
},
"style": {
"useConst": "error",
"useImportType": "off"
}
}
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 4,
"lineWidth": 100
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"trailingCommas": "es5"
}
},
"files": {
"ignore": [
"dist/**/*",
"extra/**/*",
"node_modules/**/*"
]
}
}
3 changes: 0 additions & 3 deletions packages/plugin-0g/eslint.config.mjs

This file was deleted.

6 changes: 5 additions & 1 deletion packages/plugin-0g/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@
"tsup": "8.3.5"
},
"devDependencies": {
"@biomejs/biome": "1.5.3",
"vitest": "^1.2.1"
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --format esm --dts --watch",
"test": "vitest run",
"lint": "eslint --fix --cache ."
"lint": "biome check src/",
"lint:fix": "biome check --apply src/",
"format": "biome format src/",
"format:fix": "biome format --write src/"
}
}
26 changes: 14 additions & 12 deletions packages/plugin-0g/src/actions/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import {
elizaLogger,
} from "@elizaos/core";
import { Indexer, ZgFile, getFlowContract } from "@0glabs/0g-ts-sdk";
import { ethers } from "ethers";
import { ethers, Wallet } from "ethers";
import { composeContext } from "@elizaos/core";
import { promises as fs } from "fs";
import { promises as fs, type Stats } from "node:fs";
import { FileSecurityValidator } from "../utils/security";
import { logSecurityEvent, monitorUpload, monitorFileValidation, monitorCleanup } from '../utils/monitoring';
import { uploadTemplate } from "../templates/upload";
Expand All @@ -24,10 +24,10 @@ export interface UploadContent extends Content {

function isUploadContent(
_runtime: IAgentRuntime,
content: any
content: unknown
): content is UploadContent {
elizaLogger.debug("Validating upload content", { content });
return typeof content.filePath === "string";
return typeof content === "object" && content !== null && "filePath" in content && typeof (content as UploadContent).filePath === "string";
}

export const zgUpload: Action = {
Expand Down Expand Up @@ -82,7 +82,7 @@ export const zgUpload: Action = {
};

// Validate config values
if (isNaN(config.maxFileSize) || config.maxFileSize <= 0) {
if (Number.isNaN(config.maxFileSize) || config.maxFileSize <= 0) {
elizaLogger.error("Invalid ZEROG_MAX_FILE_SIZE setting", {
value: runtime.getSetting("ZEROG_MAX_FILE_SIZE"),
messageId: message.id
Expand Down Expand Up @@ -117,7 +117,7 @@ export const zgUpload: Action = {
runtime: IAgentRuntime,
message: Memory,
state: State,
_options: any,
_options: Record<string, unknown>,
callback: HandlerCallback
) => {
elizaLogger.info("ZG_UPLOAD action started", {
Expand All @@ -131,18 +131,20 @@ export const zgUpload: Action = {

try {
// Update state if needed
if (!state) {
// Initialize or update state
let currentState = state;
if (!currentState) {
elizaLogger.debug("No state provided, composing new state");
state = (await runtime.composeState(message)) as State;
currentState = (await runtime.composeState(message)) as State;
} else {
elizaLogger.debug("Updating existing state");
state = await runtime.updateRecentMessageState(state);
currentState = await runtime.updateRecentMessageState(currentState);
}

// Compose upload context
elizaLogger.debug("Composing upload context");
const uploadContext = composeContext({
state,
state: currentState,
template: uploadTemplate,
});

Expand Down Expand Up @@ -307,7 +309,7 @@ export const zgUpload: Action = {

// Start upload monitoring
const startTime = Date.now();
let fileStats;
let fileStats: Stats;
try {
fileStats = await fs.stat(sanitizedPath);
elizaLogger.debug("File stats retrieved", {
Expand Down Expand Up @@ -365,7 +367,7 @@ export const zgUpload: Action = {
const provider = new ethers.JsonRpcProvider(runtime.getSetting("ZEROG_EVM_RPC"));
const signer = new ethers.Wallet(runtime.getSetting("ZEROG_PRIVATE_KEY"), provider);
const indexer = new Indexer(runtime.getSetting("ZEROG_INDEXER_RPC"));
const flowContract = getFlowContract(runtime.getSetting("ZEROG_FLOW_ADDRESS"), signer);
const flowContract = getFlowContract(runtime.getSetting("ZEROG_FLOW_ADDRESS"), signer as any);

// Upload file to ZeroG
elizaLogger.info("Starting file upload to ZeroG", {
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-0g/src/utils/security.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { promises as fs } from 'fs';
import path from 'path';
import { promises as fs } from 'node:fs';
import path from 'node:path';

export interface SecurityConfig {
maxFileSize: number;
Expand Down
41 changes: 41 additions & 0 deletions packages/plugin-0x/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"noUnusedVariables": "error"
},
"suspicious": {
"noExplicitAny": "error"
},
"style": {
"useConst": "error",
"useImportType": "off"
}
}
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 4,
"lineWidth": 100
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"trailingCommas": "es5"
}
},
"files": {
"ignore": [
"dist/**/*",
"extra/**/*",
"node_modules/**/*"
]
}
}
12 changes: 10 additions & 2 deletions packages/plugin-0x/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,21 @@
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --format esm --dts --watch",
"test": "vitest run"
"test": "vitest run",
"lint": "biome check src/",
"lint:fix": "biome check --apply src/",
"format": "biome format src/",
"format:fix": "biome format --write src/"
},
"dependencies": {
"@elizaos/core": "workspace:*",
"whatwg-url": "7.1.0",
"@0x/swap-ts-sdk": "2.1.1"
},
"devDependencies": {
"tsup": "^8.0.1"
"tsup": "^8.0.1",
"@biomejs/biome": "1.5.3",
"vitest": "^2.1.5"
},
"peerDependencies": {
"@elizaos/core": "workspace:*",
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin-0x/src/EVMtokenRegistry.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { elizaLogger } from "@elizaos/core";
import {
Chains,
TokenMetadata,
TrustWalletGithubJson,
TrustWalletTokenMetadata,
type TokenMetadata,
type TrustWalletGithubJson,
type TrustWalletTokenMetadata,
} from "./types";
import { NATIVE_TOKENS } from "./constants";

Expand Down
Loading

0 comments on commit 0725b41

Please sign in to comment.