Skip to content

Commit 3a10ce5

Browse files
committed
updates
1 parent 4bc0f3e commit 3a10ce5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+10002
-191
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ characters/**/private/
5252
characters/knowledge
5353
characters/qkntl_iris.character.json
5454
characters/qkntl_cipher.character.json
55+
characters/flaunchy.character.json
5556

5657
packages/core/src/providers/cache
5758
packages/core/src/providers/cache/*

.gitignore.temp

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ packages/*
109109
!packages/core
110110
!packages/plugin-bootstrap
111111
!packages/plugin-di
112+
!packages/plugin-flaunch
112113
!packages/plugin-gitbook
113114
!packages/plugin-goat
114115
!packages/plugin-image-generation

Dockerfile

+50-38
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Use Node.js 23.3.0 as specified in package.json
1+
# Build stage
22
FROM node:23.3.0-slim AS builder
33

44
# Playwright environment variables
@@ -7,11 +7,13 @@ ENV PLAYWRIGHT_BROWSERS_PATH=/usr/bin \
77
PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium \
88
PLAYWRIGHT_SKIP_BROWSER_VALIDATION=1
99

10-
# Install pnpm globally and install necessary build tools
10+
# Install pnpm and build dependencies in a single layer
1111
RUN npm install -g pnpm@9.4.0 && \
1212
apt-get update && \
13-
apt-get install -y git python3 make g++ curl \
13+
apt-get install -y --no-install-recommends \
14+
git python3 make g++ curl \
1415
chromium \
16+
dbus \
1517
libglib2.0-0 \
1618
libnss3 \
1719
libnspr4 \
@@ -31,17 +33,28 @@ RUN npm install -g pnpm@9.4.0 && \
3133
libasound2 \
3234
libatspi2.0-0 && \
3335
apt-get clean && \
34-
rm -rf /var/lib/apt/lists/*
35-
36-
# Set Python 3 as the default python
37-
RUN ln -s /usr/bin/python3 /usr/bin/python
36+
rm -rf /var/lib/apt/lists/* && \
37+
# Set up D-Bus configuration
38+
mkdir -p /var/run/dbus && \
39+
dbus-uuidgen > /var/lib/dbus/machine-id && \
40+
mkdir -p /usr/share/dbus-1/services && \
41+
# Create D-Bus service file for Chrome Session Manager
42+
echo "[D-BUS Service]\
43+
Name=org.chromium.SessionManager\
44+
Exec=/usr/bin/chromium --no-sandbox\
45+
User=root" > /usr/share/dbus-1/services/org.chromium.SessionManager.service && \
46+
# Set Python 3 as the default python
47+
ln -s /usr/bin/python3 /usr/bin/python
3848

3949
WORKDIR /app
4050

41-
# Copy all files
42-
COPY . .
51+
# Copy package files first to leverage Docker cache
52+
COPY package.json pnpm-workspace.yaml .npmrc turbo.json ./
53+
COPY agent/package.json ./agent/
54+
COPY client/package.json ./client/
55+
COPY packages/*/package.json ./packages/
4356

44-
# Install dependencies with improved error handling and debugging
57+
# Install dependencies with improved caching
4558
RUN pnpm install --frozen-lockfile || \
4659
(echo "Frozen lockfile install failed, trying without..." && \
4760
pnpm install --no-frozen-lockfile) && \
@@ -50,27 +63,24 @@ RUN pnpm install --frozen-lockfile || \
5063
# Debug workspace packages
5164
pnpm list -r | grep "@elizaos" || echo "No workspace packages found!"
5265

53-
# Build with detailed logging
66+
# Copy the rest of the files after dependency installation
67+
COPY . .
68+
69+
# Build with detailed logging but cleaner approach
5470
RUN set -ex && \
5571
for i in 1 2 3; do \
5672
echo "Build attempt $i" && \
57-
(PNPM_DEBUG=1 DEBUG=* TURBO_LOG_VERBOSITY=verbose pnpm build-docker 2>&1 | tee build_attempt_${i}.log) && exit 0 || \
58-
(echo "=== Build Failure Details for Attempt ${i} ===" && \
59-
cat build_attempt_${i}.log && \
60-
echo "=== End of Build Failure Details ===" && \
61-
echo "Build failed, retrying..." && \
73+
(PNPM_DEBUG=1 DEBUG=* TURBO_LOG_VERBOSITY=verbose pnpm build-docker 2>&1) && break || \
74+
(echo "Build failed, retrying..." && \
6275
sleep 5) \
6376
done && \
64-
echo "All build attempts failed" && \
65-
echo "=== All Build Logs ===" && \
66-
cat build_attempt_*.log && \
67-
exit 1
68-
69-
# Prune for production
70-
RUN pnpm prune --prod && \
71-
echo "Production pruning completed"
77+
# Prune for production
78+
pnpm prune --prod && \
79+
echo "Production pruning completed" && \
80+
# Remove build logs to reduce image size
81+
rm -rf build_attempt_*.log || true
7282

73-
# Final stage
83+
# Runtime stage
7484
FROM node:23.3.0-slim
7585

7686
# Playwright environment variables
@@ -79,13 +89,14 @@ ENV PLAYWRIGHT_BROWSERS_PATH=/usr/bin \
7989
PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium \
8090
PLAYWRIGHT_SKIP_BROWSER_VALIDATION=1
8191

82-
# Install runtime dependencies and certificates first
92+
# Install runtime dependencies in a single layer
8393
RUN apt-get update && \
8494
apt-get upgrade -y && \
8595
apt-get install -y --no-install-recommends \
8696
git \
8797
python3 \
8898
python3-pip \
99+
dbus \
89100
curl \
90101
node-gyp \
91102
ffmpeg \
@@ -127,26 +138,23 @@ RUN apt-get update && \
127138
libcairo2 \
128139
libasound2 \
129140
libatspi2.0-0 && \
130-
apt-get clean && \
131-
rm -rf /var/lib/apt/lists/*
132-
133-
# Install pnpm, PM2, and Google Cloud SDK
134-
RUN npm install -g pnpm@9.4.0 pm2@latest && \
135-
apt-get update && \
136-
apt-get install -y git python3 curl gnupg && \
141+
# Install Google Cloud SDK in same layer
137142
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
138143
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && \
139144
apt-get update && \
140145
apt-get install -y google-cloud-sdk && \
146+
# Install pnpm and PM2
147+
npm install -g pnpm@9.4.0 pm2@latest && \
148+
# Clean up
141149
apt-get clean && \
142-
rm -rf /var/lib/apt/lists/*
143-
144-
RUN mkdir -p /app/logs && \
150+
rm -rf /var/lib/apt/lists/* && \
151+
# Set up directories
152+
mkdir -p /app/logs && \
145153
chmod 755 /app/logs
146154

147155
WORKDIR /app
148156

149-
# Copy necessary files from builder
157+
# Copy only necessary files from builder
150158
COPY --from=builder /app/package.json ./
151159
COPY --from=builder /app/pnpm-workspace.yaml ./
152160
COPY --from=builder /app/.npmrc ./
@@ -157,6 +165,10 @@ COPY --from=builder /app/client ./client
157165
COPY --from=builder /app/packages ./packages
158166
COPY --from=builder /app/scripts ./scripts
159167

168+
# Copy D-Bus configuration from builder
169+
COPY --from=builder /var/lib/dbus/machine-id /var/lib/dbus/
170+
COPY --from=builder /usr/share/dbus-1/services/org.chromium.SessionManager.service /usr/share/dbus-1/services/
171+
160172
# Create necessary directories
161173
RUN mkdir -p characters && \
162174
mkdir -p characters/knowledge
@@ -171,7 +183,7 @@ RUN service cron start
171183
EXPOSE 3000 5173
172184

173185
# CMD that fetches and runs the entrypoint script
174-
CMD sh -c 'echo "Fetching latest container entrypoint script..." && \
186+
CMD dbus-daemon --system --fork && sh -c 'echo "Fetching latest container entrypoint script..." && \
175187
gsutil cp "gs://${AGENTS_BUCKET_NAME}/_project-files/container-entrypoint.sh" /app/container-entrypoint.sh && \
176188
chmod +x /app/container-entrypoint.sh && \
177189
/app/container-entrypoint.sh'

agent/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@
3030
"@elizaos/core": "workspace:*",
3131
"@elizaos/plugin-bootstrap": "workspace:*",
3232
"@elizaos/plugin-di": "workspace:*",
33+
"@elizaos/plugin-flaunch": "workspace:*",
3334
"@elizaos/plugin-gitbook": "workspace:*",
3435
"@elizaos/plugin-goat": "workspace:*",
3536
"@elizaos/plugin-image-generation": "workspace:*",
3637
"@elizaos/plugin-lit": "workspace:*",
3738
"@elizaos/plugin-news": "workspace:*",
3839
"@elizaos/plugin-node": "workspace:*",
3940
"@elizaos/plugin-quick-intel": "workspace:*",
41+
"@elizaos/plugin-rss": "workspace:*",
4042
"@elizaos/plugin-tee": "workspace:*",
4143
"@elizaos/plugin-tee-log": "workspace:*",
4244
"@elizaos/plugin-tee-marlin": "workspace:*",

agent/src/index.ts

+8-7
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ import { fileURLToPath } from "url";
4848
import yargs from "yargs";
4949
import { imgflipPlugin } from "@elizaos/plugin-imgflip";
5050
import { quickIntelPlugin } from "@elizaos/plugin-quick-intel";
51+
import { flaunchPlugin } from "@elizaos/plugin-flaunch";
52+
import { rssPlugin } from "@elizaos/plugin-rss";
5153

5254
const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
5355
const __dirname = path.dirname(__filename); // get the name of the directory
@@ -588,6 +590,7 @@ export async function initializeClients(
588590

589591
if (clientTypes.includes(Clients.FARCASTER)) {
590592
const farcasterClient = await FarcasterClientInterface.start(runtime);
593+
591594
if (farcasterClient) {
592595
clients.farcaster = farcasterClient;
593596
}
@@ -658,11 +661,11 @@ export async function createAgent(
658661

659662
let goatPlugin: any | undefined;
660663

661-
if (getSecret(character, "EVM_PRIVATE_KEY")) {
662-
goatPlugin = await createGoatPlugin((secret) =>
663-
getSecret(character, secret)
664-
);
665-
}
664+
// if (getSecret(character, "EVM_PRIVATE_KEY")) {
665+
// goatPlugin = await createGoatPlugin((secret) =>
666+
// getSecret(character, secret)
667+
// );
668+
// }
666669

667670
// Initialize Opacity adapter if environment variables are present
668671
let verifiableInferenceAdapter: any;
@@ -705,8 +708,6 @@ export async function createAgent(
705708
getSecret(character, "EVM_RPC_URL")
706709
? litPlugin
707710
: null,
708-
getSecret(character, "DCAP_EVM_PRIVATE_KEY") &&
709-
710711
getSecret(character, "QUICKINTEL_API_KEY")
711712
? quickIntelPlugin
712713
: null,

packages/client-discord/src/messages.ts

+3
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,9 @@ export class MessageManager {
325325
this.runtime.agentId
326326
)
327327
: undefined,
328+
metadata: attachments?.[0]?.url && attachments?.[0]?.source == 'Image' ?
329+
{ imageData: { url: attachments?.[0]?.url, contentType: "image/jpeg" } } as { imageData: { url: string, contentType: string } }
330+
: undefined
328331
};
329332

330333
const userMessage = {

packages/client-discord/src/templates.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ Note that {{agentName}} is capable of reading/seeing/hearing various forms of me
117117
118118
{{messageDirections}}
119119
120+
{{currentMessage}}
121+
120122
{{recentMessages}}
121123
122-
# Instructions: Write the next message for {{agentName}}. Include an action, if appropriate. {{actionNames}}
124+
# Instructions: Write the next message for {{agentName}}. Include an optional action if appropriate. {{actionNames}}
123125
` + messageCompletionFooter;
124126

125127
export const discordAutoPostTemplate =

packages/client-farcaster/src/client.ts

+9
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,21 @@ export class FarcasterClient {
161161
},
162162
}
163163
: {}),
164+
embeds: notification.cast!.embeds || [],
164165
timestamp: new Date(notification.cast!.timestamp),
165166
};
166167
mentions.push(cast);
167168
this.cache.set(`farcaster/cast/${cast.hash}`, cast);
168169
});
169170

171+
// console.log('Notifications Counts:', mentions?.length)
172+
173+
// const neynarMentionMarkedAsSeen = await this.neynar.markNotificationsAsSeen({
174+
// signerUuid: this.signerUuid
175+
// });
176+
177+
// console.log('Notifications Marked as Seen:', neynarMentionMarkedAsSeen);
178+
170179
return mentions;
171180
}
172181

packages/client-farcaster/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const FarcasterClientInterface: Client = {
7373

7474
// Start all services
7575
await manager.start();
76-
runtime.clients.farcaster = manager;
76+
//runtime.clients.farcaster = manager;
7777
return manager;
7878
},
7979

0 commit comments

Comments
 (0)