diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..9370fa7 --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +OPENAI_API_KEY= +USE_OPENAI_EMBEDDING=true \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json index e3952f7..a12bd4b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -72,43 +72,6 @@ ], "@typescript-eslint/no-useless-constructor": ["error"], "@typescript-eslint/no-non-null-assertion": "error", - "no-restricted-imports": [ - "error", - { - "paths": [ - { - "name": "lodash", - "importNames": ["isNull"], - "message": "Please use isNull from @tribes/core instead." - }, - { - "name": "ethers", - "importNames": ["logger"], - "message": "Please use logger from @tribes/core instead." - }, - { - "name": "console", - "importNames": ["assert"], - "message": "Please use assert from 'assert' instead." - }, - { - "name": "aws-sdk", - "importNames": ["DynamoDB"], - "message": "Please import AWS and use as AWS.DynamoDB instead." - }, - { - "name": "@wagmi/core", - "importNames": ["getPublicClient"], - "message": "Do not use getPublicClient directly. Use basePublicClient instead." - }, - { - "name": "@reown/appkit/networks", - "importNames": ["base", "mainnet"], - "message": "Do not use base directly. Use supported_chains instead." - } - ] - } - ], "prettier/prettier": "error", "no-async-promise-executor": "off", "space-before-function-paren": "off", diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7f8d5c7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +name: CI +on: + push: + branches: + - '**' + pull_request: + types: [opened, edited] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + - uses: oven-sh/setup-bun@v2 + + - name: Install dependencies + run: bun install + + - name: Build project + run: bun run build + + - name: Run linting + run: bun run lint diff --git a/.gitignore b/.gitignore index 55206fa..ee4acbc 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ dist node_modules dist/ built -data/ +data/knowledgeFiles +data/agent-keypair.json +data/sqlite.db db.sqlite .idea \ No newline at end of file diff --git a/README.md b/README.md index 2a8883b..d3883db 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,17 @@ # Agent- ayaos Template +## Setup + +```bash +cp .env.example .env +``` + +```bash +bun install +``` + +## Run + +```bash +bun dev +``` diff --git a/bun.lockb b/bun.lockb index f996e5f..50b5c0c 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 3138e6c..e1e1369 100644 --- a/package.json +++ b/package.json @@ -6,19 +6,20 @@ "scripts": { "build": "tsup src/index.ts --format esm --dts", "lint": "eslint src/**/*.ts", - "dev": "tsx src/index.ts", + "dev": "tsx watch src/index.ts", "start": "NODE_ENV=production tsx dist/index.js", - "agent": "dotenv --e /root/.agentcoin-fun/env.production -- tsx dist/index.js" + "agent": "tsx dist/index.js" }, "dependencies": { - "@elizaos/core": "0.1.9", - "@tribesxyz/ayaos": "0.0.33" + "@tribesxyz/ayaos": "0.0.34", + "zod": "3.24.2" }, "engines": { "node": ">=22" }, "resolutions": { - "onnxruntime-node": "1.20.0" + "onnxruntime-node": "1.20.0", + "zod": "3.24.2" }, "devDependencies": { "@changesets/cli": "2.28.1", diff --git a/src/index.ts b/src/index.ts index d1120e1..6ed01dc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,27 +1,27 @@ -import { elizaLogger } from '@elizaos/core' -import { Agent } from '@tribesxyz/ayaos' +import { Agent, ayaLogger } from '@tribesxyz/ayaos' async function main(): Promise { try { - const agent = new Agent() + const agent = new Agent({ + dataDir: 'data' + }) agent.on('pre:llm', async (context) => { - console.log('llm:pre', context.memory) + ayaLogger.info('llm:pre', context.memory) return true }) agent.on('post:llm', async (context) => { - console.log('llm:post', context.memory) + ayaLogger.info('llm:post', context.memory) return true }) await agent.start() - elizaLogger.success('sdk initialized', agent.agentId) + ayaLogger.success('sdk initialized', agent.agentId) } catch { process.exit(1) } } -console.log('hello, agent!') -main().catch(elizaLogger.error) +main().catch(ayaLogger.error)