Skip to content

Commit 3e31a19

Browse files
authored
Merge branch 'develop' into ng/moving-readmes
2 parents 1388507 + 30b1c69 commit 3e31a19

23 files changed

+1682
-15
lines changed

.env.example

+14
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ PGLITE_DATA_DIR= #../pgLite/ if selecting a directory --- or memory:// if
99

1010
# Eliza Port Config
1111
SERVER_PORT=3000
12+
VITE_SERVER_PORT=${SERVER_PORT}
1213

1314
# Supabase Configuration
1415
SUPABASE_URL=
@@ -602,3 +603,16 @@ AKASH_MANIFEST_VALIDATION_LEVEL=strict
602603
# Quai Network Ecosystem
603604
QUAI_PRIVATE_KEY=
604605
QUAI_RPC_URL=https://rpc.quai.network
606+
607+
# Instagram Configuration
608+
INSTAGRAM_DRY_RUN=false
609+
INSTAGRAM_USERNAME= # Account username
610+
INSTAGRAM_PASSWORD= # Account password
611+
INSTAGRAM_APP_ID= # Instagram App ID is required
612+
INSTAGRAM_APP_SECRET= # Instagram App Secret is required
613+
INSTAGRAM_BUSINESS_ACCOUNT_ID= # Optional Business Account ID for additional features
614+
INSTAGRAM_POST_INTERVAL_MIN=60 # Default: 60 minutes
615+
INSTAGRAM_POST_INTERVAL_MAX=120 # Default: 120 minutes
616+
INSTAGRAM_ENABLE_ACTION_PROCESSING=false # Enable/disable action processing
617+
INSTAGRAM_ACTION_INTERVAL=5 # Interval between actions in minutes
618+
INSTAGRAM_MAX_ACTIONS=1 # Maximum number of actions to process at once

agent/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"@elizaos/client-lens": "workspace:*",
3131
"@elizaos/client-telegram": "workspace:*",
3232
"@elizaos/client-twitter": "workspace:*",
33+
"@elizaos/client-instagram": "workspace:*",
3334
"@elizaos/client-slack": "workspace:*",
3435
"@elizaos/core": "workspace:*",
3536
"@elizaos/plugin-0g": "workspace:*",

agent/src/index.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ import { SqliteDatabaseAdapter } from "@elizaos/adapter-sqlite";
55
import { SupabaseDatabaseAdapter } from "@elizaos/adapter-supabase";
66
import { AutoClientInterface } from "@elizaos/client-auto";
77
import { DiscordClientInterface } from "@elizaos/client-discord";
8-
import { FarcasterClientInterface } from "@elizaos/client-farcaster";
8+
import { InstagramClientInterface } from "@elizaos/client-instagram";
99
import { LensAgentClient } from "@elizaos/client-lens";
1010
import { SlackClientInterface } from "@elizaos/client-slack";
1111
import { TelegramClientInterface } from "@elizaos/client-telegram";
1212
import { TwitterClientInterface } from "@elizaos/client-twitter";
13+
import { FarcasterClientInterface } from "@elizaos/client-farcaster";
1314
// import { ReclaimAdapter } from "@elizaos/plugin-reclaim";
1415
import { PrimusAdapter } from "@elizaos/plugin-primus";
1516

@@ -29,10 +30,10 @@ import {
2930
IDatabaseAdapter,
3031
IDatabaseCacheAdapter,
3132
ModelProviderName,
33+
parseBooleanFromText,
3234
settings,
3335
stringToUuid,
3436
validateCharacterConfig,
35-
parseBooleanFromText,
3637
} from "@elizaos/core";
3738
import { zgPlugin } from "@elizaos/plugin-0g";
3839

@@ -87,6 +88,7 @@ import { quaiPlugin } from "@elizaos/plugin-quai";
8788
import { sgxPlugin } from "@elizaos/plugin-sgx";
8889
import { solanaPlugin } from "@elizaos/plugin-solana";
8990
import { solanaAgentkitPlguin } from "@elizaos/plugin-solana-agentkit";
91+
import { squidRouterPlugin } from "@elizaos/plugin-squid-router";
9092
import { stargazePlugin } from "@elizaos/plugin-stargaze";
9193
import { storyPlugin } from "@elizaos/plugin-story";
9294
import { suiPlugin } from "@elizaos/plugin-sui";
@@ -96,7 +98,6 @@ import { teeMarlinPlugin } from "@elizaos/plugin-tee-marlin";
9698
import { verifiableLogPlugin } from "@elizaos/plugin-tee-verifiable-log";
9799
import { thirdwebPlugin } from "@elizaos/plugin-thirdweb";
98100
import { tonPlugin } from "@elizaos/plugin-ton";
99-
import { squidRouterPlugin } from "@elizaos/plugin-squid-router";
100101
import { webSearchPlugin } from "@elizaos/plugin-web-search";
101102
import { echoChambersPlugin } from "@elizaos/plugin-echochambers";
102103
import { dexScreenerPlugin } from "@elizaos/plugin-dexscreener";
@@ -612,6 +613,13 @@ export async function initializeClients(
612613
}
613614
}
614615

616+
if (clientTypes.includes(Clients.INSTAGRAM)) {
617+
const instagramClient = await InstagramClientInterface.start(runtime);
618+
if (instagramClient) {
619+
clients.instagram = instagramClient;
620+
}
621+
}
622+
615623
if (clientTypes.includes(Clients.FARCASTER)) {
616624
const farcasterClient = await FarcasterClientInterface.start(runtime);
617625
if (farcasterClient) {

client/src/lib/api.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { type UUID, type Character } from "@elizaos/core";
22

3-
const BASE_URL = "http://localhost:3000";
3+
const BASE_URL = `http://localhost:${import.meta.env.VITE_SERVER_PORT}`;
44

55
const fetcher = async ({
66
url,

client/vite.config.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { defineConfig } from "vite";
22
import react from "@vitejs/plugin-react-swc";
33
import viteCompression from "vite-plugin-compression";
4+
import path from "path";
45

56
// https://vite.dev/config/
67
export default defineConfig({
@@ -13,6 +14,7 @@ export default defineConfig({
1314
}),
1415
],
1516
clearScreen: false,
17+
envDir: path.resolve(__dirname, ".."),
1618
build: {
1719
outDir: "dist",
1820
minify: true,

docs/README_FR.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ _Utilisée dans [@DegenSpartanAI](https://x.com/degenspartanai) et [@MarcAIndree
88
- Ajout de multiples personnages avec [characterfile](https://github.com/lalalune/characterfile/)
99
- Support des fonctionnalités et connecteurs Discord/ Twitter / Telegram, avec salons vocaux sur Discord
1010
- Accès aux données en mémoire et aux documents stockés
11-
- Peut ouvrir et lire des documents PDF, retranscire des fichiers son et vidéo, résumer des conversations, etc.
11+
- Peut ouvrir et lire des documents PDF, retranscrire des fichiers son et vidéo, résumer des conversations, etc.
1212
- Supporte les modèles open source et locaux (configuré par défaut avec Nous Hermes Llama 3.1B)
1313
- Supporte OpenAI pour une utilisation sur le cloud depuis une machine peu performante
1414
- Mode "Ask Claude" pour l'utilisation de Claude sur des modèles complexes
@@ -22,10 +22,10 @@ _Utilisée dans [@DegenSpartanAI](https://x.com/degenspartanai) et [@MarcAIndree
2222
- [Node.js 22+](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
2323
- [pnpm](https://pnpm.io/installation)
2424

25-
### Edit the .env file
25+
### Éditer le fichier .env
2626

27-
- Copy .env.example to .env and fill in the appropriate values
28-
- Edit the TWITTER environment variables to add your bot's username and password
27+
- Copiez le fichier .env.example, renommez-le en .env et remplissez les valeurs appropriées.
28+
- Modifiez les variables d'environnement TWITTER pour ajouter le nom d'utilisateur et le mot de passe de votre bot.
2929

3030
### Modifier les fichiers personnage
3131

@@ -50,7 +50,7 @@ pnpm clean
5050

5151
# Personnaliser Eliza
5252

53-
### Ajouter un des actions personnalisées
53+
### Ajouter une des actions personnalisées
5454

5555
Pour éviter les conflits Git dans le répertoire core, nous vous recommandons d’ajouter les actions personnalisées dans un répertoire `custom_actions` et de les configurer dans le fichier `elizaConfig.yaml` . Vous pouvez consulter l’exemple dans le fichier `elizaConfig.example.yaml`.
5656

@@ -82,13 +82,13 @@ pnpm install --include=optional sharp
8282
Vous devez ajouter certaines variables à votre fichier .env pour vous connecter aux différentes plates-formes:
8383

8484
```
85-
# Variables d'environement Discord (nécessaires)
85+
# Variables d'environnement Discord (nécessaires)
8686
DISCORD_APPLICATION_ID=
8787
DISCORD_API_TOKEN= # Bot token
8888
OPENAI_API_KEY=sk-* # OpenAI API key, starting with sk-
8989
ELEVENLABS_XI_API_KEY= # API key from elevenlabs
9090
91-
# Parmètres ELEVENLABS
91+
# Paramètres ELEVENLABS
9292
ELEVENLABS_MODEL_ID=eleven_multilingual_v2
9393
ELEVENLABS_VOICE_ID=21m00Tcm4TlvDq8ikWAM
9494
ELEVENLABS_VOICE_STABILITY=0.5
@@ -144,7 +144,7 @@ Assurez-vous d’avoir le kit complet CUDA installé, y compris cuDNN et cuBLAS.
144144
### Exécution locale
145145

146146
Ajoutez XAI_MODEL et définissez-le à l’une des options ci-dessus [Run with
147-
Llama](#run-with-llama) - Vous pouvez laisser les valeurs X_SERVER_URL et XAI_API_KEY vides, le modèle est sera téléchargé depuis huggingface et sera modifié en local
147+
Llama](#run-with-llama) - Vous pouvez laisser les valeurs X_SERVER_URL et XAI_API_KEY vides, le modèle sera téléchargé depuis huggingface et sera modifié en local
148148

149149
# Clients
150150

@@ -173,7 +173,7 @@ pnpm test:sqljs # Lance les tests avec SQL.js
173173
Les tests sont écrits en Jest et se trouvent ici : `src/**/*.test.ts`. L’environnement de test est configuré pour :
174174

175175
- Charger les variables d’environnement depuis `.env.test`
176-
- Ajouter d'un délai d'attente de 2 minutes pour les tests de longue durée
176+
- Ajouter un délai d'attente de 2 minutes pour les tests de longue durée
177177
- Supporter les modules ESM
178178
- Lancer les tests de façon séquentielle (--runInBand)
179179

packages/client-instagram/README.md

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# @elizaos/client-instagram
2+
3+
An Instagram client implementation for ElizaOS, enabling Instagram integration with support for media posting, comment handling, and interaction management.
4+
5+
## Features
6+
7+
- Instagram API integration using instagram-private-api
8+
- Media post creation and scheduling
9+
- Comment and interaction handling
10+
- Profile management
11+
- Media processing utilities
12+
- Rate limiting and request queuing
13+
- Session management and caching
14+
15+
## Installation
16+
17+
As this is a workspace package, it's installed as part of the ElizaOS monorepo:
18+
19+
```bash
20+
pnpm install
21+
```
22+
23+
## Configuration
24+
25+
The client requires the following environment variables:
26+
27+
```bash
28+
# Instagram Credentials
29+
INSTAGRAM_USERNAME=your_username
30+
INSTAGRAM_PASSWORD=your_password
31+
INSTAGRAM_APP_ID=your_app_id
32+
INSTAGRAM_APP_SECRET=your_app_secret
33+
34+
# Optional Business Account
35+
INSTAGRAM_BUSINESS_ACCOUNT_ID=your_business_account_id
36+
37+
# Posting Configuration
38+
POST_INTERVAL_MIN=90 # Minimum interval between posts (minutes)
39+
POST_INTERVAL_MAX=180 # Maximum interval between posts (minutes)
40+
ENABLE_ACTION_PROCESSING=true
41+
ACTION_INTERVAL=5 # Minutes between action processing
42+
MAX_ACTIONS_PROCESSING=1 # Maximum actions to process per interval
43+
```
44+
45+
## Usage
46+
47+
### Basic Initialization
48+
49+
```typescript
50+
import { InstagramClientInterface } from '@elizaos/client-instagram';
51+
52+
// Initialize the client
53+
const instagramManager = await InstagramClientInterface.start(runtime);
54+
```
55+
56+
### Posting Content
57+
58+
All posts on Instagram must include media (image, video, or carousel):
59+
60+
```typescript
61+
// Post a single image
62+
await instagramManager.post.createPost({
63+
media: [{
64+
type: 'IMAGE',
65+
url: 'path/to/image.jpg'
66+
}],
67+
caption: 'Hello Instagram!'
68+
});
69+
70+
// Post a carousel
71+
await instagramManager.post.createPost({
72+
media: [
73+
{ type: 'IMAGE', url: 'path/to/image1.jpg' },
74+
{ type: 'IMAGE', url: 'path/to/image2.jpg' }
75+
],
76+
caption: 'Check out these photos!'
77+
});
78+
```
79+
80+
### Handling Interactions
81+
82+
```typescript
83+
// Handle comments
84+
await instagramManager.interaction.handleComment({
85+
mediaId: 'media-123',
86+
comment: 'Great post!',
87+
userId: 'user-123'
88+
});
89+
90+
// Like media
91+
await instagramManager.interaction.likeMedia('media-123');
92+
```
93+
94+
## Key Components
95+
96+
1. ClientBase
97+
- Handles authentication and session management
98+
- Manages API rate limiting
99+
- Provides core API functionality
100+
101+
102+
2. PostClient
103+
- Manages media uploads
104+
- Handles post scheduling
105+
- Processes media before upload
106+
107+
108+
3. InteractionClient
109+
- Handles comments and likes
110+
- Manages user interactions
111+
- Processes notifications
112+
113+
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "@elizaos/client-instagram",
3+
"version": "0.1.0",
4+
"type": "module",
5+
"main": "dist/index.js",
6+
"module": "dist/index.js",
7+
"types": "dist/index.d.ts",
8+
"exports": {
9+
"./package.json": "./package.json",
10+
".": {
11+
"import": {
12+
"@elizaos/source": "./src/index.ts",
13+
"types": "./dist/index.d.ts",
14+
"default": "./dist/index.js"
15+
}
16+
}
17+
},
18+
"files": [
19+
"dist"
20+
],
21+
"dependencies": {
22+
"@elizaos/core": "workspace:*",
23+
"zod": "3.23.8",
24+
"instagram-private-api": "^1.45.3",
25+
"sharp": "^0.33.2",
26+
"glob": "11.0.0"
27+
},
28+
"devDependencies": {
29+
"tsup": "8.3.5",
30+
"@types/sharp": "^0.32.0"
31+
},
32+
"scripts": {
33+
"build": "tsup --format esm --dts",
34+
"dev": "tsup --format esm --dts --watch",
35+
"lint": "eslint --fix --cache ."
36+
}
37+
}

0 commit comments

Comments
 (0)