Skip to content

Commit

Permalink
Merge branch 'main' of github.com:sweetmantech/eliza
Browse files Browse the repository at this point in the history
  • Loading branch information
sweetmantech committed Jan 16, 2025
2 parents e080c83 + e95254f commit fe81ad4
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/community/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ElizaOS empowers developers of all skill levels to harness the potential of AI a

## Governance

ai16z originates as being an AI agent led DAO. Similar to how we can influence the autonomous agents on memecoins to buy, we intend to bring similar functionality for token holders to actively participate in the decision-making process and shape the future of the project. Community members can pitch ideas, provide insights, and influence investment strategies based on their expertise and track record.
ai16z originates as being an AI agent-led DAO. Similar to how we can influence the autonomous agents on memecoins to buy, we intend to bring similar functionality for token holders to actively participate in the decision-making process and shape the future of the project. Community members can pitch ideas, provide insights, and influence investment strategies based on their expertise and track record.

## Explore and Contribute

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/core/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ interface Action {
- **validate**: Determines if the action can be executed
- **handler**: Implements the action's behavior
- **examples**: Demonstrates proper usage patterns
- **suppressInitialMessage**: When true, suppresses the initial response message before processing the action. Useful for actions that generate their own responses (like image generation)
- **suppressInitialMessage**: When true, suppress the initial response message before processing the action. Useful for actions that generate their own responses (like image generation)

---

Expand All @@ -179,7 +179,7 @@ const continueAction: Action = {
name: "CONTINUE",
similes: ["ELABORATE", "KEEP_TALKING"],
description:
"Used when the message requires a follow-up. Don't use when the conversation is finished.",
"Used when the message requires a follow-up. Don't use it when the conversation is finished.",
validate: async (runtime, message) => {
// Validation logic
return true;
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ You set which model to use inside the character JSON file
pnpm start --character="characters/trump.character.json"
```

You can also load multiple characters with the characters option with a comma separated list:
You can also load multiple characters with the characters option with a comma-separated list:

```bash
pnpm start --characters="characters/trump.character.json,characters/tate.character.json"
Expand Down
22 changes: 22 additions & 0 deletions packages/plugin-solana/__tests__/actions/swap.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { describe, it, expect, vi } from 'vitest';

describe('Swap Action', () => {
describe('validate', () => {
it('should handle swap message validation', async () => {
const mockMessage = {
content: 'Swap 1 SOL to USDC',
metadata: {
fromToken: 'SOL',
toToken: 'USDC',
amount: '1'
}
};

// Basic test to ensure message structure
expect(mockMessage.metadata).toBeDefined();
expect(mockMessage.metadata.fromToken).toBe('SOL');
expect(mockMessage.metadata.toToken).toBe('USDC');
expect(mockMessage.metadata.amount).toBe('1');
});
});
});
55 changes: 55 additions & 0 deletions packages/plugin-solana/__tests__/evaluators/trust.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { describe, it, expect, vi } from 'vitest';
import { trustEvaluator } from '../../src/evaluators/trust';

// Mock the core module
vi.mock('@elizaos/core', () => ({
generateTrueOrFalse: vi.fn().mockResolvedValue(false),
ModelClass: {
SMALL: 'small'
},
settings: {
MAIN_WALLET_ADDRESS: 'test-wallet-address'
},
booleanFooter: 'Answer with Yes or No.',
elizaLogger: {
log: vi.fn(),
debug: vi.fn(),
info: vi.fn(),
error: vi.fn()
},
composeContext: vi.fn().mockReturnValue({
state: {},
template: ''
})
}));

describe('Trust Evaluator', () => {
it('should handle non-trust messages', async () => {
const mockRuntime = {
getSetting: vi.fn(),
composeState: vi.fn().mockResolvedValue({
agentId: 'test-agent',
roomId: 'test-room'
}),
getLogger: vi.fn().mockReturnValue({
debug: vi.fn(),
info: vi.fn(),
log: vi.fn(),
error: vi.fn()
})
};

const mockMessage = {
content: 'Hello world',
metadata: {}
};

const mockState = {
agentId: 'test-agent',
roomId: 'test-room'
};

const result = await trustEvaluator.handler(mockRuntime, mockMessage, mockState);
expect(result).toBeDefined();
});
});
36 changes: 36 additions & 0 deletions packages/plugin-solana/__tests__/providers/token-security.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { describe, it, expect, vi } from 'vitest';
import { TokenProvider } from '../../src/providers/token';
import { WalletProvider } from '../../src/providers/wallet';
import { ICacheManager } from '@elizaos/core';

describe('Token Security', () => {
it('should handle empty security data gracefully', async () => {
const mockCacheManager = {
get: vi.fn().mockResolvedValue(null),
set: vi.fn(),
delete: vi.fn(),
clear: vi.fn(),
has: vi.fn(),
};

const mockWalletProvider = new WalletProvider(mockCacheManager);
const tokenProvider = new TokenProvider(
'So11111111111111111111111111111111111111112',
mockWalletProvider,
mockCacheManager
);

global.fetch = vi.fn().mockResolvedValueOnce({
ok: true,
json: () => Promise.resolve({
success: true,
data: {}
})
});

const result = await tokenProvider.fetchTokenSecurity();
expect(result).toBeDefined();
expect(result.ownerBalance).toBe(undefined);
expect(result.creatorBalance).toBe(undefined);
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect, beforeEach, vi, afterEach } from "vitest";
import { TokenProvider } from "../providers/token.ts";
import { TokenProvider } from "../src/providers/token.ts";

// Mock NodeCache
vi.mock("node-cache", () => {
Expand Down

0 comments on commit fe81ad4

Please sign in to comment.