Skip to content

Commit

Permalink
Merge branch 'develop' into plugin-evm-oz-governance
Browse files Browse the repository at this point in the history
  • Loading branch information
thetechnocratic authored Jan 5, 2025
2 parents 3757131 + 1cebf4d commit c937b6b
Show file tree
Hide file tree
Showing 26 changed files with 369 additions and 206 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ETERNALAI_MODEL= # Default: "neuralmagic/Meta-Llama-3.1-405B-Inst
ETERNALAI_API_KEY=
ETERNAL_AI_LOG_REQUEST=false #Default: false

GROK_API_KEY= # GROK API Key
GROK_API_KEY= # GROK/xAI API Key
GROQ_API_KEY= # Starts with gsk_
OPENROUTER_API_KEY=
GOOGLE_GENERATIVE_AI_API_KEY= # Gemini API key
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
run: sudo apt-get install -y protobuf-compiler

- name: Install dependencies
run: pnpm install
run: pnpm install -r --no-frozen-lockfile

- name: Build packages
run: pnpm run build
Expand Down
157 changes: 156 additions & 1 deletion CHANGELOG.md

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions packages/adapter-sqljs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
import { v4 } from "uuid";
import { sqliteTables } from "./sqliteTables.ts";
import { Database } from "./types.ts";
import { elizaLogger } from "@elizaos/core";

export class SqlJsDatabaseAdapter
extends DatabaseAdapter<Database>
Expand Down Expand Up @@ -88,9 +89,9 @@ export class SqlJsDatabaseAdapter
params.agentId,
...params.roomIds,
];
console.log({ queryParams });
elizaLogger.log({ queryParams });
stmt.bind(queryParams);
console.log({ queryParams });
elizaLogger.log({ queryParams });

const memories: Memory[] = [];
while (stmt.step()) {
Expand Down Expand Up @@ -162,7 +163,7 @@ export class SqlJsDatabaseAdapter
stmt.free();
return true;
} catch (error) {
console.log("Error creating account", error);
elizaLogger.error("Error creating account", error);
return false;
}
}
Expand Down Expand Up @@ -633,7 +634,7 @@ export class SqlJsDatabaseAdapter
stmt.run([roomId ?? (v4() as UUID)]);
stmt.free();
} catch (error) {
console.log("Error creating room", error);
elizaLogger.error("Error creating room", error);
}
return roomId as UUID;
}
Expand Down Expand Up @@ -685,7 +686,7 @@ export class SqlJsDatabaseAdapter
stmt.free();
return true;
} catch (error) {
console.log("Error adding participant", error);
elizaLogger.error("Error adding participant", error);
return false;
}
}
Expand All @@ -699,7 +700,7 @@ export class SqlJsDatabaseAdapter
stmt.free();
return true;
} catch (error) {
console.log("Error removing participant", error);
elizaLogger.error("Error removing participant", error);
return false;
}
}
Expand Down Expand Up @@ -735,7 +736,7 @@ export class SqlJsDatabaseAdapter
}
stmt.free();
} catch (error) {
console.log("Error fetching relationship", error);
elizaLogger.error("Error fetching relationship", error);
}
return relationship;
}
Expand Down Expand Up @@ -798,7 +799,7 @@ export class SqlJsDatabaseAdapter
stmt.free();
return true;
} catch (error) {
console.log("Error removing cache", error);
elizaLogger.error("Error removing cache", error);
return false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/client-lens/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export class LensClient {

return timeline;
} catch (error) {
console.log(error);
elizaLogger.error(error);
throw new Error("client-lens:: getTimeline");
}
}
Expand Down Expand Up @@ -305,7 +305,7 @@ export class LensClient {
private async createPostMomoka(
contentURI: string
): Promise<BroadcastResult | undefined> {
console.log("createPostMomoka");
elizaLogger.log("createPostMomoka");
// gasless + signless if they enabled the lens profile manager
if (this.authenticatedProfile?.signless) {
const broadcastResult = await this.core.publication.postOnMomoka({
Expand All @@ -319,7 +319,7 @@ export class LensClient {
await this.core.publication.createMomokaPostTypedData({
contentURI,
});
console.log("typedDataResult", typedDataResult);
elizaLogger.log("typedDataResult", typedDataResult);
const { id, typedData } = typedDataResult.unwrap();

const signedTypedData = await this.account.signTypedData({
Expand Down
25 changes: 13 additions & 12 deletions packages/client-slack/src/examples/standalone-attachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import { SlackClientProvider } from "../providers/slack-client.provider";
import { AttachmentManager } from "../attachments";
import { SlackConfig } from "../types/slack-types";
import path from "path";
import { elizaLogger } from "@elizaos/core";

// Load environment variables
config({ path: path.resolve(__dirname, "../../../.env") });

console.log("\n=== Starting Slack Attachment Example ===\n");
elizaLogger.log("\n=== Starting Slack Attachment Example ===\n");

// Load environment variables
const slackConfig: SlackConfig = {
Expand All @@ -20,35 +21,35 @@ const slackConfig: SlackConfig = {
botId: process.env.SLACK_BOT_ID || "",
};

console.log("Environment variables loaded:");
elizaLogger.log("Environment variables loaded:");
Object.entries(slackConfig).forEach(([key, value]) => {
if (value) {
console.log(`${key}: ${value.slice(0, 4)}...${value.slice(-4)}`);
elizaLogger.log(`${key}: ${value.slice(0, 4)}...${value.slice(-4)}`);
} else {
console.error(`Missing ${key}`);
}
});

async function runExample() {
try {
console.log("\nInitializing Slack client...");
elizaLogger.log("\nInitializing Slack client...");
const provider = new SlackClientProvider(slackConfig);
const client = provider.getContext().client;

console.log("\nValidating Slack connection...");
elizaLogger.log("\nValidating Slack connection...");
const isValid = await provider.validateConnection();
if (!isValid) {
throw new Error("Failed to validate Slack connection");
}
console.log("✓ Successfully connected to Slack");
elizaLogger.log("✓ Successfully connected to Slack");

// Test file upload
const channelId = process.env.SLACK_CHANNEL_ID;
if (!channelId) {
throw new Error("SLACK_CHANNEL_ID is required");
}

console.log("\nSending test message with attachment...");
elizaLogger.log("\nSending test message with attachment...");
const testMessage = "Here is a test message with an attachment";

// Create a test file
Expand All @@ -71,7 +72,7 @@ async function runExample() {
initial_comment: testMessage,
});

console.log("✓ File uploaded successfully");
elizaLogger.log("✓ File uploaded successfully");

// Initialize AttachmentManager
const runtime = {
Expand All @@ -83,7 +84,7 @@ async function runExample() {

// Process the uploaded file
if (fileUpload.file) {
console.log("\nProcessing attachment...");
elizaLogger.log("\nProcessing attachment...");
const processedAttachment =
await attachmentManager.processAttachment({
id: fileUpload.file.id,
Expand All @@ -94,19 +95,19 @@ async function runExample() {
title: fileUpload.file.title || "",
});

console.log("✓ Attachment processed:", processedAttachment);
elizaLogger.log("✓ Attachment processed:", processedAttachment);
}

// Cleanup
fs.unlinkSync(testFilePath);
console.log("\n✓ Test completed successfully");
elizaLogger.log("\n✓ Test completed successfully");
} catch (error) {
console.error("Error:", error);
process.exit(1);
}
}

runExample().then(() => {
console.log("\n=== Example completed ===\n");
elizaLogger.log("\n=== Example completed ===\n");
process.exit(0);
});
13 changes: 7 additions & 6 deletions packages/client-slack/src/examples/standalone-summarize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { SlackClientProvider } from '../providers/slack-client.provider';
import { SlackConfig } from '../types/slack-types';
import { config } from 'dotenv';
import { resolve } from 'path';
import { elizaLogger } from "@elizaos/core";

// Load environment variables from root .env
const envPath = resolve(__dirname, '../../../../.env');
console.log('Loading environment from:', envPath);
elizaLogger.log('Loading environment from:', envPath);
config({ path: envPath });

function validateEnvironment() {
Expand All @@ -25,12 +26,12 @@ function validateEnvironment() {
return false;
}

console.log('Environment variables loaded successfully');
elizaLogger.log('Environment variables loaded successfully');
return true;
}

async function main() {
console.log('\n=== Starting Summarize Conversation Example ===\n');
elizaLogger.log('\n=== Starting Summarize Conversation Example ===\n');

if (!validateEnvironment()) {
throw new Error('Environment validation failed');
Expand All @@ -54,10 +55,10 @@ async function main() {
if (!isConnected) {
throw new Error('Failed to connect to Slack');
}
console.log('✓ Successfully connected to Slack');
elizaLogger.log('✓ Successfully connected to Slack');

const channel = process.env.SLACK_CHANNEL_ID!;
console.log(`\nSending messages to channel: ${channel}`);
elizaLogger.log(`\nSending messages to channel: ${channel}`);

// First, send some test messages
await slackProvider.sendMessage(
Expand Down Expand Up @@ -91,7 +92,7 @@ async function main() {

// Keep the process running
await new Promise(resolve => setTimeout(resolve, 10000));
console.log('\n✓ Example completed successfully');
elizaLogger.log('\n✓ Example completed successfully');
process.exit(0);
}

Expand Down
13 changes: 7 additions & 6 deletions packages/client-slack/src/examples/standalone-transcribe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { SlackClientProvider } from '../providers/slack-client.provider';
import { SlackConfig } from '../types/slack-types';
import { config } from 'dotenv';
import { resolve } from 'path';
import { elizaLogger } from "@elizaos/core";

// Load environment variables from root .env
const envPath = resolve(__dirname, '../../../../.env');
console.log('Loading environment from:', envPath);
elizaLogger.log('Loading environment from:', envPath);
config({ path: envPath });

function validateEnvironment() {
Expand All @@ -25,12 +26,12 @@ function validateEnvironment() {
return false;
}

console.log('Environment variables loaded successfully');
elizaLogger.log('Environment variables loaded successfully');
return true;
}

async function main() {
console.log('\n=== Starting Transcribe Media Example ===\n');
elizaLogger.log('\n=== Starting Transcribe Media Example ===\n');

if (!validateEnvironment()) {
throw new Error('Environment validation failed');
Expand All @@ -54,10 +55,10 @@ async function main() {
if (!isConnected) {
throw new Error('Failed to connect to Slack');
}
console.log('✓ Successfully connected to Slack');
elizaLogger.log('✓ Successfully connected to Slack');

const channel = process.env.SLACK_CHANNEL_ID!;
console.log(`\nSending messages to channel: ${channel}`);
elizaLogger.log(`\nSending messages to channel: ${channel}`);

// First, send a test message with a media attachment
await slackProvider.getContext().client.chat.postMessage({
Expand All @@ -80,7 +81,7 @@ async function main() {

// Keep the process running
await new Promise(resolve => setTimeout(resolve, 10000));
console.log('\n✓ Example completed successfully');
elizaLogger.log('\n✓ Example completed successfully');
process.exit(0);
}

Expand Down
3 changes: 2 additions & 1 deletion packages/client-slack/src/providers/slack-client.provider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { WebClient } from '@slack/web-api';
import { SlackConfig, SlackClientContext } from '../types/slack-types';
import { SlackUtils, RetryOptions } from '../utils/slack-utils';
import { elizaLogger } from "@elizaos/core";

export class SlackClientProvider {
private client: WebClient;
Expand Down Expand Up @@ -34,7 +35,7 @@ export class SlackClientProvider {

if (result.ok) {
this.config.botId = result.user_id || this.config.botId;
console.log('Bot ID:', this.config.botId);
elizaLogger.log('Bot ID:', this.config.botId);
return true;
}
return false;
Expand Down
Loading

0 comments on commit c937b6b

Please sign in to comment.