Skip to content

Commit d4c9e81

Browse files
authored
Merge branch 'develop' into plugin
2 parents 94e5f26 + 5d89ec3 commit d4c9e81

File tree

66 files changed

+7191
-548
lines changed

Some content is hidden

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

66 files changed

+7191
-548
lines changed

.env.example

+46
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,52 @@ TAVILY_API_KEY=
481481
VERIFIABLE_INFERENCE_ENABLED=false # Set to false to disable verifiable inference
482482
VERIFIABLE_INFERENCE_PROVIDER=opacity # Options: opacity
483483

484+
484485
# Autonome Configuration
485486
AUTONOME_JWT_TOKEN=
486487
AUTONOME_RPC=https://wizard-bff-rpc.alt.technology/v1/bff/aaa/apps
488+
489+
####################################
490+
#### Akash Network Configuration ####
491+
####################################
492+
AKASH_ENV=mainnet
493+
AKASH_NET=https://raw.githubusercontent.com/ovrclk/net/master/mainnet
494+
RPC_ENDPOINT=https://rpc.akashnet.net:443
495+
AKASH_GAS_PRICES=0.025uakt
496+
AKASH_GAS_ADJUSTMENT=1.5
497+
AKASH_KEYRING_BACKEND=os
498+
AKASH_FROM=default
499+
AKASH_FEES=20000uakt
500+
AKASH_DEPOSIT=500000uakt
501+
AKASH_MNEMONIC=
502+
AKASH_WALLET_ADDRESS=
503+
# Akash Pricing API
504+
AKASH_PRICING_API_URL=https://console-api.akash.network/v1/pricing
505+
# Default values # 1 CPU = 1000 1GB = 1000000000 1GB = 1000000000
506+
AKASH_DEFAULT_CPU=1000
507+
AKASH_DEFAULT_MEMORY=1000000000
508+
AKASH_DEFAULT_STORAGE=1000000000
509+
AKASH_SDL=example.sdl.yml
510+
# Close deployment
511+
# Close all deployments = closeAll
512+
# Close a single deployment = dseq and add the value in AKASH_CLOSE_DSEQ
513+
AKASH_CLOSE_DEP=closeAll
514+
AKASH_CLOSE_DSEQ=19729929
515+
# Provider Info we added one to check you will have to pass this into the action
516+
AKASH_PROVIDER_INFO=akash1ccktptfkvdc67msasmesuy5m7gpc76z75kukpz
517+
# Deployment Status
518+
# AKASH_DEP_STATUS = dseq or param_passed when you are building you wil pass the dseq dinamically to test you
519+
# you can pass the dseq using AKASH_DEP_DSEQ 19729929 is an example of a dseq we test while build.
520+
AKASH_DEP_STATUS=dseq
521+
AKASH_DEP_DSEQ=19729929
522+
# Gas Estimation Options: close, create, or update
523+
# qseq is required when operation is "close" 19729929 is an example of a dseq we test while build.
524+
AKASH_GAS_OPERATION=close
525+
AKASH_GAS_DSEQ=19729929
526+
# Manifest
527+
# Values: "auto" | "manual" | "validate_only" Default: "auto"
528+
AKASH_MANIFEST_MODE=auto
529+
# Default: Will use the SDL directory
530+
AKASH_MANIFEST_PATH=
531+
# Values: "strict" | "lenient" | "none" - Default: "strict"
532+
AKASH_MANIFEST_VALIDATION_LEVEL=strict

.github/workflows/integrationTests.yaml

+6-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
push:
44
branches:
55
- "*"
6-
pull_request_target:
6+
pull_request:
77
branches:
88
- "*"
99

@@ -33,12 +33,9 @@ jobs:
3333
- name: Build packages
3434
run: pnpm build
3535

36-
- name: Check for API key
37-
run: |
38-
if [ -z "$OPENAI_API_KEY" ]; then
39-
echo "Error: OPENAI_API_KEY is not set."
40-
exit 1
41-
fi
42-
4336
- name: Run integration tests
44-
run: pnpm run integrationTests
37+
env:
38+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
39+
COINBASE_COMMERCE_KEY: ${{ secrets.COINBASE_COMMERCE_KEY }}
40+
run: |
41+
pnpm run integrationTests

agent/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
"@elizaos/plugin-arthera": "workspace:*",
8888
"@elizaos/plugin-allora": "workspace:*",
8989
"@elizaos/plugin-opacity": "workspace:*",
90+
"@elizaos/plugin-akash": "workspace:*",
9091
"readline": "1.3.0",
9192
"ws": "8.18.0",
9293
"yargs": "17.7.2"

agent/src/index.ts

+5
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ import { zksyncEraPlugin } from "@elizaos/plugin-zksync-era";
9191
import { OpacityAdapter } from "@elizaos/plugin-opacity";
9292
import { openWeatherPlugin } from "@elizaos/plugin-open-weather";
9393
import { stargazePlugin } from "@elizaos/plugin-stargaze";
94+
import { akashPlugin } from "@elizaos/plugin-akash";
9495
import Database from "better-sqlite3";
9596
import fs from "fs";
9697
import net from "net";
@@ -758,6 +759,10 @@ export async function createAgent(
758759
? artheraPlugin
759760
: null,
760761
getSecret(character, "ALLORA_API_KEY") ? alloraPlugin : null,
762+
getSecret(character, "AKASH_MNEMONIC") &&
763+
getSecret(character, "AKASH_WALLET_ADDRESS")
764+
? akashPlugin
765+
: null,
761766
].filter(Boolean),
762767
providers: [],
763768
actions: [],

packages/adapter-postgres/src/__tests__/vector-extension.test.ts

+17-17
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import pg from 'pg';
33
import fs from 'fs';
44
import path from 'path';
55
import { describe, test, expect, beforeEach, afterEach, vi, beforeAll } from 'vitest';
6-
import { DatabaseAdapter, elizaLogger, type Memory, type Content, EmbeddingProvider } from '@elizaos/core';
6+
import { elizaLogger, type Memory, type Content } from '@elizaos/core';
77

88
// Increase test timeout
99
vi.setConfig({ testTimeout: 15000 });
@@ -41,7 +41,7 @@ vi.mock('@elizaos/core', () => ({
4141
const parseVectorString = (vectorStr: string): number[] => {
4242
if (!vectorStr) return [];
4343
// Remove brackets and split by comma
44-
return vectorStr.replace(/[\[\]]/g, '').split(',').map(Number);
44+
return vectorStr.replace(/[[\]]/g, '').split(',').map(Number);
4545
};
4646

4747
describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
@@ -111,7 +111,7 @@ describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
111111
user: 'postgres',
112112
password: 'postgres'
113113
});
114-
114+
115115
const setupClient = await setupPool.connect();
116116
try {
117117
await cleanDatabase(setupClient);
@@ -133,13 +133,13 @@ describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
133133
user: 'postgres',
134134
password: 'postgres'
135135
});
136-
136+
137137
testClient = await testPool.connect();
138138
elizaLogger.debug('Database connection established');
139-
139+
140140
await cleanDatabase(testClient);
141141
elizaLogger.debug('Database cleaned');
142-
142+
143143
adapter = new PostgresDatabaseAdapter({
144144
host: 'localhost',
145145
port: 5433,
@@ -254,7 +254,7 @@ describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
254254
elizaLogger.debug('Attempting initialization with error...');
255255
await expect(adapter.init()).rejects.toThrow('Schema read error');
256256
elizaLogger.success('Error thrown as expected');
257-
257+
258258
// Verify no tables were created
259259
elizaLogger.debug('Verifying rollback...');
260260
const { rows } = await testClient.query(`
@@ -277,19 +277,19 @@ describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
277277
describe('Memory Operations with Vector', () => {
278278
const TEST_UUID = 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee';
279279
const TEST_TABLE = 'test_memories';
280-
280+
281281
beforeEach(async () => {
282282
elizaLogger.info('Setting up memory operations test...');
283283
try {
284284
// Ensure clean state and proper initialization
285285
await adapter.init();
286-
286+
287287
// Verify vector extension and search path
288288
await testClient.query(`
289289
SET search_path TO public, extensions;
290290
SELECT set_config('app.use_openai_embedding', 'true', false);
291291
`);
292-
292+
293293
// Create necessary account and room first
294294
await testClient.query('BEGIN');
295295
try {
@@ -298,19 +298,19 @@ describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
298298
VALUES ($1, 'test@test.com')
299299
ON CONFLICT (id) DO NOTHING
300300
`, [TEST_UUID]);
301-
301+
302302
await testClient.query(`
303303
INSERT INTO rooms (id)
304304
VALUES ($1)
305305
ON CONFLICT (id) DO NOTHING
306306
`, [TEST_UUID]);
307-
307+
308308
await testClient.query('COMMIT');
309309
} catch (error) {
310310
await testClient.query('ROLLBACK');
311311
throw error;
312312
}
313-
313+
314314
} catch (error) {
315315
elizaLogger.error('Memory operations setup failed:', {
316316
error: error instanceof Error ? error.message : String(error)
@@ -324,7 +324,7 @@ describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
324324
const content: Content = {
325325
text: 'test content'
326326
};
327-
327+
328328
const memory: Memory = {
329329
id: TEST_UUID,
330330
content,
@@ -383,7 +383,7 @@ describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
383383
await testClient.query('ROLLBACK');
384384
throw error;
385385
}
386-
386+
387387
// Act
388388
const results = await adapter.searchMemoriesByEmbedding(embedding, {
389389
tableName: TEST_TABLE,
@@ -405,7 +405,7 @@ describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
405405
const content: Content = {
406406
text: 'test content'
407407
};
408-
408+
409409
const memory: Memory = {
410410
id: TEST_UUID,
411411
content,
@@ -430,4 +430,4 @@ describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
430430
}
431431
}, { timeout: 30000 }); // Increased timeout for retry attempts
432432
});
433-
});
433+
});

packages/adapter-sqljs/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ export class SqlJsDatabaseAdapter
859859
return JSON.parse(cachedResult);
860860
}
861861

862-
let sql = `
862+
const sql = `
863863
WITH vector_scores AS (
864864
SELECT id,
865865
1 / (1 + vec_distance_L2(embedding, ?)) as vector_score

packages/client-direct/src/api.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function createApiRouter(
5656
return;
5757
}
5858

59-
let character = agent?.character;
59+
const character = agent?.character;
6060
if (character?.settings?.secrets) {
6161
delete character.settings.secrets;
6262
}

packages/client-direct/src/index.ts

+40-42
Original file line numberDiff line numberDiff line change
@@ -373,14 +373,12 @@ export class DirectClient {
373373

374374
// hyperfi specific parameters
375375
let nearby = [];
376-
let messages = [];
377376
let availableEmotes = [];
378377

379378
if (body.nearby) {
380379
nearby = body.nearby;
381380
}
382381
if (body.messages) {
383-
messages = body.messages;
384382
// loop on the messages and record the memories
385383
// might want to do this in parallel
386384
for (const msg of body.messages) {
@@ -502,10 +500,17 @@ export class DirectClient {
502500
schema: hyperfiOutSchema,
503501
});
504502

503+
if (!response) {
504+
res.status(500).send(
505+
"No response from generateMessageResponse"
506+
);
507+
return;
508+
}
509+
505510
let hfOut;
506511
try {
507512
hfOut = hyperfiOutSchema.parse(response.object);
508-
} catch (e) {
513+
} catch {
509514
elizaLogger.error(
510515
"cant serialize response",
511516
response.object
@@ -515,7 +520,7 @@ export class DirectClient {
515520
}
516521

517522
// do this in the background
518-
const rememberThis = new Promise(async (resolve) => {
523+
new Promise((resolve) => {
519524
const contentObj: Content = {
520525
text: hfOut.say,
521526
};
@@ -545,45 +550,38 @@ export class DirectClient {
545550
content: contentObj,
546551
};
547552

548-
await runtime.messageManager.createMemory(responseMessage); // 18.2ms
549-
550-
if (!response) {
551-
res.status(500).send(
552-
"No response from generateMessageResponse"
553-
);
554-
return;
555-
}
556-
557-
let message = null as Content | null;
558-
559-
const messageId = stringToUuid(Date.now().toString());
560-
const memory: Memory = {
561-
id: messageId,
562-
agentId: runtime.agentId,
563-
userId,
564-
roomId,
565-
content,
566-
createdAt: Date.now(),
567-
};
568-
569-
// run evaluators (generally can be done in parallel with processActions)
570-
// can an evaluator modify memory? it could but currently doesn't
571-
await runtime.evaluate(memory, state); // 0.5s
572-
573-
// only need to call if responseMessage.content.action is set
574-
if (contentObj.action) {
575-
// pass memory (query) to any actions to call
576-
const _result = await runtime.processActions(
577-
memory,
578-
[responseMessage],
579-
state,
580-
async (newMessages) => {
581-
message = newMessages;
582-
return [memory];
553+
runtime.messageManager.createMemory(responseMessage).then(() => {
554+
const messageId = stringToUuid(Date.now().toString());
555+
const memory: Memory = {
556+
id: messageId,
557+
agentId: runtime.agentId,
558+
userId,
559+
roomId,
560+
content,
561+
createdAt: Date.now(),
562+
};
563+
564+
// run evaluators (generally can be done in parallel with processActions)
565+
// can an evaluator modify memory? it could but currently doesn't
566+
runtime.evaluate(memory, state).then(() => {
567+
// only need to call if responseMessage.content.action is set
568+
if (contentObj.action) {
569+
// pass memory (query) to any actions to call
570+
runtime.processActions(
571+
memory,
572+
[responseMessage],
573+
state,
574+
async (newMessages) => {
575+
// FIXME: this is supposed override what the LLM said/decided
576+
// but the promise doesn't make this possible
577+
//message = newMessages;
578+
return [memory];
579+
}
580+
); // 0.674s
583581
}
584-
); // 0.674s
585-
}
586-
resolve(true);
582+
resolve(true);
583+
});
584+
});
587585
});
588586
res.json({ response: hfOut });
589587
}

packages/client-slack/src/actions/chat_with_attachments.ts

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
parseJSONObjectFromText,
66
getModelSettings,
77
} from "@elizaos/core";
8-
import { models } from "@elizaos/core";
98
import {
109
Action,
1110
ActionExample,

packages/client-slack/src/actions/summarize_conversation.ts

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
parseJSONObjectFromText,
77
getModelSettings,
88
} from "@elizaos/core";
9-
import { models } from "@elizaos/core";
109
import { getActorDetails } from "@elizaos/core";
1110
import {
1211
Action,

0 commit comments

Comments
 (0)