Skip to content

Commit fde96cd

Browse files
committed
feat: refactor rest express server
1 parent 884f3e5 commit fde96cd

File tree

10 files changed

+1118
-966
lines changed

10 files changed

+1118
-966
lines changed

.github/workflows/run-tck.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ on:
1010
env:
1111
# TODO once we have the TCK for 0.4.0 we will need to look at the branch to decide which TCK version to run.
1212
# Tag of the TCK
13-
TCK_VERSION: 0.3.0.beta3
13+
TCK_VERSION: main
1414
# Tells uv to not need a venv, and instead use system
1515
UV_SYSTEM_PYTHON: 1
16-
# SUT_JSONRPC_URL to use for the TCK and the server agent
17-
SUT_JSONRPC_URL: http://localhost:41241
16+
# Base URL for the SUT agent
17+
SUT_BASE_URL: http://localhost:41241
18+
# Base URL for the SUT agent JSON-RPC transport
19+
SUT_JSONRPC_URL: http://localhost:41241/a2a/jsonrpc
1820
# Slow system on CI
1921
TCK_STREAMING_TIMEOUT: 5.0
2022

@@ -58,7 +60,7 @@ jobs:
5860
npm run tck:sut-agent &
5961
- name: Wait for SUT to start
6062
run: |
61-
URL="${{ env.SUT_JSONRPC_URL }}/.well-known/agent-card.json"
63+
URL="${{ env.SUT_BASE_URL }}/.well-known/agent-card.json"
6264
EXPECTED_STATUS=200
6365
TIMEOUT=120
6466
RETRY_INTERVAL=2
@@ -94,8 +96,9 @@ jobs:
9496
id: run-tck
9597
timeout-minutes: 5
9698
run: |
97-
./run_tck.py --sut-url ${{ env.SUT_JSONRPC_URL }} --category mandatory
99+
./run_tck.py --sut-url ${{ env.SUT_JSONRPC_URL }} --category mandatory --transports jsonrpc,rest
98100
working-directory: tck/a2a-tck
101+
99102
- name: Stop SUT
100103
if: always()
101104
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,4 @@ testem.log
179179
# System files
180180
.DS_Store
181181
Thumbs.db
182+
.nyc_output/

package-lock.json

Lines changed: 10 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/server/express/a2a_express_app.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { A2ARequestHandler } from '../request_handler/a2a_request_handler.js';
44
import { AGENT_CARD_PATH } from '../../constants.js';
55
import { jsonErrorHandler, jsonRpcHandler } from './json_rpc_handler.js';
66
import { agentCardHandler } from './agent_card_handler.js';
7+
import { httpRestHandler } from './http_rest_handler.js';
78

89
export class A2AExpressApp {
910
private requestHandler: A2ARequestHandler;
@@ -40,6 +41,7 @@ export class A2AExpressApp {
4041

4142
router.use(jsonRpcHandler({ requestHandler: this.requestHandler }));
4243
router.use(`/${agentCardPath}`, agentCardHandler({ agentCardProvider: this.requestHandler }));
44+
router.use(httpRestHandler({ requestHandler: this.requestHandler }));
4345

4446
app.use(baseUrl, router);
4547
return app;

0 commit comments

Comments
 (0)