# Description
This Pull Request implements server-side support for the gRPC transport
protocol.
**Schema and Generation**
The implementation is based on [A2A Proto Specification
v3.0.0](https://raw.githubusercontent.com/a2aproject/A2A/v0.3.0/specification/grpc/a2a.proto).
**Tooling**
ts-proto was adopted for generating TypeScript service definitions (with
buf), which will reuse the message types previously generated (this
requires a manual modification of the generated file).
**Limitations**
Due to the current dependency on Proto v3.0.0, the gRPC implementation
is missing some APIs already available for other transports, for example
the `getExtendedAuthenticatedAgentCard` method.
These missing endpoints will be implemented with future official
releases of proto specification.
**Entry Points**
A new dedicated entry point has been introduced to export the gRPC
server logic and @grpc/grpc-js and its related transport libraries have
been added as peer dependencies.
Fixes#275🦕
Release-As: 0.3.9
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Ivan Shymko <ishymko@google.com>
Co-authored-by: Ivan Shymko <vana.shimko@gmail.com>
# Description
This PR resolves an incompatibility in the payload shape between the
REST Transport handlers and other A2A SDKs.
In this version, the transmitted payload now aligns with the field names
and structure defined in the proto file. A new `a2a.ts` file has been
introduced to represent the proto types, including their corresponding
`fromJson` and `toJson` conversion functions.
**Technically this is a breaking change, however current implementation
isn't compatible with other official SDKs, so fixing in-place.** Current
situation with JSON format for HTTP+JSON is complicated as there is no
explicit specification in 0.3, see
[here](https://github.com/a2aproject/a2a-js/issues/291#issuecomment-3719125908)
for more details.
Fixes#291🦕
Release-As: 0.3.8
---------
Co-authored-by: Ivan Shymko <ishymko@google.com>
# Description
Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make
sure it goes smoothly:
- [x] Follow the [`CONTRIBUTING`
Guide](https://github.com/google-a2a/a2a-js/blob/main/CONTRIBUTING.md).
- [x] Make your Pull Request title in the
<https://www.conventionalcommits.org/> specification.
- Important Prefixes for
[release-please](https://github.com/googleapis/release-please):
- `fix:` which represents bug fixes, and correlates to a
[SemVer](https://semver.org/) patch.
- `feat:` represents a new feature, and correlates to a SemVer minor.
- `feat!:`, or `fix!:`, `refactor!:`, etc., which represent a breaking
change (indicated by the `!`) and will result in a SemVer major.
- [x] Ensure the tests and linter pass
- [ ] Appropriate docs were updated (if necessary)
Fixes#264🦕
Release-As: 0.3.8
---------
Co-authored-by: Ivan Shimko <vana.shimko@gmail.com>
# Description
Follow-up for #142: authenticated agent card logic relies on context to
determine authentication status.
`src/server/transports/rest/rest_transport_handler.ts` is not exported,
so adding a required parameter is fine.
Re #137
# Description
Due to a name conflict with legacy JSON-RPC types reexported from
`src/index.ts` below errors are going to be exported via
`src/client/index.ts` to allow usage from external transport
implementations.
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
# Description
Following continuation of this PR
https://github.com/a2aproject/a2a-js/pull/142, this one is related to
the implementation of the REST mode support for the client part of
**a2a-js** sdk. Following the same pattern as other sdk (agnostic
transport).
----
Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make
sure it goes smoothly:
- [x] Follow the [`CONTRIBUTING`
Guide](https://github.com/google-a2a/a2a-js/blob/main/CONTRIBUTING.md).
- [x] Make your Pull Request title in the
<https://www.conventionalcommits.org/> specification.
- Important Prefixes for
[release-please](https://github.com/googleapis/release-please):
- `fix:` which represents bug fixes, and correlates to a
[SemVer](https://semver.org/) patch.
- `feat:` represents a new feature, and correlates to a SemVer minor.
- `feat!:`, or `fix!:`, `refactor!:`, etc., which represent a breaking
change (indicated by the `!`) and will result in a SemVer major.
- [x] Ensure the tests and linter pass
- [ ] Appropriate docs were updated (if necessary)
Fixes#137, fixes#175🦕
Release-As: 0.3.7
Co-authored-by: Ivan Shymko <ishymko@google.com>
## Summary
This PR addresses [issue
#218](https://github.com/a2aproject/a2a-js/issues/218) by replacing the
Node.js-specific `EventEmitter` with the web-standard `EventTarget` API,
enabling the SDK to run natively on edge runtimes (Cloudflare Workers,
Deno, Bun) without requiring Node.js compatibility modes.
## Changes
### Replace EventEmitter with EventTarget
**File:** `src/server/events/execution_event_bus.ts`
- Removes Node.js `events` module dependency
- Uses web-standard `EventTarget` API available in all modern runtimes
- Maintains backward-compatible API (`on`, `off`, `once`,
`removeAllListeners`)
- Adds `ExecutionEventName` type alias for `'event' | 'finished'`
- Includes `CustomEvent` polyfill for Node.js 15-18 (built-in from
Node.js 19+)
## Implementation Details
### EventEmitter Behavior Compatibility
The implementation faithfully replicates EventEmitter semantics:
- **FIFO dispatch order** - Listeners fire in the order they were
registered
- **`this` context** - Listeners are invoked with `this` bound to the
event bus instance
- **Memory semantics** - Listeners are held via strong references until
explicitly removed (identical to EventEmitter)
### Type Safety
- Uses type guards (`isAgentExecutionCustomEvent`) for safe runtime
narrowing - no unsafe casts
- `'finished'` event listeners are invoked with no arguments (using
`Function.prototype.call`) matching EventEmitter behavior
- Internal listener tracking uses `readonly` Maps
## Benefits
- ✅ **Native Cloudflare Workers support** - No `nodejs_compat` flag
needed
- ✅ **Native Deno support** - No `npm:` shims required
- ✅ **Native Bun support** - Full web API compatibility
- ✅ **Browser compatibility** - True universal JavaScript
- ✅ **Node.js 15+** - EventTarget is built-in
## Breaking Changes
- Requires **Node.js 15+** (EventTarget support)
- Node.js 14 no longer supported (EOL anyway)
## Testing
- All **146 existing tests pass** with these changes
- Added **27 new tests** for `DefaultExecutionEventBus` covering:
- Basic `on`/`off`/`once` functionality
- Multiple registrations of same listener
- `once()` auto-cleanup behavior
- `removeAllListeners()` for specific events and all events
- Event firing order (FIFO)
- Method chaining
- `this` context binding
## Related Work
I've implemented and tested these changes in my fork:
- Fork: https://github.com/drew-foxall/a2a-js-sdk
- Working Hono implementation:
https://github.com/drew-foxall/a2a-js-sdk-examplesCloses#218
Release-As: 0.3.7
# Description
1. Update README.md, sample agents and sample CLI to use new APIs
introduced in #162 (extract middlewares from `A2AExpressApp`) and #198
(transport-agnostic client).
2. Mark `A2AExpressApp` and `A2AClient` as deprecated.
3. Ensure samples and TCK import via index files only to "test" that all
required types are exported.
4. Consolidate all `@example` tags to use ` ```ts `.
# Description
Update `ClientFactory.createFrom` merging logic to work better with
common use-cases:
1. Merge transports by `TransportFactory.protocolName` to allow the
following:
```ts
const factory = new ClientFactory(ClientFactoryOptions.createFrom(ClientFactoryOptions.default, {
transports: [
new JsonRpcTransportFactory({ fetchImpl: myCustomFetch })
]
}))
```
2. Concatenate interceptors to allow providing SDK default interceptors.
3. Other config-like arrays (`preferredTransports`,
`clientConfig.acceptedOutputModes`) are replaced.
Re: follow-up for unreleased #240
# Description
This PR reverses the execution order of interceptors in the
interceptAfter method. It ensures symmetry with interceptBefore, meaning
the last interceptor called during the 'before' phase is the first one
called during the 'after' phase.
---------
Co-authored-by: Ivan Shymko <vana.shimko@gmail.com>
Bumps [jws](https://github.com/brianloveswords/node-jws) from 3.2.2 to
3.2.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/brianloveswords/node-jws/releases">jws's
releases</a>.</em></p>
<blockquote>
<h2>v3.2.3</h2>
<h3>Changed</h3>
<ul>
<li>Fix advisory GHSA-869p-cjfg-cm3x: createSign and createVerify now
require
that a non empty secret is provided (via opts.secret, opts.privateKey or
opts.key)
when using HMAC algorithms.</li>
<li>Upgrading JWA version to 1.4.2, addressing a compatibility issue for
Node >= 25.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/auth0/node-jws/blob/master/CHANGELOG.md">jws's
changelog</a>.</em></p>
<blockquote>
<h2>[3.2.3]</h2>
<h3>Changed</h3>
<ul>
<li>Fix advisory GHSA-869p-cjfg-cm3x: createSign and createVerify now
require
that a non empty secret is provided (via opts.secret, opts.privateKey or
opts.key)
when using HMAC algorithms.</li>
<li>Upgrading JWA version to 1.4.2, adressing a compatibility issue for
Node >= 25.</li>
</ul>
<h2>[3.0.0]</h2>
<h3>Changed</h3>
<ul>
<li><strong>BREAKING</strong>: <code>jwt.verify</code> now requires an
<code>algorithm</code> parameter, and
<code>jws.createVerify</code> requires an <code>algorithm</code> option.
The <code>"alg"</code> field
signature headers is ignored. This mitigates a critical security flaw
in the library which would allow an attacker to generate signatures with
arbitrary contents that would be accepted by <code>jwt.verify</code>.
See
<a
href="https://auth0.com/blog/2015/03/31/critical-vulnerabilities-in-json-web-token-libraries/">https://auth0.com/blog/2015/03/31/critical-vulnerabilities-in-json-web-token-libraries/</a>
for details.</li>
</ul>
<h2><a
href="https://github.com/brianloveswords/node-jws/compare/v1.0.1...v2.0.0">2.0.0</a>
- 2015-01-30</h2>
<h3>Changed</h3>
<ul>
<li>
<p><strong>BREAKING</strong>: Default payload encoding changed from
<code>binary</code> to
<code>utf8</code>. <code>utf8</code> is a is a more sensible default
than <code>binary</code> because
many payloads, as far as I can tell, will contain user-facing
strings that could be in any language. (<!-- raw HTML omitted --><a
href="https://github.com/brianloveswords/node-jws/commit/6b6de48">6b6de48</a><!--
raw HTML omitted -->)</p>
</li>
<li>
<p>Code reorganization, thanks <a
href="https://github.com/fearphage"><code>@fearphage</code></a>! (<!--
raw HTML omitted --><a
href="https://github.com/brianloveswords/node-jws/commit/7880050">7880050</a><!--
raw HTML omitted -->)</p>
</li>
</ul>
<h3>Added</h3>
<ul>
<li>Option in all relevant methods for <code>encoding</code>. For those
few users
that might be depending on a <code>binary</code> encoding of the
messages, this
is for them. (<!-- raw HTML omitted --><a
href="https://github.com/brianloveswords/node-jws/commit/6b6de48">6b6de48</a><!--
raw HTML omitted -->)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="4f6e73f24d"><code>4f6e73f</code></a>
Merge commit from fork</li>
<li><a
href="bd0fea57f3"><code>bd0fea5</code></a>
version 3.2.3</li>
<li><a
href="7c3b4b4110"><code>7c3b4b4</code></a>
Enhance tests for HMAC streaming sign and verify</li>
<li><a
href="a9b8ed999d"><code>a9b8ed9</code></a>
Improve secretOrKey initialization in VerifyStream</li>
<li><a
href="6707fde62c"><code>6707fde</code></a>
Improve secret handling in SignStream</li>
<li>See full diff in <a
href="https://github.com/brianloveswords/node-jws/compare/v3.2.2...v3.2.3">compare
view</a></li>
</ul>
</details>
<details>
<summary>Maintainer changes</summary>
<p>This version was pushed to npm by <a
href="https://www.npmjs.com/~julien.wollscheid">julien.wollscheid</a>, a
new releaser for jws since your current version.</p>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/a2aproject/a2a-js/network/alerts).
</details>
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ivan Shimko <vana.shimko@gmail.com>
# Description
## Add HTTP+REST ServerSide Transport Support
- Server: REST endpoints/routes addition by taking advantage of
pre-existing express from the codebase. Following this
[doc](https://a2a-protocol.org/latest/specification/#356-method-mapping-reference-table)
and internally rerouting to each a2a handler method containing the
buisness logic
Some part of the code has been generated using generative AI to speed up
the development, I have reviewed it carefully, but this should be taken
into account into the review. Keep in mind this is my first time
contributing to the repo and this is an attempt to help a2a-js support
REST (HTTP+JSON) as per describe in the [a2a
documentation](https://a2a-protocol.org/latest/specification/#323-httpjsonrest-transport).
I'll be happy to refacto it during review process, don't hesitate to
challenge it.
---
Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make
sure it goes smoothly:
- [x] Follow the [`CONTRIBUTING`
Guide](https://github.com/google-a2a/a2a-js/blob/main/CONTRIBUTING.md).
- [x] Make your Pull Request title in the
<https://www.conventionalcommits.org/> specification.
- Important Prefixes for
[release-please](https://github.com/googleapis/release-please):
- `fix:` which represents bug fixes, and correlates to a
[SemVer](https://semver.org/) patch.
- `feat:` represents a new feature, and correlates to a SemVer minor.
- `feat!:`, or `fix!:`, `refactor!:`, etc., which represent a breaking
change (indicated by the `!`) and will result in a SemVer major.
- [x] Ensure the tests and linter pass
- [ ] Appropriate docs were updated (if necessary)
Re #137🦕
Release-As: 0.3.6
# Description
`createFromAgentCardUrl` may give a wrong impression that full URL has
to be provided, rename and add examples.
Not yet released, `AgentCardResolver` and the method were added in #225.
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
# Description
Deep cloning each object and array for adding an interceptor into
default client config (for example) is quite involved, define a helper
function so that it can be done as follows:
```ts
const options = ClientFactoryOptions.createFrom(ClientFactoryOptions.default, {
clientConfig: { interceptors: [new MyInterceptor()] },
});
```
# Description
This PR add a feature to PR #223 adding the agentCard to the
interceptors' parameters. Some values of the agentCard may be necessary
at the interceptors level (e.g. security schemes).
BEGIN_COMMIT_OVERRIDE
refactor: add AgentCard to interceptors parameters
END_COMMIT_OVERRIDE
# Description
Pass `ServerCallContext` to `TaskStore` to allow DB-backed stores.
Enhance comments for `User`, stating that `userName` is a unique
identifier.
Re #213
# Description
This PR adds the support on client side for the
getAuthenticatedExtendedCard api.
Fixes#196🦕
Release-As: 0.3.6
---------
Co-authored-by: Ivan Shymko <vana.shimko@gmail.com>
# Description
This PR implements the support for extensions on client side
Fixes#170🦕
Release-As: 0.3.6
---------
Co-authored-by: Ivan Shymko <ishymko@google.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
# Description
Provides typed API to read and update context to make predefined and
externally defined keys composable in the same way.
```ts
export type SystemParameters = Record<string, string>;
export const systemParametersKey = new ClientCallContextKey<SystemParameters>('systemParameters');
const myContext = ClientCallContext.create(
systemParametersKey.set({ 'X-A2A-Extensions': 'http://example.com' })
);
const myParameters = systemParametersKey.get(myContext);
```
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
# Description
This PR changes the `context` parameter in `RequestOptions` from
mandatory to optional.
Fix for #223 which is not yet released, so overriding changelog entry
below to avoid extra message for unreleased functionality.
BEGIN_COMMIT_OVERRIDE
refactor: change `context` parameter in `RequestOptions` from mandatory
to optional
END_COMMIT_OVERRIDE
1. `after` wasn't invoked in case of early return from `before` for
executed interceptors as done in non-generators methods.
2. `after` wasn't invoked for non-streaming fallback from
`sendMessageStream`.
Fix for #223 which is not yet released, so overriding changelog entry
below to avoid extra message for unreleased functionality.
BEGIN_COMMIT_OVERRIDE
refactor: properly invoke CallInterceptor.after for async generators
END_COMMIT_OVERRIDE
# Description
Implement client interceptors and export multi-transport client types to
prepare for upcoming release.
Interceptors support "early return" both before and after transport
invocation. For early return before transport invocation client invokes
appropriate "after" methods of executed interceptors.
Release-As: 0.3.6
---------
Co-authored-by: Guglielmo Colombo <guglielmoc@google.com>
# Description
`tsc --noEmit` added in #214 as a part of `npm run lint` wasn't executed
in CI.
Add it and fix errors introduced while it wasn't running.
# Description
This PR introduces a sample for the authentication feature.
Re #195
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
# Description
This PR creates a new `package.json` in the `samples` folder, not to
pollute the main `package.json` with libraries specific to the samples.
# Description
`tsup` does not perform strict type checking before the generation of
the `d.ts` files. Adding the `tsc --noEmit` step checks for types
violation.
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Ivan Shymko <vana.shimko@gmail.com>
# Description
As a next step after #169, define a transport agnostic client.
# Changes
## Main
- Define `Client` built around core types, not JSON-RPC wrappers.
- Define `ClientFactory` to dynamically select transport among available
based on agent card and factory level preferences.
## Misc
- Rename `A2ATransport` to `Transport` (this type is not yet exported
via `index.ts`).
- Add `AbortSignal` to `Transport` and new client for cancellation.
- Add basic E2E test for `sendMessage` and `sendMessageStream` using
server SDK wired up with real expressjs app and invoked via newly
created client.
- Fix `getTaskPushNotificationConfig` types in transport.
# TODOs
- Client interceptors.
- Extensions support.
Re #137, #142
Release-As: 0.3.6
# Description
Marking as refactor, since updated type wasn't released yet.
Making `userBuilder` a mandatory parameter for `JsonRpcHandlerOptions`
and define a helper `UserBuilder.NoAuthentication` to make it explicit.
Re #195.
# Description
This PR is a fix for the bug caused by the user being deleted when the
request is containing requested extensions, as a new ServerCallContext
was created without copying the `context.user`.
Fixes#199🦕
PRs #171, #195
BEGIN_COMMIT_OVERRIDE
refactor: Populate the ServerCallContext user param when a new
ServerCallContext is created
END_COMMIT_OVERRIDE
# Description
This PR introduces a more robust implementation of the
`getAuthenticatedExtendedAgentCard` API.
The user may inject in the `default_request_handler` an AgentCart object
or a callback (`ExtendedAgentCardProvider`) which receives as input
parameters the `ServerCallContext` and returns an AgentCard object.
- If extendedAgentCardProvider is provided as callback: The logic
delegates entirely to the callback. This allows consumers to implement
custom authorization check if the user has insufficient permissions.
- If extendedAgentCardProvider is provided as AgentCard object:
1. User in context is Authenticated: Returns extendedAgentCard.
2. User in context is Unauthenticated: Returns the basic agentCard.
Fixes#196🦕
Release-As: 0.3.6
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
# Description
This PR integrates a support for authentication on the server side.
A new `User` interface is created to represent the Authenticated and
UnAuthenticated user in the context, with 2 required function:
1. isAuthenticathed()
2. userName()
The callback `authenticathedUserExtractor` provided to the
`A2AExpressApp` is responsible for extracting the user object from the
Request (if set up by the authentication middleware), and returning an
instance of the `User` interface. The returned instance will be added to
the ServerCallContext.
If no authentication middleware or no `authenticathedUserExtractor` is
provided to the Server, the user in the ServerCallContext will be of
type UnAuthenticated.
Fixes#194🦕
Release-As: 0.3.6
# Description
The purpose of this PR is removing all the references to keyword 'any'
present in the repository, as it is considered a bad practice. Future
adoptions will be triggered by the linter automatic checks
Fixes#184🦕
# Description
This PR fixes the error of server crash in case of error in the event
loop for non blocking event, if the first reply to the client has been
already sent.
Two different error handling strategies are implemented based on the
origin of the error:
1. If the error originates from the pushNotification service, the loop
is not interrupted, and the error is simply printed on the console error
output
2. If the error is originating from the ExecutionEventQueue or from a
taskStore operation (resultManager interaction), the error is
interrupting the loop.
In the catch clause a TaskStatusUpdateEvent is generated, with
taskStatus equal to "failed", if an already existing Task has been
processed by the ResultManager. The new TaskStatusUpdateEvent is saved
in the taskStore. If a new error occurs within this operation, it is
simply printed on the console error output.
Fixes#186🦕
# Description
Currently `A2AClient` defined in `client.ts` uses JSON-RPC types in its
interface, i.e. `sendMessage` uses
[`SendMessageResponse`](e7e8f35d5d/src/client/client.ts (L207))
which contains [JSON-RPC fields like `id` and `jsonrpc`
version](e7e8f35d5d/src/types.ts (L2177-L2190)).
It was also the case for Python SDK which required introducing a new
[client.py](https://github.com/a2aproject/a2a-python/blob/main/src/a2a/client/client.py)
keeping the old one as
[legacy.py](https://github.com/a2aproject/a2a-python/blob/main/src/a2a/client/legacy.py)
for backward compatibility (see
[#348](https://github.com/a2aproject/a2a-python/pull/348)).
As a first step of introducing a transport-agnostic client, extract
JSON-RPC specific logic into a transport abstraction and switch existing
`A2AClient` to it in a backward compatible way to take advantage of
existing tests.
**Note:** new types are not exported from `index.ts`, this will be done
once new client is ready.
# Changes
1. Define `A2ATransport` abstraction without using JSON-RPC types.
2. Implement `JsonRpcTransport` from existing `A2AClient`.
3. Use new `JsonRpcTransport` from `A2AClient` - new transports are
**not going** to be added into this client as it uses JSON-RPC types.
This is done in a backward compatible way, existing behavior is
preserved: returning JSON-RPC errors as objects, populating JSON-RPC
specific fields.
4. Define shared transport-agnostic errors for A2A specific errors
defined in [the
spec](https://a2a-protocol.org/latest/specification/#82-a2a-specific-errors).
Re #137, #142
# Description
This PR integrates the prettier check in the github workflow to ensure
the code respects the correct formatting standards
Fixes#177🦕
---------
Co-authored-by: Ivan Shymko <vana.shimko@gmail.com>
# Description
This pull request introduces a new ESLint configuration file,
`eslint.config.mjs` to standardize code quality and style across the
project.
Here's a summary of the key changes:
- ESLint Setup with TypeScript and Prettier Integration: The
configuration now leverages @eslint/js and typescript-eslint for linting
of TypeScript code. eslint-config-prettier is included to disable any
ESLint rules that might conflict with Prettier's formatting, which will
be included in a new PR.
- Ignored Files: The dist/ and node_modules/ directories are explicitly
ignored to prevent linting of generated output and third-party
dependencies.
Custom Rule Adjustments:
- @typescript-eslint/no-explicit-any is turned off to allow the use of
the any type where necessary.
- @typescript-eslint/no-unused-vars is configured to ignore unused
arguments and caught errors that are prefixed with an underscore (_).
This is a common pattern to signal intentional unused variables.
Test File Specific Rules:
- @typescript-eslint/no-unused-expressions is turned off to accommodate
testing libraries like Chai, which often use expression-based
assertions.
- @typescript-eslint/no-unsafe-function-type is turned off to allow more
flexible function type usage within test contexts.
Node.js Global Variables: The configuration now includes globals.node to
correctly recognize Node.js global variables, preventing false positives
for undefined variables in Node.js environments.
The changes in other files in this PR are necessary for the linter
checks to pass. They involve mainly the removal of unused parameters.
Re #177🦕
# Description
The code submitted in the PR introduces the support for extensions on
the server side.
Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make
sure it goes smoothly:
- [x] Follow the [`CONTRIBUTING`
Guide](https://github.com/google-a2a/a2a-js/blob/main/CONTRIBUTING.md).
- [x] Make your Pull Request title in the
<https://www.conventionalcommits.org/> specification.
- Important Prefixes for
[release-please](https://github.com/googleapis/release-please):
- `fix:` which represents bug fixes, and correlates to a
[SemVer](https://semver.org/) patch.
- `feat:` represents a new feature, and correlates to a SemVer minor.
- `feat!:`, or `fix!:`, `refactor!:`, etc., which represent a breaking
change (indicated by the `!`) and will result in a SemVer major.
- [x] Ensure the tests and linter pass
- [x] Appropriate docs were updated (if necessary)
Fixes#170🦕
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
# Description
As a preparation step for REST support proposed in #142, extract
Express.js handlers from `A2AExpressApp` to allow assembling your own
app using Express.js API directly for specifying individual paths and
middlewares, rather than wrapping it in `A2AExpressApp`:
```ts
// const a2aRequestHandler = . . .
const app = express();
// Minimal example:
app.use(`/${AGENT_CARD_PATH}`, agentCardHandler({ agentCardProvider: a2aRequestHandler }));
app.use(jsonRpcHandler({ requestHandler: a2aRequestHandler }));
// Advanced example:
app.use(myCustomMiddleware());
app.use('/.well-known/custom-agent-card.json', myCustomAgentCardMiddleware, agentCardHandler({ agentCardProvider: a2aRequestHandler }));
app.use('/a2a/jsonrpc', myJsonRpcMiddleware, jsonRpcHandler({ requestHandler: a2aRequestHandler }));
app.use('/a2a/api', restHandler({ requestHandler: a2aRequestHandler }));
```
No logic changes to existing handlers, they are moved as is. Also
`A2AExpressApp` is switched to use new handlers without behavior
changes.
**Note:** new functions **are not** exported via `index.ts` yet, it will
be done together with updating docs and examples once REST support is
done.
Re #137
# Description
Minor fix in `client.ts` error handling: avoid checking an error thrown
within the same block via a string match. Include `cause` into rethrown
error.
# Description
The current implementation of the cancel/task did not return the task in
'cancelled' status, because it was not consuming all the events on the
eventBus, but was taking the last published one.
This PR fixes this tck
[test](9893cfdb5f/tests/mandatory/protocol/test_tasks_cancel_method.py (L39))
Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make
sure it goes smoothly:
- [x] Follow the [`CONTRIBUTING`
Guide](https://github.com/google-a2a/a2a-js/blob/main/CONTRIBUTING.md).
- [x] Make your Pull Request title in the
<https://www.conventionalcommits.org/> specification.
- Important Prefixes for
[release-please](https://github.com/googleapis/release-please):
- `fix:` which represents bug fixes, and correlates to a
[SemVer](https://semver.org/) patch.
- `feat:` represents a new feature, and correlates to a SemVer minor.
- `feat!:`, or `fix!:`, `refactor!:`, etc., which represent a breaking
change (indicated by the `!`) and will result in a SemVer major.
- [x] Ensure the tests and linter pass
- [x] Appropriate docs were updated (if necessary)
Fixes#157🦕