forked from elizaOS/eliza
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from sqrDAO/feat/bullmq
feat: bullmq
- Loading branch information
Showing
17 changed files
with
535 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,64 @@ | ||
{ | ||
"name": "@ai16z/agent", | ||
"version": "0.1.6", | ||
"main": "src/index.ts", | ||
"type": "module", | ||
"scripts": { | ||
"start": "node --loader ts-node/esm src/index.ts", | ||
"dev": "node --loader ts-node/esm src/index.ts", | ||
"check-types": "tsc --noEmit" | ||
}, | ||
"nodemonConfig": { | ||
"watch": [ | ||
"src", | ||
"../core/dist" | ||
], | ||
"ext": "ts,json", | ||
"exec": "node --enable-source-maps --loader ts-node/esm src/index.ts" | ||
}, | ||
"dependencies": { | ||
"@sqrdao/plugin-github": "workspace:*", | ||
"@ai16z/adapter-postgres": "workspace:*", | ||
"@ai16z/adapter-redis": "workspace:*", | ||
"@ai16z/adapter-sqlite": "workspace:*", | ||
"@ai16z/client-auto": "workspace:*", | ||
"@ai16z/client-direct": "workspace:*", | ||
"@ai16z/client-discord": "workspace:*", | ||
"@ai16z/client-farcaster": "workspace:*", | ||
"@ai16z/client-lens": "workspace:*", | ||
"@ai16z/client-telegram": "workspace:*", | ||
"@ai16z/client-twitter": "workspace:*", | ||
"@ai16z/client-slack": "workspace:*", | ||
"@ai16z/eliza": "workspace:*", | ||
"@ai16z/plugin-0g": "workspace:*", | ||
"@ai16z/plugin-aptos": "workspace:*", | ||
"@ai16z/plugin-bootstrap": "workspace:*", | ||
"@ai16z/plugin-intiface": "workspace:*", | ||
"@ai16z/plugin-coinbase": "workspace:*", | ||
"@ai16z/plugin-conflux": "workspace:*", | ||
"@ai16z/plugin-evm": "workspace:*", | ||
"@ai16z/plugin-flow": "workspace:*", | ||
"@ai16z/plugin-story": "workspace:*", | ||
"@ai16z/plugin-goat": "workspace:*", | ||
"@ai16z/plugin-icp": "workspace:*", | ||
"@ai16z/plugin-image-generation": "workspace:*", | ||
"@ai16z/plugin-nft-generation": "workspace:*", | ||
"@ai16z/plugin-node": "workspace:*", | ||
"@ai16z/plugin-solana": "workspace:*", | ||
"@ai16z/plugin-starknet": "workspace:*", | ||
"@ai16z/plugin-ton": "workspace:*", | ||
"@ai16z/plugin-sui": "workspace:*", | ||
"@ai16z/plugin-tee": "workspace:*", | ||
"@ai16z/plugin-multiversx": "workspace:*", | ||
"@ai16z/plugin-near": "workspace:*", | ||
"@ai16z/plugin-zksync-era": "workspace:*", | ||
"readline": "1.3.0", | ||
"ws": "8.18.0", | ||
"yargs": "17.7.2" | ||
}, | ||
"devDependencies": { | ||
"ts-node": "10.9.2", | ||
"tsup": "8.3.5" | ||
} | ||
"name": "@ai16z/agent", | ||
"version": "0.1.6", | ||
"main": "src/index.ts", | ||
"type": "module", | ||
"scripts": { | ||
"start": "node --loader ts-node/esm src/index.ts", | ||
"dev": "node --loader ts-node/esm src/index.ts", | ||
"check-types": "tsc --noEmit" | ||
}, | ||
"nodemonConfig": { | ||
"watch": [ | ||
"src", | ||
"../core/dist" | ||
], | ||
"ext": "ts,json", | ||
"exec": "node --enable-source-maps --loader ts-node/esm src/index.ts" | ||
}, | ||
"dependencies": { | ||
"@sqrdao/plugin-github": "workspace:*", | ||
"@sqrdao/plugin-bullmq": "workspace:*", | ||
"@ai16z/adapter-postgres": "workspace:*", | ||
"@ai16z/adapter-redis": "workspace:*", | ||
"@ai16z/adapter-sqlite": "workspace:*", | ||
"@ai16z/client-auto": "workspace:*", | ||
"@ai16z/client-direct": "workspace:*", | ||
"@ai16z/client-discord": "workspace:*", | ||
"@ai16z/client-farcaster": "workspace:*", | ||
"@ai16z/client-lens": "workspace:*", | ||
"@ai16z/client-telegram": "workspace:*", | ||
"@ai16z/client-twitter": "workspace:*", | ||
"@ai16z/client-slack": "workspace:*", | ||
"@ai16z/eliza": "workspace:*", | ||
"@ai16z/plugin-0g": "workspace:*", | ||
"@ai16z/plugin-aptos": "workspace:*", | ||
"@ai16z/plugin-bootstrap": "workspace:*", | ||
"@ai16z/plugin-intiface": "workspace:*", | ||
"@ai16z/plugin-coinbase": "workspace:*", | ||
"@ai16z/plugin-conflux": "workspace:*", | ||
"@ai16z/plugin-evm": "workspace:*", | ||
"@ai16z/plugin-flow": "workspace:*", | ||
"@ai16z/plugin-story": "workspace:*", | ||
"@ai16z/plugin-goat": "workspace:*", | ||
"@ai16z/plugin-icp": "workspace:*", | ||
"@ai16z/plugin-image-generation": "workspace:*", | ||
"@ai16z/plugin-nft-generation": "workspace:*", | ||
"@ai16z/plugin-node": "workspace:*", | ||
"@ai16z/plugin-solana": "workspace:*", | ||
"@ai16z/plugin-starknet": "workspace:*", | ||
"@ai16z/plugin-ton": "workspace:*", | ||
"@ai16z/plugin-sui": "workspace:*", | ||
"@ai16z/plugin-tee": "workspace:*", | ||
"@ai16z/plugin-multiversx": "workspace:*", | ||
"@ai16z/plugin-near": "workspace:*", | ||
"@ai16z/plugin-zksync-era": "workspace:*", | ||
"readline": "1.3.0", | ||
"ws": "8.18.0", | ||
"yargs": "17.7.2" | ||
}, | ||
"devDependencies": { | ||
"ts-node": "10.9.2", | ||
"tsup": "8.3.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
* | ||
|
||
!dist/** | ||
!package.json | ||
!readme.md | ||
!tsup.config.ts | ||
!tsconfig.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import eslintGlobalConfig from "../../eslint.global.mjs"; | ||
|
||
export default [...eslintGlobalConfig]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "@sqrdao/plugin-bullmq", | ||
"version": "0.0.1", | ||
"main": "dist/index.js", | ||
"type": "module", | ||
"types": "dist/index.d.ts", | ||
"dependencies": { | ||
"@ai16z/eliza": "workspace:^", | ||
"bullmq": "^5.34.4", | ||
"pg": "8.13.1", | ||
"tsup": "^8.3.5" | ||
}, | ||
"devDependencies": { | ||
"eslint": "9.13.0", | ||
"eslint-config-prettier": "9.1.0", | ||
"eslint-plugin-prettier": "5.2.1", | ||
"eslint-plugin-vitest": "0.5.4", | ||
"typescript": "^5.7.2" | ||
}, | ||
"scripts": { | ||
"build": "tsup --format esm --dts", | ||
"dev": "tsup --watch", | ||
"lint": "eslint . --fix" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { | ||
Action, | ||
elizaLogger, | ||
HandlerCallback, | ||
IAgentRuntime, | ||
IBullMQService, | ||
Memory, | ||
State, | ||
} from "@ai16z/eliza"; | ||
import { Job, Worker } from "bullmq"; | ||
import { BullService } from "../services/bullmq"; | ||
|
||
const worker = new Worker( | ||
"gg_schedule", | ||
async (job: Job) => { | ||
await job.updateProgress(0); | ||
await job.updateProgress(100); | ||
}, | ||
BullService.getInstance<IBullMQService>().getQueueOptions() | ||
); | ||
|
||
worker.on("progress", (job: Job, progress: number) => { | ||
elizaLogger.log(`Job ${job.id} is ${progress}% done`); | ||
}); | ||
|
||
export const ggScheduleAction: Action = { | ||
name: "GG_SCHEDULE", | ||
similes: ["schedule", "plan", "book"], | ||
description: "Schedule a meeting or event", | ||
validate: async (runtime: IAgentRuntime, _message: Memory) => { | ||
return true; | ||
}, | ||
handler: async ( | ||
runtime: IAgentRuntime, | ||
message: Memory, | ||
_state: State, | ||
_options: any, | ||
callback: HandlerCallback | ||
) => { | ||
try { | ||
const bullService = runtime.getService<IBullMQService>( | ||
BullService.serviceType | ||
); | ||
if (!bullService) { | ||
throw new Error("BullMQ service not found"); | ||
} | ||
await bullService.createQueue("gg_schedule"); | ||
await bullService.createJob("gg_schedule", "gg_schedule", {}, {}); | ||
await (BullService.getInstance() as BullService).createQueue( | ||
"gg_schedule" | ||
); | ||
callback({ | ||
text: "Meeting scheduled successfully", | ||
}); | ||
} catch (error) { | ||
elizaLogger.error("Error scheduling meeting", error); | ||
callback({ | ||
text: "Error scheduling meeting" + error, | ||
}); | ||
} | ||
}, | ||
examples: [], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { BullService } from "./services/bullmq"; | ||
import { Plugin } from "@ai16z/eliza"; | ||
import { ggScheduleAction } from "./actions/ggSchedule"; | ||
export { BullService }; | ||
|
||
export const BullMQPlugin: Plugin = { | ||
name: "bullmqPlugin", | ||
description: "BullMQ plugin", | ||
actions: [ggScheduleAction], | ||
services: [new BullService()], | ||
}; |
Oops, something went wrong.