Skip to content

Commit 5b3b0f3

Browse files
authored
Merge branch 'develop' into tcm-compose-random-user
2 parents 90730c1 + 4d04b8b commit 5b3b0f3

File tree

67 files changed

+1860
-1600
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1860
-1600
lines changed
+5-29
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,13 @@
1-
name: integration-test
1+
name: Integration Tests
22
on:
33
push:
44
branches:
55
- "*"
6-
pull_request:
6+
pull_request_target:
77
branches:
88
- "*"
9-
jobs:
10-
smoke-tests:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- uses: actions/checkout@v4
14-
15-
- uses: pnpm/action-setup@v3
16-
with:
17-
version: 9.4.0
189

19-
- uses: actions/setup-node@v4
20-
with:
21-
node-version: "23"
22-
cache: "pnpm"
23-
24-
- name: Run smoke tests
25-
run: pnpm run smokeTests
10+
jobs:
2611
integration-tests:
2712
runs-on: ubuntu-latest
2813
env:
@@ -46,20 +31,11 @@ jobs:
4631
run: pnpm build
4732

4833
- name: Check for API key
49-
id: check_api_key
5034
run: |
5135
if [ -z "$OPENAI_API_KEY" ]; then
52-
echo "::set-output name=api_key_present::false"
53-
else
54-
echo "::set-output name=api_key_present::true"
36+
echo "Error: OPENAI_API_KEY is not set."
37+
exit 1
5538
fi
5639
5740
- name: Run integration tests
58-
if: steps.check_api_key.outputs.api_key_present == 'true'
5941
run: pnpm run integrationTests
60-
61-
- name: Skip integration tests
62-
if: steps.check_api_key.outputs.api_key_present == 'false'
63-
run: |
64-
echo "Skipping integration tests due to missing required API keys"
65-
exit 1

.github/workflows/pr.yaml

+5-3
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,21 @@ jobs:
1010

1111
steps:
1212
- name: Check out the repository
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v3
1414

1515
- name: Validate PR title
1616
id: validate
1717
run: |
1818
PR_TITLE=$(jq -r .pull_request.title "$GITHUB_EVENT_PATH")
1919
echo "PR Title: $PR_TITLE"
20-
if [[ ! "$PR_TITLE" =~ ^(feat|fix|docs|style|refactor|test|chore):\ .+ ]]; then
20+
if [[ ! "$PR_TITLE" =~ ^(feat|fix|docs|style|refactor|test|chore)(\([a-zA-Z0-9-]+\))?:\ .+ ]]; then
2121
echo "PR title does not match the required pattern."
2222
exit 1
2323
fi
2424
2525
- name: Set status
2626
if: failure()
2727
run: |
28-
gh pr comment ${{ github.event.pull_request.number }} --body "❌ PR title does not match the required pattern. Please use the format: 'type: description' (e.g., 'feat|fix|docs|style|refactor|test|chore: title')."
28+
gh pr comment ${{ github.event.pull_request.number }} --body "❌ PR title does not match the required pattern. Please use one of these formats:
29+
- 'type: description' (e.g., 'feat: add new feature')
30+
- 'type(scope): description' (e.g., 'chore(core): update dependencies')"

.github/workflows/smoke-tests.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: smoke-test
2+
on:
3+
push:
4+
branches:
5+
- "*"
6+
pull_request:
7+
branches:
8+
- "*"
9+
10+
jobs:
11+
smoke-tests:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: pnpm/action-setup@v3
17+
with:
18+
version: 9.4.0
19+
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: "23"
23+
cache: "pnpm"
24+
25+
- name: Run smoke tests
26+
run: pnpm run smokeTests

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ cd eliza-starter
5555
cp .env.example .env
5656
pnpm i && pnpm build && pnpm start
5757
```
58+
Once the agent is running, You should see the message to run "pnpm start:client" at the end.
59+
Open another terminal and move to same directory and then run below command and follow the URL to chat to your agent.
60+
```bash
61+
pnpm start:client
62+
```
5863

5964
Then read the [Documentation](https://elizaos.github.io/eliza/) to learn how to customize your Eliza.
6065

agent/package.json

+60-60
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,62 @@
11
{
2-
"name": "@elizaos/agent",
3-
"version": "0.1.7-alpha.1",
4-
"main": "src/index.ts",
5-
"type": "module",
6-
"scripts": {
7-
"start": "node --loader ts-node/esm src/index.ts",
8-
"dev": "node --loader ts-node/esm src/index.ts",
9-
"check-types": "tsc --noEmit"
10-
},
11-
"nodemonConfig": {
12-
"watch": [
13-
"src",
14-
"../core/dist"
15-
],
16-
"ext": "ts,json",
17-
"exec": "node --enable-source-maps --loader ts-node/esm src/index.ts"
18-
},
19-
"dependencies": {
20-
"@elizaos/adapter-postgres": "workspace:*",
21-
"@elizaos/adapter-redis": "workspace:*",
22-
"@elizaos/adapter-sqlite": "workspace:*",
23-
"@elizaos/client-auto": "workspace:*",
24-
"@elizaos/client-direct": "workspace:*",
25-
"@elizaos/client-discord": "workspace:*",
26-
"@elizaos/client-farcaster": "workspace:*",
27-
"@elizaos/client-lens": "workspace:*",
28-
"@elizaos/client-telegram": "workspace:*",
29-
"@elizaos/client-twitter": "workspace:*",
30-
"@elizaos/client-slack": "workspace:*",
31-
"@elizaos/core": "workspace:*",
32-
"@elizaos/plugin-0g": "workspace:*",
33-
"@elizaos/plugin-aptos": "workspace:*",
34-
"@elizaos/plugin-bootstrap": "workspace:*",
35-
"@elizaos/plugin-intiface": "workspace:*",
36-
"@elizaos/plugin-coinbase": "workspace:*",
37-
"@elizaos/plugin-conflux": "workspace:*",
38-
"@elizaos/plugin-evm": "workspace:*",
39-
"@elizaos/plugin-flow": "workspace:*",
40-
"@elizaos/plugin-story": "workspace:*",
41-
"@elizaos/plugin-goat": "workspace:*",
42-
"@elizaos/plugin-icp": "workspace:*",
43-
"@elizaos/plugin-image-generation": "workspace:*",
44-
"@elizaos/plugin-nft-generation": "workspace:*",
45-
"@elizaos/plugin-node": "workspace:*",
46-
"@elizaos/plugin-solana": "workspace:*",
47-
"@elizaos/plugin-starknet": "workspace:*",
48-
"@elizaos/plugin-ton": "workspace:*",
49-
"@elizaos/plugin-sui": "workspace:*",
50-
"@elizaos/plugin-tee": "workspace:*",
51-
"@elizaos/plugin-multiversx": "workspace:*",
52-
"@elizaos/plugin-near": "workspace:*",
53-
"@elizaos/plugin-zksync-era": "workspace:*",
54-
"readline": "1.3.0",
55-
"ws": "8.18.0",
56-
"yargs": "17.7.2"
57-
},
58-
"devDependencies": {
59-
"ts-node": "10.9.2",
60-
"tsup": "8.3.5"
61-
}
2+
"name": "@elizaos/agent",
3+
"version": "0.1.7-alpha.1",
4+
"main": "src/index.ts",
5+
"type": "module",
6+
"scripts": {
7+
"start": "node --loader ts-node/esm src/index.ts",
8+
"dev": "node --loader ts-node/esm src/index.ts",
9+
"check-types": "tsc --noEmit"
10+
},
11+
"nodemonConfig": {
12+
"watch": [
13+
"src",
14+
"../core/dist"
15+
],
16+
"ext": "ts,json",
17+
"exec": "node --enable-source-maps --loader ts-node/esm src/index.ts"
18+
},
19+
"dependencies": {
20+
"@elizaos/adapter-postgres": "workspace:*",
21+
"@elizaos/adapter-redis": "workspace:*",
22+
"@elizaos/adapter-sqlite": "workspace:*",
23+
"@elizaos/client-auto": "workspace:*",
24+
"@elizaos/client-direct": "workspace:*",
25+
"@elizaos/client-discord": "workspace:*",
26+
"@elizaos/client-farcaster": "workspace:*",
27+
"@elizaos/client-lens": "workspace:*",
28+
"@elizaos/client-telegram": "workspace:*",
29+
"@elizaos/client-twitter": "workspace:*",
30+
"@elizaos/client-slack": "workspace:*",
31+
"@elizaos/core": "workspace:*",
32+
"@elizaos/plugin-0g": "workspace:*",
33+
"@elizaos/plugin-aptos": "workspace:*",
34+
"@elizaos/plugin-bootstrap": "workspace:*",
35+
"@elizaos/plugin-intiface": "workspace:*",
36+
"@elizaos/plugin-coinbase": "workspace:*",
37+
"@elizaos/plugin-conflux": "workspace:*",
38+
"@elizaos/plugin-evm": "workspace:*",
39+
"@elizaos/plugin-flow": "workspace:*",
40+
"@elizaos/plugin-story": "workspace:*",
41+
"@elizaos/plugin-goat": "workspace:*",
42+
"@elizaos/plugin-icp": "workspace:*",
43+
"@elizaos/plugin-image-generation": "workspace:*",
44+
"@elizaos/plugin-nft-generation": "workspace:*",
45+
"@elizaos/plugin-node": "workspace:*",
46+
"@elizaos/plugin-solana": "workspace:*",
47+
"@elizaos/plugin-starknet": "workspace:*",
48+
"@elizaos/plugin-ton": "workspace:*",
49+
"@elizaos/plugin-sui": "workspace:*",
50+
"@elizaos/plugin-tee": "workspace:*",
51+
"@elizaos/plugin-multiversx": "workspace:*",
52+
"@elizaos/plugin-near": "workspace:*",
53+
"@elizaos/plugin-zksync-era": "workspace:*",
54+
"readline": "1.3.0",
55+
"ws": "8.18.0",
56+
"yargs": "17.7.2"
57+
},
58+
"devDependencies": {
59+
"ts-node": "10.9.2",
60+
"tsup": "8.3.5"
61+
}
6262
}

agent/src/index.ts

+36-5
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import fs from "fs";
6060
import path from "path";
6161
import { fileURLToPath } from "url";
6262
import yargs from "yargs";
63+
import net from "net";
6364

6465
const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
6566
const __dirname = path.dirname(__filename); // get the name of the directory
@@ -692,13 +693,30 @@ async function startAgent(
692693
}
693694
}
694695

696+
const checkPortAvailable = (port: number): Promise<boolean> => {
697+
return new Promise((resolve) => {
698+
const server = net.createServer();
699+
700+
server.once("error", (err: NodeJS.ErrnoException) => {
701+
if (err.code === "EADDRINUSE") {
702+
resolve(false);
703+
}
704+
});
705+
706+
server.once("listening", () => {
707+
server.close();
708+
resolve(true);
709+
});
710+
711+
server.listen(port);
712+
});
713+
};
714+
695715
const startAgents = async () => {
696716
const directClient = new DirectClient();
697-
const serverPort = parseInt(settings.SERVER_PORT || "3000");
717+
let serverPort = parseInt(settings.SERVER_PORT || "3000");
698718
const args = parseArguments();
699-
700719
let charactersArg = args.characters || args.character;
701-
702720
let characters = [defaultCharacter];
703721

704722
if (charactersArg) {
@@ -713,19 +731,32 @@ const startAgents = async () => {
713731
elizaLogger.error("Error starting agents:", error);
714732
}
715733

734+
// Find available port
735+
while (!(await checkPortAvailable(serverPort))) {
736+
elizaLogger.warn(
737+
`Port ${serverPort} is in use, trying ${serverPort + 1}`
738+
);
739+
serverPort++;
740+
}
741+
716742
// upload some agent functionality into directClient
717743
directClient.startAgent = async (character: Character) => {
718744
// wrap it so we don't have to inject directClient later
719745
return startAgent(character, directClient);
720746
};
747+
721748
directClient.start(serverPort);
722749

750+
if (serverPort !== parseInt(settings.SERVER_PORT || "3000")) {
751+
elizaLogger.log(`Server started on alternate port ${serverPort}`);
752+
}
753+
723754
elizaLogger.log(
724-
"Run `pnpm start:client` to start the client and visit the outputted URL (http://localhost:5173) to chat with your agents"
755+
"Run `pnpm start:client` to start the client and visit the outputted URL (http://localhost:5173) to chat with your agents. When running multiple agents, use client with different port `SERVER_PORT=3001 pnpm start:client`"
725756
);
726757
};
727758

728759
startAgents().catch((error) => {
729760
elizaLogger.error("Unhandled error in startAgents:", error);
730-
process.exit(1); // Exit the process after logging
761+
process.exit(1);
731762
});

0 commit comments

Comments
 (0)