Skip to content

Commit

Permalink
adding plugin-unreal to repo
Browse files Browse the repository at this point in the history
  • Loading branch information
metakai1 committed Jan 1, 2025
1 parent 8e5af06 commit 3122269
Show file tree
Hide file tree
Showing 111 changed files with 17,552 additions and 0 deletions.
2 changes: 2 additions & 0 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { LensAgentClient } from "@ai16z/client-lens";
import { SlackClientInterface } from "@ai16z/client-slack";
import { TelegramClientInterface } from "@ai16z/client-telegram";
import { TwitterClientInterface } from "@ai16z/client-twitter";
import { unrealPlugin } from "@ai16z/plugin-unreal";
import {
AgentRuntime,
CacheManager,
Expand Down Expand Up @@ -563,6 +564,7 @@ export async function createAgent(
getSecret(character, "TON_PRIVATE_KEY") ? tonPlugin : null,
getSecret(character, "SUI_PRIVATE_KEY") ? suiPlugin : null,
getSecret(character, "STORY_PRIVATE_KEY") ? storyPlugin : null,
unrealPlugin,
saveThisPlugin
].filter(Boolean),
providers: [],
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@coinbase/coinbase-sdk": "0.10.0",
"@deepgram/sdk": "^3.9.0",
"@vitest/eslint-plugin": "1.0.1",
"@ai16z/plugin-unreal": "workspace:*",
"amqplib": "0.10.5",
"csv-parse": "5.6.0",
"ollama-ai-provider": "0.16.1",
Expand Down
47 changes: 47 additions & 0 deletions packages/plugin-save-this/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# @ai16z/plugin-save-this
# saveThisPlugin

A plugin for Eliza that enables saving information from conversations as knowledge records.

## Description

The save-this plugin allows users to save important information from their conversations with Eliza for later reference. When a user starts a message with "save this", the plugin will process and store that information in the knowledge base, using the knowledge.set() method.

This will create a document record in the memories table, with associated fragments for each message. The plugin will then provide a confirmation message to the user, such as "I've stored the information for you."

In order to decide what to save, the action handler makes a generateText request to the llm with the last 7 messages. The prompt is carefully designed to extract the most relevant information from the conversation.

## Installation

```bash
pnpm add @ai16z/plugin-save-this
```

## Usage

1. Import and register the plugin:

```typescript
import { saveThisPlugin } from '@ai16z/plugin-save-this';


2. Use in conversation:

```
User: "save this: The meeting with John is scheduled for tomorrow at 2 PM"
Eliza: "I've stored the information for you"
```
## Configuration
No additional configuration is required. The plugin uses Eliza's built-in knowledge storage system.
### Triggering and use of State.
Instead of an ACTION based trigger, the plugin uses the Provider to monitor for an explicit "save this" keyphrase at the beginning of a message. A typical action based trigger is not used, because I found that when multiple SAVE_MEMORY requests are done, eventually the LLM decides to start saving all messages to memory, and that is probably not what we want to do.
If the "save this" keyphrase is found, the Provider will set a state variable to allow the action to proceed. So if the SAVE_THIS action is somehow triggered in another way, the handler aborts.
## License
MIT
6 changes: 6 additions & 0 deletions packages/plugin-unreal/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*

!dist/**
!package.json
!readme.md
!tsup.config.ts
3 changes: 3 additions & 0 deletions packages/plugin-unreal/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import eslintGlobalConfig from "../../eslint.config.mjs";

export default [...eslintGlobalConfig];
20 changes: 20 additions & 0 deletions packages/plugin-unreal/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@ai16z/plugin-unreal",
"version": "0.1.6",
"main": "dist/index.js",
"type": "module",
"types": "dist/index.d.ts",
"dependencies": {
"@ai16z/eliza": "workspace:*",
"@ai16z/adapter-postgres": "workspace:*",
"tsup": "8.3.5"
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --format esm --dts --watch",
"lint": "eslint --fix --cache ."
},
"peerDependencies": {
"whatwg-url": "7.1.0"
}
}
80 changes: 80 additions & 0 deletions packages/plugin-unreal/plugin-spreadsheet/INITIALIZATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Plugin Spreadsheet Initialization Flow

## Overview
This document describes the proper initialization flow for the Plugin Spreadsheet package, specifically focusing on the PropertyStorage system.

## Initialization Chain

1. **Plugin Creation** (`index.ts`)
```typescript
const storage = new MemoryPropertyStorage();
const service = new PropertyStorageService(storage);
```
- MemoryPropertyStorage constructor is called
- PropertyStorageService is created with the storage instance

2. **Plugin Registration**
- Plugin is registered with the Eliza runtime
- Runtime calls initialize on the plugin
- Plugin should initialize its services

3. **Service Initialization** (`services.ts`)
```typescript
class PropertyStorageService {
async initialize(runtime: IAgentRuntime) {
// Should initialize the underlying storage
await this.storage.initialize(runtime);
}
}
```
- Service receives runtime during initialization
- Service should pass runtime to storage layer

4. **Storage Initialization** (`memory-storage.ts`)
```typescript
class MemoryPropertyStorage {
initialize(runtime: AgentRuntime) {
this.runtime = runtime;
elizaLogger.info('MemoryPropertyStorage: Initializing with runtime', {
hasRuntime: !!runtime,
runtimeType: runtime?.constructor?.name,
agentId: runtime?.agentId
});
}
}
```
- Storage receives and stores runtime reference
- Ready for operations like search

## Common Issues

1. **Missing Runtime**
- Symptom: `StorageError: Runtime not initialized`
- Cause: Operations attempted before proper initialization chain completion
- Fix: Ensure service.initialize() is called and propagates to storage layer

2. **Initialization Order**
- The plugin must be fully initialized before any actions are handled
- All search operations should check this.runtime exists before proceeding

## Best Practices

1. **Logging**
- Use INFO level for initialization steps
- Log runtime details during initialization for debugging
- Log errors when runtime is missing

2. **Error Handling**
- Use StorageErrorCode.INTERNAL_ERROR for initialization issues
- Provide clear error messages indicating initialization state

3. **Runtime Validation**
- Always check runtime exists before operations
- Log detailed diagnostics when runtime is missing

## Verification
To verify proper initialization:
1. Check logs for "MemoryPropertyStorage: Constructor called"
2. Check logs for "MemoryPropertyStorage: Initializing with runtime"
3. Verify runtime details are logged (hasRuntime, runtimeType, agentId)
4. Test a simple search operation to confirm runtime is available
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# 1. System Overview

## Architecture Overview

```mermaid
graph TD
A[Eliza Plugin] --> B[Property Search Service]
B --> C[Storage Interface]
C --> D[Local Storage]
C --> E[Cloud Storage]
B --> F[Query Parser]
F --> G[LLM Service]
B --> H[NFT Market Service]
H --> I[OpenSea API]
```

## Core Components

### 1. Property Search Service
Central coordinator that manages:
- Query processing
- Storage selection
- Result ranking
- Market data integration

### 2. Storage Interface
Abstract interface supporting:
- Vector similarity search
- Structured filters
- Batch operations

### 3. Query Processing
Multi-phase system:
1. Query understanding (Eliza)
2. Property search (Storage)
3. Market enrichment (OpenSea)

### 4. NFT Integration
Provides:
- Real-time pricing
- Market analysis
- Listing status

## System Flow

```mermaid
sequenceDiagram
participant U as User
participant E as Eliza
participant S as Storage
participant M as Market
U->>E: Natural language query
E->>E: Parse query
E->>S: Search properties
E->>M: Get market data
E->>E: Rank results
E->>U: Return results
```

## Key Features

1. **Semantic Search**
- Natural language queries
- Vector similarity
- Metadata filtering

2. **Market Integration**
- Real-time prices
- Listing status
- Price history

3. **Flexible Storage**
- Local development
- Cloud scaling
- Hybrid options

## Next Steps

1. **Implementation**
- Start with storage abstraction
- Add basic search
- Integrate market data

2. **Enhancement**
- Improve query parsing
- Add advanced filters
- Optimize performance

3. **Scale**
- Deploy cloud service
- Add caching
- Monitor performance
Loading

0 comments on commit 3122269

Please sign in to comment.