Skip to content

Commit

Permalink
Merge branch 'develop' into add_perplexica_search
Browse files Browse the repository at this point in the history
  • Loading branch information
samarth30 authored Feb 3, 2025
2 parents 4ca4cf5 + a00ab78 commit 63cc113
Show file tree
Hide file tree
Showing 82 changed files with 2,313 additions and 204 deletions.
2 changes: 0 additions & 2 deletions agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,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
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@polkadot/types-codec": "10.13.1",
"@polkadot/keyring": "12.6.2",
"@ai-sdk/provider": "1.0.6",
"@ai-sdk/provider-utils": "2.1.2",
"@ai-sdk/provider-utils": "2.1.6",
"cookie": "0.7.0",
"bs58": "5.0.0",
"@coral-xyz/anchor": "0.28.0"
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
30 changes: 15 additions & 15 deletions packages/plugin-0x/src/actions/getIndicativePrice.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
Action,
IAgentRuntime,
Memory,
State,
HandlerCallback,
type Action,
type IAgentRuntime,
type Memory,
type State,
type HandlerCallback,
elizaLogger,
composeContext,
ModelClass,
Expand All @@ -13,7 +13,7 @@ import {
import { createClientV2 } from "@0x/swap-ts-sdk";
import { getIndicativePriceTemplate } from "../templates";
import { z } from "zod";
import { Chains, GetIndicativePriceResponse, PriceInquiry } from "../types";
import { Chains, type GetIndicativePriceResponse, type PriceInquiry } from "../types";
import { parseUnits } from "viem";
import { CHAIN_NAMES, ZX_MEMORY } from "../constants";
import { EVMTokenRegistry } from "../EVMtokenRegistry";
Expand Down Expand Up @@ -45,17 +45,17 @@ export const getIndicativePrice: Action = {
runtime: IAgentRuntime,
message: Memory,
state: State,
options: Record<string, unknown>,
_options: Record<string, unknown>,
callback: HandlerCallback
) => {
const supportedChains = Object.keys(Chains).join(" | ");

state = !state
const localState = !state
? await runtime.composeState(message, { supportedChains })
: await runtime.updateRecentMessageState(state);

const context = composeContext({
state,
state: localState,
template: getIndicativePriceTemplate,
});

Expand Down Expand Up @@ -86,7 +86,7 @@ export const getIndicativePrice: Action = {
text: `Unsupported chain: ${chain}. Supported chains are: ${Object.keys(
Chains
)
.filter((k) => isNaN(Number(k)))
.filter((k) => !Number.isNaN(Number(k)))
.join(", ")}`,
});
return;
Expand Down Expand Up @@ -148,10 +148,10 @@ export const getIndicativePrice: Action = {
// Format amounts to human-readable numbers
const buyAmount =
Number(price.buyAmount) /
Math.pow(10, buyTokenMetadata.decimals);
(10 ** buyTokenMetadata.decimals);
const sellAmount =
Number(price.sellAmount) /
Math.pow(10, sellTokenMetadata.decimals);
(10 ** sellTokenMetadata.decimals);

await storePriceInquiryToMemory(runtime, message, {
sellTokenObject: sellTokenMetadata,
Expand All @@ -163,13 +163,13 @@ export const getIndicativePrice: Action = {

// Updated formatted response to include chain
const formattedResponse = [
`πŸ’± Swap Details:`,
`────────────────`,
"πŸ’± Swap Details:",
"────────────────",
`πŸ“€ Sell: ${sellAmount.toFixed(4)} ${sellTokenMetadata.symbol}`,
`πŸ“₯ Buy: ${buyAmount.toFixed(4)} ${buyTokenMetadata.symbol}`,
`πŸ“Š Rate: 1 ${sellTokenMetadata.symbol} = ${(buyAmount / sellAmount).toFixed(4)} ${buyTokenMetadata.symbol}`,
`πŸ”— Chain: ${CHAIN_NAMES[chainId]}`,
`────────────────`,
"────────────────",
`πŸ’« Happy with the price? Type 'quote' to continue`,
].join("\n");

Expand Down
Loading

0 comments on commit 63cc113

Please sign in to comment.