Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

File renamed without changes.
58 changes: 58 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Teeception Backend

This directory contains the Go-based backend services for the Teeception project.

## Components

- **Agent Service**: Implements the AI agent that runs in a Trusted Execution Environment (TEE)
- **UI Service**: API service for the Teeception frontend
- **Indexer**: Processes and indexes on-chain events
- **Twitter Integration**: Implementation of Twitter client for agent interactions

## Development

### Prerequisites

- Go 1.23 or later
- Docker and Docker Compose
- Node.js (for Twitter client)

### Running Locally

1. Copy `.env.example` to `.env` and update with your configuration
2. Run the service with Docker Compose:

```bash
cd backend
docker-compose -f docker-compose-local.yml up
```

### Project Structure

- `cmd/`: Entry points for various executable components
- `pkg/`: Shared Go packages
- `agent/`: Agent implementation
- `ui_service/`: UI service implementation
- `indexer/`: Blockchain indexer
- `wallet/`: Wallet-related functionality
- `twitter/`: Twitter client implementation
- `selenium_utils/`: Utility functions for browser automation

## Building

```bash
# Build agent binary
go build -o agent cmd/agent/main.go

# Build UI service
go build -o ui_service cmd/ui_service/main.go
```

## Docker

The backend services can be built and run as Docker containers using the provided Dockerfiles:

- `agent.Dockerfile`: Builds the agent service
- `ui_service.Dockerfile`: Builds the UI service

For production usage, refer to the top-level documentation.
File renamed without changes.
6 changes: 3 additions & 3 deletions cmd/agent/main.go → backend/cmd/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"os"
"time"

"github.com/NethermindEth/teeception/pkg/agent"
"github.com/NethermindEth/teeception/pkg/agent/setup"
"github.com/NethermindEth/teeception/pkg/twitter"
"github.com/NethermindEth/teeception/backend/pkg/agent"
"github.com/NethermindEth/teeception/backend/pkg/agent/setup"
"github.com/NethermindEth/teeception/backend/pkg/twitter"
)

func main_impl() error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/llm/main.go → backend/cmd/llm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/spf13/cobra"

"github.com/NethermindEth/juno/core/felt"
"github.com/NethermindEth/teeception/pkg/agent/chat"
"github.com/NethermindEth/teeception/backend/pkg/agent/chat"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions cmd/ui_service/main.go → backend/cmd/ui_service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/NethermindEth/juno/core/felt"
"github.com/NethermindEth/starknet.go/rpc"

uiservice "github.com/NethermindEth/teeception/pkg/ui_service"
"github.com/NethermindEth/teeception/pkg/wallet/starknet"
uiservice "github.com/NethermindEth/teeception/backend/pkg/ui_service"
"github.com/NethermindEth/teeception/backend/pkg/wallet/starknet"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/verify/main.go → backend/cmd/verify/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

"github.com/NethermindEth/juno/core/felt"

"github.com/NethermindEth/teeception/pkg/agent/quote"
"github.com/NethermindEth/teeception/backend/pkg/agent/quote"
)

var (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion go.mod → backend/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/NethermindEth/teeception
module github.com/NethermindEth/teeception/backend

go 1.23.1

Expand Down
File renamed without changes.
18 changes: 9 additions & 9 deletions pkg/agent/agent.go → backend/pkg/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ import (
"github.com/sashabaranov/go-openai"
"golang.org/x/sync/errgroup"

"github.com/NethermindEth/teeception/pkg/agent/chat"
"github.com/NethermindEth/teeception/pkg/agent/debug"
"github.com/NethermindEth/teeception/pkg/agent/quote"
"github.com/NethermindEth/teeception/pkg/agent/setup"
"github.com/NethermindEth/teeception/pkg/agent/validation"
"github.com/NethermindEth/teeception/pkg/indexer"
"github.com/NethermindEth/teeception/pkg/twitter"
"github.com/NethermindEth/teeception/pkg/wallet/starknet"
snaccount "github.com/NethermindEth/teeception/pkg/wallet/starknet"
"github.com/NethermindEth/teeception/backend/pkg/agent/chat"
"github.com/NethermindEth/teeception/backend/pkg/agent/debug"
"github.com/NethermindEth/teeception/backend/pkg/agent/quote"
"github.com/NethermindEth/teeception/backend/pkg/agent/setup"
"github.com/NethermindEth/teeception/backend/pkg/agent/validation"
"github.com/NethermindEth/teeception/backend/pkg/indexer"
"github.com/NethermindEth/teeception/backend/pkg/twitter"
"github.com/NethermindEth/teeception/backend/pkg/wallet/starknet"
snaccount "github.com/NethermindEth/teeception/backend/pkg/wallet/starknet"
)

var (
Expand Down
14 changes: 7 additions & 7 deletions pkg/agent/agent_test.go → backend/pkg/agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import (
"github.com/NethermindEth/starknet.go/utils"
starknetgoutils "github.com/NethermindEth/starknet.go/utils"

"github.com/NethermindEth/teeception/pkg/agent"
"github.com/NethermindEth/teeception/pkg/agent/chat"
"github.com/NethermindEth/teeception/pkg/agent/quote"
"github.com/NethermindEth/teeception/pkg/indexer"
"github.com/NethermindEth/teeception/pkg/twitter"
"github.com/NethermindEth/teeception/pkg/wallet/starknet"
snaccount "github.com/NethermindEth/teeception/pkg/wallet/starknet"
"github.com/NethermindEth/teeception/backend/pkg/agent"
"github.com/NethermindEth/teeception/backend/pkg/agent/chat"
"github.com/NethermindEth/teeception/backend/pkg/agent/quote"
"github.com/NethermindEth/teeception/backend/pkg/indexer"
"github.com/NethermindEth/teeception/backend/pkg/twitter"
"github.com/NethermindEth/teeception/backend/pkg/wallet/starknet"
snaccount "github.com/NethermindEth/teeception/backend/pkg/wallet/starknet"
)

type MockTwitterClientMethods struct {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"strings"
"time"

"github.com/NethermindEth/teeception/pkg/agent/debug"
"github.com/NethermindEth/teeception/pkg/agent/password"
"github.com/NethermindEth/teeception/pkg/selenium_utils"
"github.com/NethermindEth/teeception/backend/pkg/agent/debug"
"github.com/NethermindEth/teeception/backend/pkg/agent/password"
"github.com/NethermindEth/teeception/backend/pkg/selenium_utils"
"github.com/tebeka/selenium"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http"
"sync"

"github.com/NethermindEth/teeception/pkg/agent/debug"
"github.com/NethermindEth/teeception/backend/pkg/agent/debug"
"github.com/dghubble/oauth1"
twauth "github.com/dghubble/oauth1/twitter"
"github.com/gin-gonic/gin"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"strings"
"time"

"github.com/NethermindEth/teeception/pkg/agent/debug"
"github.com/NethermindEth/teeception/pkg/agent/password"
"github.com/NethermindEth/teeception/pkg/selenium_utils"
"github.com/NethermindEth/teeception/backend/pkg/agent/debug"
"github.com/NethermindEth/teeception/backend/pkg/agent/password"
"github.com/NethermindEth/teeception/backend/pkg/selenium_utils"
"github.com/dghubble/oauth1"
"github.com/tebeka/selenium"
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

"github.com/NethermindEth/juno/core/felt"
starknetgoutils "github.com/NethermindEth/starknet.go/utils"
"github.com/NethermindEth/teeception/pkg/agent/debug"
snaccount "github.com/NethermindEth/teeception/pkg/wallet/starknet"
"github.com/NethermindEth/teeception/backend/pkg/agent/debug"
snaccount "github.com/NethermindEth/teeception/backend/pkg/wallet/starknet"
"github.com/dghubble/oauth1"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/Dstack-TEE/dstack/sdk/go/tappd"

"github.com/NethermindEth/teeception/pkg/agent/debug"
"github.com/NethermindEth/teeception/backend/pkg/agent/debug"
)

func Setup(ctx context.Context) (*SetupOutput, error) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"golang.org/x/sync/errgroup"

"github.com/NethermindEth/teeception/pkg/agent/chat"
"github.com/NethermindEth/teeception/backend/pkg/agent/chat"
)

// NameCache provides a cache for agent name validation results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/NethermindEth/juno/core/felt"

"github.com/NethermindEth/teeception/pkg/wallet/starknet"
"github.com/NethermindEth/teeception/backend/pkg/wallet/starknet"
)

type AgentBalance struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"sync"
"time"

"github.com/NethermindEth/teeception/pkg/indexer/utils"
"github.com/NethermindEth/teeception/backend/pkg/indexer/utils"
)

// AgentBalanceIndexerDatabaseReader is the reader for an AgentBalanceIndexerDatabase.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"github.com/NethermindEth/juno/core/felt"
"github.com/NethermindEth/starknet.go/rpc"
"github.com/NethermindEth/teeception/pkg/wallet/starknet"
snaccount "github.com/NethermindEth/teeception/pkg/wallet/starknet"
"github.com/NethermindEth/teeception/backend/pkg/wallet/starknet"
snaccount "github.com/NethermindEth/teeception/backend/pkg/wallet/starknet"
"golang.org/x/sync/errgroup"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"golang.org/x/sync/errgroup"

"github.com/NethermindEth/juno/core/felt"
"github.com/NethermindEth/teeception/pkg/wallet/starknet"
"github.com/NethermindEth/teeception/backend/pkg/wallet/starknet"
)

type AgentUsage struct {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (

"github.com/NethermindEth/juno/core/felt"
"github.com/NethermindEth/starknet.go/rpc"
"github.com/NethermindEth/teeception/pkg/wallet/starknet"
snaccount "github.com/NethermindEth/teeception/pkg/wallet/starknet"
"github.com/NethermindEth/teeception/backend/pkg/wallet/starknet"
snaccount "github.com/NethermindEth/teeception/backend/pkg/wallet/starknet"
)

type EventType int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/NethermindEth/juno/core/felt"
"golang.org/x/sync/errgroup"

"github.com/NethermindEth/teeception/pkg/indexer/price"
"github.com/NethermindEth/teeception/backend/pkg/indexer/price"
)

// TokenPriceUpdate is a struct that contains the token price and its update block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"golang.org/x/sync/errgroup"

"github.com/NethermindEth/juno/core/felt"
"github.com/NethermindEth/teeception/pkg/wallet/starknet"
"github.com/NethermindEth/teeception/backend/pkg/wallet/starknet"
)

type UserInfo struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/NethermindEth/juno/core/felt"

"github.com/NethermindEth/teeception/pkg/indexer/utils"
"github.com/NethermindEth/teeception/backend/pkg/indexer/utils"
)

type UserIndexerDatabaseReader interface {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"time"

"github.com/NethermindEth/juno/core/felt"
"github.com/NethermindEth/teeception/pkg/indexer"
"github.com/NethermindEth/teeception/pkg/indexer/price"
"github.com/NethermindEth/teeception/pkg/wallet/starknet"
"github.com/NethermindEth/teeception/backend/pkg/indexer"
"github.com/NethermindEth/teeception/backend/pkg/indexer/price"
"github.com/NethermindEth/teeception/backend/pkg/wallet/starknet"
"github.com/gin-contrib/gzip"
"github.com/gin-gonic/gin"
"golang.org/x/sync/errgroup"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
36 changes: 36 additions & 0 deletions docs/development-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,42 @@ The agent:
go run cmd/agent/main.go
```

### Running the Indexer

The Teeception indexer is part of the UI Service component and consists of multiple sub-indexers that track:
- Registered agents and their details
- User data and leaderboards

**Prerequisites for the indexer:**
- A Starknet RPC endpoint
- The registry contract address
- The block number when the registry contract was deployed

**Start the indexer locally:**
```bash
go run cmd/ui_service/main.go \
--provider-url=YOUR_STARKNET_RPC_URL \
--registry-addr=YOUR_REGISTRY_CONTRACT_ADDRESS \
--deployment-block=REGISTRY_DEPLOYMENT_BLOCK_NUMBER \
--server-addr=:8000
```

**Optional configuration parameters:**
- `--page-size`: Maximum page size for pagination (default: 50)
- `--balance-tick-rate`: How often to update agent balances (default: 5s)
- `--price-tick-rate`: How often to update token prices (default: 5s)
- `--event-tick-rate`: How often to check for new events (default: 5s)
- `--event-startup-tick-rate`: Initial rate for catching up on events (default: 1s)
- `--user-tick-rate`: How often to sort user leaderboards (default: 1m)

**Available API endpoints:**
- `/agents`: Get a list of registered agents
- `/agents/:address`: Get details for a specific agent
- `/users`: Get the user leaderboard
- `/usage`: Get platform usage statistics

The indexer continuously updates in the background as new events occur on the Starknet blockchain.

## Chrome Extension Development

The extension is built with Vite and TypeScript.
Expand Down
5 changes: 0 additions & 5 deletions extension/.cursorrules

This file was deleted.

1 change: 0 additions & 1 deletion extension/.env.development

This file was deleted.

24 changes: 0 additions & 24 deletions extension/.gitignore

This file was deleted.

Loading