Skip to content

Commit 5849435

Browse files
authored
Merge branch 'develop' into main
2 parents 03f8028 + 1cebf4d commit 5849435

File tree

22 files changed

+209
-203
lines changed

22 files changed

+209
-203
lines changed

packages/adapter-sqljs/src/index.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
import { v4 } from "uuid";
1717
import { sqliteTables } from "./sqliteTables.ts";
1818
import { Database } from "./types.ts";
19+
import { elizaLogger } from "@elizaos/core";
1920

2021
export class SqlJsDatabaseAdapter
2122
extends DatabaseAdapter<Database>
@@ -88,9 +89,9 @@ export class SqlJsDatabaseAdapter
8889
params.agentId,
8990
...params.roomIds,
9091
];
91-
console.log({ queryParams });
92+
elizaLogger.log({ queryParams });
9293
stmt.bind(queryParams);
93-
console.log({ queryParams });
94+
elizaLogger.log({ queryParams });
9495

9596
const memories: Memory[] = [];
9697
while (stmt.step()) {
@@ -162,7 +163,7 @@ export class SqlJsDatabaseAdapter
162163
stmt.free();
163164
return true;
164165
} catch (error) {
165-
console.log("Error creating account", error);
166+
elizaLogger.error("Error creating account", error);
166167
return false;
167168
}
168169
}
@@ -633,7 +634,7 @@ export class SqlJsDatabaseAdapter
633634
stmt.run([roomId ?? (v4() as UUID)]);
634635
stmt.free();
635636
} catch (error) {
636-
console.log("Error creating room", error);
637+
elizaLogger.error("Error creating room", error);
637638
}
638639
return roomId as UUID;
639640
}
@@ -685,7 +686,7 @@ export class SqlJsDatabaseAdapter
685686
stmt.free();
686687
return true;
687688
} catch (error) {
688-
console.log("Error adding participant", error);
689+
elizaLogger.error("Error adding participant", error);
689690
return false;
690691
}
691692
}
@@ -699,7 +700,7 @@ export class SqlJsDatabaseAdapter
699700
stmt.free();
700701
return true;
701702
} catch (error) {
702-
console.log("Error removing participant", error);
703+
elizaLogger.error("Error removing participant", error);
703704
return false;
704705
}
705706
}
@@ -735,7 +736,7 @@ export class SqlJsDatabaseAdapter
735736
}
736737
stmt.free();
737738
} catch (error) {
738-
console.log("Error fetching relationship", error);
739+
elizaLogger.error("Error fetching relationship", error);
739740
}
740741
return relationship;
741742
}
@@ -798,7 +799,7 @@ export class SqlJsDatabaseAdapter
798799
stmt.free();
799800
return true;
800801
} catch (error) {
801-
console.log("Error removing cache", error);
802+
elizaLogger.error("Error removing cache", error);
802803
return false;
803804
}
804805
}

packages/client-lens/src/client.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ export class LensClient {
263263

264264
return timeline;
265265
} catch (error) {
266-
console.log(error);
266+
elizaLogger.error(error);
267267
throw new Error("client-lens:: getTimeline");
268268
}
269269
}
@@ -305,7 +305,7 @@ export class LensClient {
305305
private async createPostMomoka(
306306
contentURI: string
307307
): Promise<BroadcastResult | undefined> {
308-
console.log("createPostMomoka");
308+
elizaLogger.log("createPostMomoka");
309309
// gasless + signless if they enabled the lens profile manager
310310
if (this.authenticatedProfile?.signless) {
311311
const broadcastResult = await this.core.publication.postOnMomoka({
@@ -319,7 +319,7 @@ export class LensClient {
319319
await this.core.publication.createMomokaPostTypedData({
320320
contentURI,
321321
});
322-
console.log("typedDataResult", typedDataResult);
322+
elizaLogger.log("typedDataResult", typedDataResult);
323323
const { id, typedData } = typedDataResult.unwrap();
324324

325325
const signedTypedData = await this.account.signTypedData({

packages/client-slack/src/examples/standalone-attachment.ts

+13-12
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import { SlackClientProvider } from "../providers/slack-client.provider";
33
import { AttachmentManager } from "../attachments";
44
import { SlackConfig } from "../types/slack-types";
55
import path from "path";
6+
import { elizaLogger } from "@elizaos/core";
67

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

10-
console.log("\n=== Starting Slack Attachment Example ===\n");
11+
elizaLogger.log("\n=== Starting Slack Attachment Example ===\n");
1112

1213
// Load environment variables
1314
const slackConfig: SlackConfig = {
@@ -20,35 +21,35 @@ const slackConfig: SlackConfig = {
2021
botId: process.env.SLACK_BOT_ID || "",
2122
};
2223

23-
console.log("Environment variables loaded:");
24+
elizaLogger.log("Environment variables loaded:");
2425
Object.entries(slackConfig).forEach(([key, value]) => {
2526
if (value) {
26-
console.log(`${key}: ${value.slice(0, 4)}...${value.slice(-4)}`);
27+
elizaLogger.log(`${key}: ${value.slice(0, 4)}...${value.slice(-4)}`);
2728
} else {
2829
console.error(`Missing ${key}`);
2930
}
3031
});
3132

3233
async function runExample() {
3334
try {
34-
console.log("\nInitializing Slack client...");
35+
elizaLogger.log("\nInitializing Slack client...");
3536
const provider = new SlackClientProvider(slackConfig);
3637
const client = provider.getContext().client;
3738

38-
console.log("\nValidating Slack connection...");
39+
elizaLogger.log("\nValidating Slack connection...");
3940
const isValid = await provider.validateConnection();
4041
if (!isValid) {
4142
throw new Error("Failed to validate Slack connection");
4243
}
43-
console.log("✓ Successfully connected to Slack");
44+
elizaLogger.log("✓ Successfully connected to Slack");
4445

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

51-
console.log("\nSending test message with attachment...");
52+
elizaLogger.log("\nSending test message with attachment...");
5253
const testMessage = "Here is a test message with an attachment";
5354

5455
// Create a test file
@@ -71,7 +72,7 @@ async function runExample() {
7172
initial_comment: testMessage,
7273
});
7374

74-
console.log("✓ File uploaded successfully");
75+
elizaLogger.log("✓ File uploaded successfully");
7576

7677
// Initialize AttachmentManager
7778
const runtime = {
@@ -83,7 +84,7 @@ async function runExample() {
8384

8485
// Process the uploaded file
8586
if (fileUpload.file) {
86-
console.log("\nProcessing attachment...");
87+
elizaLogger.log("\nProcessing attachment...");
8788
const processedAttachment =
8889
await attachmentManager.processAttachment({
8990
id: fileUpload.file.id,
@@ -94,19 +95,19 @@ async function runExample() {
9495
title: fileUpload.file.title || "",
9596
});
9697

97-
console.log("✓ Attachment processed:", processedAttachment);
98+
elizaLogger.log("✓ Attachment processed:", processedAttachment);
9899
}
99100

100101
// Cleanup
101102
fs.unlinkSync(testFilePath);
102-
console.log("\n✓ Test completed successfully");
103+
elizaLogger.log("\n✓ Test completed successfully");
103104
} catch (error) {
104105
console.error("Error:", error);
105106
process.exit(1);
106107
}
107108
}
108109

109110
runExample().then(() => {
110-
console.log("\n=== Example completed ===\n");
111+
elizaLogger.log("\n=== Example completed ===\n");
111112
process.exit(0);
112113
});

packages/client-slack/src/examples/standalone-summarize.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import { SlackClientProvider } from '../providers/slack-client.provider';
22
import { SlackConfig } from '../types/slack-types';
33
import { config } from 'dotenv';
44
import { resolve } from 'path';
5+
import { elizaLogger } from "@elizaos/core";
56

67
// Load environment variables from root .env
78
const envPath = resolve(__dirname, '../../../../.env');
8-
console.log('Loading environment from:', envPath);
9+
elizaLogger.log('Loading environment from:', envPath);
910
config({ path: envPath });
1011

1112
function validateEnvironment() {
@@ -25,12 +26,12 @@ function validateEnvironment() {
2526
return false;
2627
}
2728

28-
console.log('Environment variables loaded successfully');
29+
elizaLogger.log('Environment variables loaded successfully');
2930
return true;
3031
}
3132

3233
async function main() {
33-
console.log('\n=== Starting Summarize Conversation Example ===\n');
34+
elizaLogger.log('\n=== Starting Summarize Conversation Example ===\n');
3435

3536
if (!validateEnvironment()) {
3637
throw new Error('Environment validation failed');
@@ -54,10 +55,10 @@ async function main() {
5455
if (!isConnected) {
5556
throw new Error('Failed to connect to Slack');
5657
}
57-
console.log('✓ Successfully connected to Slack');
58+
elizaLogger.log('✓ Successfully connected to Slack');
5859

5960
const channel = process.env.SLACK_CHANNEL_ID!;
60-
console.log(`\nSending messages to channel: ${channel}`);
61+
elizaLogger.log(`\nSending messages to channel: ${channel}`);
6162

6263
// First, send some test messages
6364
await slackProvider.sendMessage(
@@ -91,7 +92,7 @@ async function main() {
9192

9293
// Keep the process running
9394
await new Promise(resolve => setTimeout(resolve, 10000));
94-
console.log('\n✓ Example completed successfully');
95+
elizaLogger.log('\n✓ Example completed successfully');
9596
process.exit(0);
9697
}
9798

packages/client-slack/src/examples/standalone-transcribe.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import { SlackClientProvider } from '../providers/slack-client.provider';
22
import { SlackConfig } from '../types/slack-types';
33
import { config } from 'dotenv';
44
import { resolve } from 'path';
5+
import { elizaLogger } from "@elizaos/core";
56

67
// Load environment variables from root .env
78
const envPath = resolve(__dirname, '../../../../.env');
8-
console.log('Loading environment from:', envPath);
9+
elizaLogger.log('Loading environment from:', envPath);
910
config({ path: envPath });
1011

1112
function validateEnvironment() {
@@ -25,12 +26,12 @@ function validateEnvironment() {
2526
return false;
2627
}
2728

28-
console.log('Environment variables loaded successfully');
29+
elizaLogger.log('Environment variables loaded successfully');
2930
return true;
3031
}
3132

3233
async function main() {
33-
console.log('\n=== Starting Transcribe Media Example ===\n');
34+
elizaLogger.log('\n=== Starting Transcribe Media Example ===\n');
3435

3536
if (!validateEnvironment()) {
3637
throw new Error('Environment validation failed');
@@ -54,10 +55,10 @@ async function main() {
5455
if (!isConnected) {
5556
throw new Error('Failed to connect to Slack');
5657
}
57-
console.log('✓ Successfully connected to Slack');
58+
elizaLogger.log('✓ Successfully connected to Slack');
5859

5960
const channel = process.env.SLACK_CHANNEL_ID!;
60-
console.log(`\nSending messages to channel: ${channel}`);
61+
elizaLogger.log(`\nSending messages to channel: ${channel}`);
6162

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

8182
// Keep the process running
8283
await new Promise(resolve => setTimeout(resolve, 10000));
83-
console.log('\n✓ Example completed successfully');
84+
elizaLogger.log('\n✓ Example completed successfully');
8485
process.exit(0);
8586
}
8687

packages/client-slack/src/providers/slack-client.provider.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { WebClient } from '@slack/web-api';
22
import { SlackConfig, SlackClientContext } from '../types/slack-types';
33
import { SlackUtils, RetryOptions } from '../utils/slack-utils';
4+
import { elizaLogger } from "@elizaos/core";
45

56
export class SlackClientProvider {
67
private client: WebClient;
@@ -34,7 +35,7 @@ export class SlackClientProvider {
3435

3536
if (result.ok) {
3637
this.config.botId = result.user_id || this.config.botId;
37-
console.log('Bot ID:', this.config.botId);
38+
elizaLogger.log('Bot ID:', this.config.botId);
3839
return true;
3940
}
4041
return false;

0 commit comments

Comments
 (0)